tt.getCloudStorageByRelation

2020-02-15 02:29 更新
該接口只可在開放數(shù)據(jù)域下使用 在主域下使用 tt.login 確認(rèn)當(dāng)前用戶登錄后才能使用

根據(jù)關(guān)系類型獲取與當(dāng)前用戶相關(guān)的其他用戶托管數(shù)據(jù)。


參數(shù)

Object object

名稱數(shù)據(jù)類型屬性必填描述
typestring關(guān)系類型
keyListArray<string>要獲取的 key 列表
extraobject獲取挑戰(zhàn)排行榜數(shù)據(jù)時(shí)需要傳的配置
successfunction接口調(diào)用成功回調(diào)函數(shù)
failfunction接口調(diào)用失敗回調(diào)函數(shù)
completefunction接口調(diào)用結(jié)束回調(diào)函數(shù)

type 說明

說明
friend好友關(guān)系
recommend平臺推薦部分用戶
group

extra 屬性說明

屬性類型說明
sortKeystring后臺配置的排行榜 key
groupIdstring用戶分組 id

success 返回參數(shù)說明

Object 類型, 屬性如下:

名稱數(shù)據(jù)類型描述
dataArray<UserGameData>宿主 APP 中關(guān)系好友的托管數(shù)據(jù)


代碼

tt.getCloudStorageByRelation({
  type: "friend",
  keyList: ["test1"],
  success(res) {},
  fail(e) {}
});

獲取挑戰(zhàn)排行榜數(shù)據(jù)

tt.getCloudStorageByRelation({
  type: "group",
  keyList: ["score"],
  extra: {
    sortKey: "score", // 指定的key需要在后臺配置過
    groupId: "test_group" // 指定要獲取的用戶所屬分組
  },
  success(res) {
    console.log(res);
  },
  fail(e) {
    console.log("獲取數(shù)據(jù)失敗");
  }
});


Bug & Tips

  • types 屬性中的各類型關(guān)系均需要宿主 APP 支持后,開發(fā)者才可調(diào)用接口獲取到有效數(shù)據(jù)。目前關(guān)系數(shù)據(jù)接口僅在抖音 APP 下可用,在頭條中使用暫時(shí)無法獲取有效數(shù)據(jù),只能獲取用戶自身數(shù)據(jù)。
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號