@seayoo-web/gamer-api 1.0.0 → 1.0.3
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 +68 -5
- package/dist/index.js +1543 -27
- package/package.json +7 -17
- package/types/index.d.ts +5 -29
- package/types/src/club.d.ts +153 -34
- package/types/src/club.define.d.ts +271 -0
- package/types/src/club.enums.d.ts +48 -0
- package/types/src/club.guards.d.ts +34 -66
- package/types/src/community.d.ts +258 -0
- package/types/src/community.define.d.ts +231 -0
- package/types/src/community.enums.d.ts +54 -0
- package/types/src/community.guards.d.ts +73 -0
- package/types/src/event.config.d.ts +10 -12
- package/types/src/event.d.ts +95 -21
- package/types/src/event.define.d.ts +295 -0
- package/types/src/event.enums.d.ts +169 -0
- package/types/src/event.guards.d.ts +37 -0
- package/types/src/token.d.ts +82 -0
- package/types/src/token.define.d.ts +29 -0
- package/types/src/token.guards.d.ts +5 -0
- package/types/src/utils.d.ts +4 -8
- package/types/src/weixin.d.ts +83 -0
- package/types/src/weixin.define.d.ts +41 -0
- package/types/src/weixin.guards.d.ts +1 -12
- package/dist/event-CXcuEQsA.js +0 -648
- package/dist/wx.js +0 -119
- package/types/src/base.d.ts +0 -64
- package/types/src/event.other.d.ts +0 -151
- package/types/src/wexin.d.ts +0 -48
- package/types/wx.d.ts +0 -36
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Antispam, Forum, Post, Topic, Comment, Reply, Notification } from "./community.define";
|
|
2
|
+
export declare function isGetForumsResponse(data: unknown): data is {
|
|
3
|
+
forums: Forum[];
|
|
4
|
+
};
|
|
5
|
+
export declare function isGetTopicsResponse(data: unknown): data is {
|
|
6
|
+
topics: Topic[];
|
|
7
|
+
};
|
|
8
|
+
export declare function isGetTopicResponse(data: unknown): data is {
|
|
9
|
+
topic: Topic;
|
|
10
|
+
};
|
|
11
|
+
export interface PostListWithToken {
|
|
12
|
+
posts: Post[];
|
|
13
|
+
next_token: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function isGetPostsResponse(data: unknown): data is PostListWithToken;
|
|
16
|
+
export declare function isGetPostResponse(data: unknown): data is {
|
|
17
|
+
post: Post;
|
|
18
|
+
};
|
|
19
|
+
export declare function isCreatePostResponse(data: unknown): data is {
|
|
20
|
+
/** 帖子信息 */
|
|
21
|
+
post?: Post;
|
|
22
|
+
/** 安全检测信息 */
|
|
23
|
+
antispam?: Antispam;
|
|
24
|
+
};
|
|
25
|
+
export declare function isCommentResponse(data: unknown): data is {
|
|
26
|
+
comment: Comment;
|
|
27
|
+
};
|
|
28
|
+
export interface CommentListWithToken {
|
|
29
|
+
comments: Comment[];
|
|
30
|
+
next_token?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function isCommentListResponse(data: unknown): data is CommentListWithToken;
|
|
33
|
+
export declare function isCreateCommentResponse(data: unknown): data is {
|
|
34
|
+
/** 评论 */
|
|
35
|
+
comment?: Comment;
|
|
36
|
+
/** 安全检测信息 */
|
|
37
|
+
antispam?: Antispam;
|
|
38
|
+
};
|
|
39
|
+
export interface ReplyListWithToken {
|
|
40
|
+
replies: Reply[];
|
|
41
|
+
next_token?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function isRelyListResponse(data: unknown): data is ReplyListWithToken;
|
|
44
|
+
export declare function isRelyResponse(data: unknown): data is {
|
|
45
|
+
reply: Reply;
|
|
46
|
+
};
|
|
47
|
+
export declare function isCreateReplyResponse(data: unknown): data is {
|
|
48
|
+
reply?: Reply;
|
|
49
|
+
antispam?: Antispam;
|
|
50
|
+
};
|
|
51
|
+
export declare function isGetPresignUrlResponse(data: unknown): data is {
|
|
52
|
+
/** 资源文件的真实地址 */
|
|
53
|
+
image_url: string;
|
|
54
|
+
/** 媒体文件临时上传地址(有效期 5min) */
|
|
55
|
+
upload_url: string;
|
|
56
|
+
/** 媒体文件是否已存在,已存在无需上传 */
|
|
57
|
+
existed: boolean;
|
|
58
|
+
};
|
|
59
|
+
export declare function isNotification(data: unknown): data is Notification;
|
|
60
|
+
export declare function isNotificationListWithToken(data: unknown): data is {
|
|
61
|
+
/** 通知列表 */
|
|
62
|
+
notifications: Notification[];
|
|
63
|
+
/** 分页标识,返回空表示后续没有数据了 */
|
|
64
|
+
next_token?: string;
|
|
65
|
+
};
|
|
66
|
+
export declare function isUnreadNotificationsCountResponse(data: unknown): data is {
|
|
67
|
+
/** 系统通知未读数量 */
|
|
68
|
+
system: number;
|
|
69
|
+
/** 评论我的通知未读数量 */
|
|
70
|
+
comment: number;
|
|
71
|
+
/** 收到的赞通知未读数量 */
|
|
72
|
+
like: number;
|
|
73
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export type EFeatureType = "preregister" | "lottery" | "survey" | "invite" | "share" | "follow" | "weixin_subscribe" | "comment" | "vote" | "cashback" | "gift_code" | "register" | "invited_register" | "claim_rewards" | "quest" | "team" | "lottery_draw";
|
|
3
|
-
export type EQuestObjective = "player_active_points" | "player_login_days" | "order_total_amount" | "community_posts" | "community_comments";
|
|
1
|
+
import { type GamerItemType, EngageAccountType, EventPeriodType, FeatureType, QuestObjective, VoteOptionSource } from "./event.enums";
|
|
4
2
|
export interface EventConfig {
|
|
5
3
|
/** 活动名称 */
|
|
6
4
|
event_name: string;
|
|
@@ -16,7 +14,7 @@ export interface EventConfig {
|
|
|
16
14
|
features: EventFeatureConfig[];
|
|
17
15
|
}
|
|
18
16
|
export declare function isEventConfig(data: unknown): data is EventConfig;
|
|
19
|
-
type EventFeatureConfig = EventFeatureBaseConfig<
|
|
17
|
+
type EventFeatureConfig = EventFeatureBaseConfig<FeatureType.Preregister, NoopFeatureConfig> | EventFeatureBaseConfig<FeatureType.Lottery, FeatureLotteryConfig> | EventFeatureBaseConfig<FeatureType.Survey, FeatureSurveyConfig> | EventFeatureBaseConfig<FeatureType.Invite, FeatureInviteConfig> | EventFeatureBaseConfig<FeatureType.Share, FeatureShareConfig> | EventFeatureBaseConfig<FeatureType.Follow, FeatureFollowConfig> | EventFeatureBaseConfig<FeatureType.Subscribe, FeatureSubscribeConfig> | EventFeatureBaseConfig<FeatureType.Comment, FeatureCommentConfig> | EventFeatureBaseConfig<FeatureType.Vote, FeatureVoteConfig> | EventFeatureBaseConfig<FeatureType.Cashback, FeatureCashbackConfig> | EventFeatureBaseConfig<FeatureType.GiftCode, FeatureGiftCodeConfig> | EventFeatureBaseConfig<FeatureType.Register, NoopFeatureConfig> | EventFeatureBaseConfig<FeatureType.InvitedRegister, NoopFeatureConfig> | EventFeatureBaseConfig<FeatureType.ClaimRewards, NoopFeatureConfig> | EventFeatureBaseConfig<FeatureType.Quest, FeatureQuestConfig> | EventFeatureBaseConfig<FeatureType.Team, FeatureTeamConfig> | EventFeatureBaseConfig<FeatureType.LotteryDraw, FeatureLotteryDrawConfig>;
|
|
20
18
|
interface EventRewardItemConfig {
|
|
21
19
|
/** 玩法奖励道具 id */
|
|
22
20
|
reward_item_id: number;
|
|
@@ -29,7 +27,7 @@ interface EventRewardItemConfig {
|
|
|
29
27
|
/** 玩法奖励道具描述 */
|
|
30
28
|
reward_item_desc?: string;
|
|
31
29
|
/** 玩法奖励道具类型 */
|
|
32
|
-
reward_item_type:
|
|
30
|
+
reward_item_type: Exclude<GamerItemType, GamerItemType.GiftCode | GamerItemType.LotteryTicket>;
|
|
33
31
|
}
|
|
34
32
|
type FeatureReward = {
|
|
35
33
|
feature_reward_type: "every";
|
|
@@ -42,7 +40,7 @@ type FeatureReward = {
|
|
|
42
40
|
}[];
|
|
43
41
|
};
|
|
44
42
|
export type NoopFeatureConfig = {} | null;
|
|
45
|
-
interface EventFeatureBaseConfig<T extends
|
|
43
|
+
interface EventFeatureBaseConfig<T extends FeatureType = FeatureType, C extends object | null = object> {
|
|
46
44
|
/** 玩法名称 */
|
|
47
45
|
feature_name: string;
|
|
48
46
|
/** 玩法 Id */
|
|
@@ -54,15 +52,15 @@ interface EventFeatureBaseConfig<T extends EFeatureType = EFeatureType, C extend
|
|
|
54
52
|
/** 玩法配置 */
|
|
55
53
|
config: C;
|
|
56
54
|
/** 玩法周期,即每多长时间可参与一次 */
|
|
57
|
-
cycle:
|
|
55
|
+
cycle: EventPeriodType;
|
|
58
56
|
/** 允许的最大参与次数 */
|
|
59
57
|
limit: number;
|
|
60
58
|
/** 玩法开始时间 */
|
|
61
59
|
since: number;
|
|
62
60
|
/** 玩法结束时间 */
|
|
63
61
|
until: number;
|
|
64
|
-
/** 参与玩法维度账号类型
|
|
65
|
-
engage_account_type:
|
|
62
|
+
/** 参与玩法维度账号类型 */
|
|
63
|
+
engage_account_type: EngageAccountType;
|
|
66
64
|
/** 玩法参与奖励 */
|
|
67
65
|
feature_rewards: FeatureReward;
|
|
68
66
|
}
|
|
@@ -72,7 +70,7 @@ interface FeatureLotteryItemConfig {
|
|
|
72
70
|
/** 抽奖奖励道具名称 */
|
|
73
71
|
reward_item_name: string;
|
|
74
72
|
/** 抽奖奖励道具类型 */
|
|
75
|
-
reward_item_type: Exclude<
|
|
73
|
+
reward_item_type: Exclude<GamerItemType, GamerItemType.GiftCode | GamerItemType.LotteryTicket>;
|
|
76
74
|
/** 抽奖奖励道具图片地址 */
|
|
77
75
|
reward_item_icon_url: string;
|
|
78
76
|
/** 抽奖奖励道具描述 */
|
|
@@ -148,7 +146,7 @@ interface FeatureVoteConfig {
|
|
|
148
146
|
/** 入围数量 */
|
|
149
147
|
finalists_amount: number;
|
|
150
148
|
/** 选项来源 */
|
|
151
|
-
source:
|
|
149
|
+
source: VoteOptionSource;
|
|
152
150
|
/** 投票选项配置 */
|
|
153
151
|
options: FeatureVoteOption[];
|
|
154
152
|
/** 投票入围后用户可获得的奖励 */
|
|
@@ -202,7 +200,7 @@ interface EventGiftItemConfig {
|
|
|
202
200
|
}
|
|
203
201
|
interface FeatureQuestConfig {
|
|
204
202
|
/** 任务目标 */
|
|
205
|
-
objective:
|
|
203
|
+
objective: QuestObjective;
|
|
206
204
|
/** 目标值 */
|
|
207
205
|
completion_value: number;
|
|
208
206
|
/** 团队任务配置 */
|
package/types/src/event.d.ts
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { EngagementInfo } from "./event.define";
|
|
2
|
+
import type { GamerItemType, RewardSoure } from "./event.enums";
|
|
3
|
+
import type { AuthToken } from "./token";
|
|
4
|
+
import type { RequestInteralError } from "@seayoo-web/request";
|
|
5
|
+
export type { EventConfig } from "./event.config";
|
|
6
|
+
export * from "./event.define";
|
|
7
|
+
export * from "./event.enums";
|
|
3
8
|
/** EventApi */
|
|
4
9
|
export declare class EventApi {
|
|
5
|
-
private
|
|
6
|
-
private autoLogin;
|
|
10
|
+
private token;
|
|
7
11
|
private event;
|
|
12
|
+
private req;
|
|
13
|
+
constructor(authToken: AuthToken, eventId: number);
|
|
8
14
|
/**
|
|
9
|
-
*
|
|
15
|
+
* 根据手机号白名单,检查手机号是否允许登录某个游戏
|
|
10
16
|
*
|
|
11
|
-
*
|
|
12
|
-
* @param autoLogin - 自动登录函数,由上层组件提供
|
|
13
|
-
*/
|
|
14
|
-
constructor(baseRequest: ReturnType<NetRequestFactory>, autoLogin: AutoLoginHandler);
|
|
15
|
-
/**
|
|
16
|
-
* 设置 Event Id,以供后续 api 请求中使用
|
|
17
|
+
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OWGSPF3Ysl
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
verifyMobileAllowed(mobile: string): Promise<import("./event.define").VerifyMobileResult | null>;
|
|
19
20
|
/**
|
|
20
21
|
* 获取运营活动的基础配置信息
|
|
21
22
|
*
|
|
22
23
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=wFXxtdNKPm
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
+
getConfig(): Promise<import("./event.config").EventConfig | null>;
|
|
25
26
|
/**
|
|
26
27
|
* 获取某个玩法参与用户数量
|
|
27
28
|
*
|
|
@@ -39,13 +40,13 @@ export declare class EventApi {
|
|
|
39
40
|
*
|
|
40
41
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=THtZ4ewIQW
|
|
41
42
|
*/
|
|
42
|
-
getEngagements(featureId: number): Promise<import("./event.
|
|
43
|
+
getEngagements(featureId: number): Promise<import("./event.define").CommentEngagement[] | import("./event.define").TeamEngagement[]>;
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
+
* 用户访问某个活动或玩法
|
|
45
46
|
*
|
|
46
47
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=DWtJrnrBCn
|
|
47
48
|
*/
|
|
48
|
-
|
|
49
|
+
visit(option?: {
|
|
49
50
|
feature_id?: number;
|
|
50
51
|
server_id?: string;
|
|
51
52
|
role_id?: string;
|
|
@@ -55,19 +56,86 @@ export declare class EventApi {
|
|
|
55
56
|
invited_by?: string;
|
|
56
57
|
}): Promise<{
|
|
57
58
|
first_visit: boolean;
|
|
58
|
-
} |
|
|
59
|
+
} | {
|
|
60
|
+
error: RequestInteralError | "event_not_found" | "feature_not_found" | "invalid_server_id" | "invalid_role_id";
|
|
61
|
+
}>;
|
|
59
62
|
/**
|
|
60
63
|
* 获取用户在目标活动下的所有玩法的参与状态,用于前端进一步确定如何执行交互逻辑
|
|
61
64
|
*
|
|
65
|
+
* 💡活动下包含 engage_account_type 为 role_id 的玩法时,前端需要提供 server_id 和 role_id
|
|
66
|
+
*
|
|
62
67
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=WzX5BrMNpL
|
|
63
68
|
*/
|
|
64
|
-
getUserFeatureStatus(
|
|
69
|
+
getUserFeatureStatus(option?: {
|
|
70
|
+
server_id: string;
|
|
71
|
+
role_id: string;
|
|
72
|
+
}): Promise<import("./event.define").UserFeatureStatus[]>;
|
|
65
73
|
/**
|
|
66
74
|
* 获取当前登录用户参与某个玩法的记录
|
|
67
75
|
*
|
|
68
76
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=WSbAeDZc8F
|
|
69
77
|
*/
|
|
70
|
-
getUserEngagements(featureId: number): Promise<import("./event.
|
|
78
|
+
getUserEngagements(featureId: number): Promise<import("./event.define").UserEngagement[]>;
|
|
79
|
+
/**
|
|
80
|
+
* 用户参与某个玩法(需要先调用 visit 接口)
|
|
81
|
+
*
|
|
82
|
+
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=vuOyrcry3S
|
|
83
|
+
*/
|
|
84
|
+
engage(option: {
|
|
85
|
+
/** 活动玩法 ID */
|
|
86
|
+
feature_id: number;
|
|
87
|
+
/** 用户参数数据 */
|
|
88
|
+
engagement: EngagementInfo;
|
|
89
|
+
/**
|
|
90
|
+
* 联的游戏账号 ID,如果传该参数后端需验证 player_id 是否从属于当前用户。
|
|
91
|
+
*
|
|
92
|
+
* 参考 club 模块的 getPlayers 方法
|
|
93
|
+
*/
|
|
94
|
+
player_id?: string;
|
|
95
|
+
server_id?: string;
|
|
96
|
+
server_name?: string;
|
|
97
|
+
role_id?: string;
|
|
98
|
+
role_name?: string;
|
|
99
|
+
}): Promise<import("./event.define").EngageResponse | {
|
|
100
|
+
error: RequestInteralError | "event_not_found" | "feature_not_found" | "invalid_weixin_appid" | "invalid_weixin_openid" | "event_not_started" | "event_already_ended" | "engage_feature_reached_limit" | "comment_too_frequently" | "lottery_reward_is_empty" | "invalid_merchant_parameter" | "budget_not_enough" | "combo_id_not_found" | "query_user_order_total_amount_err" | "unique_gift_code_is_empty" | "player_created_at_out_of_range" | "user_had_joined_a_team" | "team_is_full" | "disband_team_not_allowed" | "change_team_visibility_not_allowed" | "team_not_found" | "join_team_conflict" | "team_has_been_disbanded" | "exceeded_assembled_team_limit" | "invalid_engage_lottery_draw_ticket" | "lottery_ticket_not_found" | "draw_lottery_ticket_not_start" | "draw_lottery_ticket_is_ended";
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* 用户领取除红包和实物奖励以外的所有奖励
|
|
104
|
+
*
|
|
105
|
+
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=lCGuqgvUDP
|
|
106
|
+
*/
|
|
107
|
+
claimRewards(option: {
|
|
108
|
+
/** 用户参与记录 ID */
|
|
109
|
+
engagement_id: number;
|
|
110
|
+
/** 产生奖励的来源 */
|
|
111
|
+
reward_source: RewardSoure;
|
|
112
|
+
server_id?: string;
|
|
113
|
+
role_id?: string;
|
|
114
|
+
role_name?: string;
|
|
115
|
+
}): Promise<import("./event.define").ClaimedItem[] | {
|
|
116
|
+
error: RequestInteralError | "invalid_server_id" | "invalid_role_id" | "event_not_found" | "engagement_not_found" | "event_not_started" | "event_already_ended" | "claim_rewards_not_started" | "claim_rewards_already_ended" | "no_rewards_to_claim" | "reward_received" | "claim_reward_error";
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* 用户领取红包奖励
|
|
120
|
+
*
|
|
121
|
+
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=aQLhlOAB4Q
|
|
122
|
+
*/
|
|
123
|
+
claimWeixinHongbao(rewardId: number): Promise<{
|
|
124
|
+
reward_status: import("./event.enums").CliamRewardStatus;
|
|
125
|
+
} | {
|
|
126
|
+
error: RequestInteralError | "invalid_weixin_openid" | "event_not_started" | "event_already_ended" | "no_rewards_to_claim" | "reward_received" | "invalid_merchant_parameter" | "budget_not_enough";
|
|
127
|
+
}>;
|
|
128
|
+
/**
|
|
129
|
+
* 查询用户活动奖励列表
|
|
130
|
+
*
|
|
131
|
+
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=qj12eIgYQG
|
|
132
|
+
*/
|
|
133
|
+
getUserRewards(option: {
|
|
134
|
+
/** 活动玩法 ID */
|
|
135
|
+
feature_id?: number;
|
|
136
|
+
/** 奖励类型 */
|
|
137
|
+
reward_types?: Exclude<GamerItemType, GamerItemType.VoidItem>[];
|
|
138
|
+
}): Promise<import("./event.define").UserReward[]>;
|
|
71
139
|
/**
|
|
72
140
|
* 查询用户活动道具数量。注意,这里只能是活动道具
|
|
73
141
|
*
|
|
@@ -80,15 +148,21 @@ export declare class EventApi {
|
|
|
80
148
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=QIwGhnaexb
|
|
81
149
|
*/
|
|
82
150
|
submitUserRewardAddress(option: {
|
|
151
|
+
/** 用户奖励记录 id */
|
|
83
152
|
reward_id: number;
|
|
84
153
|
/** ⚠️ 用户收货地址 id,后续会删除 */
|
|
85
154
|
address_id?: number;
|
|
86
|
-
/**
|
|
155
|
+
/** 收件人称呼 */
|
|
87
156
|
recipient: string;
|
|
157
|
+
/** 收件人手机号 */
|
|
88
158
|
mobile: string;
|
|
159
|
+
/** 收件地址所在省 */
|
|
89
160
|
province: string;
|
|
161
|
+
/** 收件地址所在市 */
|
|
90
162
|
city: string;
|
|
163
|
+
/** 收件地址所在街道 */
|
|
91
164
|
district: string;
|
|
165
|
+
/** 详细收货地址 */
|
|
92
166
|
address: string;
|
|
93
167
|
}): Promise<boolean | null>;
|
|
94
168
|
/**
|
|
@@ -108,7 +182,7 @@ export declare class EventApi {
|
|
|
108
182
|
*/
|
|
109
183
|
getParamsByQrcodeScene(scene: string): Promise<string | null>;
|
|
110
184
|
/**
|
|
111
|
-
*
|
|
185
|
+
* 生成不限制的带参数的小程序码(data URI格式的小程序码)
|
|
112
186
|
*
|
|
113
187
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=Rvmoq8iIy0
|
|
114
188
|
*/
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import type { CliamRewardStatus, FeatureType, GamerItemType, LotteryDrawAction, LotteryTicketStatus, QuestObjective, RewardSoure, RewardStatusPrefix, RewardStatusSuffix, TeamAction, TeamVisibility } from "./event.enums";
|
|
2
|
+
export interface VerifyMobileResult {
|
|
3
|
+
/** 手机号是否允许登录此游戏(游戏 ID 由 Request Header 的 Origin 或 Referer 决定) */
|
|
4
|
+
allowed: boolean;
|
|
5
|
+
/** 手机号是否已注册世游通行证 */
|
|
6
|
+
registered: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface CommentEngagement {
|
|
9
|
+
/** 用户世游通行证 ID */
|
|
10
|
+
user_id: string;
|
|
11
|
+
/** 用户昵称 */
|
|
12
|
+
name: string;
|
|
13
|
+
/** 用户头像地址 */
|
|
14
|
+
avatar_url: string;
|
|
15
|
+
/** 评论信息 */
|
|
16
|
+
comment: string;
|
|
17
|
+
/** 用户发布弹幕的视频点 */
|
|
18
|
+
video_note: number;
|
|
19
|
+
/** 用户发布弹幕的时间 */
|
|
20
|
+
created_at: number;
|
|
21
|
+
}
|
|
22
|
+
export interface TeamEngagement {
|
|
23
|
+
/** 组队码 */
|
|
24
|
+
team_code: string;
|
|
25
|
+
/** 队长角色名称 */
|
|
26
|
+
leader_name: string;
|
|
27
|
+
/** 队员数量 */
|
|
28
|
+
total_members: number;
|
|
29
|
+
}
|
|
30
|
+
export interface UserFeatureStatus {
|
|
31
|
+
/** 玩法 ID */
|
|
32
|
+
feature_id: number;
|
|
33
|
+
/**
|
|
34
|
+
* 是否可参与玩法。false 代表当前已不可再参与。
|
|
35
|
+
*
|
|
36
|
+
* 💡注意这里的语义是已经达到了参与次数的上限,不能再调用 engage,而不是没有资格参与。
|
|
37
|
+
*/
|
|
38
|
+
can_engage: boolean;
|
|
39
|
+
/** 是否有已获得但尚未领取的玩法参与奖励 */
|
|
40
|
+
has_unclaimed_rewards: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface UserEngagement {
|
|
43
|
+
/** 参与记录 ID */
|
|
44
|
+
engagement_id: number;
|
|
45
|
+
/** 玩法参与次数 */
|
|
46
|
+
sequence: number;
|
|
47
|
+
/** 玩法 ID */
|
|
48
|
+
feature_id: number;
|
|
49
|
+
/** 奖励 ID */
|
|
50
|
+
reward_id: number;
|
|
51
|
+
/** 奖励状态 */
|
|
52
|
+
reward_status: RewardStatusPrefix;
|
|
53
|
+
/** 奖励来源 */
|
|
54
|
+
reward_source: RewardSoure;
|
|
55
|
+
/** 附带的数据,由 feature_id 的类型决定 */
|
|
56
|
+
data?: PreregisterEngagementData | LotteryEngagementData | SurveyEngagementData | InviteEngagementData | ShareEngagementData | VoteEngagementData | WeixinSubscribeEngagementData | CashbackEngagementData | GiftCodeEngagementData | TeamEngagementData | QuestEngagementData | LotteryDrawEngagementData;
|
|
57
|
+
server_id?: string;
|
|
58
|
+
role_id?: string;
|
|
59
|
+
created_at: number;
|
|
60
|
+
}
|
|
61
|
+
export interface PreregisterEngagementData {
|
|
62
|
+
/** 用户预约平台 */
|
|
63
|
+
platforms: string[];
|
|
64
|
+
}
|
|
65
|
+
export interface LotteryEngagementData {
|
|
66
|
+
/** 用户抽奖次数 */
|
|
67
|
+
lottery_count: number;
|
|
68
|
+
}
|
|
69
|
+
export interface SurveyEngagementData {
|
|
70
|
+
/** 用户填写问卷流水号 */
|
|
71
|
+
serial_number: number;
|
|
72
|
+
}
|
|
73
|
+
export interface InviteEngagementData {
|
|
74
|
+
/** 被邀请人的世游通行证 ID */
|
|
75
|
+
user_id: string;
|
|
76
|
+
/** 被邀请人昵称 */
|
|
77
|
+
name?: string;
|
|
78
|
+
/** 被邀请人头像地址 */
|
|
79
|
+
avatar_url?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ShareEngagementData {
|
|
82
|
+
/** 用户分享到对应的平台 */
|
|
83
|
+
platform: string;
|
|
84
|
+
}
|
|
85
|
+
export interface VoteEngagementData {
|
|
86
|
+
/** 用户投票选项 */
|
|
87
|
+
option_sn: string;
|
|
88
|
+
}
|
|
89
|
+
export interface WeixinSubscribeEngagementData {
|
|
90
|
+
weixin_openid: string;
|
|
91
|
+
}
|
|
92
|
+
export interface CashbackEngagementData {
|
|
93
|
+
/** 用户充值订单总金额(分) */
|
|
94
|
+
order_total_amount: `${number}` | number;
|
|
95
|
+
/** 充值返还的总金额(分) */
|
|
96
|
+
cashback_total_amount: `${number}` | number;
|
|
97
|
+
/** 充值返还的总金额所对应的游戏道具数量 */
|
|
98
|
+
game_item_count: `${number}` | number;
|
|
99
|
+
}
|
|
100
|
+
export interface GiftCodeEngagementData {
|
|
101
|
+
/** 礼包码 */
|
|
102
|
+
gift_code: string;
|
|
103
|
+
}
|
|
104
|
+
export interface TeamEngagementData {
|
|
105
|
+
/** 组队码 */
|
|
106
|
+
team_code: string;
|
|
107
|
+
/** 队伍可见性 */
|
|
108
|
+
visibility: TeamVisibility;
|
|
109
|
+
/** 队员信息 */
|
|
110
|
+
members: {
|
|
111
|
+
/** 是否为队长 */
|
|
112
|
+
is_leader: boolean;
|
|
113
|
+
/** 角色名 */
|
|
114
|
+
role_name: string;
|
|
115
|
+
/** 服务器名 */
|
|
116
|
+
server_name: string;
|
|
117
|
+
}[];
|
|
118
|
+
}
|
|
119
|
+
export interface QuestEngagementData {
|
|
120
|
+
/** 任务目标 */
|
|
121
|
+
objective: QuestObjective;
|
|
122
|
+
/** 个人任务进度值 */
|
|
123
|
+
progress: number;
|
|
124
|
+
/** 个人任务目标值 */
|
|
125
|
+
completion_value?: number;
|
|
126
|
+
/** 组队任务进度信息 */
|
|
127
|
+
team?: {
|
|
128
|
+
/** 进度值 */
|
|
129
|
+
progress: number;
|
|
130
|
+
/** 目标值 */
|
|
131
|
+
completion_value?: number;
|
|
132
|
+
/** 队伍信息 */
|
|
133
|
+
players: {
|
|
134
|
+
/** 用户 id,含当前用户 */
|
|
135
|
+
user_id: number;
|
|
136
|
+
/** 角色名 */
|
|
137
|
+
role_name: string;
|
|
138
|
+
/** 是否为队长 */
|
|
139
|
+
is_leader: boolean;
|
|
140
|
+
/** 进度值 */
|
|
141
|
+
progress?: number;
|
|
142
|
+
}[];
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
export interface LotteryDrawEngagementData {
|
|
146
|
+
tickets: ({
|
|
147
|
+
/** 抽奖券 */
|
|
148
|
+
ticket: string;
|
|
149
|
+
/** 抽奖券状态 */
|
|
150
|
+
status: LotteryTicketStatus.Unknown | LotteryTicketStatus.Pending;
|
|
151
|
+
} | {
|
|
152
|
+
/** 抽奖券 */
|
|
153
|
+
ticket: string;
|
|
154
|
+
/** 抽奖券状态 */
|
|
155
|
+
status: Exclude<LotteryTicketStatus, LotteryTicketStatus.Unknown | LotteryTicketStatus.Pending>;
|
|
156
|
+
/** 抽奖券奖励物品,status = drawn 时 reward_id = 0 */
|
|
157
|
+
reward: UserReward;
|
|
158
|
+
})[];
|
|
159
|
+
}
|
|
160
|
+
export interface UserReward {
|
|
161
|
+
/** 用户奖励记录 id */
|
|
162
|
+
reward_id: number;
|
|
163
|
+
/** 奖励道具 id */
|
|
164
|
+
reward_item_id: number;
|
|
165
|
+
/** 产生奖励的来源 */
|
|
166
|
+
reward_source: RewardSoure;
|
|
167
|
+
/** 奖励道具名称 */
|
|
168
|
+
reward_item_name: string;
|
|
169
|
+
/** 奖励道具类型 */
|
|
170
|
+
reward_item_type: GamerItemType;
|
|
171
|
+
/** 奖励道具图片地址 */
|
|
172
|
+
reward_item_icon_url: string;
|
|
173
|
+
/** 奖励道具描述 */
|
|
174
|
+
reward_item_desc?: string;
|
|
175
|
+
/** 奖励道具数量 */
|
|
176
|
+
reward_amount: number;
|
|
177
|
+
/** 奖励状态 */
|
|
178
|
+
reward_status: RewardStatusSuffix;
|
|
179
|
+
/** 活动 ID */
|
|
180
|
+
event_id: number;
|
|
181
|
+
/** 活动名称 */
|
|
182
|
+
event_name: string;
|
|
183
|
+
/** 活动玩法 ID */
|
|
184
|
+
feature_id: number;
|
|
185
|
+
/** 参与记录 ID */
|
|
186
|
+
engagement_id: number;
|
|
187
|
+
/** 玩法类型 */
|
|
188
|
+
feature_type: FeatureType;
|
|
189
|
+
/** 领奖时间 */
|
|
190
|
+
receive_time: number;
|
|
191
|
+
/** 提供额外扩展信息,比如收获地址等 */
|
|
192
|
+
extra_data?: Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
export type EngagementInfo = PreregisterEngagementInfo | LotteryEngagementInfo | CommentEngagementInfo | ShareEngagementInfo | VoteEngagementInfo | SubscribeEngagementInfo | TeamEngagementInfo | LotteryDrawEngagementInfo;
|
|
195
|
+
export interface PreregisterEngagementInfo {
|
|
196
|
+
/** 用户预约平台 */
|
|
197
|
+
platforms: string[];
|
|
198
|
+
}
|
|
199
|
+
export interface LotteryEngagementInfo {
|
|
200
|
+
/** 用户抽奖次数 */
|
|
201
|
+
lottery_count: number;
|
|
202
|
+
}
|
|
203
|
+
export interface CommentEngagementInfo {
|
|
204
|
+
/** 用户发送弹幕内容 */
|
|
205
|
+
comment: string;
|
|
206
|
+
/** 用户发布弹幕的视频点 */
|
|
207
|
+
video_note?: number;
|
|
208
|
+
}
|
|
209
|
+
export interface ShareEngagementInfo {
|
|
210
|
+
/** 用户分享到对应的平台 */
|
|
211
|
+
platform: string;
|
|
212
|
+
}
|
|
213
|
+
export interface VoteEngagementInfo {
|
|
214
|
+
/** 选项的 sn */
|
|
215
|
+
option_sn: string;
|
|
216
|
+
}
|
|
217
|
+
export interface SubscribeEngagementInfo {
|
|
218
|
+
/**
|
|
219
|
+
* 小程序调用 wx.requestSubscribeMessage 并收到 success 回调后,得到的订阅结果。
|
|
220
|
+
*
|
|
221
|
+
* - key 为模版 ID
|
|
222
|
+
*
|
|
223
|
+
* - value 为订阅结果。示例 accept reject ban filter
|
|
224
|
+
*/
|
|
225
|
+
subscribe_results: Record<string, string>;
|
|
226
|
+
}
|
|
227
|
+
export type TeamEngagementInfo = {
|
|
228
|
+
/** 操作类型 */
|
|
229
|
+
action: TeamAction.ChangeVisibility;
|
|
230
|
+
/** 组队码 */
|
|
231
|
+
team_code: string;
|
|
232
|
+
/** 设置队伍的可见性 */
|
|
233
|
+
visibility: TeamVisibility;
|
|
234
|
+
} | {
|
|
235
|
+
/** 操作类型 */
|
|
236
|
+
action: TeamAction.Assemble;
|
|
237
|
+
/** 设置队伍的可见性 */
|
|
238
|
+
visibility?: TeamVisibility;
|
|
239
|
+
} | {
|
|
240
|
+
action: TeamAction.Join | TeamAction.Disband;
|
|
241
|
+
/** 组队码 */
|
|
242
|
+
team_code: string;
|
|
243
|
+
} | {
|
|
244
|
+
/** 操作类型 */
|
|
245
|
+
action: TeamAction.Query;
|
|
246
|
+
/** 组队码 */
|
|
247
|
+
team_code?: string;
|
|
248
|
+
};
|
|
249
|
+
export type LotteryDrawEngagementInfo = {
|
|
250
|
+
/** 参与抽奖券的动作类型 */
|
|
251
|
+
action: Exclude<LotteryDrawAction, LotteryDrawAction.Claim>;
|
|
252
|
+
} | {
|
|
253
|
+
/** 参与抽奖券的动作类型 */
|
|
254
|
+
action: LotteryDrawAction.Claim;
|
|
255
|
+
/** 抽奖券 */
|
|
256
|
+
ticket: string;
|
|
257
|
+
};
|
|
258
|
+
export interface EngageReward {
|
|
259
|
+
/** 用户奖励记录 id(微信红包类型奖励需要前端请求一次领奖 api) */
|
|
260
|
+
reward_id: number;
|
|
261
|
+
/** 奖励道具 id */
|
|
262
|
+
reward_item_id: number;
|
|
263
|
+
/** 奖励道具名称 */
|
|
264
|
+
reward_item_name: string;
|
|
265
|
+
/** 奖励道具类型 */
|
|
266
|
+
reward_item_type: Exclude<GamerItemType, GamerItemType.GiftCode | GamerItemType.LotteryTicket>;
|
|
267
|
+
/** 奖励道具图片地址 */
|
|
268
|
+
reward_item_icon_url: string;
|
|
269
|
+
/** 奖励道具描述 */
|
|
270
|
+
reward_item_desc?: string;
|
|
271
|
+
/** 奖励道具数量 */
|
|
272
|
+
reward_amount: number;
|
|
273
|
+
/** 奖励状态 */
|
|
274
|
+
reward_status: RewardStatusSuffix;
|
|
275
|
+
/** 产生奖励的来源 */
|
|
276
|
+
reward_source: RewardSoure;
|
|
277
|
+
/** 提供额外扩展信息,例如:礼包码的值等 */
|
|
278
|
+
extra_data?: Record<string, unknown>;
|
|
279
|
+
}
|
|
280
|
+
export interface EngageResponse {
|
|
281
|
+
/** 当前参与记录 ID */
|
|
282
|
+
engagement_id: number;
|
|
283
|
+
/** 用户玩法参与记录 */
|
|
284
|
+
engagement?: UserEngagement;
|
|
285
|
+
/** 用户参与玩法得到的奖励 */
|
|
286
|
+
rewards?: EngageReward[];
|
|
287
|
+
/** 参与玩法后是否需要微信扫码 */
|
|
288
|
+
scan?: boolean;
|
|
289
|
+
}
|
|
290
|
+
export interface ClaimedItem {
|
|
291
|
+
/** 用户奖励记录 id */
|
|
292
|
+
reward_id: number;
|
|
293
|
+
/** 领取后的奖励状态 */
|
|
294
|
+
reward_status: CliamRewardStatus;
|
|
295
|
+
}
|