go_dreamfactory/modules/practice/api_gyminfo.go
2023-06-06 11:08:14 +08:00

39 lines
1.0 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
)
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,
})
}
session.SendMsg(string(this.module.GetType()), "gyminfo", &pb.PracticeGymInfoResp{Lastaction: room.Gymaction, Refreshnum: room.Gymrefresh})
return
}