57 lines
1.5 KiB
Go
57 lines
1.5 KiB
Go
package venture
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
"go_dreamfactory/utils"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) SignGetListCheck(session comm.IUserSession, req *pb.VentureSignGetListReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// /获取自己的排行榜信息
|
|
func (this *apiComp) SignGetList(session comm.IUserSession, req *pb.VentureSignGetListReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
sign *pb.DBVentureSign
|
|
err error
|
|
)
|
|
if errdata = this.SignGetListCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
endTime := this.module.ModuleTools.GetGlobalConf().SignAccount
|
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
|
if configure.Now().Unix() > user.Ctime+int64(endTime*24*3600) {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ActivityOver,
|
|
Title: pb.ErrorCode_ActivityOver.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
}
|
|
if sign, err = this.module.ModelSign.getUserSign(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
if !utils.IsToday(sign.Lasttime) {
|
|
sign.Lasttime = configure.Now().Unix()
|
|
sign.Val += 1
|
|
this.module.ModelSign.Change(session.GetUserId(), map[string]interface{}{
|
|
"lasttime": sign.Lasttime,
|
|
"val": sign.Val,
|
|
})
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), "signgetlist", &pb.VentureSignGetListResp{
|
|
Sign: sign,
|
|
})
|
|
return
|
|
}
|