From 8be40ffd79c4dcdb4dc00bef359ccf48a6b031f3 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期六, 28 十月 2023 15:56:26 +0800 Subject: [PATCH] 若干接口支持查看下属数据 --- api/v1/quotation.go | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/api/v1/quotation.go b/api/v1/quotation.go index 4fd996c..3fd3552 100644 --- a/api/v1/quotation.go +++ b/api/v1/quotation.go @@ -34,18 +34,27 @@ return } + count, err := model.NewQuotationSearch(nil).SetNumber(params.Number).Count() + if err != nil { + ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜楠岃瘉澶辫触") + return + } + if count > 0 { + ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜宸插瓨鍦�") + return + } + + if quotation.MemberId == 0 { + userInfo := utils.GetUserInfo(c) + if userInfo.UserType == constvar.UserTypeSub { + quotation.MemberId = userInfo.CrmUserId + } + } + errCode = quotationService.AddQuotation("ation) if errCode != ecode.OK { ctx.Fail(errCode) return - } - - if params.CodeRule.Method == 1 { - autoCode := model.GetAutoCode(quotation.Id, ¶ms.CodeRule) - m := map[string]interface{}{ - "number": autoCode, - } - _ = model.NewQuotationSearch(nil).SetId(quotation.Id).Updates(m) } ctx.Ok() @@ -151,6 +160,7 @@ quotationModel.File = quotation.File quotationModel.Products = quotation.Products quotationModel.CodeStandID = quotation.CodeStandID + quotationModel.QuotationName = quotation.QuotationName return ecode.OK, quotationModel -- Gitblit v1.8.0