go_dreamfactory/modules/reddot/api_get.go
2022-11-11 15:59:13 +08:00

52 lines
1.4 KiB
Go

package reddot
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) GetCheck(session comm.IUserSession, req *pb.ReddotGetReq) (code pb.ErrorCode) {
return
}
///获取系统公告
func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code pb.ErrorCode, data proto.Message) {
var (
reddot map[int32]bool = make(map[int32]bool)
)
if code = this.GetCheck(session, req); code != pb.ErrorCode_Success {
return
}
for _, rid := range req.Rids {
// reddot[v] = false
switch rid {
case int32(comm.Reddot1):
for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot1) {
reddot[int32(k)] = v
}
case int32(comm.Reddot2):
for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot2) {
reddot[int32(k)] = v
}
case int32(comm.Reddot3):
for k, v := range this.module.ModuleSociaty.Reddot(session.GetUserId(), comm.Reddot3) {
reddot[int32(k)] = v
}
case int32(comm.Reddot4):
for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot2) {
reddot[int32(k)] = v
}
}
}
// for k, v := range this.module.martialhall.Reddot(session.GetUserId(), comm.Reddot1) {
// reddot[int32(k)] = v
// }
session.SendMsg(string(this.module.GetType()), "get", &pb.ReddotGetAllResp{Reddot: reddot})
return
}