@ccw-api/api 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +591 -367
  2. package/dist/esm/community-web/ccw-mall/ccw/product/fe/query.js +34 -0
  3. package/dist/esm/community-web/ccw-mall/ccw/product/fe/query.test.js +8 -0
  4. package/dist/esm/community-web/comment/page_by_topic.js +1 -1
  5. package/dist/esm/community-web/extensions/creation-like/detail.js +14 -0
  6. package/dist/esm/community-web/extensions/creation-like/detail.test.js +4 -0
  7. package/dist/esm/community-web/extensions/following/status.js +14 -0
  8. package/dist/esm/community-web/extensions/following/status.test.js +4 -0
  9. package/dist/esm/community-web/great_creation/update.js +13 -0
  10. package/dist/esm/community-web/great_creation/update.test.js +4 -0
  11. package/dist/esm/community-web/index.js +22 -0
  12. package/dist/esm/community-web/post/post.test.js +0 -1
  13. package/dist/esm/community-web/smart_contract/account.js +13 -0
  14. package/dist/esm/community-web/smart_contract/account.test.js +4 -0
  15. package/dist/esm/community-web/smart_contract/detail.js +13 -0
  16. package/dist/esm/community-web/smart_contract/detail.test.js +4 -0
  17. package/dist/esm/community-web/smart_contract/execute.js +17 -0
  18. package/dist/esm/community-web/smart_contract/execute.test.js +4 -0
  19. package/dist/esm/community-web/smart_contract/list.js +14 -0
  20. package/dist/esm/community-web/smart_contract/list.test.js +4 -0
  21. package/dist/esm/community-web/study-community/following/follow.js +13 -0
  22. package/dist/esm/community-web/study-community/following/follow.test.js +4 -0
  23. package/dist/esm/community-web/user_package/status.js +14 -0
  24. package/dist/esm/community-web/user_package/status.test.js +4 -0
  25. package/dist/esm/community-web/user_package/user_product.js +29 -0
  26. package/dist/esm/community-web/user_package/user_product.test.js +9 -0
  27. package/dist/esm/community-web-cloud-database/cloud_variable/detail/v2.js +16 -0
  28. package/dist/esm/community-web-cloud-database/cloud_variable/detail/v2.test.js +4 -0
  29. package/dist/esm/community-web-cloud-database/cloud_variable/save.js +29 -0
  30. package/dist/esm/community-web-cloud-database/cloud_variable/save.test.js +13 -0
  31. package/dist/esm/community-web-cloud-database/index.js +7 -0
  32. package/dist/esm/gandi-main/creation/leaderboards/{oid}/records.js +28 -0
  33. package/dist/esm/gandi-main/creation/leaderboards/{oid}/records.test.js +11 -0
  34. package/dist/esm/gandi-main/index.js +3 -0
  35. package/dist/esm/index.js +5 -1
  36. package/dist/esm/op-parent-api/captcha/check.js +15 -0
  37. package/dist/esm/op-parent-api/captcha/check.test.js +12 -0
  38. package/dist/esm/op-parent-api/captcha/create.js +13 -0
  39. package/dist/esm/op-parent-api/captcha/create.test.js +13 -0
  40. package/dist/esm/op-parent-api/index.js +6 -0
  41. package/dist/esm/sso/index.js +4 -0
  42. package/dist/esm/sso/web/auth/assistant/captcha/v2/create.js +17 -0
  43. package/dist/esm/sso/web/auth/assistant/captcha/v2/create.test.js +8 -0
  44. package/dist/esm/sso/web/auth/login-by-password.js +4 -3
  45. package/dist/esm/sso/web/auth/v3/login/by-phone.js +33 -0
  46. package/dist/esm/sso/web/auth/v3/login/by-phone.test.js +7 -0
  47. package/dist/node/community-web/ccw-mall/ccw/product/fe/query.js +38 -0
  48. package/dist/node/community-web/ccw-mall/ccw/product/fe/query.test.js +10 -0
  49. package/dist/node/community-web/comment/page_by_topic.js +1 -1
  50. package/dist/node/community-web/extensions/creation-like/detail.js +18 -0
  51. package/dist/node/community-web/extensions/creation-like/detail.test.js +6 -0
  52. package/dist/node/community-web/extensions/following/status.js +18 -0
  53. package/dist/node/community-web/extensions/following/status.test.js +6 -0
  54. package/dist/node/community-web/great_creation/update.js +17 -0
  55. package/dist/node/community-web/great_creation/update.test.js +6 -0
  56. package/dist/node/community-web/index.js +22 -0
  57. package/dist/node/community-web/post/post.test.js +0 -1
  58. package/dist/node/community-web/smart_contract/account.js +17 -0
  59. package/dist/node/community-web/smart_contract/account.test.js +6 -0
  60. package/dist/node/community-web/smart_contract/detail.js +17 -0
  61. package/dist/node/community-web/smart_contract/detail.test.js +6 -0
  62. package/dist/node/community-web/smart_contract/execute.js +21 -0
  63. package/dist/node/community-web/smart_contract/execute.test.js +6 -0
  64. package/dist/node/community-web/smart_contract/list.js +18 -0
  65. package/dist/node/community-web/smart_contract/list.test.js +6 -0
  66. package/dist/node/community-web/study-community/following/follow.js +17 -0
  67. package/dist/node/community-web/study-community/following/follow.test.js +6 -0
  68. package/dist/node/community-web/user_package/status.js +18 -0
  69. package/dist/node/community-web/user_package/status.test.js +6 -0
  70. package/dist/node/community-web/user_package/user_product.js +33 -0
  71. package/dist/node/community-web/user_package/user_product.test.js +11 -0
  72. package/dist/node/community-web-cloud-database/cloud_variable/detail/v2.js +20 -0
  73. package/dist/node/community-web-cloud-database/cloud_variable/detail/v2.test.js +6 -0
  74. package/dist/node/community-web-cloud-database/cloud_variable/save.js +34 -0
  75. package/dist/node/community-web-cloud-database/cloud_variable/save.test.js +15 -0
  76. package/dist/node/community-web-cloud-database/index.js +10 -0
  77. package/dist/node/gandi-main/creation/leaderboards/{oid}/records.js +33 -0
  78. package/dist/node/gandi-main/creation/leaderboards/{oid}/records.test.js +13 -0
  79. package/dist/node/gandi-main/index.js +3 -0
  80. package/dist/node/index.js +7 -1
  81. package/dist/node/op-parent-api/captcha/check.js +19 -0
  82. package/dist/node/op-parent-api/captcha/check.test.js +14 -0
  83. package/dist/node/op-parent-api/captcha/create.js +17 -0
  84. package/dist/node/op-parent-api/captcha/create.test.js +15 -0
  85. package/dist/node/op-parent-api/index.js +9 -0
  86. package/dist/node/sso/index.js +4 -0
  87. package/dist/node/sso/web/auth/assistant/captcha/v2/create.js +21 -0
  88. package/dist/node/sso/web/auth/assistant/captcha/v2/create.test.js +10 -0
  89. package/dist/node/sso/web/auth/login-by-password.js +4 -3
  90. package/dist/node/sso/web/auth/v3/login/by-phone.js +37 -0
  91. package/dist/node/sso/web/auth/v3/login/by-phone.test.js +9 -0
  92. package/dist/types/community-web/ccw-mall/ccw/product/fe/query.d.ts +54 -0
  93. package/dist/types/community-web/comment/page_by_topic.d.ts +1 -1
  94. package/dist/types/community-web/extensions/creation-like/detail.d.ts +18 -0
  95. package/dist/types/community-web/extensions/following/status.d.ts +19 -0
  96. package/dist/types/community-web/great_creation/update.d.ts +12 -0
  97. package/dist/types/community-web/index.d.ts +22 -0
  98. package/dist/types/community-web/post/detail.d.ts +1 -1
  99. package/dist/types/community-web/smart_contract/account.d.ts +13 -0
  100. package/dist/types/community-web/smart_contract/detail.d.ts +24 -0
  101. package/dist/types/community-web/smart_contract/execute.d.ts +25 -0
  102. package/dist/types/community-web/smart_contract/list.d.ts +49 -0
  103. package/dist/types/community-web/study-community/following/follow.d.ts +12 -0
  104. package/dist/types/community-web/user_package/status.d.ts +13 -0
  105. package/dist/types/community-web/user_package/user_product.d.ts +40 -0
  106. package/dist/types/community-web-cloud-database/cloud_variable/detail/v2.d.ts +17 -0
  107. package/dist/types/community-web-cloud-database/cloud_variable/save.d.ts +26 -0
  108. package/dist/types/community-web-cloud-database/index.d.ts +7 -0
  109. package/dist/types/gandi-main/creation/leaderboards/{oid}/records.d.ts +62 -0
  110. package/dist/types/gandi-main/index.d.ts +3 -0
  111. package/dist/types/index.d.ts +27 -1
  112. package/dist/types/op-parent-api/captcha/check.d.ts +21 -0
  113. package/dist/types/op-parent-api/captcha/create.d.ts +24 -0
  114. package/dist/types/op-parent-api/index.d.ts +6 -0
  115. package/dist/types/sso/index.d.ts +4 -0
  116. package/dist/types/sso/web/auth/assistant/captcha/v2/create.d.ts +34 -0
  117. package/dist/types/sso/web/auth/login-by-password.d.ts +2 -18
  118. package/dist/types/sso/web/auth/v3/login/by-phone.d.ts +38 -0
  119. package/package.json +2 -2
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const records_1 = require("./records");
4
+ test("submit leaderboard record should fail without token", async () => {
5
+ await expect((0, records_1.submitLeaderboardRecord)("65a2314daa96bd09b5beae5a", 0, "65a2314daa96bd09b5beae5a", "")).rejects.toThrow();
6
+ });
7
+ test("get leaderboard records should return data", async () => {
8
+ const res = await (0, records_1.getLeaderboardRecords)("65a2314daa96bd09b5beae5a");
9
+ expect(res.oid).toBe("65a2314daa96bd09b5beae5a");
10
+ expect(res.title).toBeDefined();
11
+ expect(res.leaderboardRecordTotalNum).toBeDefined();
12
+ expect(Array.isArray(res.leaderboardRecords)).toBe(true);
13
+ });
@@ -4,8 +4,11 @@ exports.gandiMain = void 0;
4
4
  const current_1 = require("./timestamp/current");
5
5
  const page_1 = require("./bulletins/page");
6
6
  const detail_1 = require("./bulletins/detail");
7
+ const records_1 = require("./creation/leaderboards/{oid}/records");
7
8
  exports.gandiMain = {
8
9
  getCurrentTimestamp: current_1.getCurrentTimestamp,
9
10
  getBulletinsPage: page_1.getBulletinsPage,
10
11
  getBulletinDetail: detail_1.getBulletinDetail,
12
+ submitLeaderboardRecord: records_1.submitLeaderboardRecord,
13
+ getLeaderboardRecords: records_1.getLeaderboardRecords,
11
14
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setToken = exports.bfsWeb = exports.gandiMain = exports.communityWeb = exports.sso = void 0;
3
+ exports.setToken = exports.opParentApi = exports.communityWebCloudDatabase = exports.bfsWeb = exports.gandiMain = exports.communityWeb = exports.sso = void 0;
4
4
  const index_1 = require("./sso/index");
5
5
  Object.defineProperty(exports, "sso", { enumerable: true, get: function () { return index_1.sso; } });
6
6
  const community_web_1 = require("./community-web");
@@ -9,6 +9,10 @@ const gandi_main_1 = require("./gandi-main");
9
9
  Object.defineProperty(exports, "gandiMain", { enumerable: true, get: function () { return gandi_main_1.gandiMain; } });
10
10
  const bfs_web_1 = require("./bfs-web");
11
11
  Object.defineProperty(exports, "bfsWeb", { enumerable: true, get: function () { return bfs_web_1.bfsWeb; } });
12
+ const community_web_cloud_database_1 = require("./community-web-cloud-database");
13
+ Object.defineProperty(exports, "communityWebCloudDatabase", { enumerable: true, get: function () { return community_web_cloud_database_1.communityWebCloudDatabase; } });
14
+ const op_parent_api_1 = require("./op-parent-api");
15
+ Object.defineProperty(exports, "opParentApi", { enumerable: true, get: function () { return op_parent_api_1.opParentApi; } });
12
16
  var axios_1 = require("@ccw-api/axios");
13
17
  Object.defineProperty(exports, "setToken", { enumerable: true, get: function () { return axios_1.setToken; } });
14
18
  exports.default = {
@@ -16,4 +20,6 @@ exports.default = {
16
20
  communityWeb: community_web_1.communityWeb,
17
21
  gandiMain: gandi_main_1.gandiMain,
18
22
  bfsWeb: bfs_web_1.bfsWeb,
23
+ communityWebCloudDatabase: community_web_cloud_database_1.communityWebCloudDatabase,
24
+ opParentApi: op_parent_api_1.opParentApi,
19
25
  };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.checkCaptcha = checkCaptcha;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://op-parent-api.xiguacity.cn/captcha/check";
7
+ /**
8
+ * 校验图形验证码(拼图滑块坐标)
9
+ * @param {string} token createCaptcha 返回的 token
10
+ * @param {number} x 拼图滑块目标位置的 x 坐标
11
+ * @param {number} y 拼图滑块目标位置的 y 坐标
12
+ * @returns {Promise<Res>} 校验结果
13
+ */
14
+ async function checkCaptcha(token, x, y = 5) {
15
+ const req = { data: { x, y }, token };
16
+ return await axios_1.ccwAxios
17
+ .post(exports.url, req)
18
+ .then((res) => res.data.body);
19
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const check_1 = require("./check");
4
+ const create_1 = require("./create");
5
+ test("checkCaptcha returns structured result with token and coords without auth", async () => {
6
+ const created = await (0, create_1.createCaptcha)("BLOCK_PUZZLE");
7
+ const res = await (0, check_1.checkCaptcha)(created.token, 0, -1);
8
+ expect(res).toHaveProperty("captchaExpired");
9
+ expect(res).toHaveProperty("errorMsg");
10
+ expect(res).toHaveProperty("success");
11
+ expect(res.captchaExpired).toBeFalsy();
12
+ expect(res.success).toBeFalsy();
13
+ expect(res.errorMsg).toEqual("验证失败");
14
+ }, 30000);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.createCaptcha = createCaptcha;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://op-parent-api.xiguacity.cn/captcha/create";
7
+ /**
8
+ * 创建图形验证码(拼图滑块)
9
+ * @param {CaptchaType} type 验证码类型,默认 BLOCK_PUZZLE(滑块拼图)
10
+ * @returns {Promise<Res>} 验证码信息:bgImg为背景图base64 data url,jigsawImg为拼图块base64 data url,token用于后续校验
11
+ */
12
+ async function createCaptcha(type = "BLOCK_PUZZLE") {
13
+ const req = { type };
14
+ return await axios_1.ccwAxios
15
+ .post(exports.url, req)
16
+ .then((res) => res.data.body);
17
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const create_1 = require("./create");
4
+ test("create BLOCK_PUZZLE captcha returns bgImg, jigsawImg and token without token", async () => {
5
+ const res = await (0, create_1.createCaptcha)("BLOCK_PUZZLE");
6
+ expect(res).toHaveProperty("data");
7
+ expect(res.data).toHaveProperty("bgImg");
8
+ expect(res.data).toHaveProperty("jigsawImg");
9
+ expect(res).toHaveProperty("token");
10
+ expect(typeof res.token).toBe("string");
11
+ expect(typeof res.data.bgImg).toBe("string");
12
+ expect(typeof res.data.jigsawImg).toBe("string");
13
+ expect(res.data.bgImg.startsWith("data:image/png;base64,")).toBeTruthy();
14
+ expect(res.data.jigsawImg.startsWith("data:image/png;base64,")).toBeTruthy();
15
+ }, 30000);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.opParentApi = void 0;
4
+ const create_1 = require("./captcha/create");
5
+ const check_1 = require("./captcha/check");
6
+ exports.opParentApi = {
7
+ createCaptcha: create_1.createCaptcha,
8
+ checkCaptcha: check_1.checkCaptcha,
9
+ };
@@ -4,8 +4,12 @@ exports.sso = void 0;
4
4
  const login_by_password_1 = require("./web/auth/login-by-password");
5
5
  const logout_1 = require("./web/auth/logout");
6
6
  const logout_by_session_1 = require("./web/auth/logout_by_session");
7
+ const create_1 = require("./web/auth/assistant/captcha/v2/create");
8
+ const by_phone_1 = require("./web/auth/v3/login/by-phone");
7
9
  exports.sso = {
8
10
  loginByPassword: login_by_password_1.loginByPassword,
9
11
  logout: logout_1.logout,
10
12
  logoutBySession: logout_by_session_1.logoutBySession,
13
+ createSmsCaptcha: create_1.createSmsCaptcha,
14
+ loginByPhone: by_phone_1.loginByPhone,
11
15
  };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.createSmsCaptcha = createSmsCaptcha;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://sso.ccw.site/web/auth/assistant/captcha/v2/create";
7
+ /**
8
+ * 发送短信验证码
9
+ * @param {string} recipient 接收手机号,如 "10011451919"
10
+ * @param {SmsScene} scene 场景,默认 loginbyPhone
11
+ * @param {string} countryCode 国家代码,默认 "86"
12
+ * @param {SmsRuleCode} ruleCode 短信规则编码,默认 "ccw_sms"
13
+ * @param {CaptchaPayload} captcha 图形验证码校验结果(滑块拼图的坐标与token),可选(部分场景未强制要求时可省略,但失败时sendResult!=1)
14
+ * @returns {Promise<Res>} 发送结果:batchId 为短信批次ID,sendResult=1 表示成功
15
+ */
16
+ async function createSmsCaptcha(recipient, scene = "loginbyPhone", countryCode = "86", ruleCode = "ccw_sms", captcha) {
17
+ const req = { recipient, countryCode, scene, ruleCode, captcha };
18
+ return await axios_1.ccwAxios
19
+ .post(exports.url, req)
20
+ .then((res) => res.data.body);
21
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const create_1 = require("./create");
4
+ test("createSmsCaptchaV2 returns batchId and sendResult fields without token", async () => {
5
+ const res = await (0, create_1.createSmsCaptcha)("12345671145", "loginbyPhone", "86", "ccw_sms");
6
+ expect(res).toHaveProperty("batchId");
7
+ expect(res).toHaveProperty("sendResult");
8
+ expect(res.batchId).toBeNull();
9
+ expect(res.sendResult).toBe(2);
10
+ }, 30000);
@@ -15,13 +15,14 @@ async function loginByPassword(loginKey, password, reqExtra = {
15
15
  device: "Node",
16
16
  browser: "Node.js",
17
17
  }) {
18
- const { extra, ...restBody } = await axios_1.ccwAxios
19
- .post(exports.url, {
18
+ const req = {
20
19
  loginKey,
21
20
  password,
22
21
  clientCode: "STUDY_COMMUNITY",
23
22
  extra: JSON.stringify({ ...reqExtra, scene: null }),
24
- })
23
+ };
24
+ const { extra, ...restBody } = await axios_1.ccwAxios
25
+ .post(exports.url, req)
25
26
  .then((res) => res.data.body);
26
27
  const resExtra = JSON.parse(extra);
27
28
  return {
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.url = void 0;
4
+ exports.loginByPhone = loginByPhone;
5
+ const axios_1 = require("@ccw-api/axios");
6
+ exports.url = "https://sso.ccw.site/web/auth/v3/login/by_phone";
7
+ /**
8
+ * 通过手机号+短信验证码登录(V3)
9
+ * @param {string} phone 手机号,如 "12345671145"
10
+ * @param {string} code 收到的短信验证码
11
+ * @param {ReqExtra} reqExtra 设备和浏览器信息
12
+ * @param {string} countryCode 国家代码,默认 "86"
13
+ * @param {LoginRuleCode} ruleCode 短信规则编码,默认 "ccw_sms"
14
+ * @param {LoginScene} scene 登录场景,默认 "loginbyPhone"
15
+ * @returns {Promise<Res<Extra>>} session 信息
16
+ */
17
+ async function loginByPhone(phone, code, reqExtra = {
18
+ device: "Node",
19
+ browser: "Node.js",
20
+ }, countryCode = "86", ruleCode = "ccw_sms", scene = "loginbyPhone") {
21
+ const { extra, ...restBody } = await axios_1.ccwAxios
22
+ .post(exports.url, {
23
+ phone,
24
+ code,
25
+ countryCode,
26
+ ruleCode,
27
+ scene,
28
+ clientCode: "STUDY_COMMUNITY",
29
+ extra: JSON.stringify({ ...reqExtra, scene: null }),
30
+ })
31
+ .then((res) => res.data.body);
32
+ const resExtra = JSON.parse(extra);
33
+ return {
34
+ ...restBody,
35
+ extra: resExtra,
36
+ };
37
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const by_phone_1 = require("./by-phone");
4
+ test("expect wrong sms code to throw error", async () => {
5
+ await expect((0, by_phone_1.loginByPhone)("12345671145", "000000", {
6
+ device: "Node.js Test",
7
+ browser: "Jest",
8
+ })).rejects.toThrow();
9
+ }, 30000);
@@ -0,0 +1,54 @@
1
+ import { CNameOssUrl, MongoDBId } from "src/types/api";
2
+ import { PagesRes, PageArgs, SortType } from "src/types/pages";
3
+ export declare const url = "https://community-web.ccw.site/ccw-mall/ccw/product/fe/query";
4
+ export declare enum ProductCategory {
5
+ Merchandise = 7,
6
+ AvatarFrame = 5,
7
+ EMOJI = 10
8
+ }
9
+ export type ProductSource = "CCW_OFFICIAL";
10
+ export type ProductType = 1 | 2 | 3;
11
+ export type ProductSortField = "createdAt" | "updatedAt" | "pointPrice" | "priority" | "stockNum";
12
+ export type Product = {
13
+ createdAt: number;
14
+ description: string;
15
+ elements: unknown[];
16
+ functionDescribe: string;
17
+ id: number;
18
+ name: string;
19
+ note: string;
20
+ offlineAt: null | number;
21
+ oid: MongoDBId;
22
+ onlineAt: number;
23
+ originPointPrice: number;
24
+ originPrice: number;
25
+ periodValidityDay: null | number;
26
+ periodValidityTime: null | number;
27
+ picUrl: null | CNameOssUrl | string;
28
+ pointPrice: number;
29
+ price: number;
30
+ priority: number;
31
+ productCategory: ProductCategory;
32
+ purchaseLimitationNum: number;
33
+ source: ProductSource;
34
+ status: number;
35
+ stockNum: number;
36
+ type: ProductType;
37
+ updatedAt: number;
38
+ virtualValue: null | CNameOssUrl | string;
39
+ };
40
+ export type Req = {
41
+ page: number;
42
+ perPage: number;
43
+ productCategory?: ProductCategory;
44
+ sortType: SortType;
45
+ source?: ProductSource;
46
+ };
47
+ export type Res = PagesRes<Product, ProductSortField>;
48
+ /**
49
+ * 分页查询CCW小商店商品列表
50
+ * @param {ProductCategory | undefined} productCategory 商品分类(可选):5=头像框,7=周边商品,10=表情 等
51
+ * @param {Partial<PageArgs<ProductSortField>>} pageArgs_ 分页参数(默认 page=1, perPage=30, sortType="DESC")
52
+ * @returns {Promise<Res>} 商品分页结果 PagesRes<Product>
53
+ */
54
+ export declare function queryMallProducts<T extends string>(productCategory?: ProductCategory, pageArgs_?: Partial<PageArgs<ProductSortField | T>>): Promise<Res>;
@@ -12,7 +12,7 @@ export type Res = PagesRes<Comment>;
12
12
  * 根据主题获取评论列表
13
13
  * @param {string} subjectOid 主题oid
14
14
  * @param {SubjectType} subjectType 主题类型 (如: "POST")
15
- * @param {string} sectionType 区块类型 (如: "COMMENT")
15
+ * @param {SectionType} sectionType 区块类型 (如: "COMMENT")
16
16
  * @param {Partial<PageArgs<SortField| T>>} pageArgs_ 分页参数
17
17
  * @returns {Promise<Res>} 评论分页结果
18
18
  */
@@ -0,0 +1,18 @@
1
+ import { MongoDBId } from "src/types/api";
2
+ export declare const url = "https://community-web.ccw.site/extensions/creation-like/detail";
3
+ export type Req = {
4
+ playingCreationOid: MongoDBId;
5
+ creationOid: MongoDBId;
6
+ };
7
+ export type Res = {
8
+ interactionStatus: boolean;
9
+ oid: MongoDBId;
10
+ title: string;
11
+ };
12
+ /**
13
+ * [连接社区扩展] 查询用户对作品的点赞交互状态
14
+ * @param {MongoDBId} playingCreationOid 当前播放的作品 OID
15
+ * @param {MongoDBId} creationOid 目标作品 OID
16
+ * @returns {Promise<Res>} 点赞状态及作品信息
17
+ */
18
+ export declare function getConnectCommunityCreationLikeStatus(playingCreationOid: MongoDBId, creationOid: MongoDBId): Promise<Res>;
@@ -0,0 +1,19 @@
1
+ import { MongoDBId, CNameOssUrl } from "src/types/api";
2
+ export declare const url = "https://community-web.ccw.site/extensions/following/status";
3
+ export type Req = {
4
+ playingCreationOid: MongoDBId;
5
+ userOid: MongoDBId;
6
+ };
7
+ export type Res = {
8
+ avatar: CNameOssUrl;
9
+ isFollowing: boolean;
10
+ name: string;
11
+ oid: MongoDBId;
12
+ };
13
+ /**
14
+ * [连接社区扩展] 查询是否关注了指定创作者
15
+ * @param {MongoDBId} playingCreationOid 当前播放的作品 OID
16
+ * @param {MongoDBId} userOid 目标用户 OID
17
+ * @returns {Promise<Res>} 关注状态及用户信息
18
+ */
19
+ export declare function getConnectCommunityFollowingStatus(playingCreationOid: MongoDBId, userOid: MongoDBId): Promise<Res>;
@@ -0,0 +1,12 @@
1
+ import { MongoDBId } from "src/types/api";
2
+ export declare const url = "https://community-web.ccw.site/great_creation/update";
3
+ export type Req = {
4
+ creationOid: MongoDBId | "";
5
+ };
6
+ export type Res = boolean;
7
+ /**
8
+ * 更换代表作
9
+ * @param {MongoDBId|""} creationOid 作品OID 若为""则是取消展示
10
+ * @returns {Promise<Res>} 更换结果
11
+ */
12
+ export declare function updateGreatCreation(creationOid: MongoDBId | ""): Promise<Res>;
@@ -9,6 +9,7 @@ import { searchCloudAssets } from "./cloud_asset/search";
9
9
  import { getCommentReplies } from "./comment/page";
10
10
  import { getCommentsByTopic } from "./comment/page_by_topic";
11
11
  import { getConfigDetail } from "./config/detail";
12
+ import { queryMallProducts } from "./ccw-mall/ccw/product/fe/query";
12
13
  import { getCreationDetail } from "./creation/detail";
13
14
  import { getExcellentCreations } from "./creation/excellent/list";
14
15
  import { getCreationIntroduction } from "./creation/introduction/detail";
@@ -93,10 +94,21 @@ import { createComment } from "./comment/create";
93
94
  import { likeComment } from "./comment/like_record/create";
94
95
  import { getStudentFollowingPage } from "./student/following/page";
95
96
  import { donateTrade } from "./study-trade/trade/donate";
97
+ import { getUserProductsPage } from "./user_package/user_product";
98
+ import { setUserProductStatus } from "./user_package/status";
99
+ import { updateGreatCreation } from "./great_creation/update";
100
+ import { executeSmartContract } from "./smart_contract/execute";
101
+ import { getSmartContractAccount } from "./smart_contract/account";
102
+ import { getSmartContractDetail } from "./smart_contract/detail";
103
+ import { getSmartContractList } from "./smart_contract/list";
104
+ import { getConnectCommunityFollowingStatus } from "./extensions/following/status";
105
+ import { getConnectCommunityCreationLikeStatus } from "./extensions/creation-like/detail";
106
+ import { followCreator } from "./study-community/following/follow";
96
107
  export declare const communityWeb: {
97
108
  acceptAward: typeof acceptAward;
98
109
  donateTrade: typeof donateTrade;
99
110
  encodeShortCode: typeof encodeShortCode;
111
+ executeSmartContract: typeof executeSmartContract;
100
112
  createCloudVariable: typeof createCloudVariable;
101
113
  createComment: typeof createComment;
102
114
  createShortUrl: typeof createShortUrl;
@@ -104,6 +116,7 @@ export declare const communityWeb: {
104
116
  decompressShortUrl: typeof decompressShortUrl;
105
117
  deleteComment: typeof deleteComment;
106
118
  foldComment: typeof foldComment;
119
+ followCreator: typeof followCreator;
107
120
  getApprovalTags: typeof getApprovalTags;
108
121
  getCampaignResources: typeof getCampaignResources;
109
122
  getCcwMainStatus: typeof getCCWMainStatus;
@@ -117,6 +130,7 @@ export declare const communityWeb: {
117
130
  getCreationDetail: typeof getCreationDetail;
118
131
  getCreationFavoriteDetail: typeof getCreationFavoriteDetail;
119
132
  getCreationIntroduction: typeof getCreationIntroduction;
133
+ getConnectCommunityCreationLikeStatus: typeof getConnectCommunityCreationLikeStatus;
120
134
  getCreationRecommendPositionList: typeof getCreationRecommendPositionList;
121
135
  getCreationReleasePage: typeof getCreationReleasePage;
122
136
  getCreationScreenshotPage: typeof getCreationScreenshotPage;
@@ -125,6 +139,7 @@ export declare const communityWeb: {
125
139
  getCreatorScore: typeof getCreatorScore;
126
140
  getDonatedRecordRanking: typeof getDonatedRecordRanking;
127
141
  getExcellentCreations: typeof getExcellentCreations;
142
+ getConnectCommunityFollowingStatus: typeof getConnectCommunityFollowingStatus;
128
143
  getEmojiCategoryList: typeof getEmojiCategoryList;
129
144
  getEmojiPage: typeof getEmojiPage;
130
145
  getAllEmojis: typeof getAllEmojis;
@@ -153,6 +168,9 @@ export declare const communityWeb: {
153
168
  getRemixedCreationPage: typeof getRemixedCreationPage;
154
169
  getReputationScoreLogPage: typeof getReputationScoreLog;
155
170
  getSearchHotWords: typeof getSearchHotWords;
171
+ getSmartContractAccount: typeof getSmartContractAccount;
172
+ getSmartContractDetail: typeof getSmartContractDetail;
173
+ getSmartContractList: typeof getSmartContractList;
156
174
  getSplitRuleDetail: typeof getSplitRuleDetail;
157
175
  getSpreadFeedUnreadCount: typeof getSpreadFeedUnreadCount;
158
176
  getStudentBlockRecordDetail: typeof getStudentBlockRecordDetail;
@@ -176,6 +194,8 @@ export declare const communityWeb: {
176
194
  getUserAssetStorageSize: typeof getUserAssetStorageSize;
177
195
  getUserCardDetail: typeof getUserCardDetail;
178
196
  getUserLabelList: typeof getUserLabelList;
197
+ getUserProductsPage: typeof getUserProductsPage;
198
+ queryMallProducts: typeof queryMallProducts;
179
199
  getCreationsByStudent: typeof getCreationsByStudent;
180
200
  insertCheckInRecord: typeof insertCheckInRecord;
181
201
  likeComment: typeof likeComment;
@@ -184,9 +204,11 @@ export declare const communityWeb: {
184
204
  searchCloudAssets: typeof searchCloudAssets;
185
205
  searchCreationsByTag: typeof searchCreationsByTag;
186
206
  sendEvent: typeof sendEvent;
207
+ setUserProductStatus: typeof setUserProductStatus;
187
208
  submitCreation: typeof submitCreation;
188
209
  topComment: typeof topComment;
189
210
  updateCreation: typeof updateCreation;
211
+ updateGreatCreation: typeof updateGreatCreation;
190
212
  updateStudent: typeof updateStudent;
191
213
  viewCreationStats: typeof viewCreationStats;
192
214
  };
@@ -31,7 +31,7 @@ export type Res = {
31
31
  oid: MongoDBId;
32
32
  pageView: number;
33
33
  publishedAt: number;
34
- rank: string;
34
+ rank: "EXCELLENT" | "ORDINARY";
35
35
  rankUpdatedAt: null | number;
36
36
  reviewedAt: number;
37
37
  slug: string;
@@ -0,0 +1,13 @@
1
+ export declare const url = "https://community-web.ccw.site/smart_contract/account";
2
+ export type Req = {
3
+ id: number;
4
+ };
5
+ export type Res = {
6
+ balance: number;
7
+ };
8
+ /**
9
+ * 查询智能合约账户余额
10
+ * @param {number} id 合约 ID
11
+ * @returns {Promise<Res>} 合约账户余额
12
+ */
13
+ export declare function getSmartContractAccount(id: number): Promise<Res>;
@@ -0,0 +1,24 @@
1
+ import { MongoDBId } from "src/types/api";
2
+ import { SmartContractBizType, SmartContractRule } from "./list";
3
+ export declare const url = "https://community-web.ccw.site/smart_contract/detail";
4
+ export type Req = {
5
+ id: number;
6
+ };
7
+ export type Res = {
8
+ accountId: MongoDBId;
9
+ bizId: MongoDBId;
10
+ bizType: SmartContractBizType;
11
+ createdAt: number;
12
+ id: number;
13
+ rules: SmartContractRule[];
14
+ status: "ENABLED";
15
+ title: string;
16
+ type: string;
17
+ updatedAt: number;
18
+ };
19
+ /**
20
+ * 获取智能合约详情
21
+ * @param {number} id 合约 ID
22
+ * @returns {Promise<Res>} 合约详情
23
+ */
24
+ export declare function getSmartContractDetail(id: number): Promise<Res>;
@@ -0,0 +1,25 @@
1
+ import { MongoDBId } from "src/types/api";
2
+ import { SmartContractBizType } from "./list";
3
+ export declare const url = "https://community-web.ccw.site/smart_contract/execute";
4
+ export type Req = {
5
+ bizId: MongoDBId;
6
+ bizType: SmartContractBizType;
7
+ id: number;
8
+ ruleId: number;
9
+ params: {
10
+ bucks: number;
11
+ };
12
+ };
13
+ export type Res = {
14
+ success: boolean;
15
+ };
16
+ /**
17
+ * 执行智能合约(投币/领取奖励)
18
+ * @param {MongoDBId} bizId 业务 ID(如作品 OID)
19
+ * @param {SmartContractBizType} bizType 业务类型,CREATION
20
+ * @param {number} id 合约 ID
21
+ * @param {number} ruleId 规则 ID
22
+ * @param {number} bucks 金币数量
23
+ * @returns {Promise<Res>} 执行结果
24
+ */
25
+ export declare function executeSmartContract(bizId: MongoDBId, id: number, ruleId: number, bucks: number, bizType?: SmartContractBizType): Promise<Res>;
@@ -0,0 +1,49 @@
1
+ import { MongoDBId } from "src/types/api";
2
+ export declare const url = "https://community-web.ccw.site/smart_contract/list";
3
+ export type SmartContractBizType = "CREATION";
4
+ export type Req = {
5
+ bizId: MongoDBId;
6
+ bizType: SmartContractBizType;
7
+ };
8
+ export type SmartContractRule = {
9
+ createdAt: number;
10
+ id: number;
11
+ rule: {
12
+ awardeeAccountId?: "${curUserAccountId}";
13
+ awarderAccountId?: "${smartContractAccountId}";
14
+ bucks: "${bucks}";
15
+ code: "donate" | "award";
16
+ donatorAccountId?: "${curUserAccountId}";
17
+ funSignature: {
18
+ en: string;
19
+ zh_cn: string;
20
+ };
21
+ splitDetailList?: {
22
+ accountId: "${smartContractAccountId}" | "${creationAccountId}";
23
+ rate: number;
24
+ }[];
25
+ title: string;
26
+ };
27
+ smartContractId: number;
28
+ updatedAt: number;
29
+ };
30
+ export type SmartCoinContract = {
31
+ accountId: MongoDBId;
32
+ bizId: MongoDBId;
33
+ bizType: SmartContractBizType;
34
+ createdAt: number;
35
+ id: number;
36
+ rules: SmartContractRule[];
37
+ status: "ENABLED";
38
+ title: "通用合约";
39
+ type: "GENERAL";
40
+ updatedAt: number;
41
+ };
42
+ export type Res = SmartCoinContract[];
43
+ /**
44
+ * 列出作品中的智能金币合约
45
+ * @param {MongoDBId} bizId 业务ID(如作品OID)
46
+ * @param {SmartContractBizType} bizType 业务类型,CREATION
47
+ * @returns {Promise<Res>} 智能合约列表
48
+ */
49
+ export declare function getSmartContractList(bizId: MongoDBId, bizType?: SmartContractBizType): Promise<Res>;
@@ -0,0 +1,12 @@
1
+ import { MongoDBId } from "src/types/api";
2
+ export declare const url = "https://community-web.ccw.site/study-community/following/follow";
3
+ export type Req = {
4
+ followingOid: MongoDBId;
5
+ };
6
+ export type Res = "FOLLOWED";
7
+ /**
8
+ * 关注创作者
9
+ * @param {MongoDBId} followingOid 要关注的用户 OID
10
+ * @returns {Promise<Res>} "FOLLOWED" 表示关注成功
11
+ */
12
+ export declare function followCreator(followingOid: MongoDBId): Promise<Res>;
@@ -0,0 +1,13 @@
1
+ export declare const url = "https://community-web.ccw.site/user_package/status";
2
+ export type Req = {
3
+ status: boolean;
4
+ id: number;
5
+ };
6
+ export type Res = boolean;
7
+ /**
8
+ * 设置用户商品状态(如佩戴/卸下头像框)
9
+ * @param {number} id 用户商品ID
10
+ * @param {boolean} status 商品状态,true为佩戴,false为卸下
11
+ * @returns {Promise<Res>} 设置结果
12
+ */
13
+ export declare function setUserProductStatus(id: number, status: boolean): Promise<Res>;
@@ -0,0 +1,40 @@
1
+ import { MongoDBId, CNameOssUrl } from "src/types/api";
2
+ import { PagesRes, PageArgs } from "src/types/pages";
3
+ import { AccountTypes } from "src/types/account";
4
+ export declare const url = "https://community-web.ccw.site/user_package/user_product";
5
+ export type Req = {
6
+ page: number;
7
+ perPage: number;
8
+ productCategory: number;
9
+ sortType: "ASC" | "DESC";
10
+ };
11
+ export type Res = PagesRes<UserProduct>;
12
+ export type UserProduct = {
13
+ createdAt: number | null;
14
+ description: string;
15
+ exchangeOrderId: string | null;
16
+ expiredAt: number | null;
17
+ id: number;
18
+ isExpire: boolean;
19
+ name: string;
20
+ picUrl: CNameOssUrl;
21
+ productCategory: number;
22
+ productOid: MongoDBId;
23
+ productSource: null;
24
+ status: boolean;
25
+ updatedAt: number | null;
26
+ userOid: MongoDBId;
27
+ userType: AccountTypes;
28
+ validFrom: number;
29
+ virtualValue: CNameOssUrl;
30
+ };
31
+ export declare enum ProductCategory {
32
+ AVATAR_FRAME = 5
33
+ }
34
+ /**
35
+ * 分页获取用户商品(如头像框)
36
+ * @param {ProductCategory} productCategory 商品分类,默认5为头像框
37
+ * @param {Partial<PageArgs<SortField>>} pageArgs_ 分页参数
38
+ * @returns {Promise<Res>} 分页用户商品数据
39
+ */
40
+ export declare function getUserProductsPage<SortField extends string>(productCategory?: ProductCategory, pageArgs_?: Partial<PageArgs<SortField>>): Promise<Res>;