35 lines
947 B
Go
35 lines
947 B
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) (code pb.ErrorCode) {
|
|
|
|
return
|
|
}
|
|
|
|
///练功请求
|
|
func (this *apiComp) GymInfo(session comm.IUserSession, req *pb.PracticeGymInfoReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
|
var (
|
|
err error
|
|
room *pb.DBPracticeRoom
|
|
)
|
|
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
|
|
code = pb.ErrorCode_DBError
|
|
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
|
|
}
|