go_dreamfactory/modules/sys/api_func.go
2022-09-08 15:49:17 +08:00

38 lines
913 B
Go

package sys
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) FunclistCheck(session comm.IUserSession, req *pb.SysFuncListReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Funclist(session comm.IUserSession, req *pb.SysFuncListReq) (code pb.ErrorCode, data proto.Message) {
rsp := &pb.SysFuncListResp{}
iuser := this.moduleSys.ModuleUser
user := iuser.GetUser(session.GetUserId())
if user == nil {
code = pb.ErrorCode_UserSessionNobeing
return
}
var funcList []string
confList := this.moduleSys.configure.getOpencondList()
for _, v := range confList {
// 返回未开启的功能列表
if user.Lv < v.Main {
funcList = append(funcList, v.Id)
}
}
rsp.FuncIds = funcList
if err := session.SendMsg(string(this.moduleSys.GetType()), SysSubTypeFunc, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}