From 4d7d6f0e363d71ebe7ae506dd8ba02aa92eafb34 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期一, 13 十一月 2023 16:09:26 +0800 Subject: [PATCH] 字段修改 --- api/v1/saleChance.go | 33 ++++++++++++++++----------------- 1 files changed, 16 insertions(+), 17 deletions(-) diff --git a/api/v1/saleChance.go b/api/v1/saleChance.go index f5e57f2..73bcdb0 100644 --- a/api/v1/saleChance.go +++ b/api/v1/saleChance.go @@ -33,15 +33,21 @@ ctx.Fail(errCode) return } - if params.CodeRule.Method != 1 { - count, err := model.NewSaleChanceSearch().SetNumber(saleChance.Number).Count() - if err != nil { - ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜楠岃瘉澶辫触") - return - } - if count > 0 { - ctx.FailWithMsg(ecode.UnknownErr, "閿�鍞満浼氱紪鐮佸凡瀛樺湪") - return + + count, err := model.NewSaleChanceSearch().SetNumber(saleChance.Number).Count() + if err != nil { + ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜楠岃瘉澶辫触") + return + } + if count > 0 { + ctx.FailWithMsg(ecode.UnknownErr, "閿�鍞満浼氱紪鐮佸凡瀛樺湪") + return + } + + if saleChance.MemberId == 0 { + userInfo := utils.GetUserInfo(c) + if userInfo.UserType == constvar.UserTypeSub { + saleChance.MemberId = userInfo.CrmUserId } } @@ -49,14 +55,6 @@ if errCode != ecode.OK { ctx.Fail(errCode) return - } - - if params.CodeRule.Method == 1 { - autoCode := model.GetAutoCode(saleChance.Id, ¶ms.CodeRule) - m := map[string]interface{}{ - "number": autoCode, - } - _ = model.NewSaleChanceSearch().SetId(saleChance.Id).UpdateByMap(m) } ctx.Ok() @@ -201,6 +199,7 @@ sc.Address.CountryId = saleChance.Address.CountryId sc.Address.ProvinceId = saleChance.Address.ProvinceId sc.CodeStandID = saleChance.CodeStandID + sc.Products = saleChance.Products return ecode.OK, sc } -- Gitblit v1.8.0