@freelog/tools-lib 0.1.158 → 0.1.161

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.
@@ -1,42 +1,42 @@
1
- import FUtil from '../utils';
2
-
3
- // 列出运营分类分组排序
4
- interface OperationCategoriesParamsType {
5
- name?: string;
6
- status?: number;
7
- }
8
-
9
- export function operationCategories({...params}: OperationCategoriesParamsType = {}) {
10
- return FUtil.Request({
11
- method: 'GET',
12
- url: `/v2/resources/operation-categories/listSimpleByGroup`,
13
- params: params,
14
- });
15
- }
16
-
17
- // 收益排行
18
- interface RecordRankParamsType {
19
- coinAccountType: 1 | 2;
20
- limit: number;
21
- }
22
-
23
- export function recordRank({...params}: RecordRankParamsType) {
24
- return FUtil.Request({
25
- method: 'POST',
26
- url: `/v2/activities/coin/record/rank`,
27
- data: params,
28
- });
29
- }
30
-
31
- // 收益详情
32
- interface RankInfoParamsType {
33
- coinAccountType: 1 | 2;
34
- }
35
-
36
- export function rankInfo({...params}: RankInfoParamsType) {
37
- return FUtil.Request({
38
- method: 'POST',
39
- url: `/v2/activities/coin/record/rankInfo`,
40
- data: params,
41
- });
42
- }
1
+ import FUtil from '../utils';
2
+
3
+ // 列出运营分类分组排序
4
+ interface OperationCategoriesParamsType {
5
+ name?: string;
6
+ status?: number;
7
+ }
8
+
9
+ export function operationCategories({...params}: OperationCategoriesParamsType = {}) {
10
+ return FUtil.Request({
11
+ method: 'GET',
12
+ url: `/v2/resources/operation-categories/listSimpleByGroup`,
13
+ params: params,
14
+ });
15
+ }
16
+
17
+ // 收益排行
18
+ interface RecordRankParamsType {
19
+ coinAccountType: 1 | 2;
20
+ limit: number;
21
+ }
22
+
23
+ export function recordRank({...params}: RecordRankParamsType) {
24
+ return FUtil.Request({
25
+ method: 'POST',
26
+ url: `/v2/activities/coin/record/rank`,
27
+ data: params,
28
+ });
29
+ }
30
+
31
+ // 收益详情
32
+ interface RankInfoParamsType {
33
+ coinAccountType: 1 | 2;
34
+ }
35
+
36
+ export function rankInfo({...params}: RankInfoParamsType) {
37
+ return FUtil.Request({
38
+ method: 'POST',
39
+ url: `/v2/activities/coin/record/rankInfo`,
40
+ data: params,
41
+ });
42
+ }
@@ -21,7 +21,6 @@ export interface CreatePresentableParamsType {
21
21
  }
22
22
 
