手动激活 通知模块

This commit is contained in:
meixiongfeng 2023-04-04 14:21:42 +08:00
parent 6b48acda2a
commit 990ac20953
2 changed files with 16 additions and 14 deletions

View File

@ -2,6 +2,7 @@ package sys
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
@ -15,14 +16,8 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.SysFuncActivate
rsp := &pb.SysFuncActivateResp{}
iuser := this.module.ModuleUser
user := iuser.GetUser(session.GetUserId())
if user == nil {
code = pb.ErrorCode_UserSessionNobeing
return
}
if opencfg := this.module.configure.getOpencondCfgByCid(req.Cid); opencfg != nil {
opencfg := this.module.configure.getOpencondCfgByCid(req.Cid)
if opencfg != nil {
if id := this.module.modelSys.validCond(session.GetUserId(), opencfg); id == "" { // 条件不满足
code = pb.ErrorCode_OpenCondErr
return
@ -43,5 +38,18 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.SysFuncActivate
if err := session.SendMsg(string(this.module.GetType()), SysSubTypeFunc, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
//手动激活通知模块
for _, m := range opencfg.Notify {
i, err := this.service.GetModule(core.M_Modules(m))
if err != nil {
this.module.Errorln(err)
continue
}
if ic, ok := i.(comm.IOpenCmdNotice); ok {
ic.OpenCmdNotice(session, req.Cid)
}
}
return
}

View File

@ -15,12 +15,6 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi
rsp := &pb.SysFuncGetListResp{}
rsp.Cond = make(map[string]int32, 0)
iuser := this.module.ModuleUser
user := iuser.GetUser(session.GetUserId())
if user == nil {
code = pb.ErrorCode_UserSessionNobeing
return
}
if len(req.Keys) == 0 {
confList := this.module.configure.getOpencondList()