| | |
| | | package v1 |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model/request" |
| | | "aps_crm/model/response" |
| | | "aps_crm/pkg/contextx" |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/service" |
| | | "aps_crm/utils" |
| | | "github.com/gin-gonic/gin" |
| | | "strconv" |
| | | ) |
| | |
| | | if !ok { |
| | | return |
| | | } |
| | | if params.Id == 0 { |
| | | ctx.Fail(ecode.ParamsErr) |
| | | } |
| | | params.Receipt.Id = params.Id |
| | | if params.Id == 0 { |
| | | ctx.Fail(ecode.ParamsErr) |
| | | } |
| | | params.Receipt.Id = params.Id |
| | | |
| | | errCode := service.NewReceiptService().UpdateReceipt(¶ms.Receipt) |
| | | if errCode != ecode.OK { |
| | |
| | | return |
| | | } |
| | | |
| | | receipt, total, errCode := service.NewReceiptService().GetReceiptList() |
| | | userInfo := utils.GetUserInfo(c) |
| | | if userInfo.UserType == constvar.UserTypeSub { |
| | | params.PrincipleIds = userInfo.SubUserIds |
| | | } |
| | | |
| | | receipt, total, errCode := service.NewReceiptService().GetReceiptList(params) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.ListResponse{ |
| | | Data: receipt, |
| | | Data: receipt, |
| | | Count: total, |
| | | }) |
| | | } |