@lzpenguin/economy 1.0.2 → 1.0.4

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 CHANGED
@@ -30,9 +30,6 @@ try {
30
30
  console.error('❌ 失败:', error.message);
31
31
  }
32
32
 
33
- // 充值货币
34
- const recharged = await economy.recharge('diamond', 50);
35
- console.log('充值后钻石:', recharged.diamond);
36
33
  ```
37
34
 
38
35
  ## API
@@ -51,12 +48,6 @@ console.log('充值后钻石:', recharged.diamond);
51
48
  - `num` - 数量(必须 > 0)
52
49
  - **返回:** `Promise<{coin: number, diamond: number}>`
53
50
 
54
- ### `recharge(type, num)`
55
- 充值货币
56
- - `type` - 货币类型:`'coin'` 或 `'diamond'`
57
- - `num` - 数量(必须 > 0)
58
- - **返回:** `Promise<{coin: number, diamond: number}>`
59
-
60
51
  ## TypeScript
61
52
 
62
53
  ```typescript
package/index.d.ts CHANGED
@@ -71,12 +71,5 @@ export class RiffleEconomy {
71
71
  */
72
72
  consume(type: CurrencyType, num: number): Promise<AccountInfo>;
73
73
 
74
- /**
75
- * 充值货币
76
- * @param type 货币类型 ('coin' 或 'diamond')
77
- * @param num 充值数量(必须大于 0)
78
- * @returns 更新后的账户信息
79
- */
80
- recharge(type: CurrencyType, num: number): Promise<AccountInfo>;
81
74
  }
82
75
 
package/index.js CHANGED
@@ -23,9 +23,6 @@ let isBrowser = typeof window !== 'undefined';
23
23
  * const result = await economy.consume('coin', 10);
24
24
  * console.log('Remaining coin:', result.coin);
25
25
  *
26
- * // 充值货币
27
- * const recharged = await economy.recharge('diamond', 50);
28
- * console.log('New diamond:', recharged.diamond);
29
26
  * ```
30
27
  */
31
28
  export class RiffleEconomy {
@@ -92,11 +89,11 @@ export class RiffleEconomy {
92
89
  const data = await response.json();
93
90
 
94
91
  // 检查响应中是否有错误
95
- if (data.code !== 0) {
92
+ if (data.code !== 200) {
96
93
  throw new Error(data.message || 'API request failed');
97
94
  }
98
95
 
99
- return data.data;
96
+ return data.data
100
97
  } catch (error) {
101
98
  console.error('[RiffleEconomy] Request failed:', error);
102
99
  throw error;
@@ -134,25 +131,5 @@ export class RiffleEconomy {
134
131
 
135
132
  return await this._request('/api/v1/economy/consume', { type, num });
136
133
  }
137
-
138
- /**
139
- * 充值货币
140
- * @param {string} type - 货币类型 ('coin' 或 'diamond')
141
- * @param {number} num - 充值数量
142
- * @returns {Promise<{coin: number, diamond: number}>} 更新后的账户信息
143
- * @example
144
- * const result = await economy.recharge('diamond', 50);
145
- * console.log('New diamond:', result.diamond);
146
- */
147
- async recharge(type, num) {
148
- if (!type || (type !== 'coin' && type !== 'diamond')) {
149
- throw new Error('type must be "coin" or "diamond"');
150
- }
151
- if (!num || num <= 0) {
152
- throw new Error('num must be greater than 0');
153
- }
154
-
155
- return await this._request('/api/v1/economy/recharge', { type, num });
156
- }
157
134
  }
158
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lzpenguin/economy",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Riffle 经济系统客户端 SDK",
5
5
  "license": "ISC",
6
6
  "author": "lzpenguin",