61 lines
1.5 KiB
Go
61 lines
1.5 KiB
Go
package pagoda
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
"go_dreamfactory/utils"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) GetCycleCheck(session comm.IUserSession, req *pb.PagodaGetCycleReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
///获取阵营爬塔信息
|
|
func (this *apiComp) GetCycle(session comm.IUserSession, req *pb.PagodaGetCycleReq) (errdata *pb.ErrorData) {
|
|
|
|
var (
|
|
list *pb.DBPagodaCycle
|
|
err error
|
|
update map[string]interface{}
|
|
)
|
|
|
|
list, err = this.module.modelCyclePagoda.getPagodaCycleList(session.GetUserId())
|
|
if err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
// 是否切换赛季
|
|
if list.Etime < configure.Now().Unix() {
|
|
data := this.module.modelCyclePagoda.getCycelData()
|
|
list.Etime = data.Etime
|
|
update["rtime"] = list.Etime
|
|
list.Itype = data.Itype
|
|
update["itype"] = list.Itype
|
|
}
|
|
if !utils.IsToday(list.Rtime) {
|
|
update = make(map[string]interface{}, 0)
|
|
list.Rtime = configure.Now().Unix()
|
|
list.Battlecount = 0
|
|
update["battlecount"] = list.Battlecount
|
|
update["rtime"] = list.Rtime
|
|
if err = this.module.modelCyclePagoda.ModifyPagodaCycleData(session.GetUserId(), update); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
}
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), "getcycle", &pb.PagodaGetCycleResp{
|
|
Data: list,
|
|
})
|
|
return
|
|
}
|