52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
package jielong
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
"go_dreamfactory/utils"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.JielongGetListReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// /获取自己的排行榜信息
|
|
func (this *apiComp) GetList(session comm.IUserSession, req *pb.JielongGetListReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
list *pb.DBJielongData
|
|
err error
|
|
)
|
|
if errdata = this.GetListCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
|
|
list, err = this.module.modelJielong.getUserJielongData(session.GetUserId())
|
|
if err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ReqParameterError,
|
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
if list.Lasttime < configure.Now().Unix() {
|
|
update := make(map[string]interface{}, 0)
|
|
list.Lasttime = utils.WeekIntervalTime()
|
|
list.Curwin = 0 // 本周连胜
|
|
list.Weekmax = 0 // 本周最大连胜
|
|
list.Reward = map[int32]int32{}
|
|
update["lasttime"] = list.Lasttime
|
|
update["curwin"] = list.Curwin
|
|
update["weekmax"] = list.Weekmax
|
|
update["reward"] = list.Reward
|
|
this.module.modelJielong.changeJielongData(session.GetUserId(), update)
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), "getlist", &pb.JielongGetListResp{
|
|
Data: list,
|
|
})
|
|
return
|
|
}
|