diff --git a/core/AEGS_methods.go b/core/AEGS_methods.go index 4adf3cb..f9a8732 100644 --- a/core/AEGS_methods.go +++ b/core/AEGS_methods.go @@ -317,8 +317,9 @@ func (tx *transaction) UpdateCharInfo(charSlotId int32, raw map[string]interface q, err := tx.gs.mongoClient.FindOne("PlayerInfo", bson.M{"_id": playerid, "charInfo.slotId": charSlotId}, options.FindOne().SetProjection(bson.M{"charInfo.$": 1})) + var info map[string]interface{} if q == nil { - info := raw + info = raw info["slotId"] = charSlotId tx.gs.Logger.Println("new info", info) @@ -331,7 +332,7 @@ func (tx *transaction) UpdateCharInfo(charSlotId int32, raw map[string]interface }, options.Update().SetUpsert(true)) } else { - info := q["charInfo"].(bson.A)[0].(map[string]interface{}) + info = q["charInfo"].(bson.A)[0].(map[string]interface{}) tx.gs.Logger.Println("current info", info) for k, v := range raw { @@ -359,7 +360,8 @@ func (tx *transaction) UpdateCharInfo(charSlotId int32, raw map[string]interface // }, options.Update().SetUpsert(true)) if err == nil { - return shared.MakeRPCReturn("update success", err) + doc := bson.M(info) + return shared.MakeRPCReturn(doc, nil) } else { return shared.MakeRPCReturn(nil, errors.New("invalid body")) }