@seayoo-web/gamer-api 1.0.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/dist/wx.js ADDED
@@ -0,0 +1,119 @@
1
+ var a = Object.defineProperty;
2
+ var h = (n, i, e) => i in n ? a(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
+ var o = (n, i, e) => h(n, typeof i != "symbol" ? i + "" : i, e);
4
+ import { NetRequest as k } from "@seayoo-web/request/wx";
5
+ import { G as c, E as u, C as g, c as w, i as x } from "./event-CXcuEQsA.js";
6
+ import { isPlainObject as l } from "@seayoo-web/utils";
7
+ function m(n) {
8
+ return l(n, "openid", "unionid", "weixin_token");
9
+ }
10
+ class T {
11
+ /**
12
+ * 创建 WeixinApi 实例
13
+ *
14
+ * @param baseRequest - Gamer 通用的 request 工具实例,baseUrl 仅仅包含 endpoint + version
15
+ * @param autoLogin - 自动登录函数,由上层组件提供
16
+ */
17
+ constructor(i, e) {
18
+ o(this, "req");
19
+ o(this, "autoLogin");
20
+ this.req = i, this.autoLogin = e;
21
+ }
22
+ /**
23
+ * 微信静默登录,获取 weixinToken / openid / unionid,其中 weixinToken 应该被缓存
24
+ *
25
+ * 使用场景为:
26
+ *
27
+ * - 用户通过任意途径打开小程序的任意页面后,如果本地缓存中不存在微信用户身份信息,则自动调用此 API。
28
+ * - 调用成功后,应当使用存储能力将 response 中的微信用户身份信息缓存在本地。
29
+ *
30
+ * 小程序不应当频繁调用此 API。
31
+ *
32
+ * 由于小程序的存储是以用户维度隔离的,每个微信用户在每个小程序下只需要成功调用一次此 API。
33
+ *
34
+ * [API文档 weixin/login](https://kdocs.cn/l/cf2mO2uRLqh9?linkname=x17CeNlDQx)
35
+ *
36
+ * @param wxcode - 微信小程序调用 wx.login 获得的登录凭证
37
+ * @param appid - 微信小程序的 Appid,后端 api 可以从请求的 referer 中提取,后续会删除此参数
38
+ */
39
+ async login(i, e) {
40
+ const { data: t, code: s, message: r } = await this.req.post(
41
+ "weixin/login",
42
+ { code: i, appid: e },
43
+ m,
44
+ {
45
+ message: !1
46
+ }
47
+ );
48
+ return t ?? { error: s, message: r };
49
+ }
50
+ /**
51
+ * 关联游戏账号
52
+ *
53
+ * 用于从游戏内跳转至小程序时,将微信用户身份和游戏内身份关联起来,使得后续的企业微信客服流程能够知道该微信用户在游戏内的身份。
54
+ *
55
+ * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=ci73N833Mk
56
+ *
57
+ * @param weixinToken 调用 login 后,得到的 Weixin Token
58
+ * @param gameCode 从游戏内跳转至小程序时,通过请求参数 query 携带的 game_code
59
+ */
60
+ async linkPlayer(i, e) {
61
+ const { ok: t, code: s, message: r } = await this.req.post("weixin/link-player", {
62
+ weixin_token: i,
63
+ game_code: e
64
+ });
65
+ return t || { error: s, message: r };
66
+ }
67
+ }
68
+ class L extends c {
69
+ constructor(e, t) {
70
+ super(e, (t == null ? void 0 : t.version) || "v1", k);
71
+ o(this, "weixinToken", "");
72
+ /** event api 集合 */
73
+ o(this, "event");
74
+ /** club api 集合 */
75
+ o(this, "club");
76
+ /** weixin api 集合 */
77
+ o(this, "weixin");
78
+ const s = this.autoLogin.bind(this);
79
+ this.event = new u(this.req, s), this.club = new g(this.req, s), this.weixin = new T(this.req, s);
80
+ }
81
+ /**设置 Weixin Token,用于后续请求自动置换 Gamer Token */
82
+ setWeixinToken(e) {
83
+ return this.weixinToken !== e && (this.weixinToken = e, this.gamerToken = ""), this;
84
+ }
85
+ /** 读取设置 wexinToken */
86
+ getWexinToken() {
87
+ return this.weixinToken;
88
+ }
89
+ /**
90
+ * 用世游通行证统一登录能力签发的 idToken 和 weixinToken,自动置换 gamerToken,成功后会自动设置后续 Request Headers
91
+ *
92
+ * [世游通行证统一登录](https://kdocs.cn/l/cf2mO2uRLqh9?linkname=FJXYgqvLHs)
93
+ *
94
+ * [世游通行证统一登录 - 微信小程序](https://365.kdocs.cn/l/ccHVuUs0UsZs)
95
+ *
96
+ * - 此方法通常不需要手动调用,在需要登录的接口调用时会自动执行
97
+ * - 为了提高页面执行速度,可以在 setIdToken + setWeixinToken 后立即调用 autoLogin,比如
98
+ *
99
+ * @example
100
+ * ``` js
101
+ * gamerApi.setIdToken("xxxxx").setWeixinToken("yyyyyy").autoLogin()
102
+ * ```
103
+ */
104
+ async autoLogin() {
105
+ if (this.gamerToken)
106
+ return !0;
107
+ if (!this.weixinToken || !this.idToken)
108
+ return w.error("Missing idToken / weixinToken when call autoLogin()"), !1;
109
+ const { data: e } = await this.req.post(
110
+ "login-with-token",
111
+ { id_token: this.idToken, weixin_token: this.weixinToken },
112
+ x
113
+ );
114
+ return this.gamerToken = (e == null ? void 0 : e.gamer_token) || "", !!this.gamerToken;
115
+ }
116
+ }
117
+ export {
118
+ L as GamerApi
119
+ };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@seayoo-web/gamer-api",
3
+ "description": "agent for gamer api",
4
+ "version": "1.0.0",
5
+ "type": "module",
6
+ "source": "index.ts",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./types/index.d.ts",
10
+ "files": [
11
+ "dist",
12
+ "types",
13
+ "README.md"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "types": "./types/index.d.ts",
18
+ "import": "./dist/index.js",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "./wx": {
22
+ "types": "./types/wx.d.ts",
23
+ "import": "./dist/wx.js",
24
+ "default": "./dist/wx.js"
25
+ }
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "author": "web@seayoo.com",
34
+ "license": "MIT",
35
+ "devDependencies": {
36
+ "@types/node": "^22.13.1",
37
+ "@seayoo-web/request": "^2.0.8",
38
+ "@seayoo-web/tsconfig": "^1.0.2",
39
+ "@seayoo-web/utils": "^2.0.1"
40
+ },
41
+ "peerDependencies": {
42
+ "@seayoo-web/request": "^2.0.8",
43
+ "@seayoo-web/utils": "^2.0.1"
44
+ },
45
+ "scripts": {
46
+ "build": "vite build && tsc --emitDeclarationOnly",
47
+ "type-check": "tsc --noEmit",
48
+ "lint": "eslint ./src/**/*.ts",
49
+ "lint:fix": "eslint ./src/**/*.{ts,js} --fix",
50
+ "prepublish": "pnpm lint:fix && pnpm build"
51
+ }
52
+ }
@@ -0,0 +1,29 @@
1
+ import { GamerBaseApi } from "./src/base";
2
+ import { ClubApi } from "./src/club";
3
+ import { EventApi } from "./src/event";
4
+ export declare class GamerApi extends GamerBaseApi {
5
+ /** event api 集合 */
6
+ event: EventApi;
7
+ /** club api 集合 */
8
+ club: ClubApi;
9
+ constructor(endpoint: string, option?: {
10
+ version?: string;
11
+ eventId?: number;
12
+ });
13
+ /**
14
+ * 用世游通行证统一登录能力签发的 ID Token,自动置换 Gamer Token,成功后会自动设置后续 Request Headers
15
+ *
16
+ * [世游通行证统一登录](https://kdocs.cn/l/cf2mO2uRLqh9?linkname=FJXYgqvLHs)
17
+ *
18
+ * [世游通行证统一登录 - Web 站点](https://365.kdocs.cn/l/cf57sp1qLlZh)
19
+ *
20
+ * - 此方法通常不需要手动调用,在需要登录的接口调用时会自动执行
21
+ * - 为了提高页面执行速度,可以在 setIdToken 后立即调用 autoLogin,比如
22
+ *
23
+ * @example
24
+ * ``` js
25
+ * gamerApi.setIdToken("xxxxx").autoLogin()
26
+ * ```
27
+ */
28
+ autoLogin(): Promise<boolean>;
29
+ }
@@ -0,0 +1,64 @@
1
+ import type { NetRequestFactory } from "@seayoo-web/request";
2
+ /**
3
+ * [Gamer 系统架构](https://365.kdocs.cn/l/chWSTMvxyyCW?from=koa)
4
+ *
5
+ * [世游用户运营 api 服务](https://365.kdocs.cn/l/cf2mO2uRLqh9)
6
+ */
7
+ export declare abstract class GamerBaseApi {
8
+ protected idToken: string;
9
+ protected gamerToken: string;
10
+ protected req: ReturnType<NetRequestFactory>;
11
+ constructor(endpoint: string, version: string, request: NetRequestFactory);
12
+ /** 设置从登录组件获取的 Id Token,用于后续请求自动置换 Gamer Token */
13
+ setIdToken(idToken: string): this;
14
+ /** 读取已经设置的 idToken */
15
+ getIdToken(): string;
16
+ /** 读取自动置换的 gamerToken */
17
+ getGamerToken(): string;
18
+ /**
19
+ * 根据 ID Token / Weixin Token 自动置换 Gamer Token
20
+ *
21
+ * ⚠️ 此方法需要覆盖,根据不同的场景 token 做具体实现
22
+ *
23
+ * [世游通行证的统一登录机制](https://kdocs.cn/l/cf2mO2uRLqh9?linkname=FJXYgqvLHs)
24
+ */
25
+ abstract autoLogin(): Promise<boolean>;
26
+ /**
27
+ * 获取当前 Session 的信息
28
+ *
29
+ * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OdGVCdQxEu
30
+ */
31
+ getSession(): Promise<GamerSession | null>;
32
+ /**
33
+ * 根据手机号白名单,检查手机号是否允许登录某个游戏
34
+ *
35
+ * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OWGSPF3Ysl
36
+ */
37
+ verifyMobileAllowed(mobile: string): Promise<VerifyMobileResult | null>;
38
+ }
39
+ export declare function isGamerTokenResponse(data: unknown): data is {
40
+ gamer_token: string;
41
+ };
42
+ interface GamerSession {
43
+ /** 世游通行证 ID */
44
+ seayoo_user_id?: string;
45
+ /** 手机号码(掩码形式) */
46
+ seayoo_mobile?: string;
47
+ /** 世游通行证用户实名信息(掩码形式) */
48
+ seayoo_real_name?: string;
49
+ /** Combo ID */
50
+ combo_id?: string;
51
+ /**
52
+ * combo_id 背后的 IdP
53
+ *
54
+ * 取值参见 [Combo Client REST API 中的 idp](https://kdocs.cn/l/cg0cfHzazsta?linkname=ZVDdf1pe48),仅当 combo_id 有值时才有值
55
+ */
56
+ combo_idp?: string;
57
+ }
58
+ interface VerifyMobileResult {
59
+ /** 手机号是否允许登录此游戏(游戏 ID 由 Request Header 的 Origin 或 Referer 决定) */
60
+ allowed: boolean;
61
+ /** 手机号是否已注册世游通行证 */
62
+ registered: boolean;
63
+ }
64
+ export {};
@@ -0,0 +1,67 @@
1
+ import type { AutoLoginHandler } from "./utils";
2
+ import type { NetRequestFactory } from "@seayoo-web/request";
3
+ export declare class ClubApi {
4
+ private req;
5
+ private autoLogin;
6
+ /**
7
+ * 创建 ClubApi 实例
8
+ *
9
+ * @param baseRequest - Gamer 通用的 request 工具实例,baseUrl 仅仅包含 endpoint + version
10
+ * @param autoLogin - 自动登录函数,由上层组件提供
11
+ */
12
+ constructor(baseRequest: ReturnType<NetRequestFactory>, autoLogin: AutoLoginHandler);
13
+ /**
14
+ * 获取俱乐部配置
15
+ *
16
+ * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=tuhsPt3ihp
17
+ */
18
+ getClubConfig(): Promise<import("./club.guards").ClubGlobalConfig | null>;
19
+ /**
20
+ * 用于游戏内嵌 Web 页面获取当前登录的游戏账号在俱乐部中的信息
21
+ *
22
+ * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=hIDfaMlT7m
23
+ */
24
+ getCurrentPlayer(): Promise<import("./club.guards").ClubPlayer | null>;
25
+ /**
26
+ * 获取俱乐部当前关联的所有游戏账号
27
+ *
28
+ * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=yccPUuagkA
29
+ */
30
+ getPlayers(): Promise<import("./club.guards").ClubPlayer[] | null>;
31
+ /**
32
+ * 俱乐部关联游戏主账号。在俱乐部查询不到主游戏账号信息时,前端自行调用。
33
+ *
34
+ * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=SfGAm3mOyp
35
+ */
36
+ linkPrimaryPlayer(): Promise<import("./club.guards").ClubPlayer | null>;
37
+ /**
38
+ * 获取关联副游戏账号时所需的游戏服务器列表
39
+ *
40
+ * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=cBqJkplCAN
41
+ */
42
+ getSecondaryServers(): Promise<import("./club.guards").Server[]>;
43
+ /**
44
+ * 通过角色邮件,向游戏角色发送验证码,用于游戏外关联副游戏账号至俱乐部会员
45
+ *
46
+ * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=mG7yRPapRv
47
+ */
48
+ createLinkSecondaryPlayerOtp(serverId: string, roleId: string): Promise<string | null>;
49
+ /**
50
+ * 验证角色邮件收到的验证码
51
+ *
52
+ * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=BhEdxXC5E4
53
+ */
54
+ verifyLinkSecondaryPlayerOtp(ticket: string, otp: string): Promise<import("./club.guards").VerifyLinkSecondaryPlayerOtpResponse | null>;
55
+ /**
56
+ * 关联副游戏账号至俱乐部会员,适用于游戏外环境
57
+ *
58
+ * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=QNi2C2D0vO
59
+ */
60
+ linkSecondaryPlayerWithTicket(ticket: string): Promise<import("./club.guards").ClubPlayer | null>;
61
+ /**
62
+ * 关联副游戏账号至俱乐部会员,适用于游戏内嵌页环境
63
+ *
64
+ * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=QNi2C2D0vO
65
+ */
66
+ linkSecondaryPlayerWithIdToken(idToken: string): Promise<import("./club.guards").ClubPlayer | null>;
67
+ }
@@ -0,0 +1,75 @@
1
+ export interface ClubGlobalConfig {
2
+ /** 俱乐部默认头像地址 */
3
+ default_avatar_url: string;
4
+ /** 俱乐部官方头像库地址 */
5
+ official_avatar_urls: string[];
6
+ /** 俱乐部默认昵称 */
7
+ default_nickname: string;
8
+ /** 俱乐部默认签名 */
9
+ default_bio: string;
10
+ /** 俱乐部默认用户角色头像地址 */
11
+ default_role_avatar_url: string;
12
+ /** 俱乐部等级配置 */
13
+ level_configs: {
14
+ /** 俱乐部等级 */
15
+ level: number;
16
+ /** 等级对应的成长值 */
17
+ exp: number;
18
+ /** 俱乐部等级对应的称号 */
19
+ title: string;
20
+ }[];
21
+ /** 俱乐部等级有效期 */
22
+ level_valid_days: number;
23
+ /** 俱乐部权益描述 */
24
+ benefit_description: string;
25
+ /** 俱乐部成长值描述 */
26
+ exp_description: string;
27
+ /** 俱乐部积分规则描述 */
28
+ credit_description: string;
29
+ /** 发送角色邮件的频次限制,单位:秒 */
30
+ send_role_mail_rate_limit: number;
31
+ }
32
+ export declare function isClubConfigResponse(data: unknown): data is ClubGlobalConfig;
33
+ export interface ClubPlayer {
34
+ /** 俱乐部会员 ID(世游通行证 ID) */
35
+ member_id: string;
36
+ /** Combo ID */
37
+ player_id: string;
38
+ /** 游戏账号类型 */
39
+ type: "primary" | "secondary";
40
+ /** 成长值 */
41
+ exp: number;
42
+ /** 等级 */
43
+ level: number;
44
+ /** 用户积分余额 */
45
+ credit: number;
46
+ /** 月底即将过期积分数量 */
47
+ credit_expiring: number;
48
+ /** 等级变动时间 */
49
+ level_change_time: number;
50
+ /** 等级过期时间 */
51
+ level_expire_time: number;
52
+ }
53
+ export declare function isClubPlayerResponse(data: unknown): data is {
54
+ player: ClubPlayer;
55
+ };
56
+ export declare function isClubPlayersResponse(data: unknown): data is {
57
+ players: ClubPlayer[];
58
+ };
59
+ export interface Server {
60
+ server_id: string;
61
+ server_name: string;
62
+ }
63
+ export declare function isGetSecondaryServersResponse(data: unknown): data is {
64
+ servers: Server[];
65
+ };
66
+ export declare function isCreateLinkSecondaryPlayerOtpResponse(data: unknown): data is {
67
+ ticket: string;
68
+ };
69
+ export interface VerifyLinkSecondaryPlayerOtpResponse {
70
+ role_id: string;
71
+ role_name: string;
72
+ server_id: string;
73
+ server_name: string;
74
+ }
75
+ export declare function isVerifyLinkSecondaryPlayerOtpResponse(data: unknown): data is VerifyLinkSecondaryPlayerOtpResponse;
File without changes
File without changes
@@ -0,0 +1,228 @@
1
+ export type EGameItemType = "event_item" | "game_item" | "physical_item" | "weixin_hongbao" | "gift_code" | "lottery_ticket" | "void_item";
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";
4
+ export interface EventConfig {
5
+ /** 活动名称 */
6
+ event_name: string;
7
+ /** 面向玩家的富文本活动规则 */
8
+ rules: string;
9
+ /** 活动开始时间 */
10
+ since: number;
11
+ /** 活动结束时间 */
12
+ until: number;
13
+ /** 活动访问人数 */
14
+ visit_count: number;
15
+ /** 活动下玩法列表 */
16
+ features: EventFeatureConfig[];
17
+ }
18
+ export declare function isEventConfig(data: unknown): data is EventConfig;
19
+ type EventFeatureConfig = EventFeatureBaseConfig<"preregister", NoopFeatureConfig> | EventFeatureBaseConfig<"lottery", FeatureLotteryConfig> | EventFeatureBaseConfig<"survey", FeatureSurveyConfig> | EventFeatureBaseConfig<"invite", FeatureInviteConfig> | EventFeatureBaseConfig<"share", FeatureShareConfig> | EventFeatureBaseConfig<"follow", FeatureFollowConfig> | EventFeatureBaseConfig<"weixin_subscribe", FeatureSubscribeConfig> | EventFeatureBaseConfig<"comment", FeatureCommentConfig> | EventFeatureBaseConfig<"vote", FeatureVoteConfig> | EventFeatureBaseConfig<"cashback", FeatureCashbackConfig> | EventFeatureBaseConfig<"gift_code", FeatureGiftCodeConfig> | EventFeatureBaseConfig<"register", NoopFeatureConfig> | EventFeatureBaseConfig<"invited_register", NoopFeatureConfig> | EventFeatureBaseConfig<"claim_rewards", NoopFeatureConfig> | EventFeatureBaseConfig<"quest", FeatureQuestConfig> | EventFeatureBaseConfig<"team", FeatureTeamConfig> | EventFeatureBaseConfig<"lottery_draw", FeatureLotteryDrawConfig>;
20
+ interface EventRewardItemConfig {
21
+ /** 玩法奖励道具 id */
22
+ reward_item_id: number;
23
+ /** 玩法奖励道具数量 */
24
+ reward_amount: number;
25
+ /** 玩法奖励道具名称 */
26
+ reward_item_name: string;
27
+ /** 玩法奖励道具图片地址 */
28
+ reward_item_icon_url: string;
29
+ /** 玩法奖励道具描述 */
30
+ reward_item_desc?: string;
31
+ /** 玩法奖励道具类型 */
32
+ reward_item_type: EGameItemType;
33
+ }
34
+ type FeatureReward = {
35
+ feature_reward_type: "every";
36
+ reward_details: EventRewardItemConfig[];
37
+ } | {
38
+ feature_reward_type: "regular";
39
+ reward_details: {
40
+ engage_count: number;
41
+ rewards: EventRewardItemConfig[];
42
+ }[];
43
+ };
44
+ export type NoopFeatureConfig = {} | null;
45
+ interface EventFeatureBaseConfig<T extends EFeatureType = EFeatureType, C extends object | null = object> {
46
+ /** 玩法名称 */
47
+ feature_name: string;
48
+ /** 玩法 Id */
49
+ feature_id: number;
50
+ /** 玩法描述 */
51
+ description: string;
52
+ /** 玩法类型 */
53
+ feature_type: T;
54
+ /** 玩法配置 */
55
+ config: C;
56
+ /** 玩法周期,即每多长时间可参与一次 */
57
+ cycle: "none" | "daily" | "weekly" | "monthly";
58
+ /** 允许的最大参与次数 */
59
+ limit: number;
60
+ /** 玩法开始时间 */
61
+ since: number;
62
+ /** 玩法结束时间 */
63
+ until: number;
64
+ /** 参与玩法维度账号类型 user_id(世游通行证 ID / Combo ID) 或 role_id(游戏角色 ID) */
65
+ engage_account_type: "user_id" | "role_id";
66
+ /** 玩法参与奖励 */
67
+ feature_rewards: FeatureReward;
68
+ }
69
+ interface FeatureLotteryItemConfig {
70
+ /** 抽奖奖励道具 id */
71
+ reward_item_id: number;
72
+ /** 抽奖奖励道具名称 */
73
+ reward_item_name: string;
74
+ /** 抽奖奖励道具类型 */
75
+ reward_item_type: Exclude<EGameItemType, "gift_code" | "lottery_ticket">;
76
+ /** 抽奖奖励道具图片地址 */
77
+ reward_item_icon_url: string;
78
+ /** 抽奖奖励道具描述 */
79
+ reward_item_desc?: string;
80
+ /** 抽奖奖励道具数量 */
81
+ reward_amount: number;
82
+ /** 抽奖奖励道具库存 */
83
+ reward_remaining_stock: number;
84
+ }
85
+ interface FeatureLotteryConfig {
86
+ /** 抽奖消耗道具 id */
87
+ consume_item_id: number;
88
+ /** 抽奖消耗道具名称 */
89
+ consume_item_name: number;
90
+ /** 抽奖消耗道具图片地址 */
91
+ consume_item_icon_url: string;
92
+ /** 抽奖消耗道具数量配置 */
93
+ consume_item_count: number;
94
+ /** 抽奖消耗道具描述 */
95
+ consume_item_desc?: string;
96
+ /** 抽奖配置奖励列表 */
97
+ rewards: FeatureLotteryItemConfig[];
98
+ }
99
+ interface FeatureSurveyConfig {
100
+ /** 问卷 ID */
101
+ survey_id: string;
102
+ /** 问卷 url 地址 */
103
+ survey_url: string;
104
+ }
105
+ interface FeatureInviteConfig {
106
+ /** 邀请玩法配置分享链接 */
107
+ share_url: string;
108
+ }
109
+ interface FeatureShareConfig {
110
+ /** 分享玩法配置分享平台 */
111
+ share_platform: string;
112
+ /** 分享玩法配置跳转地址 */
113
+ jump_url?: string;
114
+ /** 分享玩法分享平台图标 */
115
+ icon_url?: string;
116
+ }
117
+ interface FeatureFollowConfig {
118
+ /**
119
+ * 社交媒体平台的标识
120
+ *
121
+ * 比如 "bilibili", "douyin", "xiaohongshu", "weibo", "weixin_official_account", "qq"
122
+ */
123
+ platform: string;
124
+ /** 社交媒体平台 icon */
125
+ platform_icon?: string;
126
+ /** 跳转链接 */
127
+ link?: string;
128
+ /** 二维码链接地址 */
129
+ qr_code_url?: string;
130
+ /** 社交媒体平台描述 */
131
+ platform_desc?: string;
132
+ }
133
+ interface FeatureSubscribeConfig {
134
+ /** 一组微信订阅消息模版 ID */
135
+ weixin_template_ids: string[];
136
+ }
137
+ interface FeatureCommentConfig {
138
+ /** 活动配置的弹幕信息,用于快捷选择 */
139
+ comments: string[];
140
+ /** 发送频率限制,单位:秒 */
141
+ send_rate: number;
142
+ }
143
+ interface FeatureVoteConfig {
144
+ /** 关联一个或多个投票玩法 ID */
145
+ vote_feature_ids: number[];
146
+ /** 关联一个或多个投稿玩法 ID */
147
+ submission_feature_ids: number[];
148
+ /** 入围数量 */
149
+ finalists_amount: number;
150
+ /** 选项来源 */
151
+ source: "system" | "user_submission" | "shortlisted";
152
+ /** 投票选项配置 */
153
+ options: FeatureVoteOption[];
154
+ /** 投票入围后用户可获得的奖励 */
155
+ rewards: EventRewardItemConfig[];
156
+ }
157
+ interface FeatureVoteOption {
158
+ /** 选项标识 */
159
+ sn: string;
160
+ /** 选项名称 */
161
+ name: string;
162
+ /** 选项图片地址 */
163
+ img_urls?: string[];
164
+ /** 选项视频地址 */
165
+ video_urls?: string[];
166
+ /** 选项描述文本 */
167
+ descriptions?: string[];
168
+ /** 跳转地址 */
169
+ jump_url: string;
170
+ /** 选项投票数量 */
171
+ amount: number;
172
+ /** 选项是否入围 */
173
+ finalists: boolean;
174
+ /** 最后投票时间秒级时间戳 */
175
+ last_vote_time: number;
176
+ }
177
+ interface FeatureCashbackConfig {
178
+ /** 计算充值总额的开始时间 */
179
+ order_start_time: number;
180
+ /** 计算充值总额的结束时间 */
181
+ order_end_time: number;
182
+ /** 可领取充值返还奖励的开始时间 */
183
+ claim_rewards_start_time: number;
184
+ /** 可领取充值返还奖励的结束时间 */
185
+ claim_rewards_end_time: number;
186
+ }
187
+ interface FeatureGiftCodeConfig {
188
+ /** 用于前端显示礼包码兑换后会获得的奖励内容 */
189
+ gift_items: EventGiftItemConfig[];
190
+ /** 社媒平台链接 */
191
+ mp_url?: string;
192
+ /** 社媒平台二维码 */
193
+ mp_qrcode_url?: string;
194
+ }
195
+ interface EventGiftItemConfig {
196
+ /** 用于前端展示的游戏道具名称 */
197
+ name: string;
198
+ /** 用于前端展示的游戏道具图片地址 */
199
+ icon_url: string;
200
+ /** 用于前端展示的游戏道具数量 */
201
+ count: number;
202
+ }
203
+ interface FeatureQuestConfig {
204
+ /** 任务目标 */
205
+ objective: EQuestObjective;
206
+ /** 目标值 */
207
+ completion_value: number;
208
+ /** 团队任务配置 */
209
+ team?: {
210
+ /** 组队任务 ID */
211
+ feature_id?: number;
212
+ /** 目标值 */
213
+ completion_value: number;
214
+ };
215
+ }
216
+ interface FeatureTeamConfig {
217
+ /** 队伍最大成员数 */
218
+ max_members: number;
219
+ /** 队伍最小成员数 */
220
+ min_members: number;
221
+ }
222
+ interface FeatureLotteryDrawConfig {
223
+ /** 可开奖起始时间 */
224
+ draw_not_before: number;
225
+ /** 可开奖结束时间 */
226
+ draw_not_after: number;
227
+ }
228
+ export {};