43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package enchant
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/mgo"
|
|
"go_dreamfactory/pb"
|
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.EnchantGetListReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) GetList(session comm.IUserSession, req *pb.EnchantGetListReq) (errdata *pb.ErrorData) {
|
|
|
|
// 刷新挑战卷
|
|
if code = this.module.ModuleItems.RecoverTicket(session); errdata != nil {
|
|
return
|
|
}
|
|
|
|
list, err := this.module.modelEnchant.getEnchantList(session.GetUserId())
|
|
if mgo.MongodbNil == err {
|
|
|
|
list.Id = primitive.NewObjectID().Hex()
|
|
list.Uid = session.GetUserId()
|
|
list.Boss = make(map[int32]int64)
|
|
list.BossTime = make(map[int32]int32)
|
|
|
|
this.module.modelEnchant.Add(session.GetUserId(), list)
|
|
}
|
|
if session.GetUserId() != "" { // 恢复时间
|
|
if userexpand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil {
|
|
list.RecoveryTime = userexpand.Recovertimeunifiedticket
|
|
}
|
|
}
|
|
|
|
session.SendMsg(string(this.module.GetType()), EnchantGetListResp, &pb.EnchantGetListResp{Data: list})
|
|
return
|
|
}
|