langjie-m-play 0.0.13 → 0.0.15

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.
@@ -0,0 +1,5 @@
1
+ export interface AtsInfo {
2
+ handle: number;
3
+ atsName: string;
4
+ atsParams: Record<string, any>;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { SubscribeDatagramResult } from "./SubscribeDatagramResult";
2
+ import { AtsInfo } from "./AtsInfo";
3
+ export interface RuntimeInfo {
4
+ testing: boolean;
5
+ currentAtsHandle: number;
6
+ currentActionTag: string;
7
+ subscribeDatagramResultList: Array<SubscribeDatagramResult>;
8
+ atsInfoList: Array<AtsInfo>;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -60,5 +60,7 @@ export declare enum JsonRpcMethodEnum {
60
60
  CALL_SUBSCRIBE_FOR_DATA_GRAM = "R_CALL_PACK.subscribeForDatagram",
61
61
  REPLY_SUBSCRIBE_FOR_DATA_GRAM = "R_REPLY_PACK.subscribeForDatagram",
62
62
  CALL_UNSUBSCRIBE_FOR_DATA_GRAM = "R_CALL_PACK.unsubscribeForDatagram",
63
- REPLY_UNSUBSCRIBE_FOR_DATA_GRAM = "R_REPLY_PACK.unsubscribeForDatagram"
63
+ REPLY_UNSUBSCRIBE_FOR_DATA_GRAM = "R_REPLY_PACK.unsubscribeForDatagram",
64
+ CALL_SYNC_RUNTIME_INFO = "R_CALL_PACK.syncRuntimeInfo",
65
+ REPLY_SYNC_RUNTIME_INFO = "R_REPLY_PACK.syncRuntimeInfo"
64
66
  }
@@ -63,4 +63,6 @@ export var JsonRpcMethodEnum;
63
63
  JsonRpcMethodEnum["REPLY_SUBSCRIBE_FOR_DATA_GRAM"] = "R_REPLY_PACK.subscribeForDatagram";
64
64
  JsonRpcMethodEnum["CALL_UNSUBSCRIBE_FOR_DATA_GRAM"] = "R_CALL_PACK.unsubscribeForDatagram";
65
65
  JsonRpcMethodEnum["REPLY_UNSUBSCRIBE_FOR_DATA_GRAM"] = "R_REPLY_PACK.unsubscribeForDatagram";
66
+ JsonRpcMethodEnum["CALL_SYNC_RUNTIME_INFO"] = "R_CALL_PACK.syncRuntimeInfo";
67
+ JsonRpcMethodEnum["REPLY_SYNC_RUNTIME_INFO"] = "R_REPLY_PACK.syncRuntimeInfo";
66
68
  })(JsonRpcMethodEnum || (JsonRpcMethodEnum = {}));
