go_dreamfactory/modules/reddot/api_get.go
2022-11-21 11:20:43 +08:00

53 lines
1.3 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, comm.Reddot1) {
reddot[int32(k)] = v
}
case int32(comm.Reddot2):
for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) {
reddot[int32(k)] = v
}
case int32(comm.Reddot3):
for k, v := range this.module.ModuleSociaty.Reddot(session, comm.Reddot3) {
reddot[int32(k)] = v
}
case int32(comm.Reddot4):
for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) {
reddot[int32(k)] = v
}
case int32(comm.Reddot17):
for k, v := range this.module.horoscope.Reddot(session, comm.Reddot2) {
reddot[int32(k)] = v
}
}
}
session.SendMsg(string(this.module.GetType()), "get", &pb.ReddotGetAllResp{Reddot: reddot})
return
}