我這邊原本想做batch儲存
但呼叫後會出現奇怪的錯誤
我有一個Endpoint叫UpdateUserData長這樣

        [LCEngineFunction(LCConstants.EP_UpdateUserData)]
        public static async Task<bool> UpdateUserData(
            [LCEngineFunctionParam(LCConstants.Field_email)] string email,
            [LCEngineFunctionParam(LCConstants.Field_playerName)] string playerName)
        {
            List<LCObject> dirtyList = new List<LCObject>();
            var curUser = await LCUtil.GetLoginUser();
            if (!string.IsNullOrEmpty(email))
            {
                curUser.Email = email;
                dirtyList.Add(curUser);
            }
            if (!string.IsNullOrEmpty(playerName)) 
                await curUser.SetPlayerName(playerName, dirtyList);

            await LCObject.SaveAll(dirtyList); //這個request會報錯
        return true;
    }

SetPlayerName長這樣

public static async Task<LCUser> SetPlayerName(this LCUser user, string playerName, List<LCObject> dirtyList)
        {
            var lcObj = await user.GetRecord<AccountDataRecord>();
            if (lcObj == null)
            {
                throw LCErrorUtil.LookUpException(LCError.ParamAbnormal, "accountData is null");
            }
            else
            {
                lcObj[LCConstants.Field_playerName] = playerName;
                dirtyList.Add(lcObj);
            }

            return user;
    }

GetRecord長這樣

public static async Task<LCObject> GetRecord<T>(this LCUser user)
        {
            var recordType = typeof(T);
            string recordKey = LCConstants.typeNameMap[recordType];
            var obj = user[recordKey];
            if (obj is LCObject)
            {
                var lcObj = obj as LCObject;
                Debug.Log("is LCObj, objID:" + lcObj.ObjectId + ",class:" + lcObj.ClassName);
                return lcObj;
            }
            else if (obj is string) //objectID
            {
                Debug.Log("objID:" + obj);
                return await LCUtil.GetQuery<T>().Get(obj as string);
            }
            else
            {
                Debug.LogError("unknown data for recordType:" + recordType.Name);
                return null;
            }
        }

目前得知的訊息是GetRecord那邊他會跑obj is LCObject這個branch的邏輯 這裡看起來符合預期取到對的LCObject
然後也能順利設定PlayerName 但是要進行batch儲存時(SaveAll)的request就會爆一個錯 這個錯長這樣
他說 Could not find object by id AccountDataRecord for class AccountDataRecord這讓我感到有點困惑不知道這句話的意思是?

从截图中的请求来看,SDK 发了一个格式错误的请求 PUT /1.1/classes/<className>/<className> (应该是 PUT /1.1/classes/<className>/<objectId> 才对)。有可能是 SDK 有 bug,麻烦把截图中的日志用文本格式再贴一遍,以便排查问题。

目前您可以临时先不用 SaveAll 这个接口。

从 dirtyList.Add(curUser); 和 await curUser.SetPlayerName(playerName, dirtyList); 中看是有循环关系。
请问你那边的结构是怎样的?我尝试复现一下问题

結構上是LCUser裡面會紀錄他擁有哪些DataRecord的Pointer 比如AccountDataRecord是一個Pointer 然後讀取時就根據這個ObjectID去AccountDataRecord表格裡撈對應的row出來

AccountDataRecord的某個Row:
{
  "numOnlineDays": 1,
  "updatedAt": "2021-09-29T09:25:14.318Z",
  "accountCreatedTime": "",
  "ACL": {
    "*": {
      "read": true,
      "write": true
    }
  },
  "objectId": "614e10535e0db15b17ef2e18",
  "exp": 0,
  "createdAt": "2021-09-24T17:52:19.975Z",
  "playerLevel": 1,
  "playerName": "ww",
  "numLoginTimes": 0,
  "jkOpenID": "",
  "onlineTimestamp": "",
  "user": null
}

某個LCUser的Row:
{
  "AltarDataRecord": {
    "__type": "Pointer",
    "className": "AltarDataRecord",
    "objectId": "614e10545e0db15b17ef2e20"
  },
  "StoreDataRecord": {
    "__type": "Pointer",
    "className": "StoreDataRecord",
    "objectId": "614e10545e0db15b17ef2e1e"
  },
  "ProgressDataRecord": {
    "__type": "Pointer",
    "className": "ProgressDataRecord",
    "objectId": "614e10545e0db15b17ef2e1c"
  },
  "EquipDataRecord": {
    "__type": "Pointer",
    "className": "EquipDataRecord",
    "objectId": "614e10535e0db15b17ef2e0c"
  },
  "GameSnapshotRecord": {
    "__type": "Pointer",
    "className": "GameSnapshotRecord",
    "objectId": "614e10535e0db15b17ef2e10"
  },
  "updatedAt": "2021-09-29T08:37:04.671Z",
  "ACL": {
    "*": {
      "read": true,
      "write": true
    }
  },
  "objectId": "614e10546b4e797ba25464ae",
  "username": "MiniPlayer1",
  "OfflineRewardRecord": {
    "__type": "Pointer",
    "className": "OfflineRewardRecord",
    "objectId": "614e10535e0db15b17ef2e14"
  },
  "SkillDataRecord": {
    "__type": "Pointer",
    "className": "SkillDataRecord",
    "objectId": "614e10535e0db15b17ef2e12"
  },
  "createdAt": "2021-09-24T17:52:20.347Z",
  "CharDataRecord": {
    "__type": "Pointer",
    "className": "CharDataRecord",
    "objectId": "614e10545e0db15b17ef2e22"
  },
  "ResDataRecord": {
    "__type": "Pointer",
    "className": "ResDataRecord",
    "objectId": "614e10535e0db15b17ef2e0a"
  },
  "emailVerified": false,
  "BackpackDataRecord": {
    "__type": "Pointer",
    "className": "BackpackDataRecord",
    "objectId": "614e10535e0db15b17ef2e0e"
  },
  "MissionDataRecord": {
    "__type": "Pointer",
    "className": "MissionDataRecord",
    "objectId": "614e10535e0db15b17ef2e16"
  },
  "AccountDataRecord": {
    "__type": "Pointer",
    "className": "AccountDataRecord",
    "objectId": "614e10535e0db15b17ef2e18"
  },
  "ADDataRecord": {
    "__type": "Pointer",
    "className": "ADDataRecord",
    "objectId": "614e10545e0db15b17ef2e1a"
  },
  "userType": 1,
  "mobilePhoneVerified": false
}

現在AccountDataRecord裡的user已經沒在用了 所以我看起來是沒有循環問題才是

還是說我只需要對User進行儲存即可?

目前這個SaveAll的問題在0.9.9會發生 其他版本目前還沒試過

感谢反馈,这里确实是 bug,已发布 0.10.142 修复