爬塔数据保存bug

This commit is contained in:
meixiongfeng 2022-08-16 14:15:43 +08:00
parent 6619b87839
commit 302e85dc59
4 changed files with 9 additions and 9 deletions

View File

@ -49,7 +49,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
} }
mapData := make(map[string]interface{}, 0) mapData := make(map[string]interface{}, 0)
mapData["pagodaId"] = cfg.NextLevel mapData["pagodaId"] = cfg.NextLevel
code = this.module.ModifyPagodaData(session.GetUserId(), pagoda.Id, mapData) code = this.module.ModifyPagodaData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), PagodaChallengeResp, &pb.PagodaChallengeResp{Data: pagoda}) session.SendMsg(string(this.module.GetType()), PagodaChallengeResp, &pb.PagodaChallengeResp{Data: pagoda})
return return
} }

View File

@ -28,11 +28,11 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq
result := &pb.DBPagoda{} result := &pb.DBPagoda{}
result.Id = primitive.NewObjectID().Hex() result.Id = primitive.NewObjectID().Hex()
_mData := make(map[string]interface{}, 0) //_mData := make(map[string]interface{}, 0)
result.Uid = session.GetUserId() result.Uid = session.GetUserId()
result.PagodaId = 1 // 初始数据1层 result.PagodaId = 1 // 初始数据1层
_mData[result.Id] = result //_mData[result.Id] = result
this.module.modelPagoda.addNewPagoda(session.GetUserId(), _mData) this.module.modelPagoda.addNewPagoda(session.GetUserId(), result)
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: result}) session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: result})
return return
} }

View File

@ -41,12 +41,12 @@ func (this *ModelPagoda) getPagodaList(uid string) (result *pb.DBPagoda, err err
} }
// 修改爬塔数据信息 // 修改爬塔数据信息
func (this *ModelPagoda) modifyPagodaDataByObjId(uid string, objid string, data map[string]interface{}) error { func (this *ModelPagoda) modifyPagodaDataByObjId(uid string, data map[string]interface{}) error {
return this.ChangeList(uid, objid, data) return this.Change(uid, data)
} }
// 创建一个新的塔数据 // 创建一个新的塔数据
func (this *ModelPagoda) addNewPagoda(uId string, data map[string]interface{}) (err error) { func (this *ModelPagoda) addNewPagoda(uId string, data *pb.DBPagoda) (err error) {
if err = this.Add(uId, data); err != nil { if err = this.Add(uId, data); err != nil {
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)

View File

@ -36,8 +36,8 @@ func (this *Pagoda) OnInstallComp() {
} }
// 接口信息 // 接口信息
func (this *Pagoda) ModifyPagodaData(uid string, objId string, data map[string]interface{}) (code pb.ErrorCode) { func (this *Pagoda) ModifyPagodaData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
err := this.modelPagoda.modifyPagodaDataByObjId(uid, objId, data) err := this.modelPagoda.modifyPagodaDataByObjId(uid, data)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
} }