@@ -1,4 +1,5 @@
1
1
  export interface RequestServerConfig {
2
+ host: string;
2
3
  address: string;
3
4
  token: string;
4
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langjie-m-play",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -3,7 +3,7 @@ import { PlayUseSubmit } from "../domain/server/PlayUseSubmit";
3
3
  import { PlayReleaseSubmit } from "../domain/server/PlayReleaseSubmit";
4
4
  import { RequestServerConfig } from "../domain/server/RequestServerConfig";
5
5
  import { PlayAccountPageDO } from "../domain/server/PlayAccountPageDO";
6
- export declare const REMOTE_CLOUD_SERVICE_ADDRESS = "https://cp.langjie.com";
6
+ export declare let CONFIG: RequestServerConfig;
7
7
  export declare const RemoteWebService: {
8
8
  initRequestServerConfig: (config: RequestServerConfig) => void;
9
9
  queryPlayAccountList: (params: PlayAccountQueryDO) => Promise<PlayAccountPageDO>;
@@ -9,8 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  // @ts-ignore
11
11
  import axios from "axios";
12
- export const REMOTE_CLOUD_SERVICE_ADDRESS = "https://cp.langjie.com";
13
- let CONFIG = {
12
+ const REMOTE_CLOUD_SERVICE_ADDRESS = "https://cp.langjie.com";
13
+ export let CONFIG = {
14
+ host: REMOTE_CLOUD_SERVICE_ADDRESS,
14
15
  address: REMOTE_CLOUD_SERVICE_ADDRESS + '/cloudCustomerService',
15
16
  token: localStorage.getItem('token'),
16
17
  };
@@ -7,6 +7,7 @@ import { OutMsg } from "../domain/OutMsg";
7
7
  import { AtsLoadResponse } from "../domain/AtsLoadResponse";
8
8
  import { SubscribeDatagramResult } from "../domain/SubscribeDatagramResult";
9
9
  import { BaseAtsEvent } from "../domain/ats/event/BaseAtsEvent";
10
+ import { RuntimeInfo } from "../domain/RuntimeInfo";
10
11
  /**
11
12
  * 提供给前端接口调用
12
13
  */
@@ -96,6 +97,14 @@ export declare class GtcClient {
96
97
  * @return 产品信息,主要是为了获取序列号
97
98
  */
98
99
  static getProductInfo(slaveInstId: string | null, serviceType: ServiceTypeEnum, ctrlIndex: number): Promise<ProductInfo>;
100
+ /**
101
+ * 获取运行时状态信息
102
+ *
103
+ * @param slaveInstId 从机id
104
+ * @param serviceType 服务类型
105
+ * @param ctrlIndex 卡索引
106
+ */
107
+ static syncRuntimeInfo(slaveInstId: string | null, serviceType: ServiceTypeEnum, ctrlIndex: number): Promise<RuntimeInfo>;
99
108
  /**
100
109
  * 订阅通道数据流
101
110
  *
@@ -170,6 +170,21 @@ export class GtcClient {
170
170
  return GtcServiceFactory.getGtcService().call(request);
171
171
  });
172
172
  }
173
+ /**
174
+ * 获取运行时状态信息
175
+ *
176
+ * @param slaveInstId 从机id
177
+ * @param serviceType 服务类型
178
+ * @param ctrlIndex 卡索引
179
+ */
180
+ static syncRuntimeInfo(slaveInstId, serviceType, ctrlIndex) {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ const request = GtcClient.generateRequest(JsonRpcMethodEnum.CALL_SYNC_RUNTIME_INFO, slaveInstId);
183
+ request.params[JsonRpcConstant.SERVICE_TYPE] = serviceType;
184
+ request.params[JsonRpcConstant.CTRL_INDEX] = ctrlIndex;
185
+ return GtcServiceFactory.getGtcService().call(request);
186
+ });
187
+ }
173
188
  /**
174
189
  * 订阅通道数据流
175
190
  *
@@ -40,9 +40,17 @@ class GtcServiceSocketIOImpl {
40
40
  this.reply(response);
41
41
  });
42
42
  this.socket.on(JsonRpcEventEnum.EVENT, response => {
43
+ if (typeof response === "string") {
44
+ // @ts-ignore
45
+ response = JSON.parse(response);
46
+ }
43
47
  this.event(response);
44
48
  });
45
49
  this.socket.on(JsonRpcEventEnum.DATAGRAM, response => {
50
+ if (typeof response === "string") {
51
+ // @ts-ignore
52
+ response = JSON.parse(response);
53
+ }
46
54
  this.dataGram(response);
47
55
  });
48
56
  });
@@ -7,6 +7,7 @@ import { PlayUseSubmit } from "../domain/server/PlayUseSubmit";
7
7
  import { PlayReleaseSubmit } from "../domain/server/PlayReleaseSubmit";
8
8
  import { RequestServerConfig } from "../domain/server/RequestServerConfig";
9
9
  import { PlayAccountPageDO } from "../domain/server/PlayAccountPageDO";
10
+ import { RuntimeInfo } from "../domain/RuntimeInfo";
10
11
  export declare class MPlay {
11
12
  private static isOperator;
12
13
  private readonly instId;
@@ -60,6 +61,10 @@ export declare class MPlay {
60
61
  * @param ctrlIndex The control index of the MPlay instance.
61
62
  */
62
63
  constructor(instId: string | null, serviceType: ServiceTypeEnum | null, ctrlIndex: number | null);
64
+ /**
65
+ * Synchronize runtime data for the play.
66
+ */
67
+ syncRuntimeInfo(): Promise<RuntimeInfo>;
63
68
  /**
64
69
  * Subscribe datagram to the MPlay server.
65
70
  *
package/service/MPlay.js CHANGED
@@ -13,7 +13,7 @@ import { PubSubUtil } from "../utils/PubSubUtil";
13
13
  import { SubKeyEnum } from "../utils/enums/SubKeyEnum";
14
14
  import { TaskSynchronizer } from "../utils/TaskSynchronizer";
15
15
  import { AtsEventEnum } from "../domain/enums/AtsEventEnum";
16
- import { REMOTE_CLOUD_SERVICE_ADDRESS, RemoteWebService } from "../server/RemoteWebService";
16
+ import { CONFIG, RemoteWebService } from "../server/RemoteWebService";
17
17
  export class MPlay {
18
18
  /**
19
19
  * Connect to the MPlay server.
@@ -78,7 +78,7 @@ export class MPlay {
78
78
  }
79
79
  else {
80
80
  // 连接云服务器
81
- yield MPlay.connect(`${REMOTE_CLOUD_SERVICE_ADDRESS}/play?from=watch&accountNo=${params.accountNo}'`);
81
+ yield MPlay.connect(`${CONFIG.host}/play?from=watch&accountNo=${params.accountNo}`);
82
82
  }
83
83
  });
84
84
  }
@@ -177,6 +177,14 @@ export class MPlay {
177
177
  });
178
178
  });
179
179
  }
180
+ /**
181
+ * Synchronize runtime data for the play.
182
+ */
183
+ syncRuntimeInfo() {
184
+ return __awaiter(this, void 0, void 0, function* () {
185
+ return yield GtcClient.syncRuntimeInfo(this.instId, this.serviceType, this.ctrlIndex);
186
+ });
187
+ }
180
188
  /**
181
189
  * Subscribe datagram to the MPlay server.
182
190
  *