From 18c42494735992c42d63c7858f5fdb31069d0342 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期四, 23 十一月 2023 20:11:31 +0800
Subject: [PATCH] 获取客户列表服务端
---
api/v1/contract.go | 29 ++++++++++++++++-------------
1 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/api/v1/contract.go b/api/v1/contract.go
index 8041742..a0228fc 100644
--- a/api/v1/contract.go
+++ b/api/v1/contract.go
@@ -35,6 +35,16 @@
return
}
+ count, err := model.NewContractSearch().SetNumber(params.Number).Count()
+ if err != nil {
+ ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜楠岃瘉澶辫触")
+ return
+ }
+ if count > 0 {
+ ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜宸插瓨鍦�")
+ return
+ }
+
if contract.MemberId == 0 {
userInfo := utils.GetUserInfo(c)
if userInfo.UserType == constvar.UserTypeSub {
@@ -46,14 +56,6 @@
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()
@@ -138,6 +140,7 @@
File: contract.File,
CodeStandID: contract.CodeStandID,
ContractName: contract.ContractName,
+ SendTime: contract.SendTime,
}
return ecode.OK, contractModel
@@ -158,15 +161,15 @@
return
}
+ if params.SearchMap == nil {
+ params.SearchMap = make(map[string]interface{}, 0)
+ }
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
+ params.SearchMap["member_ids"] = userInfo.SubUserIds
}
- contracts, total, errCode := contractService.GetContractList(params.Page, params.PageSize, params.SearchMap)
+ contracts, total, errCode := contractService.GetContractList(params.Page, params.PageSize, params.SearchMap, params.Keyword)
if errCode != ecode.OK {
ctx.Fail(errCode)
return
--
Gitblit v1.8.0