From 5f815df137f6edaaaddf869097b7e2718324acc6 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 13 十月 2023 13:53:22 +0800
Subject: [PATCH] 跟进记录简单数据权限
---
api/v1/followRecord.go | 10 ++++++++++
model/followRecord.go | 6 ++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/api/v1/followRecord.go b/api/v1/followRecord.go
index 0960dcf..e208231 100644
--- a/api/v1/followRecord.go
+++ b/api/v1/followRecord.go
@@ -1,11 +1,13 @@
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/utils"
"errors"
"github.com/gin-gonic/gin"
"time"
@@ -221,6 +223,14 @@
return
}
+ 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
+ }
+
followRecords, total, errCode := followRecordService.GetFollowRecordList(params.Page, params.PageSize, params.SearchMap)
if errCode != ecode.OK {
ctx.Fail(errCode)
diff --git a/model/followRecord.go b/model/followRecord.go
index 67352b6..b13ce88 100644
--- a/model/followRecord.go
+++ b/model/followRecord.go
@@ -97,10 +97,8 @@
if key == "client_status" {
db = db.Joins("Client").Joins("Client.ClientStatus").Where("Client__ClientStatus.name LIKE ?", "%"+v+"%")
}
- case int:
- case int64:
- case float64:
- if key == "client_id" || key == "contact_id" || key == "sales_leads_id" || key == "sale_chance_id" {
+ case int, int64, float64:
+ if key == "client_id" || key == "contact_id" || key == "sales_leads_id" || key == "sale_chance_id" || key == "member_id" {
db = db.Where(key+" = ?", v)
}
}
--
Gitblit v1.8.0