67 lines
1.6 KiB
Go
67 lines
1.6 KiB
Go
package shopcenter
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.ShopCenterInfoReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// /获取自己的排行榜信息
|
|
func (this *apiComp) Info(session comm.IUserSession, req *pb.ShopCenterInfoReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
info *pb.DBShopCenter
|
|
conf *cfg.GameShopCenterControlData
|
|
activitys map[int32]*pb.DBHuodong
|
|
ok bool
|
|
err error
|
|
)
|
|
if errdata = this.InfoCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
activitys = this.module.modelshop.getactivity()
|
|
if info, err = this.module.modelshop.getUserShopCenter(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
for _, v := range info.Item {
|
|
if conf, err = this.module.configure.getGameShopCenterControl(v.Id); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ConfigNoFound,
|
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
if conf.Type == 1 || conf.Type == 2 {
|
|
v.Open = true
|
|
continue
|
|
}
|
|
if _, ok = activitys[comm.XSFundPhysical]; ok && conf.Type == 3 {
|
|
v.Open = true
|
|
continue
|
|
}
|
|
if _, ok = activitys[comm.XSFundRecruit]; ok && conf.Type == 4 {
|
|
v.Open = true
|
|
continue
|
|
}
|
|
if _, ok = activitys[comm.XSFundExp]; ok && conf.Type == 5 {
|
|
v.Open = true
|
|
continue
|
|
}
|
|
}
|
|
|
|
session.SendMsg(string(this.module.GetType()), "info", &pb.ShopCenterInfoResp{Info: info})
|
|
return
|
|
}
|