WH01243 1 年間 前
コミット
bf75d95fcf
1 ファイル変更59 行追加6 行削除
  1. 59 6
      service/infoService.go

+ 59 - 6
service/infoService.go

@@ -3,6 +3,7 @@ package service
 import (
 	"encoding/base64"
 	"encoding/json"
+	"strings"
 
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/redis"
@@ -46,19 +47,20 @@ func (l *InfoService) Myinfo(sid string) []byte {
 		}
 		infoMap = map[string]string{
 			"nickName":     RsaEncrypt([]byte(gconv.String(info_m["s_nickname"]))),
-			"entRole":      RsaEncrypt([]byte(gconv.String(common.Int64All(info_m["entRole"])))),
+			"entRole":      RsaEncrypt([]byte(gconv.String(info_m["entRole"]))),
 			"entNicheDis":  RsaEncrypt([]byte(gconv.String(entNicheDis))),
 			"positionId":   RsaEncrypt([]byte(gconv.String(info_m["positionId"]))),
 			"accountId":    RsaEncrypt([]byte(gconv.String(info_m["accountId"]))),
-			"entAccountId": RsaEncrypt([]byte(gconv.String(common.Int64All(info_m["entAccountId"])))),
-			"entId":        RsaEncrypt([]byte(gconv.String(common.Int64All(info_m["entId"])))),
+			"entAccountId": RsaEncrypt([]byte(gconv.String(info_m["entAccountId"]))),
+			"entId":        RsaEncrypt([]byte(gconv.String(info_m["entId"]))),
 			"entName":      RsaEncrypt([]byte(gconv.String(info_m["entName"]))),
 			"entUserName":  RsaEncrypt([]byte(gconv.String(info_m["entUserName"]))),
-			"entUserId":    RsaEncrypt([]byte(gconv.String(common.Int64All(info_m["entUserId"])))),
-			"userId":       RsaEncrypt([]byte(gconv.String(common.Int64All(info_m["base_user_id"])))),
-			"entDeptId":    RsaEncrypt([]byte(gconv.String(common.Int64All(info_m["entDeptId"])))),
+			"entUserId":    RsaEncrypt([]byte(gconv.String(info_m["entUserId"]))),
+			"userId":       RsaEncrypt([]byte(gconv.String(info_m["base_user_id"]))),
+			"entDeptId":    RsaEncrypt([]byte(gconv.String(info_m["entDeptId"]))),
 			"entChildDept": RsaEncrypt([]byte(depIDArr)),
 			"crmVersion":   RsaEncrypt([]byte(version)),
+			"equityMap":    RsaEncrypt([]byte(gconv.String(FindEquity(entUserId, gconv.Int64(info_m["entRole"]))))),
 		}
 	}
 	infoByte, _ := json.Marshal(infoMap)
@@ -72,3 +74,54 @@ func RsaEncrypt(data []byte) string {
 	b, _ := sm4.Sm4Ecb(key, data, true)
 	return base64.StdEncoding.EncodeToString(b)
 }
+func FindEquity(entUserId int64, entRole int64) map[string]bool {
+	equityMap := map[string]bool{
+		"检索工具-收录按钮-显示": false,
+		"潜在商机-情报列表-企业": false,
+		"潜在商机-情报列表-部门": false,
+		"潜在商机-转发-企业":   false,
+		"潜在商机-转发-部门":   false,
+		"潜在商机-跟进-显示":   false,
+		"潜在商机-不跟进-显示":  false,
+	}
+	//查找用户
+	data := entity.JyMysql.FindOne("entniche_user", map[string]interface{}{
+		"id": entUserId,
+	}, "role", "")
+	if data != nil && len(*data) > 0 {
+		role := strings.Split(gconv.String((*data)["role"]), ",")
+		fool1 := false
+		fool2 := false
+		for _, v := range role {
+			//角色;1:情报处理岗 2:情报分配岗 3:信息浏览岗 4 :销售管理岗
+			switch v {
+			case "1":
+				fool1 = true
+				equityMap["检索工具-收录按钮-显示"] = true
+				equityMap["潜在商机-情报列表-个人"] = true
+				equityMap["潜在商机-转发-企业"] = true
+				equityMap["潜在商机-跟进-显示"] = true
+				equityMap["潜在商机-不跟进-显示"] = true
+			case "2":
+				fool2 = true
+				if entRole == 1 {
+					//企业
+					equityMap["检索工具-收录按钮-显示"] = true
+					equityMap["潜在商机-情报列表-企业"] = true
+					equityMap["潜在商机-转发-企业"] = true
+					equityMap["潜在商机-是否分发-显示"] = true
+				} else {
+					//部门
+					equityMap["检索工具-收录按钮-显示"] = true
+					equityMap["潜在商机-情报列表-部门"] = true
+					equityMap["潜在商机-转发-部门"] = true
+					equityMap["潜在商机-是否分发-显示"] = true
+				}
+			}
+		}
+		if fool1 && fool2 {
+			equityMap["潜在商机-数据归属-显示"] = true
+		}
+	}
+	return equityMap
+}