23
23
  export function createPresentable(params: CreatePresentableParamsType) {
24
- // return FUtil.Axios.post(`/v2/presentables`, params);
25
24
  return FUtil.Request({
26
25
  method: 'POST',
27
26
  url: `/v2/presentables`,
@@ -54,7 +53,6 @@ interface UpdatePresentableParamsType {
54
53
  }
55
54
 
56
55
  export function updatePresentable({presentableId, ...params}: UpdatePresentableParamsType) {
57
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}`, params);
58
56
  return FUtil.Request({
59
57
  method: 'PUT',
60
58
  url: `/v2/presentables/${presentableId}`,
@@ -73,7 +71,6 @@ interface PresentablesOnlineParamsType {
73
71
  }
74
72
 
75
73
  export function presentablesOnlineStatus({presentableId, ...params}: PresentablesOnlineParamsType) {
76
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}/onlineStatus`, params);
77
74
  return FUtil.Request({
78
75
  method: 'PUT',
79
76
  url: `/v2/presentables/${presentableId}/onlineStatus`,
@@ -106,9 +103,6 @@ interface PresentableDetailsParamsType2 {
106
103
 
107
104
  export function presentableDetails(params: PresentableDetailsParamsType1 | PresentableDetailsParamsType2) {
108
105
  if ((params as PresentableDetailsParamsType2).nodeId) {
109
- // return FUtil.Axios.get(`/v2/presentables/detail`, {
110
- // params,
111
- // });
112
106
  return FUtil.Request({
113
107
  method: 'GET',
114
108
  url: `/v2/presentables/detail`,
@@ -116,9 +110,6 @@ export function presentableDetails(params: PresentableDetailsParamsType1 | Prese
116
110
  });
117
111
  }
118
112
  const {presentableId, ...p} = params as PresentableDetailsParamsType1;
119
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}`, {
120
- // params: p,
121
- // });
122
113
  return FUtil.Request({
123
114
  method: 'GET',
124
115
  url: `/v2/presentables/${presentableId}`,
@@ -182,7 +173,6 @@ interface DependencyTreeParamsType {
182
173
  }
183
174
 
184
175
  export function dependencyTree({presentableId, ...params}: DependencyTreeParamsType) {
185
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}/dependencyTree`, {params});
186
176
  return FUtil.Request({
187
177
  method: 'GET',
188
178
  url: `/v2/presentables/${presentableId}/dependencyTree`,
@@ -197,7 +187,6 @@ interface RelationTreeParamsType {
197
187
  }
198
188
 
199
189
  export function relationTree({presentableId, ...params}: RelationTreeParamsType) {
200
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}/relationTree`, {params});
201
190
  return FUtil.Request({
202
191
  method: 'GET',
203
192
  url: `/v2/presentables/${presentableId}/relationTree`,
@@ -215,7 +204,6 @@ interface AuthTreeParamsType {
215
204
  }
216
205
 
217
206
  export function authTree({presentableId, ...params}: AuthTreeParamsType) {
218
- // return FUtil.Axios.get(`/v2/presentables/${presentableId}/authTree`, {params});
219
207
  return FUtil.Request({
220
208
  method: 'GET',
221
209
  url: `/v2/presentables/${presentableId}/authTree`,
@@ -230,7 +218,6 @@ interface PresentablesVersionParamsType {
230
218
  }
231
219
 
232
220
  export function presentablesVersion({presentableId, ...params}: PresentablesVersionParamsType) {
233
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}/version`, params);
234
221
  return FUtil.Request({
235
222
  method: 'PUT',
236
223
  url: `/v2/presentables/${presentableId}/version`,
@@ -249,7 +236,6 @@ interface UpdateRewritePropertyParamsType {
249
236
  }
250
237
 
251
238
  export function updateRewriteProperty({presentableId, ...params}: UpdateRewritePropertyParamsType) {
252
- // return FUtil.Axios.put(`/v2/presentables/${presentableId}/rewriteProperty`, params);
253
239
  return FUtil.Request({
254
240
  method: 'PUT',
255
241
  url: `/v2/presentables/${presentableId}/rewriteProperty`,
@@ -265,9 +251,6 @@ interface BatchAuthParamsType {
265
251
  }
266
252
 
267
253
  export function batchAuth({nodeId, ...params}: BatchAuthParamsType) {
268
- // return FUtil.Axios.get(`/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`, {
269
- // params,
270
- // });
271
254
  return FUtil.Request({
272
255
  method: 'GET',
273
256
  url: `/v2/auths/presentables/nodes/${nodeId}/batchAuth/result`,
@@ -282,12 +265,58 @@ interface ContractAppliedPresentableParamsType {
282
265
  }
283
266
 
284
267
  export function contractAppliedPresentable({nodeId, ...params}: ContractAppliedPresentableParamsType) {
285
- // return FUtil.Axios.get(`/v2/presentables/${nodeId}/contractAppliedPresentable`, {
286
- // params,
287
- // });
288
268
  return FUtil.Request({
289
269
  method: 'GET',
290
270
  url: `/v2/presentables/${nodeId}/contractAppliedPresentable`,
291
271
  params: params,
292
272
  });
293
273
  }
274
+
275
+ // 一键批量创建展品
276
+ export interface BatchCreatePresentableParamsType {
277
+ nodeId: number;
278
+ resources: {
279
+ resourceId: string;
280
+ policyId?: string;
281
+ }[];
282
+ }
283
+
284
+ export function batchCreatePresentable(params: BatchCreatePresentableParamsType) {
285
+ return FUtil.Request({
286
+ method: 'POST',
287
+ url: `/v2/presentables/createPresentableBatchEasy`,
288
+ data: params,
289
+ });
290
+ }
291
+
292
+ // 批量更新展品
293
+ interface BatchUpdatePresentableParamsType {
294
+ presentableIds: string[];
295
+ addPolicies: {
296
+ policyName: string;
297
+ policyText: string;
298
+ status?: 0 | 1;
299
+ }[];
300
+ }
301
+
302
+ export function batchUpdatePresentable({...params}: BatchUpdatePresentableParamsType) {
303
+ return FUtil.Request({
304
+ method: 'PUT',
305
+ url: `/v2/presentables/updatePresentableBatch`,
306
+ data: params,
307
+ });
308
+ }
309
+
310
+ // 批量切换展品上下线状态
311
+ interface BatchUpdatePresentableStatusParamsType {
312
+ presentableIds: string[];
313
+ onlineStatus: 0 | 1;
314
+ }
315
+
316
+ export function batchUpdatePresentableStatus({...params}: BatchUpdatePresentableStatusParamsType) {
317
+ return FUtil.Request({
318
+ method: 'PUT',
319
+ url: `/v2/presentables/updatePresentableOnlineStatusBatch`,
320
+ data: params,
321
+ });
322
+ }
@@ -17,6 +17,7 @@ interface IResourceInfo {
17
17
  }[];
18
18
  resourceId: string;
19
19
  resourceName: string;
20
+ resourceTitle: string;
20
21
  resourceType: string[];
21
22
  resourceVersions: {
22
23
  createDate: string;
@@ -50,6 +51,62 @@ export function create(params: CreateParamsType) {
50
51
  });
51
52
  }
52
53
 
54
+ // 批量创建资源
55
+ export interface CreateBatchParamsType {
56
+ resourceTypeCode: string;
57
+ resourceTypeName?: string;
58
+ createResourceObjects: {
59
+ name: string;
60
+ resourceTitle?: string;
61
+ policies?: {
62
+ policyName: string;
63
+ policyText: string;
64
+ status?: 1 | 0;
65
+ }[];
66
+ coverImages?: string[];
67
+ intro?: string;
68
+ tags?: string[];
69
+
70
+ version: string;
71
+ fileSha1: string;
72
+ filename: string;
73
+ description?: string;
74
+ dependencies?: {
75
+ resourceId: string;
76
+ versionRange: string;
77
+ }[];
78
+ customPropertyDescriptors?: {
79
+ key: string;
80
+ name: string;
81
+ defaultValue: string;
82
+ type: 'editableText' | 'readonlyText' | 'radio' | 'checkbox' | 'select';
83
+ candidateItems?: string[];
84
+ remark?: string;
85
+ }[];
86
+ baseUpcastResources?: {
87
+ resourceId: string;
88
+ }[];
89
+ resolveResources: {
90
+ resourceId: string;
91
+ contracts: {
92
+ policyId: string;
93
+ }[];
94
+ }[];
95
+ inputAttrs?: {
96
+ key: string;
97
+ value: string;
98
+ }[];
99
+ }[];
100
+ }
101
+
102
+ export function createBatch(params: CreateBatchParamsType) {
103
+ return FUtil.Request({
104
+ method: 'POST',
105
+ url: `/v2/resources/createBatch`,
106
+ data: params,
107
+ });
108
+ }
109
+
53
110
  // 更新资源信息
54
111
  interface UpdateParamsType {
55
112
  resourceId: string;
@@ -77,6 +134,33 @@ export function update(params: UpdateParamsType) {
77
134
  });
78
135
  }
79
136
 
137
+ // 批量更新资源信息
138
+ interface BatchUpdateParamsType {
139
+ resourceIds: string[];
140
+ status?: 1 | 4;
141
+ // resourceTitle?: string;
142
+ // intro?: string;
143
+ // tags?: string[];
144
+ // coverImages?: string[];
145
+ addPolicies?: {
146
+ policyName: string;
147
+ policyText: string;
148
+ status?: 0 | 1; // 1:上线 0:下线
149
+ }[];
150
+ // updatePolicies?: {
151
+ // policyId: string;
152
+ // status: 0 | 1; // 0:下线策略 1:上线策略
153
+ // }[];
154
+ }
155
+
156
+ export function batchUpdate(params: BatchUpdateParamsType) {
157
+ return FUtil.Request({
158
+ method: 'PUT',
159
+ url: `/v2/resources/updateBatch`,
160
+ data: params,
161
+ });
162
+ }
163
+
80
164
  // 查看资源分页列表
81
165
  interface ListParamsType {
82
166
  skip?: number;
@@ -99,6 +183,7 @@ interface ListParamsType {
99
183
  sort?: string;
100
184
  // startResourceId?: string;
101
185
  operationCategoryCode?: string;
186
+ operationTypes?: string;
102
187
  }
103
188
 
104
189
  // interface ListReturnType extends CommonReturn {
@@ -260,6 +345,20 @@ export function resourceVersionInfo2(params: ResourceVersionInfo2ParamsType) {
260
345
  });
261
346
  }
262
347
 
348
+ // 批量查询资源版本列表
349
+ interface GetVersionListParamsType {
350
+ versionIds: string;
351
+ projection?: string;
352
+ }
353
+
354
+ export function getVersionList({...params}: GetVersionListParamsType) {
355
+ return FUtil.Request({
356
+ method: 'GET',
357
+ url: `/v2/resources/versions/list`,
358
+ params: params,
359
+ });
360
+ }
361
+
263
362
  // 根据sha1查询版本列表 (查询文件对象所挂载的资源及版本)
264
363
  interface GetResourceVersionBySha1ParamsType {
265
364
  fileSha1: string;
@@ -267,9 +366,6 @@ interface GetResourceVersionBySha1ParamsType {
267
366
  }
268
367
 
269
368
  export function getResourceVersionBySha1({fileSha1, ...params}: GetResourceVersionBySha1ParamsType) {
270
- // return FUtil.Axios.get(`/v2/resources/files/${fileSha1}/versions`, {
271
- // params,
272
- // });
273
369
  return FUtil.Request({
274
370
  method: 'GET',
275
371
  url: `/v2/resources/files/${fileSha1}/versions`,
@@ -357,6 +453,20 @@ export function lookDraft(params: LookDraftParamsType) {
357
453
  });
358
454
  }
359
455
 
456
+ // 删除资源版本草稿
457
+ interface DeleteResourceDraftParamsType {
458
+ resourceId: string;
459
+ }
460
+
461
+ export function deleteResourceDraft({resourceId}: DeleteResourceDraftParamsType) {
462
+ // return FUtil.Axios.post(`/v2/resources/${params.resourceId}/versions/drafts`, params);
463
+ return FUtil.Request({
464
+ method: 'DELETE',
465
+ url: `/v2/resources/${resourceId}/versions/drafts`,
466
+ // data: params,
467
+ });
468
+ }
469
+
360
470
  // 校验文件是否被引入资源
361
471
  interface ResourceIsUsedByOtherParamsType {
362
472
  fileSha1: string;
@@ -380,7 +490,7 @@ interface ResourcesDownloadParamsType {
380
490
  }
381
491
 
382
492
  export function resourcesDownload(params: ResourcesDownloadParamsType) {
383
- return window.location.href = FUtil.Format.completeUrlByDomain('qi') + `/v2/resources/${params.resourceId}/versions/${params.version}/download`;
493
+ return window.location.href = FUtil.Format.completeUrlByDomain('api') + `/v2/resources/${params.resourceId}/versions/${params.version}/download`;
384
494
  // return request.get(`/v2/resources/${params.resourceId}/versions/${params.$version}/download`, {
385
495
  // responseType: 'arraybuffer',
386
496
  // });
@@ -549,7 +659,7 @@ export function resourcesRecommend({...params}: ResourcesRecommendParamsType) {
549
659
 
550
660
  // 根据资源类型查看推荐的标签
551
661
  interface AvailableTagsParamsType {
552
- resourceType: string;
662
+ resourceTypeCode: string;
553
663
  }
554
664
 
555
665
  export function availableTags({...params}: AvailableTagsParamsType) {
@@ -566,6 +676,7 @@ interface ResourceTypesParamsType {
566
676
  category?: 1 | 2; // 种类 1:基础资源类型 2:自定义资源类型
567
677
  isMine?: boolean;
568
678
  status?: 0 | 1;
679
+ supportCreateBatch?: 1 | 2;
569
680
  }
570
681
 
571
682
  export function resourceTypes({...params}: ResourceTypesParamsType = {}) {
@@ -643,3 +754,19 @@ export function getAttrsInfoByKey({...params}: GetAttrsInfoByKeyParamsType) {
643
754
  params: params,
644
755
  });
645
756
  }
757
+
758
+ // 通过key取资源属性
759
+ interface GenerateResourceNamesParamsType {
760
+ data: {
761
+ name: string;
762
+ num: number;
763
+ }[];
764
+ }
765
+
766
+ export function generateResourceNames({data}: GenerateResourceNamesParamsType) {
767
+ return FUtil.Request({
768
+ method: 'POST',
769
+ url: `/v2/resources/generateResourceNames`,
770
+ data: data,
771
+ });
772
+ }
@@ -175,7 +175,7 @@ interface DownloadObjectParamsType {
175
175
  }
176
176
 
177
177
  export function downloadObject(params: DownloadObjectParamsType) {
178
- return window.location.href = FUtil.Format.completeUrlByDomain('qi') + `/v2/storages/objects/${params.objectIdOrName}/file`;
178
+ return window.location.href = FUtil.Format.completeUrlByDomain('api') + `/v2/storages/objects/${params.objectIdOrName}/file`;
179
179
  }
180
180
 
181
181
  // 根据sha1查询文件是否存在
@@ -258,6 +258,32 @@ export function uploadImage(params: UploadImageParamsType, config?: AxiosRequest
258
258
  });
259
259
  }
260
260
 
261
+ // 处理图片文件
262
+ interface HandleImageParamsType {
263
+ sha1: string;
264
+ }
265
+
266
+ export function handleImage(params: HandleImageParamsType) {
267
+ return FUtil.Request({
268
+ method: 'POST',
269
+ url: `/v2/storages/files/imageHandle`,
270
+ data: params,
271
+ });
272
+ }
273
+
274
+ // 生成封面
275
+ interface GenerateCoverImageParamsType {
276
+ sha1: string;
277
+ }
278
+
279
+ export function generateCoverImage(params: GenerateCoverImageParamsType) {
280
+ return FUtil.Request({
281
+ method: 'POST',
282
+ url: `/v2/storages/files/generateCoverImage`,
283
+ data: params,
284
+ });
285
+ }
286
+
261
287
  // 更新存储对象属性
262
288
  interface UpdateObjectParamsType {
263
289
  objectIdOrName: string;
@@ -286,6 +312,21 @@ export function updateObject({objectIdOrName, ...params}: UpdateObjectParamsType
286
312
  });
287
313
  }
288
314
 
315
+ // 批量更新存储对象
316
+ interface BatchUpdateObjectParamsType {
317
+ objectIds: string[];
318
+ resourceTypeCode: string;
319
+ resourceTypeName?: string;
320
+ }
321
+
322
+ export function batchUpdateObject({...params}: BatchUpdateObjectParamsType) {
323
+ return FUtil.Request({
324
+ method: 'PUT',
325
+ url: `/v2/storages/objects/updateBatch`,
326
+ data: params,
327
+ });
328
+ }
329
+
289
330
  // 批量查询存储对象列表
290
331
  interface BatchObjectListParamsType {
291
332
  fullObjectNames?: string;