52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
package entertainment
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
"go_dreamfactory/utils"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.EntertainGetListReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) GetList(session comm.IUserSession, req *pb.EntertainGetListReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
list *pb.DBXXLData
|
|
err error
|
|
)
|
|
list, err = this.module.model.getEntertainmList(session.GetUserId())
|
|
if err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if !utils.IsToday(list.Rtime) {
|
|
update := make(map[string]interface{})
|
|
list.Rtime = configure.Now().Unix()
|
|
for _, v := range this.module.configure.GetGameConsumeIntegral() {
|
|
list.Playtype = append(list.Playtype, v.Key) // 配置读取一个玩法
|
|
}
|
|
update["rtime"] = list.Rtime
|
|
update["playtype"] = list.Playtype
|
|
_, endSeasonTime := utils.GetMonthStartEnd()
|
|
if list.Etime > endSeasonTime {
|
|
list.Etime = endSeasonTime
|
|
update["etime"] = list.Etime
|
|
this.module.ModuleUser.CleanUserMerchantmoney(session)
|
|
}
|
|
this.module.model.modifyEntertainmList(session.GetUserId(), update)
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), "getlist", &pb.EntertainGetListResp{
|
|
Data: list,
|
|
})
|
|
return
|
|
}
|