GetHistory 获取历史记录
(ctx *gin.Context)
| 29 | |
| 30 | // GetHistory 获取历史记录 |
| 31 | func (h *HistoryHandler) GetHistory(ctx *gin.Context) { |
| 32 | var req req.ListHistoryReq |
| 33 | |
| 34 | if err := ctx.ShouldBindJSON(&req); err != nil { |
| 35 | apiresponse.ErrorWithData(ctx, err) |
| 36 | return |
| 37 | } |
| 38 | |
| 39 | uc, ok := requireUser(ctx) |
| 40 | if !ok { |
| 41 | return |
| 42 | } |
| 43 | history, err := h.svc.GetHistory(ctx, domain.Pagination{ |
| 44 | Page: req.Page, |
| 45 | Size: req.Size, |
| 46 | Uid: uc.Uid, |
| 47 | }) |
| 48 | if err != nil { |
| 49 | apiresponse.ErrorWithMessage(ctx, "获取历史记录失败") |
| 50 | return |
| 51 | } |
| 52 | |
| 53 | apiresponse.SuccessWithData(ctx, history) |
| 54 | } |
| 55 | |
| 56 | // DeleteOneHistory 删除一条历史记录 |
| 57 | func (h *HistoryHandler) DeleteOneHistory(ctx *gin.Context) { |
nothing calls this directly
no test coverage detected