@jetthai/cuora 1.1.273 → 1.1.274

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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.274](https://github.com/jetthai/cuora-module/compare/v1.1.273...v1.1.274) (2024-05-28)
6
+
5
7
  ### [1.1.273](https://github.com/jetthai/cuora-module/compare/v1.1.272...v1.1.273) (2024-05-27)
6
8
 
7
9
  ### [1.1.272](https://github.com/jetthai/cuora-module/compare/v1.1.270...v1.1.272) (2024-05-21)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.273",
3
+ "version": "1.1.274",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/game.js CHANGED
@@ -91,4 +91,5 @@ export default {
91
91
  }),
92
92
  addListFavorite: (code) => ({ method: 'post', url: 'game/list/v3/addMyFavorite', params: { games: [code] } }),
93
93
  removeListFavorite: (code) => ({ method: 'post', url: 'game/list/v3/removeMyFavorite', params: { games: [code] } }),
94
+ getGameInfo: ({ appSecret, gameCode }) => ({ method: 'get', url: 'game/info', params: { appSecret, gameCode } }),
94
95
  }
@@ -0,0 +1,57 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import game from '../api/game.js'
3
+
4
+ export default function (request, context) {
5
+ const { appSecret } = request.config
6
+ const { gameCode } = context
7
+ return createMachine(
8
+ {
9
+ id: 'game_info',
10
+ initial: 'fetching',
11
+ context: {
12
+ gameInfo: {},
13
+ },
14
+ states: {
15
+ fetching: {
16
+ invoke: {
17
+ src: 'fetchGameInfo',
18
+ onDone: {
19
+ target: 'idle',
20
+ actions: 'setGameInfo',
21
+ },
22
+ onError: {
23
+ target: 'idle',
24
+ },
25
+ },
26
+ },
27
+ idle: {
28
+ // on: {
29
+ // SET_GAME_CODE: {
30
+ // actions: 'setGameCode',
31
+ // },
32
+ // },
33
+ },
34
+ },
35
+ },
36
+ {
37
+ actions: {
38
+ setGameInfo: assign((context, event) => {
39
+ return {
40
+ gameInfo: event.data.data,
41
+ }
42
+ }),
43
+ // setGameCode: assign((context, event) => {
44
+ // return {
45
+ // gameCode: event.data.data,
46
+ // }
47
+ // }),
48
+ },
49
+ services: {
50
+ // 取得遊戲資訊
51
+ fetchGameInfo: async (context, event) => {
52
+ return await request.send(game.getGameInfo({ appSecret, gameCode }))
53
+ },
54
+ },
55
+ }
56
+ )
57
+ }
@@ -8,6 +8,7 @@ import game_favorite_v2 from './game_favorite_v2.js'
8
8
  import game_search_cash from './game_search_cash.js'
9
9
  import game_search_v2 from './game_search_v2.js'
10
10
  import game_hot_new from './game_hot_new.js'
11
+ import game_info from './game_info.js'
11
12
  import inbox from './inbox.js'
12
13
  import merge from './merge.js'
13
14
  import payment_data from './payment_data.js'
@@ -45,6 +46,7 @@ export default {
45
46
  game_search_cash,
46
47
  game_search_v2,
47
48
  game_hot_new,
49
+ game_info,
48
50
  inbox,
49
51
  merge,
50
52
  payment_data,
@@ -53,12 +53,10 @@ export default function (request) {
53
53
  services: {
54
54
  // 取得使用者頭像列表
55
55
  fetchUserPhotoList: async (context, event) => {
56
- console.log('?fetchUserPhotoList')
57
56
  return await request.send(user.getUserPhotoList())
58
57
  },
59
58
  // 更新使用者頭像
60
59
  updateUserPhoto: async (context, event) => {
61
- console.log('?updateUserPhoto', event.data)
62
60
  return await request.send(user.updateUserPhoto(event.data))
63
61
  },
64
62
  },