From 13194e787d51e4ce07dfc35341d536fb5db7aaa3 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 13 十月 2023 15:05:29 +0800
Subject: [PATCH] 服务回访单简单数据权限

---
 api/v1/serviceContract.go |   31 +++++++++----------------------
 1 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/api/v1/serviceContract.go b/api/v1/serviceContract.go
index 99bfb1e..75889fe 100644
--- a/api/v1/serviceContract.go
+++ b/api/v1/serviceContract.go
@@ -1,12 +1,14 @@
 package v1
 
 import (
+	"aps_crm/constvar"
 	"aps_crm/model"
 	"aps_crm/model/request"
 	"aps_crm/model/response"
 	"aps_crm/pkg/contextx"
 	"aps_crm/pkg/ecode"
 	"aps_crm/pkg/structx"
+	"aps_crm/utils"
 	"github.com/gin-gonic/gin"
 )
 
@@ -121,27 +123,6 @@
 	ctx.Ok()
 }
 
-// check params
-func checkServiceContractParams(serviceContract request.ServiceContract) (errCode int, result model.ServiceContract) {
-	result.Number = serviceContract.Number
-	result.MemberId = serviceContract.MemberId
-	result.Remark = serviceContract.Remark
-	result.ClientId = serviceContract.ClientId
-	result.SalesDetailsId = serviceContract.SalesDetailsId
-	result.SaleChanceId = serviceContract.SaleChanceId
-	result.QuotationId = serviceContract.QuotationId
-	result.ServiceContractTypeId = serviceContract.TypeId
-	result.ServiceContractStatusId = serviceContract.StatusId
-	result.ServiceTimes = serviceContract.ServiceTimes
-	result.Terms = serviceContract.Terms
-	result.Products = serviceContract.Products
-	result.SignTime = serviceContract.SignTime
-	result.StartTime = serviceContract.StartTime
-	result.EndTime = serviceContract.EndTime
-
-	return ecode.OK, result
-}
-
 // List
 //
 // @Tags   ServiceContract
@@ -157,7 +138,13 @@
 		return
 	}
 
-	serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.QueryClass, params.KeywordType, params.Keyword)
+	var memberIds []int
+	userInfo := utils.GetUserInfo(c)
+	if userInfo.UserType == constvar.UserTypeSub {
+		memberIds = []int{userInfo.CrmUserId}
+	}
+
+	serviceContracts, total, errCode := serviceContractService.GetServiceContractList(params.Page, params.PageSize, params.QueryClass, params.KeywordType, params.Keyword, memberIds)
 	if errCode != ecode.OK {
 		ctx.Fail(errCode)
 		return

--
Gitblit v1.8.0