|
@@ -3,6 +3,7 @@ package service
|
|
|
import (
|
|
|
"encoding/base64"
|
|
|
"encoding/json"
|
|
|
+ "strings"
|
|
|
|
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
@@ -21,22 +22,21 @@ func (l *InfoService) Myinfo(sid string) []byte {
|
|
|
info_m, _ := info_i.(map[string]interface{})
|
|
|
entNicheDis := common.Int64All(info_m["entNicheDis"])
|
|
|
depIDArr := ""
|
|
|
- if entNicheDis > 0 {
|
|
|
- //查询所有部门标识
|
|
|
- entId := gconv.String(info_m["entId"])
|
|
|
- entDeptId := gconv.String(info_m["entDeptId"])
|
|
|
- deptArr := entity.JyMysql.SelectBySql("select GROUP_CONCAT(DISTINCT b.id) as depIDArr from entniche_department_parent a INNER JOIN entniche_department b "+
|
|
|
- "on (b.ent_id=? and (b.id=? or (a.pid=? and a.id=b.id)))", entId, entDeptId, entDeptId)
|
|
|
- if len(*deptArr) > 0 {
|
|
|
- depIDArr = common.InterfaceToStr((*deptArr)[0]["depIDArr"])
|
|
|
- }
|
|
|
+ //if entNicheDis > 0 {
|
|
|
+ //查询所有部门标识
|
|
|
+ entId := gconv.String(info_m["entId"])
|
|
|
+ entDeptId := gconv.String(info_m["entDeptId"])
|
|
|
+ deptArr := entity.JyMysql.SelectBySql("select GROUP_CONCAT(DISTINCT b.id) as depIDArr from entniche_department_parent a INNER JOIN entniche_department b "+
|
|
|
+ "on (b.ent_id=? and (b.id=? or (a.pid=? and a.id=b.id)))", entId, entDeptId, entDeptId)
|
|
|
+ if len(*deptArr) > 0 {
|
|
|
+ depIDArr = common.InterfaceToStr((*deptArr)[0]["depIDArr"])
|
|
|
}
|
|
|
+ //}
|
|
|
//营销版本查询
|
|
|
accountId := gconv.Int64(info_m["accountId"])
|
|
|
entAccountId := gconv.Int64(info_m["entAccountId"])
|
|
|
- entId := gconv.Int64(info_m["entId"])
|
|
|
entUserId := gconv.Int64(info_m["entUserId"])
|
|
|
- res := entity.Middleground.ResourceCenter.Haspowers(accountId, entAccountId, entId, entUserId)
|
|
|
+ res := entity.Middleground.ResourceCenter.Haspowers(accountId, entAccountId, gconv.Int64(info_m["entId"]), entUserId)
|
|
|
version := "0"
|
|
|
for _, pCode := range res.Powers {
|
|
|
//0:通用版 1:物业专版
|
|
@@ -46,19 +46,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 +73,77 @@ 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,
|
|
|
+ "潜在商机-分发按钮-显示": false,
|
|
|
+ "潜在商机-跟进-显示": 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
|
|
|
+ equityMap["创建商机-已关联商机-个人"] = true
|
|
|
+ equityMap["潜在商机-转发按钮-显示"] = true
|
|
|
+ case "2":
|
|
|
+ fool2 = true
|
|
|
+ if entRole == 1 {
|
|
|
+ //企业
|
|
|
+ equityMap["检索工具-收录按钮-显示"] = true
|
|
|
+ equityMap["潜在商机-情报列表-企业"] = true
|
|
|
+ equityMap["潜在商机-转发-企业"] = true
|
|
|
+ equityMap["潜在商机-是否分发-显示"] = true
|
|
|
+ equityMap["创建商机-已关联商机-企业"] = true
|
|
|
+ equityMap["潜在商机-转发按钮-显示"] = true
|
|
|
+ equityMap["潜在商机-分发按钮-显示"] = true
|
|
|
+ } else {
|
|
|
+ //部门
|
|
|
+ equityMap["检索工具-收录按钮-显示"] = true
|
|
|
+ equityMap["潜在商机-情报列表-部门"] = true
|
|
|
+ equityMap["潜在商机-转发-部门"] = true
|
|
|
+ equityMap["潜在商机-是否分发-显示"] = true
|
|
|
+ equityMap["创建商机-已关联商机-部门"] = true
|
|
|
+ equityMap["潜在商机-转发按钮-显示"] = true
|
|
|
+ equityMap["潜在商机-分发按钮-显示"] = true
|
|
|
+ }
|
|
|
+ case "4":
|
|
|
+ if entRole == 1 {
|
|
|
+ equityMap["潜在商机-情报列表-企业"] = true
|
|
|
+ } else {
|
|
|
+ equityMap["潜在商机-情报列表-部门"] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if fool1 && fool2 {
|
|
|
+ equityMap["潜在商机-数据归属-显示"] = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return equityMap
|
|
|
+}
|