From b45b8ce8051e2ad9c80aafa42d1a5892f6a36bce Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期二, 17 十月 2023 15:27:44 +0800 Subject: [PATCH] 初始化一些表shuju --- api/v1/salesRefund.go | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/api/v1/salesRefund.go b/api/v1/salesRefund.go index 6a6f019..cbce386 100644 --- a/api/v1/salesRefund.go +++ b/api/v1/salesRefund.go @@ -36,10 +36,25 @@ return } + if salesRefund.MemberId == 0 { + userInfo := utils.GetUserInfo(c) + if userInfo.UserType == constvar.UserTypeSub { + salesRefund.MemberId = userInfo.CrmUserId + } + } + errCode = salesRefundService.AddSalesRefund(&salesRefund) if errCode != ecode.OK { ctx.Fail(errCode) return + } + + if params.SalesRefund.CodeRule.Method == 1 { + autoCode := model.GetAutoCode(salesRefund.Id, ¶ms.SalesRefund.CodeRule) + m := map[string]interface{}{ + "number": autoCode, + } + _ = model.NewSalesRefundSearch().SetId(salesRefund.Id).UpdateByMap(m) } ctx.Ok() @@ -144,6 +159,7 @@ salesRefundRes.Products = salesRefund.Products salesRefundRes.SourceType = salesRefund.SourceType salesRefundRes.SourceId = salesRefund.SourceId + salesRefundRes.CodeStandID = salesRefund.CodeStandID return ecode.OK, salesRefundRes } @@ -169,7 +185,7 @@ memberIds = []int{userInfo.CrmUserId} } - salesRefunds, total, errCode := salesRefundService.GetSalesRefundList(params.Page, params.PageSize, params.KeywordType, params.Keyword, memberIds) + salesRefunds, total, errCode := salesRefundService.GetSalesRefundList(params.Page, params.PageSize, params.KeywordType, params.Keyword, params.SourceId, memberIds) if errCode != ecode.OK { ctx.Fail(errCode) return -- Gitblit v1.8.0