zhangqian
2023-10-13 5f815df137f6edaaaddf869097b7e2718324acc6
跟进记录简单数据权限
2个文件已修改
16 ■■■■ 已修改文件
api/v1/followRecord.go 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/followRecord.go 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
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)
                }
            }