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/serviceContract.go | 45 +++++++++++++++++++--------------------------
1 files changed, 19 insertions(+), 26 deletions(-)
diff --git a/api/v1/serviceContract.go b/api/v1/serviceContract.go
index 75889fe..e5b97d9 100644
--- a/api/v1/serviceContract.go
+++ b/api/v1/serviceContract.go
@@ -35,6 +35,23 @@
return
}
+ count, err := model.NewServiceContractSearch().SetNumber(params.Number).Count()
+ if err != nil {
+ ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜楠岃瘉澶辫触")
+ return
+ }
+ if count > 0 {
+ ctx.FailWithMsg(ecode.UnknownErr, "缂栫爜宸插瓨鍦�")
+ return
+ }
+
+ if params.MemberId == 0 {
+ userInfo := utils.GetUserInfo(c)
+ if userInfo.UserType == constvar.UserTypeSub {
+ params.MemberId = userInfo.CrmUserId
+ }
+ }
+
errCode := serviceContractService.AddServiceContract(serviceContract)
if errCode != ecode.OK {
ctx.Fail(errCode)
@@ -43,30 +60,6 @@
ctx.Ok()
}
-
-//// Delete
-////
-//// @Tags ServiceContract
-//// @Summary 鍒犻櫎鏈嶅姟鍚堝悓
-//// @Produce application/json
-//// @Param object body request.DeleteServiceContract true "鏌ヨ鍙傛暟"
-//// @Success 200 {object} contextx.Response{}
-//// @Router /api/serviceContract/delete [delete]
-//func (s *ServiceContractApi) Delete(c *gin.Context) {
-// var params request.DeleteServiceContract
-// ctx, ok := contextx.NewContext(c, ¶ms)
-// if !ok {
-// return
-// }
-//
-// errCode := serviceContractService.DeleteServiceContract(params.Ids)
-// if errCode != ecode.OK {
-// ctx.Fail(errCode)
-// return
-// }
-//
-// ctx.Ok()
-//}
// BatchDelete
// @Tags ServiceContract
@@ -141,10 +134,10 @@
var memberIds []int
userInfo := utils.GetUserInfo(c)
if userInfo.UserType == constvar.UserTypeSub {
- memberIds = []int{userInfo.CrmUserId}
+ memberIds = userInfo.SubUserIds
}
- serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.QueryClass, params.KeywordType, params.Keyword, memberIds)
+ serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params, memberIds)
if errCode != ecode.OK {
ctx.Fail(errCode)
return
--
Gitblit v1.8.0