爬塔db 错误
This commit is contained in:
parent
9a040f7b94
commit
42ee59ff2f
@ -16,28 +16,25 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.PagodaGetLi
|
||||
|
||||
///获取主线关卡信息
|
||||
func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
_data := &pb.DBPagoda{}
|
||||
|
||||
code = this.GetListCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
list, err := this.module.modelPagoda.getPagodaList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
list, _ := this.module.modelPagoda.getPagodaList(session.GetUserId())
|
||||
|
||||
if list == nil { // redis没有数据
|
||||
|
||||
_data.Id = primitive.NewObjectID().Hex()
|
||||
list.Id = primitive.NewObjectID().Hex()
|
||||
|
||||
_mData := make(map[string]interface{}, 0)
|
||||
_data.Uid = session.GetUserId()
|
||||
_mData[_data.Id] = _data
|
||||
list.Uid = session.GetUserId()
|
||||
_mData[list.Id] = list
|
||||
this.module.modelPagoda.addNewPagoda(session.GetUserId(), _mData)
|
||||
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: _data})
|
||||
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
||||
return
|
||||
}
|
||||
|
@ -24,7 +24,10 @@ func (this *ModelPagoda) Init(service core.IService, module core.IModule, comp c
|
||||
// 获取爬塔信息
|
||||
func (this *ModelPagoda) getPagodaList(uid string) (result *pb.DBPagoda, err error) {
|
||||
result = &pb.DBPagoda{}
|
||||
if err = this.Get(uid, result); err != nil && redis.RedisNil != err {
|
||||
if err = this.Get(uid, result); err != nil {
|
||||
if redis.RedisNil != err {
|
||||
result = nil
|
||||
}
|
||||
return
|
||||
}
|
||||
err = nil
|
||||
@ -39,7 +42,7 @@ func (this *ModelPagoda) modifyPagodaDataByObjId(uid string, objid string, data
|
||||
// 创建一个新的塔数据
|
||||
func (this *ModelPagoda) addNewPagoda(uId string, data map[string]interface{}) (err error) {
|
||||
|
||||
if err = this.AddLists(uId, data); err != nil {
|
||||
if err = this.Add(uId, data); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user