@cpzxrobot/sdk 1.3.87 → 1.3.88

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.
@@ -132,8 +132,19 @@ class FactoryGateway extends Object {
132
132
  workshops(id, tags) {
133
133
  return __awaiter(this, void 0, void 0, function* () {
134
134
  var axios = yield this.context.ready;
135
- const response = yield axios.get(`/api/v1/factory/${id}/workshops?tags=${tags === null || tags === void 0 ? void 0 : tags.join(',')}`);
136
- return response.data;
135
+ var baseUrl = `/api/v1/factory/${id}/workshops`;
136
+ if (!tags) {
137
+ const response = yield axios.get(baseUrl);
138
+ return response.data;
139
+ }
140
+ const response = yield axios.get(`${baseUrl}?tags=${tags === null || tags === void 0 ? void 0 : tags.join(',')}`);
141
+ const body = response.data;
142
+ if (body.code === 200) {
143
+ return body.data;
144
+ }
145
+ else {
146
+ throw new Error(body.message);
147
+ }
137
148
  });
138
149
  }
139
150
  //获得工厂的所有单元信息,以车间为单位树状结构
@@ -117,8 +117,18 @@ export class FactoryGateway extends Object {
117
117
  //获得工厂的所有车间信息
118
118
  async workshops(id: number, tags?: string[]): Promise<any> {
119
119
  var axios = await this.context.ready;
120
- const response = await axios.get(`/api/v1/factory/${id}/workshops?tags=${tags?.join(',')}`);
121
- return response.data;
120
+ var baseUrl = `/api/v1/factory/${id}/workshops`;
121
+ if (!tags) {
122
+ const response = await axios.get(baseUrl);
123
+ return response.data;
124
+ }
125
+ const response = await axios.get(`${baseUrl}?tags=${tags?.join(',')}`);
126
+ const body = response.data;
127
+ if (body.code === 200) {
128
+ return body.data;
129
+ }else{
130
+ throw new Error(body.message);
131
+ }
122
132
  }
123
133
 
124
134
  //获得工厂的所有单元信息,以车间为单位树状结构
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.87",
3
+ "version": "1.3.88",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {