|
@@ -27,6 +27,10 @@ import (
|
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
|
)
|
|
|
|
|
|
+const (
|
|
|
+ YYSSJDZYFX = "运营商数据定制及分析"
|
|
|
+)
|
|
|
+
|
|
|
func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplication.AddUsePersonResp {
|
|
|
timeStr, ok, id, msg, code := time.Now().Format("2006-01-02 15:04:05"), false, int64(0), "", int64(0)
|
|
|
if this.EntUserId == "" {
|
|
@@ -53,7 +57,7 @@ func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplicat
|
|
|
//
|
|
|
entUserId, _ := strconv.Atoi(v)
|
|
|
data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, "", "")
|
|
|
- if common.ObjToString((*sourceData)["product_type"]) != "运营商数据定制及分析" && data != nil && len(*data) > 0 {
|
|
|
+ if common.ObjToString((*sourceData)["product_type"]) != YYSSJDZYFX && data != nil && len(*data) > 0 {
|
|
|
dataStatus := common.IntAll((*data)["status"])
|
|
|
wait_empower_id := common.Int64All((*data)["wait_empower_id"])
|
|
|
if dataStatus == -1 {
|
|
@@ -112,43 +116,41 @@ func DelUsePerson(this *entmanageapplication.DelUsePersonReq) *entmanageapplicat
|
|
|
}
|
|
|
|
|
|
func UsePersonList(this *entmanageapplication.UsePersonListReq) *entmanageapplication.UsePersonListResp {
|
|
|
+ sourceData := JyMysql.FindOne(EntnicheWaitEmpower, map[string]interface{}{"id": this.WaitEmpowerId}, "", "")
|
|
|
nowTime := time.Now().Format("2006-01-02 15:04:05")
|
|
|
- data := JyMysql.SelectBySql(`select a.id,a.wait_empower_id,c.name,c.phone,c.mail,g.name as department,e.name as role from entniche_power a
|
|
|
+ q := `select h.product_type,a.id,a.wait_empower_id,c.name,c.phone,c.mail,g.name as department,e.name as role from entniche_power a
|
|
|
INNER JOIN entniche_user c on (a.ent_user_id=c.id and a.ent_id = c.ent_id)
|
|
|
LEFT JOIN entniche_user_role d on (c.id=d.user_id)
|
|
|
LEFT JOIN entniche_role e on (d.role_id=e.id)
|
|
|
LEFT JOIN entniche_department_user f on (a.ent_user_id=f.user_id)
|
|
|
LEFT JOIN entniche_department g on (g.id=f.dept_id)
|
|
|
LEFT JOIN entniche_wait_empower h on (h.id=a.wait_empower_id)
|
|
|
- where a.status = 1 and a.ent_id = ? and h.end_time >= ?
|
|
|
- order by a.update_time,a.id desc`, this.EntId, nowTime)
|
|
|
+ where a.status = 1 and a.ent_id = ? and h.end_time >= ?`
|
|
|
+ if common.ObjToString((*sourceData)["product_type"]) == YYSSJDZYFX {
|
|
|
+ q += ` h.product_type=='` + YYSSJDZYFX + `'`
|
|
|
+ } else {
|
|
|
+ q += ` h.product_type!='` + YYSSJDZYFX + `'`
|
|
|
+ }
|
|
|
+ q += ` order by a.update_time,a.id desc`
|
|
|
+ data := JyMysql.SelectBySql(q, this.EntId, nowTime)
|
|
|
arr := []*entmanageapplication.UsePersonList{}
|
|
|
if data != nil && len(*data) > 0 {
|
|
|
for _, v := range *data {
|
|
|
wait_empower_id := common.Int64All(v["wait_empower_id"])
|
|
|
+ obj := &entmanageapplication.UsePersonList{
|
|
|
+ EntnichePowerId: common.Int64All(v["id"]),
|
|
|
+ Name: common.ObjToString(v["name"]),
|
|
|
+ Phone: common.ObjToString(v["phone"]),
|
|
|
+ Email: common.ObjToString(v["mail"]),
|
|
|
+ Department: common.ObjToString(v["department"]),
|
|
|
+ Role: common.ObjToString(v["role"]),
|
|
|
+ }
|
|
|
if wait_empower_id == this.WaitEmpowerId {
|
|
|
- obj := &entmanageapplication.UsePersonList{
|
|
|
- EntnichePowerId: common.Int64All(v["id"]),
|
|
|
- Name: common.ObjToString(v["name"]),
|
|
|
- Phone: common.ObjToString(v["phone"]),
|
|
|
- Email: common.ObjToString(v["mail"]),
|
|
|
- Department: common.ObjToString(v["department"]),
|
|
|
- Role: common.ObjToString(v["role"]),
|
|
|
- Status: 1,
|
|
|
- }
|
|
|
- arr = append(arr, obj)
|
|
|
+ obj.Status = 1
|
|
|
} else {
|
|
|
- obj := &entmanageapplication.UsePersonList{
|
|
|
- EntnichePowerId: common.Int64All(v["id"]),
|
|
|
- Name: common.ObjToString(v["name"]),
|
|
|
- Phone: common.ObjToString(v["phone"]),
|
|
|
- Email: common.ObjToString(v["mail"]),
|
|
|
- Department: common.ObjToString(v["department"]),
|
|
|
- Role: common.ObjToString(v["role"]),
|
|
|
- Status: 2,
|
|
|
- }
|
|
|
- arr = append(arr, obj)
|
|
|
+ obj.Status = 2
|
|
|
}
|
|
|
+ arr = append(arr, obj)
|
|
|
}
|
|
|
}
|
|
|
return &entmanageapplication.UsePersonListResp{
|
|
@@ -598,7 +600,7 @@ func delRedisByPowerCheck(positionId string) bool {
|
|
|
//
|
|
|
func ResourcePowerHandle(identity *usercenter.Identity, waitEmpowerId, t int64) {
|
|
|
//如果是运营商数据定制及分析产品,调用资源中台,取消对应菜单权限
|
|
|
- if JyMysql.CountBySql(`select count(1) as count from `+EntnicheWaitEmpower+` where id=? and product_type='运营商数据定制及分析'`, waitEmpowerId) > 0 {
|
|
|
+ if JyMysql.CountBySql(`select count(1) as count from `+EntnicheWaitEmpower+` where id=? and product_type=?`, waitEmpowerId, YYSSJDZYFX) > 0 {
|
|
|
entity.ResourceRpc.PowerHandle(context.Background(), &pb.PowerReq{
|
|
|
Appid: "10000",
|
|
|
GoodsCode: "special_nosale_goods",
|