功能条件开启默认值修改
0 表示未开启 1 已开启 需要手动激活, 2 已开启可以使用
This commit is contained in:
parent
63b663e5d1
commit
0389b95d06
@ -10,6 +10,7 @@ func (this *apiComp) FuncActivateCheck(session comm.IUserSession, req *pb.SysFun
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cond 值 为0 表示功能未开启 1 功能开启 需要手动激活 2 功能开启并激活
|
||||||
func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActivateReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActivateReq) (errdata *pb.ErrorData) {
|
||||||
|
|
||||||
rsp := &pb.SysFuncActivateResp{}
|
rsp := &pb.SysFuncActivateResp{}
|
||||||
@ -26,16 +27,15 @@ func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActi
|
|||||||
}
|
}
|
||||||
|
|
||||||
list, _ := this.module.modelSys.GetOpenCondList(session.GetUserId())
|
list, _ := this.module.modelSys.GetOpenCondList(session.GetUserId())
|
||||||
for k, v := range list.Cond {
|
|
||||||
if k == req.Cid && v != 0 {
|
if v, ok := list.Cond[req.Cid]; !ok || v != 1 {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_OpenCondActivate,
|
Code: pb.ErrorCode_OpenCondActivate,
|
||||||
Title: pb.ErrorCode_OpenCondActivate.ToString(),
|
Title: pb.ErrorCode_OpenCondActivate.ToString(),
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
list.Cond[req.Cid] = 1
|
list.Cond[req.Cid] = 2
|
||||||
this.module.modelSys.ChangeOpenCondData(session.GetUserId(), map[string]interface{}{
|
this.module.modelSys.ChangeOpenCondData(session.GetUserId(), map[string]interface{}{
|
||||||
"cond": list.Cond,
|
"cond": list.Cond,
|
||||||
})
|
})
|
||||||
|
@ -30,13 +30,15 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi
|
|||||||
if list.Cond[v.Id] == 0 {
|
if list.Cond[v.Id] == 0 {
|
||||||
id := this.module.modelSys.validCond(session.GetUserId(), v)
|
id := this.module.modelSys.validCond(session.GetUserId(), v)
|
||||||
if id != "" {
|
if id != "" {
|
||||||
rsp.Cond[id] = 1
|
if v.ActivateType == 1 { // 需要手动激活的
|
||||||
list.Cond[id] = 1 //设置激活
|
list.Cond[id] = 1 //设置激活
|
||||||
|
} else {
|
||||||
|
list.Cond[id] = 2 //自动激活
|
||||||
|
}
|
||||||
bChange = true
|
bChange = true
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
rsp.Cond[v.Id] = 1
|
|
||||||
}
|
}
|
||||||
|
rsp.Cond[v.Id] = list.Cond[v.Id]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for _, key := range req.Keys {
|
for _, key := range req.Keys {
|
||||||
@ -44,15 +46,16 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi
|
|||||||
if conf, ok := opencfg.GetDataMap()[key]; ok {
|
if conf, ok := opencfg.GetDataMap()[key]; ok {
|
||||||
id := this.module.modelSys.validCond(session.GetUserId(), conf)
|
id := this.module.modelSys.validCond(session.GetUserId(), conf)
|
||||||
if id != "" {
|
if id != "" {
|
||||||
rsp.Cond[id] = 1
|
if conf.ActivateType == 1 { // 需要手动激活的
|
||||||
list.Cond[key] = 1 //设置激活
|
list.Cond[id] = 1 //设置激活
|
||||||
|
} else {
|
||||||
|
list.Cond[id] = 2 //自动激活
|
||||||
|
}
|
||||||
bChange = true
|
bChange = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
rsp.Cond[key] = 1
|
|
||||||
}
|
}
|
||||||
|
rsp.Cond[key] = list.Cond[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user