55 lines
1.4 KiB
Go
55 lines
1.4 KiB
Go
package pushgiftbag
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
"time"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.PushGiftbagInfoReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// /获取自己的排行榜信息
|
|
func (this *apiComp) Info(session comm.IUserSession, req *pb.PushGiftbagInfoReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
info *pb.DBPushGiftbag
|
|
conf *cfg.GamePushGiftData
|
|
bugs []*pb.DBPushGiftbagItem
|
|
err error
|
|
)
|
|
if errdata = this.InfoCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
|
|
if info, err = this.module.model.getUserPushGift(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
bugs = make([]*pb.DBPushGiftbagItem, 0)
|
|
for _, v := range info.Item {
|
|
if conf, err = this.module.configure.getGamePushGiftbyid(v.Id); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ConfigNoFound,
|
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
if !configure.Now().After(time.Unix(v.Stime, 0).Add(time.Duration(conf.Time) * time.Second)) {
|
|
bugs = append(bugs, v)
|
|
}
|
|
}
|
|
info.Item = bugs
|
|
session.SendMsg(string(this.module.GetType()), "info", &pb.PushGiftbagInfoResp{Item: info.Item})
|
|
return
|
|
}
|