| | |
| | | package v1 |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/model/response" |
| | |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/pkg/structx" |
| | | "aps_crm/service" |
| | | "aps_crm/utils" |
| | | "github.com/gin-gonic/gin" |
| | | "strconv" |
| | | ) |
| | |
| | | |
| | | if err != nil { |
| | | ctx.Fail(ecode.ParamsErr) |
| | | return |
| | | } |
| | | count, err := model.NewInvoiceSearch().SetNumber(invoice.Number).Count() |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "编码验证失败") |
| | | return |
| | | } |
| | | if count > 0 { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "编码已存在") |
| | | return |
| | | } |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | userInfo := utils.GetUserInfo(c) |
| | | if userInfo.UserType == constvar.UserTypeSub { |
| | | params.PrincipalIds = userInfo.SubUserIds |
| | | } |
| | | |
| | | invoice, total, errCode := service.NewInvoiceService().GetInvoiceList(params) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |