| | |
| | | package v1 |
| | | |
| | | import ( |
| | | "aps_crm/constvar" |
| | | "aps_crm/model" |
| | | "aps_crm/model/request" |
| | | "aps_crm/model/response" |
| | | "aps_crm/pkg/contextx" |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/utils" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | if contract.MemberId == 0 { |
| | | userInfo := utils.GetUserInfo(c) |
| | | if userInfo.UserType == constvar.UserTypeSub { |
| | | contract.MemberId = userInfo.CrmUserId |
| | | } |
| | | } |
| | | |
| | | errCode = contractService.AddContract(&contract) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | if params.CodeRule.Method == 1 { |
| | | autoCode := model.GetAutoCode(contract.Id, ¶ms.CodeRule) |
| | | m := map[string]interface{}{ |
| | | "number": autoCode, |
| | | } |
| | | _ = model.NewContractSearch().SetId(contract.Id).UpdateByMap(m) |
| | | } |
| | | |
| | | ctx.Ok() |
| | |
| | | //} |
| | | |
| | | contractModel = model.Contract{ |
| | | ClientId: contract.ClientId, |
| | | MemberId: contract.MemberId, |
| | | Number: contract.Number, |
| | | QuotationId: contract.QuotationId, |
| | | StatusId: contract.StatusId, |
| | | File: contract.File, |
| | | ClientId: contract.ClientId, |
| | | MemberId: contract.MemberId, |
| | | Number: contract.Number, |
| | | QuotationId: contract.QuotationId, |
| | | StatusId: contract.StatusId, |
| | | File: contract.File, |
| | | CodeStandID: contract.CodeStandID, |
| | | ContractName: contract.ContractName, |
| | | } |
| | | |
| | | return ecode.OK, contractModel |
| | |
| | | return |
| | | } |
| | | |
| | | userInfo := utils.GetUserInfo(c) |
| | | if userInfo.UserType == constvar.UserTypeSub { |
| | | if params.SearchMap == nil { |
| | | params.SearchMap = make(map[string]interface{}, 0) |
| | | } |
| | | params.SearchMap["member_id"] = userInfo.CrmUserId |
| | | } |
| | | |
| | | contracts, total, errCode := contractService.GetContractList(params.Page, params.PageSize, params.SearchMap) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |