@ccw-api/api 0.4.2 → 0.5.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.
- package/README.md +82 -10
- package/dist/esm/community-web/comment/page_by_topic.js +1 -1
- package/dist/esm/community-web/great_creation/update.js +13 -0
- package/dist/esm/community-web/great_creation/update.test.js +4 -0
- package/dist/esm/community-web/index.js +8 -0
- package/dist/esm/community-web/smart_contract/list.js +14 -0
- package/dist/esm/community-web/smart_contract/list.test.js +4 -0
- package/dist/esm/community-web/user_package/status.js +14 -0
- package/dist/esm/community-web/user_package/status.test.js +4 -0
- package/dist/esm/community-web/user_package/user_product.js +29 -0
- package/dist/esm/community-web/user_package/user_product.test.js +9 -0
- package/dist/esm/community-web-cloud-database/cloud_variable/save.js +29 -0
- package/dist/esm/community-web-cloud-database/cloud_variable/save.test.js +13 -0
- package/dist/esm/community-web-cloud-database/index.js +5 -0
- package/dist/esm/gandi-main/creation/leaderboards/{oid}/records.js +28 -0
- package/dist/esm/gandi-main/creation/leaderboards/{oid}/records.test.js +11 -0
- package/dist/esm/gandi-main/index.js +3 -0
- package/dist/esm/index.js +5 -1
- package/dist/esm/op-parent-api/captcha/check.js +15 -0
- package/dist/esm/op-parent-api/captcha/check.test.js +12 -0
- package/dist/esm/op-parent-api/captcha/create.js +13 -0
- package/dist/esm/op-parent-api/captcha/create.test.js +13 -0
- package/dist/esm/op-parent-api/index.js +6 -0
- package/dist/esm/sso/index.js +4 -0
- package/dist/esm/sso/web/auth/assistant/captcha/v2/create.js +17 -0
- package/dist/esm/sso/web/auth/assistant/captcha/v2/create.test.js +8 -0
- package/dist/esm/sso/web/auth/login-by-password.js +4 -3
- package/dist/esm/sso/web/auth/v3/login/by-phone.js +33 -0
- package/dist/esm/sso/web/auth/v3/login/by-phone.test.js +7 -0
- package/dist/node/community-web/comment/page_by_topic.js +1 -1
- package/dist/node/community-web/great_creation/update.js +17 -0
- package/dist/node/community-web/great_creation/update.test.js +6 -0
- package/dist/node/community-web/index.js +8 -0
- package/dist/node/community-web/smart_contract/list.js +18 -0
- package/dist/node/community-web/smart_contract/list.test.js +6 -0
- package/dist/node/community-web/user_package/status.js +18 -0
- package/dist/node/community-web/user_package/status.test.js +6 -0
- package/dist/node/community-web/user_package/user_product.js +33 -0
- package/dist/node/community-web/user_package/user_product.test.js +11 -0
- package/dist/node/community-web-cloud-database/cloud_variable/save.js +34 -0
- package/dist/node/community-web-cloud-database/cloud_variable/save.test.js +15 -0
- package/dist/node/community-web-cloud-database/index.js +8 -0
- package/dist/node/gandi-main/creation/leaderboards/{oid}/records.js +33 -0
- package/dist/node/gandi-main/creation/leaderboards/{oid}/records.test.js +13 -0
- package/dist/node/gandi-main/index.js +3 -0
- package/dist/node/index.js +7 -1
- package/dist/node/op-parent-api/captcha/check.js +19 -0
- package/dist/node/op-parent-api/captcha/check.test.js +14 -0
- package/dist/node/op-parent-api/captcha/create.js +17 -0
- package/dist/node/op-parent-api/captcha/create.test.js +15 -0
- package/dist/node/op-parent-api/index.js +9 -0
- package/dist/node/sso/index.js +4 -0
- package/dist/node/sso/web/auth/assistant/captcha/v2/create.js +21 -0
- package/dist/node/sso/web/auth/assistant/captcha/v2/create.test.js +10 -0
- package/dist/node/sso/web/auth/login-by-password.js +4 -3
- package/dist/node/sso/web/auth/v3/login/by-phone.js +37 -0
- package/dist/node/sso/web/auth/v3/login/by-phone.test.js +9 -0
- package/dist/types/community-web/comment/page_by_topic.d.ts +1 -1
- package/dist/types/community-web/great_creation/update.d.ts +12 -0
- package/dist/types/community-web/index.d.ts +8 -0
- package/dist/types/community-web/smart_contract/list.d.ts +49 -0
- package/dist/types/community-web/user_package/status.d.ts +13 -0
- package/dist/types/community-web/user_package/user_product.d.ts +40 -0
- package/dist/types/community-web-cloud-database/cloud_variable/save.d.ts +26 -0
- package/dist/types/community-web-cloud-database/index.d.ts +5 -0
- package/dist/types/gandi-main/creation/leaderboards/{oid}/records.d.ts +62 -0
- package/dist/types/gandi-main/index.d.ts +3 -0
- package/dist/types/index.d.ts +19 -1
- package/dist/types/op-parent-api/captcha/check.d.ts +21 -0
- package/dist/types/op-parent-api/captcha/create.d.ts +24 -0
- package/dist/types/op-parent-api/index.d.ts +6 -0
- package/dist/types/sso/index.d.ts +4 -0
- package/dist/types/sso/web/auth/assistant/captcha/v2/create.d.ts +34 -0
- package/dist/types/sso/web/auth/login-by-password.d.ts +2 -18
- package/dist/types/sso/web/auth/v3/login/by-phone.d.ts +38 -0
- package/package.json +1 -1
|
@@ -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>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MongoDBId } from "src/types/api";
|
|
2
|
+
export declare const url = "https://community-web-cloud-database.ccw.site/cloud_variable/save";
|
|
3
|
+
export type SaveCloudVariableReq<T extends Record<string, unknown>> = {
|
|
4
|
+
primaryKey: string;
|
|
5
|
+
secondaryKey: string;
|
|
6
|
+
value: T;
|
|
7
|
+
};
|
|
8
|
+
export type SaveCloudVariableRes<T extends Record<string, unknown>> = T;
|
|
9
|
+
/**
|
|
10
|
+
* 保存作品云变量到云数据库
|
|
11
|
+
* @param {MongoDBId} projectId 作品id
|
|
12
|
+
* @param {string} secondaryKey 次级键 - 变量名或标识
|
|
13
|
+
* @param {T} value 要保存数据
|
|
14
|
+
* @returns {Promise<SaveCloudVariableRes<T>>} 保存后的值对象
|
|
15
|
+
*/
|
|
16
|
+
export declare function saveProjectCloudVariable<T extends string>(projectId: MongoDBId, secondaryKey: string, value: T): Promise<SaveCloudVariableRes<{
|
|
17
|
+
v: T;
|
|
18
|
+
}>>;
|
|
19
|
+
/**
|
|
20
|
+
* 保存数据到用户云数据库
|
|
21
|
+
* @param {MongoDBId} projectId 作品id
|
|
22
|
+
* @param {number} studentNum 次级键 - 用户id
|
|
23
|
+
* @param {T} value 要保存的键值对
|
|
24
|
+
* @returns {Promise<SaveCloudVariableRes<T>>} 保存后的值对象
|
|
25
|
+
*/
|
|
26
|
+
export declare function saveUserCloudVariable<T extends Record<string, string>>(projectId: MongoDBId, studentNum: number, value: T): Promise<SaveCloudVariableRes<T>>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CNameOssUrl, MongoDBId } from "src/types/api";
|
|
2
|
+
import { SortType } from "src/types/pages";
|
|
3
|
+
export declare const url = "https://gandi-main.ccw.site/creation/leaderboards";
|
|
4
|
+
export type SubmitReq = {
|
|
5
|
+
ext: string;
|
|
6
|
+
oid: MongoDBId;
|
|
7
|
+
score: number;
|
|
8
|
+
};
|
|
9
|
+
export type SubmitRes = boolean;
|
|
10
|
+
export type LeaderboardUser = {
|
|
11
|
+
avatar: null | CNameOssUrl;
|
|
12
|
+
id: MongoDBId;
|
|
13
|
+
locked: null | boolean;
|
|
14
|
+
nickname: null | string;
|
|
15
|
+
};
|
|
16
|
+
export type LeaderboardRecord = {
|
|
17
|
+
createdAt: number;
|
|
18
|
+
ext: string;
|
|
19
|
+
leaderboardOid: MongoDBId;
|
|
20
|
+
oid: MongoDBId;
|
|
21
|
+
ranking: number;
|
|
22
|
+
score: number;
|
|
23
|
+
updatedAt: number;
|
|
24
|
+
user: LeaderboardUser;
|
|
25
|
+
userId: MongoDBId;
|
|
26
|
+
};
|
|
27
|
+
export type ScoreFormat = "DECIMAL_WITH_SEPARATOR" | string;
|
|
28
|
+
export type ScoreStorageRule = "BEST" | string;
|
|
29
|
+
export type StatsCycle = "ALL_DAYS" | string;
|
|
30
|
+
export type LeaderboardRecordsRes = {
|
|
31
|
+
coverLink: null | CNameOssUrl;
|
|
32
|
+
createdAt: number;
|
|
33
|
+
creationId: MongoDBId;
|
|
34
|
+
curUserLeaderboardRecord: null | LeaderboardRecord;
|
|
35
|
+
displayLines: number;
|
|
36
|
+
leaderboardRecordTotalNum: number;
|
|
37
|
+
leaderboardRecords: LeaderboardRecord[];
|
|
38
|
+
oid: MongoDBId;
|
|
39
|
+
scoreFormat: ScoreFormat;
|
|
40
|
+
scoreStorageRule: ScoreStorageRule;
|
|
41
|
+
scoreUnit: string;
|
|
42
|
+
showPersonalRanking: boolean;
|
|
43
|
+
sortType: SortType;
|
|
44
|
+
statsCycle: StatsCycle;
|
|
45
|
+
title: string;
|
|
46
|
+
updatedAt: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* 向作品排行榜提交一条分数记录
|
|
50
|
+
* @param {MongoDBId} leaderboardOid 排行榜id
|
|
51
|
+
* @param {number} score 分数
|
|
52
|
+
* @param {MongoDBId} userOid 用户id
|
|
53
|
+
* @param {string} ext 扩展信息(可选)
|
|
54
|
+
* @returns {Promise<SubmitRes>} 是否提交成功
|
|
55
|
+
*/
|
|
56
|
+
export declare function submitLeaderboardRecord(leaderboardOid: MongoDBId, score: number, userOid: MongoDBId, ext?: string): Promise<SubmitRes>;
|
|
57
|
+
/**
|
|
58
|
+
* 获取作品排行榜记录列表
|
|
59
|
+
* @param {MongoDBId} leaderboardOid 排行榜id
|
|
60
|
+
* @returns {Promise<LeaderboardRecordsRes>} 排行榜记录列表
|
|
61
|
+
*/
|
|
62
|
+
export declare function getLeaderboardRecords(leaderboardOid: MongoDBId): Promise<LeaderboardRecordsRes>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { getCurrentTimestamp } from "./timestamp/current";
|
|
2
2
|
import { getBulletinsPage } from "./bulletins/page";
|
|
3
3
|
import { getBulletinDetail } from "./bulletins/detail";
|
|
4
|
+
import { getLeaderboardRecords, submitLeaderboardRecord } from "./creation/leaderboards/{oid}/records";
|
|
4
5
|
export declare const gandiMain: {
|
|
5
6
|
getCurrentTimestamp: typeof getCurrentTimestamp;
|
|
6
7
|
getBulletinsPage: typeof getBulletinsPage;
|
|
7
8
|
getBulletinDetail: typeof getBulletinDetail;
|
|
9
|
+
submitLeaderboardRecord: typeof submitLeaderboardRecord;
|
|
10
|
+
getLeaderboardRecords: typeof getLeaderboardRecords;
|
|
8
11
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,13 +2,17 @@ import { sso } from "./sso/index";
|
|
|
2
2
|
import { communityWeb } from "./community-web";
|
|
3
3
|
import { gandiMain } from "./gandi-main";
|
|
4
4
|
import { bfsWeb } from "./bfs-web";
|
|
5
|
-
|
|
5
|
+
import { communityWebCloudDatabase } from "./community-web-cloud-database";
|
|
6
|
+
import { opParentApi } from "./op-parent-api";
|
|
7
|
+
export { sso, communityWeb, gandiMain, bfsWeb, communityWebCloudDatabase, opParentApi, };
|
|
6
8
|
export { setToken } from "@ccw-api/axios";
|
|
7
9
|
declare const _default: {
|
|
8
10
|
sso: {
|
|
9
11
|
loginByPassword: typeof import("./sso/web/auth/login-by-password").loginByPassword;
|
|
10
12
|
logout: typeof import("./sso/web/auth/logout").logout;
|
|
11
13
|
logoutBySession: typeof import("./sso/web/auth/logout_by_session").logoutBySession;
|
|
14
|
+
createSmsCaptcha: typeof import("./sso/web/auth/assistant/captcha/v2/create").createSmsCaptcha;
|
|
15
|
+
loginByPhone: typeof import("./sso/web/auth/v3/login/by-phone").loginByPhone;
|
|
12
16
|
};
|
|
13
17
|
communityWeb: {
|
|
14
18
|
acceptAward: typeof import("./community-web/task/award").acceptAward;
|
|
@@ -70,6 +74,7 @@ declare const _default: {
|
|
|
70
74
|
getRemixedCreationPage: typeof import("./community-web/creation/page").getRemixedCreationPage;
|
|
71
75
|
getReputationScoreLogPage: typeof import("./community-web/students/reputation_score_log/page").getReputationScoreLog;
|
|
72
76
|
getSearchHotWords: typeof import("./community-web/search/hot_words").getSearchHotWords;
|
|
77
|
+
getSmartContractList: typeof import("./community-web/smart_contract/list").getSmartContractList;
|
|
73
78
|
getSplitRuleDetail: typeof import("./community-web/creation/smart_contract/split_rule/detail").getSplitRuleDetail;
|
|
74
79
|
getSpreadFeedUnreadCount: typeof import("./community-web/study-community/spread_feed/unread/count").getSpreadFeedUnreadCount;
|
|
75
80
|
getStudentBlockRecordDetail: typeof import("./community-web/student/block_record/detail").getStudentBlockRecordDetail;
|
|
@@ -93,6 +98,7 @@ declare const _default: {
|
|
|
93
98
|
getUserAssetStorageSize: typeof import("./community-web/cloud_asset/user/privacy").getUserAssetStorageSize;
|
|
94
99
|
getUserCardDetail: typeof import("./community-web/user-card/detail").getUserCardDetail;
|
|
95
100
|
getUserLabelList: typeof import("./community-web/user_label/list").getUserLabelList;
|
|
101
|
+
getUserProductsPage: typeof import("./community-web/user_package/user_product").getUserProductsPage;
|
|
96
102
|
getCreationsByStudent: typeof import("./community-web/creation/page_by_student").getCreationsByStudent;
|
|
97
103
|
insertCheckInRecord: typeof import("./community-web/check_in_record/insert").insertCheckInRecord;
|
|
98
104
|
likeComment: typeof import("./community-web/comment/like_record/create").likeComment;
|
|
@@ -101,9 +107,11 @@ declare const _default: {
|
|
|
101
107
|
searchCloudAssets: typeof import("./community-web/cloud_asset/search").searchCloudAssets;
|
|
102
108
|
searchCreationsByTag: typeof import("./community-web/creation/search/page").searchCreationsByTag;
|
|
103
109
|
sendEvent: typeof import("./community-web/event").sendEvent;
|
|
110
|
+
setUserProductStatus: typeof import("./community-web/user_package/status").setUserProductStatus;
|
|
104
111
|
submitCreation: typeof import("./community-web/creation/submit").submitCreation;
|
|
105
112
|
topComment: typeof import("./community-web/study-community/comment/top").topComment;
|
|
106
113
|
updateCreation: typeof import("./community-web/creation/update").updateCreation;
|
|
114
|
+
updateGreatCreation: typeof import("./community-web/great_creation/update").updateGreatCreation;
|
|
107
115
|
updateStudent: typeof import("./community-web/students/update").updateStudent;
|
|
108
116
|
viewCreationStats: typeof import("./community-web/creation_stats/view").viewCreationStats;
|
|
109
117
|
};
|
|
@@ -111,11 +119,21 @@ declare const _default: {
|
|
|
111
119
|
getCurrentTimestamp: typeof import("./gandi-main/timestamp/current").getCurrentTimestamp;
|
|
112
120
|
getBulletinsPage: typeof import("./gandi-main/bulletins/page").getBulletinsPage;
|
|
113
121
|
getBulletinDetail: typeof import("./gandi-main/bulletins/detail").getBulletinDetail;
|
|
122
|
+
submitLeaderboardRecord: typeof import("./gandi-main/creation/leaderboards/{oid}/records").submitLeaderboardRecord;
|
|
123
|
+
getLeaderboardRecords: typeof import("./gandi-main/creation/leaderboards/{oid}/records").getLeaderboardRecords;
|
|
114
124
|
};
|
|
115
125
|
bfsWeb: {
|
|
116
126
|
donateExtension: typeof import("./bfs-web/extensions/{eid}/donate").donateExtension;
|
|
117
127
|
getUserExtensions: typeof import("./bfs-web/users/{oid}/extensions").getUserExtensions;
|
|
118
128
|
};
|
|
129
|
+
communityWebCloudDatabase: {
|
|
130
|
+
saveProjectCloudVariable: typeof import("./community-web-cloud-database/cloud_variable/save").saveProjectCloudVariable;
|
|
131
|
+
saveUserCloudVariable: typeof import("./community-web-cloud-database/cloud_variable/save").saveUserCloudVariable;
|
|
132
|
+
};
|
|
133
|
+
opParentApi: {
|
|
134
|
+
createCaptcha: typeof import("./op-parent-api/captcha/create").createCaptcha;
|
|
135
|
+
checkCaptcha: typeof import("./op-parent-api/captcha/check").checkCaptcha;
|
|
136
|
+
};
|
|
119
137
|
};
|
|
120
138
|
export default _default;
|
|
121
139
|
export type * from "./types";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const url = "https://op-parent-api.xiguacity.cn/captcha/check";
|
|
2
|
+
export type Req = {
|
|
3
|
+
data: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
token: string;
|
|
8
|
+
};
|
|
9
|
+
export type Res = {
|
|
10
|
+
captchaExpired: boolean;
|
|
11
|
+
errorMsg: string | null;
|
|
12
|
+
success: boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 校验图形验证码(拼图滑块坐标)
|
|
16
|
+
* @param {string} token createCaptcha 返回的 token
|
|
17
|
+
* @param {number} x 拼图滑块目标位置的 x 坐标
|
|
18
|
+
* @param {number} y 拼图滑块目标位置的 y 坐标
|
|
19
|
+
* @returns {Promise<Res>} 校验结果
|
|
20
|
+
*/
|
|
21
|
+
export declare function checkCaptcha(token: string, x: number, y?: number): Promise<Res>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const url = "https://op-parent-api.xiguacity.cn/captcha/create";
|
|
2
|
+
export type CaptchaType = "BLOCK_PUZZLE";
|
|
3
|
+
export type Req = {
|
|
4
|
+
type: CaptchaType;
|
|
5
|
+
};
|
|
6
|
+
export type Res = {
|
|
7
|
+
data: {
|
|
8
|
+
/**
|
|
9
|
+
* data url
|
|
10
|
+
*/
|
|
11
|
+
bgImg: string;
|
|
12
|
+
/**
|
|
13
|
+
* data url
|
|
14
|
+
*/
|
|
15
|
+
jigsawImg: string;
|
|
16
|
+
};
|
|
17
|
+
token: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 创建图形验证码(拼图滑块)
|
|
21
|
+
* @param {CaptchaType} type 验证码类型,默认 BLOCK_PUZZLE(滑块拼图)
|
|
22
|
+
* @returns {Promise<Res>} 验证码信息:bgImg为背景图base64 data url,jigsawImg为拼图块base64 data url,token用于后续校验
|
|
23
|
+
*/
|
|
24
|
+
export declare function createCaptcha(type?: CaptchaType): Promise<Res>;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { loginByPassword } from "./web/auth/login-by-password";
|
|
2
2
|
import { logout } from "./web/auth/logout";
|
|
3
3
|
import { logoutBySession } from "./web/auth/logout_by_session";
|
|
4
|
+
import { createSmsCaptcha } from "./web/auth/assistant/captcha/v2/create";
|
|
5
|
+
import { loginByPhone } from "./web/auth/v3/login/by-phone";
|
|
4
6
|
export declare const sso: {
|
|
5
7
|
loginByPassword: typeof loginByPassword;
|
|
6
8
|
logout: typeof logout;
|
|
7
9
|
logoutBySession: typeof logoutBySession;
|
|
10
|
+
createSmsCaptcha: typeof createSmsCaptcha;
|
|
11
|
+
loginByPhone: typeof loginByPhone;
|
|
8
12
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const url = "https://sso.ccw.site/web/auth/assistant/captcha/v2/create";
|
|
2
|
+
export type SmsScene = "loginbyPhone";
|
|
3
|
+
export type SmsRuleCode = "ccw_sms";
|
|
4
|
+
export type CaptchaPayload = {
|
|
5
|
+
data: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
token: string;
|
|
10
|
+
};
|
|
11
|
+
export type Req = {
|
|
12
|
+
captcha?: CaptchaPayload;
|
|
13
|
+
countryCode: string;
|
|
14
|
+
recipient: string;
|
|
15
|
+
ruleCode: SmsRuleCode;
|
|
16
|
+
scene: SmsScene;
|
|
17
|
+
};
|
|
18
|
+
export type Res = {
|
|
19
|
+
batchId: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* sendResult=1 表示成功
|
|
22
|
+
*/
|
|
23
|
+
sendResult: 1 | 2;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* 发送短信验证码
|
|
27
|
+
* @param {string} recipient 接收手机号,如 "10011451919"
|
|
28
|
+
* @param {SmsScene} scene 场景,默认 loginbyPhone
|
|
29
|
+
* @param {string} countryCode 国家代码,默认 "86"
|
|
30
|
+
* @param {SmsRuleCode} ruleCode 短信规则编码,默认 "ccw_sms"
|
|
31
|
+
* @param {CaptchaPayload} captcha 图形验证码校验结果(滑块拼图的坐标与token),可选(部分场景未强制要求时可省略,但失败时sendResult!=1)
|
|
32
|
+
* @returns {Promise<Res>} 发送结果:batchId 为短信批次ID,sendResult=1 表示成功
|
|
33
|
+
*/
|
|
34
|
+
export declare function createSmsCaptcha(recipient: string, scene?: SmsScene, countryCode?: string, ruleCode?: SmsRuleCode, captcha?: CaptchaPayload): Promise<Res>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AccountTypes } from "src/types/account";
|
|
2
1
|
import { MongoDBId } from "src/types/api";
|
|
2
|
+
import { LoginSession } from "src/types/session";
|
|
3
3
|
export declare const url = "https://sso.ccw.site/web/auth/login-by-password";
|
|
4
4
|
export type Req = {
|
|
5
5
|
clientCode: "STUDY_COMMUNITY";
|
|
@@ -7,23 +7,7 @@ export type Req = {
|
|
|
7
7
|
loginKey: string;
|
|
8
8
|
password: string;
|
|
9
9
|
};
|
|
10
|
-
export type Res<Extra
|
|
11
|
-
accountId: -1;
|
|
12
|
-
accountObjectId: MongoDBId;
|
|
13
|
-
accountType: AccountTypes;
|
|
14
|
-
clientCode: "STUDY_COMMUNITY";
|
|
15
|
-
createdAt: number;
|
|
16
|
-
email: null;
|
|
17
|
-
expireTime: number;
|
|
18
|
-
extra: Extra;
|
|
19
|
-
id: number;
|
|
20
|
-
lastAccessTime: number;
|
|
21
|
-
orgId: "";
|
|
22
|
-
scene: null;
|
|
23
|
-
status: "ENABLED";
|
|
24
|
-
token: string;
|
|
25
|
-
urlEncodedFullName: null;
|
|
26
|
-
};
|
|
10
|
+
export type Res<Extra> = LoginSession<Extra>;
|
|
27
11
|
export type Extra = {
|
|
28
12
|
browser: string;
|
|
29
13
|
device: string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { MongoDBId } from "src/types/api";
|
|
2
|
+
import { LoginSession } from "src/types/session";
|
|
3
|
+
export declare const url = "https://sso.ccw.site/web/auth/v3/login/by_phone";
|
|
4
|
+
export type LoginClientCode = "STUDY_COMMUNITY";
|
|
5
|
+
export type LoginScene = "loginbyPhone";
|
|
6
|
+
export type LoginRuleCode = "ccw_sms";
|
|
7
|
+
export type Req = {
|
|
8
|
+
clientCode: LoginClientCode;
|
|
9
|
+
code: string;
|
|
10
|
+
countryCode: string;
|
|
11
|
+
extra: string;
|
|
12
|
+
phone: string;
|
|
13
|
+
ruleCode: LoginRuleCode;
|
|
14
|
+
scene: LoginScene;
|
|
15
|
+
};
|
|
16
|
+
export type Res<Extra> = LoginSession<Extra>;
|
|
17
|
+
export type Extra = {
|
|
18
|
+
browser: string;
|
|
19
|
+
device: string;
|
|
20
|
+
ip: string;
|
|
21
|
+
loginParentOid: MongoDBId;
|
|
22
|
+
loginType: "BY_PHONE_LOGIN_OR_REGISTER";
|
|
23
|
+
};
|
|
24
|
+
export interface ReqExtra {
|
|
25
|
+
browser: string;
|
|
26
|
+
device: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 通过手机号+短信验证码登录(V3)
|
|
30
|
+
* @param {string} phone 手机号,如 "12345671145"
|
|
31
|
+
* @param {string} code 收到的短信验证码
|
|
32
|
+
* @param {ReqExtra} reqExtra 设备和浏览器信息
|
|
33
|
+
* @param {string} countryCode 国家代码,默认 "86"
|
|
34
|
+
* @param {LoginRuleCode} ruleCode 短信规则编码,默认 "ccw_sms"
|
|
35
|
+
* @param {LoginScene} scene 登录场景,默认 "loginbyPhone"
|
|
36
|
+
* @returns {Promise<Res<Extra>>} session 信息
|
|
37
|
+
*/
|
|
38
|
+
export declare function loginByPhone(phone: string, code: string, reqExtra?: ReqExtra, countryCode?: string, ruleCode?: LoginRuleCode, scene?: LoginScene): Promise<Res<Extra>>;
|