45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
package practice
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
"time"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) GymInfoCheck(session comm.IUserSession, req *pb.PracticeGymInfoReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
//获取每日一练信息
|
|
func (this *apiComp) GymInfo(session comm.IUserSession, req *pb.PracticeGymInfoReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
err error
|
|
room *pb.DBPracticeRoom
|
|
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
|
|
)
|
|
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
if time.Unix(room.Lastrefresh, 0).Day() != configure.Now().Day() {
|
|
room.Gymrefresh = 0
|
|
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{
|
|
"gymrefresh": room.Gymrefresh,
|
|
})
|
|
}
|
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype185, 1))
|
|
session.SendMsg(string(this.module.GetType()), "gyminfo", &pb.PracticeGymInfoResp{Lastaction: room.Gymaction, Refreshnum: room.Gymrefresh})
|
|
|
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
|
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
|
})
|
|
return
|
|
}
|