go_dreamfactory/modules/reddot/api_get.go
2022-11-21 13:47:06 +08:00

61 lines
1.6 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
_rid := comm.ReddotType(rid)
switch _rid {
case comm.Reddot1:
for k, v := range this.module.ModuleTask.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case comm.Reddot2:
for k, v := range this.module.ModuleTask.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case (comm.Reddot3):
for k, v := range this.module.ModuleSociaty.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case (comm.Reddot4):
for k, v := range this.module.ModuleTask.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case (comm.Reddot17):
for k, v := range this.module.horoscope.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case (comm.Reddot19):
for k, v := range this.module.arena.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case (comm.Reddot23), (comm.Reddot24), (comm.Reddot25):
for k, v := range this.module.martialhall.Reddot(session, _rid) {
reddot[int32(k)] = v
}
}
}
session.SendMsg(string(this.module.GetType()), "get", &pb.ReddotGetAllResp{Reddot: reddot})
return
}