go_dreamfactory/modules/reddot/api_get.go
2023-06-27 14:53:58 +08:00

90 lines
2.5 KiB
Go

package reddot
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
//参数校验
func (this *apiComp) GetCheck(session comm.IUserSession, req *pb.ReddotGetReq) (errdata *pb.ErrorData) {
return
}
///获取系统公告
func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (errdata *pb.ErrorData) {
var (
reddot map[int32]*pb.ReddotItem = make(map[int32]*pb.ReddotItem)
)
if errdata = this.GetCheck(session, req); errdata != nil {
return
}
for _, rid := range req.Rids {
_rid := comm.ReddotType(rid)
switch _rid {
//任务
case comm.Reddot10101, comm.Reddot10102, comm.Reddot10103, comm.Reddot10201, comm.Reddot10301:
for k, v := range this.module.ModuleTask.Reddot(session, _rid) {
reddot[int32(k)] = v
}
//主线
case comm.Reddot24101:
for k, v := range this.module.mline.Reddot(session, _rid) {
reddot[int32(k)] = v
}
//铁匠铺
case comm.Reddot17102, comm.Reddot17106, comm.Reddot17107:
for k, v := range this.module.smithy.Reddot(session, _rid) {
reddot[int32(k)] = v
}
//工会
case comm.Reddot15102, comm.Reddot15201:
for k, v := range this.module.ModuleSociaty.Reddot(session, _rid) {
reddot[int32(k)] = v
}
//竞技场
case comm.Reddot22102:
for k, v := range this.module.arena.Reddot(session, _rid) {
reddot[int32(k)] = v
}
//好友
case comm.Reddot21101:
for k, v := range this.module.friend.Reddot(session, _rid) {
reddot[int32(k)] = v
}
//羁绊
case comm.Reddot19103, comm.Reddot19105, comm.Reddot19109, comm.Reddot19110:
for k, v := range this.module.library.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.Reddot20, comm.Reddot21, comm.Reddot22:
for k, v := range this.module.gourmet.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case comm.Reddot12101, comm.Reddot12102:
for k, v := range this.module.mail.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case comm.Reddot13102:
for k, v := range this.module.viking.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case comm.Reddot14102:
for k, v := range this.module.hunting.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case comm.Reddot23101:
for k, v := range this.module.gourmet.Reddot(session, _rid) {
reddot[int32(k)] = v
}
}
}
session.SendMsg(string(this.module.GetType()), "get", &pb.ReddotGetAllResp{Reddot: reddot})
return
}