@freelog/tools-lib 0.1.183 → 0.1.185

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,1379 +1,1379 @@
1
- import FUtil from '../utils';
2
- import { CommonReturn } from './tools';
3
-
4
- // interface IResourceInfo {
5
- // baseUpcastResources: {
6
- // resourceId: string;
7
- // resourceName: string;
8
- // }[],
9
- // coverImages: string[],
10
- // createDate: string;
11
- // intro: string;
12
- // latestVersion: string;
13
- // policies: {
14
- // policyId: string;
15
- // policyName: string;
16
- // status: 0 | 1;
17
- // }[];
18
- // resourceId: string;
19
- // resourceName: string;
20
- // resourceTitle: string;
21
- // resourceType: string[];
22
- // resourceVersions: {
23
- // createDate: string;
24
- // version: string;
25
- // versionId: string;
26
- // }[];
27
- // status: 0 | 1 | 2 | 4; // 0:待发行(初始状态) 1:上架 2:冻结 4:下架(也叫待上架)
28
- // tags: string[];
29
- // updateDate: string;
30
- // userId: number;
31
- // username: string;
32
- // operationType: number;
33
- // }
34
-
35
- // 创建资源
36
- export interface CreateParamsType {
37
- name: string;
38
- subjectType?: 1 | 4; // 标的物类型(1:普通资源 4:合集资源) 默认是1
39
- resourceTitle?: string;
40
- // resourceType: string[]
41
- resourceTypeCode: string;
42
- resourceTypeName?: string;
43
- policies?: {
44
- policyName: string;
45
- policyText: string;
46
- status?: 0 | 1;
47
- }[];
48
- coverImages?: string[];
49
- intro?: string;
50
- tags?: string[];
51
- }
52
-
53
- export function create(params: CreateParamsType) {
54
- return FUtil.Request({
55
- method: 'POST',
56
- url: `/v2/resources`,
57
- data: params,
58
- });
59
- }
60
-
61
- // 批量创建资源
62
- export interface CreateBatchParamsType {
63
- resourceTypeCode: string;
64
- resourceTypeName?: string;
65
- createResourceObjects: {
66
- name: string;
67
- resourceTitle?: string;
68
- policies?: {
69
- policyName: string;
70
- policyText: string;
71
- status?: 1 | 0;
72
- }[];
73
- coverImages?: string[];
74
- intro?: string;
75
- tags?: string[];
76
-
77
- version: string;
78
- fileSha1: string;
79
- filename: string;
80
- description?: string;
81
- dependencies?: {
82
- resourceId: string;
83
- versionRange: string;
84
- }[];
85
- customPropertyDescriptors?: {
86
- key: string;
87
- name: string;
88
- defaultValue: string;
89
- type: 'editableText' | 'readonlyText' | 'radio' | 'checkbox' | 'select';
90
- candidateItems?: string[];
91
- remark?: string;
92
- }[];
93
- baseUpcastResources?: {
94
- resourceId: string;
95
- }[];
96
- batchSignContracts?: {
97
- resourceId: string;
98
- // resourceName: string;
99
- policyIds: string[];
100
- // subjectType: 'resource' | '';
101
- subjectType: string;
102
- }[];
103
- // resolveResources: {
104
- // resourceId: string;
105
- // contracts: {
106
- // policyId: string;
107
- // }[];
108
- // }[];
109
- inputAttrs?: {
110
- key: string;
111
- value: string;
112
- }[];
113
- }[];
114
- }
115
-
116
- export function createBatch(params: CreateBatchParamsType) {
117
- return FUtil.Request({
118
- method: 'POST',
119
- url: `/v2/resources/createBatch`,
120
- data: params,
121
- });
122
- }
123
-
124
- // 更新资源信息
125
- interface UpdateParamsType {
126
- resourceId: string;
127
- status?: 0 | 1;
128
- resourceTitle?: string;
129
- intro?: string;
130
- tags?: string[];
131
- coverImages?: string[];
132
- addPolicies?: {
133
- policyName: string;
134
- policyText: string;
135
- status?: 0 | 1; // 1:上线 0:下线
136
- }[];
137
- updatePolicies?: {
138
- policyId: string;
139
- status: 0 | 1; // 0:下线策略 1:上线策略
140
- }[];
141
- }
142
-
143
- export function update(params: UpdateParamsType) {
144
- return FUtil.Request({
145
- method: 'PUT',
146
- url: `/v2/resources/${params.resourceId}`,
147
- data: params,
148
- });
149
- }
150
-
151
- // 批量更新资源信息
152
- interface BatchUpdateParamsType {
153
- resourceIds: string[];
154
- status?: 1 | 4;
155
- // resourceTitle?: string;
156
- // intro?: string;
157
- // tags?: string[];
158
- // coverImages?: string[];
159
- addPolicies?: {
160
- policyName: string;
161
- policyText: string;
162
- status?: 0 | 1; // 1:上线 0:下线
163
- }[];
164
- // updatePolicies?: {
165
- // policyId: string;
166
- // status: 0 | 1; // 0:下线策略 1:上线策略
167
- // }[];
168
- }
169
-
170
- export function batchUpdate(params: BatchUpdateParamsType) {
171
- return FUtil.Request({
172
- method: 'PUT',
173
- url: `/v2/resources/updateBatch`,
174
- data: params,
175
- });
176
- }
177
-
178
- // 查看资源分页列表
179
- interface ListParamsType {
180
- skip?: number;
181
- limit?: number;
182
- keywords?: string;
183
- resourceType?: string;
184
- resourceTypeCode?: string;
185
- resourceTypeCategory?: 1 | 2; // 资源类型分类,1:基础类型,2:自定义类型,其实只有2时生效,生效时,resourceTypeCode为父类类型
186
- omitResourceType?: string;
187
- isSelf?: 0 | 1;
188
- userId?: number;
189
- status?: 0 | 1 | 2 | 4; // 分别是 0:待发行(初始状态) 1:上架 2:冻结 4:下架(也叫待上架)
190
- isLoadPolicyInfo?: 0 | 1;
191
- isLoadLatestVersionInfo?: 0 | 1;
192
- isLoadFreezeReason?: 0 | 1;
193
- projection?: string;
194
- startCreateDate?: string;
195
- endCreateDate?: string;
196
- tags?: string;
197
- sort?: string;
198
- // startResourceId?: string;
199
- operationCategoryCode?: string;
200
- operationTypes?: string;
201
- subjectType?: 1 | 4;
202
- }
203
-
204
- // interface ListReturnType extends CommonReturn {
205
- // data: IResourceInfo[];
206
- // }
207
-
208
- export function list(params: ListParamsType) {
209
- return FUtil.Request({
210
- method: 'GET',
211
- url: `/v2/resources`,
212
- params: params,
213
- });
214
- }
215
-
216
- // 查看单个资源详情
217
- interface InfoParamsType {
218
- resourceIdOrName: string;
219
- isLoadPolicyInfo?: 0 | 1;
220
- isTranslate?: 0 | 1;
221
- isLoadLatestVersionInfo?: 0 | 1;
222
- projection?: string;
223
- isLoadFreezeReason?: 0 | 1;
224
- }
225
-
226
- // interface InfoReturnType extends CommonReturn {
227
- // data: IResourceInfo
228
- // }
229
-
230
- export function info({ resourceIdOrName, ...params }: InfoParamsType) {
231
- // : Promise<InfoReturnType>
232
- return FUtil.Request({
233
- method: 'GET',
234
- url: `/v2/resources/${encodeURIComponent(resourceIdOrName)}`,
235
- params: params,
236
- });
237
- }
238
-
239
- // 批量查询资源列表
240
- interface BatchInfoParamsType {
241
- resourceIds?: string;
242
- resourceNames?: string;
243
- isLoadPolicyInfo?: 0 | 1;
244
- isTranslate?: 0 | 1;
245
- isLoadLatestVersionInfo?: 0 | 1;
246
- projection?: string;
247
- isLoadFreezeReason?: 0 | 1;
248
- }
249
-
250
- // interface BatchInfoReturnType extends CommonReturn {
251
- // data: IResourceInfo[];
252
- // }
253
-
254
- export function batchInfo(params: BatchInfoParamsType) {
255
- // : Promise<BatchInfoReturnType>
256
- return FUtil.Request({
257
- method: 'GET',
258
- url: `/v2/resources/list`,
259
- params: params,
260
- });
261
- }
262
-
263
- // 查看资源的依赖树
264
- interface DependencyTreeParamsType {
265
- resourceId: string;
266
- version?: string;
267
- maxDeep?: string;
268
- omitFields?: string;
269
- isContainRootNode?: boolean;
270
- }
271
-
272
- export function dependencyTree({
273
- resourceId,
274
- ...params
275
- }: DependencyTreeParamsType) {
276
- return FUtil.Request({
277
- method: 'GET',
278
- url: `/v2/resources/${resourceId}/dependencyTree`,
279
- params: params,
280
- });
281
- }
282
-
283
- // 查看资源的授权树
284
- interface AuthTreeParamsType {
285
- resourceId: string;
286
- version?: string;
287
- }
288
-
289
- export function authTree({ resourceId, ...params }: AuthTreeParamsType) {
290
- return FUtil.Request({
291
- method: 'GET',
292
- url: `/v2/resources/${resourceId}/authTree`,
293
- params: params,
294
- });
295
- }
296
-
297
- // 创建资源版本
298
- interface CreateVersionParamsType {
299
- resourceId: string;
300
- version: string;
301
- fileSha1: string;
302
- filename: string;
303
- description?: string;
304
- customPropertyDescriptors?: {
305
- key: string;
306
- name: string;
307
- defaultValue: string;
308
- type: 'editableText' | 'readonlyText' | 'radio' | 'checkbox' | 'select';
309
- candidateItems?: string[];
310
- remark?: string;
311
- }[];
312
- // resolveResources: {
313
- // resourceId: string;
314
- // contracts: {
315
- // policyId: string;
316
- // }[];
317
- // }[];
318
- inputAttrs?: {
319
- key: string;
320
- value: string;
321
- }[];
322
-
323
- dependencies?: {
324
- resourceId: string;
325
- versionRange: string;
326
- }[];
327
- baseUpcastResources?: {
328
- resourceId: string;
329
- }[];
330
- batchSignContracts?: {
331
- resourceId: string;
332
- policyIds: string[];
333
- }[];
334
- authExcludedItems: {
335
- resourceId: string;
336
- excludedType: 'contractId' | 'policyId';
337
- excludedValue: string;
338
- }[];
339
- }
340
-
341
- export function createVersion({
342
- resourceId,
343
- ...params
344
- }: CreateVersionParamsType) {
345
- // return FUtil.Axios.post(`/v2/resources/${resourceId}/versions`, params);
346
- return FUtil.Request({
347
- method: 'POST',
348
- url: `/v2/resources/${resourceId}/versions`,
349
- data: params,
350
- });
351
- }
352
-
353
- // 查看资源版本信息
354
- interface ResourceVersionInfo1ParamsType {
355
- resourceId: string;
356
- version: string;
357
- projection?: string;
358
- }
359
-
360
- interface ResourceVersionInfo2ParamsType {
361
- versionId: string;
362
- projection?: string;
363
- }
364
-
365
- export function resourceVersionInfo1({
366
- resourceId,
367
- version,
368
- ...params
369
- }: ResourceVersionInfo1ParamsType) {
370
- return FUtil.Request({
371
- method: 'GET',
372
- url: `/v2/resources/${resourceId}/versions/${version}`,
373
- params: params,
374
- });
375
- }
376
-
377
- export function resourceVersionInfo2(params: ResourceVersionInfo2ParamsType) {
378
- return FUtil.Request({
379
- method: 'GET',
380
- url: `/v2/resources/versions/detail`,
381
- params: params,
382
- });
383
- }
384
-
385
- // 查看资源版本列表
386
- interface getVersionListByResourceIDParamsType {
387
- resourceId: string;
388
- version?: string;
389
- projection?: string;
390
- sort?: string;
391
- }
392
-
393
- export function getVersionListByResourceID({
394
- resourceId,
395
- ...params
396
- }: getVersionListByResourceIDParamsType) {
397
- return FUtil.Request({
398
- method: 'GET',
399
- url: `/v2/resources/${resourceId}/versions`,
400
- params: params,
401
- });
402
- }
403
-
404
- // 批量查询资源版本列表
405
- interface GetVersionListParamsType {
406
- versionIds: string;
407
- projection?: string;
408
- }
409
-
410
- export function getVersionList({ ...params }: GetVersionListParamsType) {
411
- return FUtil.Request({
412
- method: 'GET',
413
- url: `/v2/resources/versions/list`,
414
- params: params,
415
- });
416
- }
417
-
418
- // 根据sha1查询版本列表 (查询文件对象所挂载的资源及版本)
419
- interface GetResourceVersionBySha1ParamsType {
420
- fileSha1: string;
421
- projection?: string;
422
- }
423
-
424
- export function getResourceVersionBySha1({
425
- fileSha1,
426
- ...params
427
- }: GetResourceVersionBySha1ParamsType) {
428
- return FUtil.Request({
429
- method: 'GET',
430
- url: `/v2/resources/files/${fileSha1}/versions`,
431
- params: params,
432
- });
433
- }
434
-
435
- // 根据sha1查询资源列表 (查询文件对象所挂载的资源)
436
- interface GetResourceBySha1ParamsType {
437
- fileSha1: string;
438
- projection?: string;
439
- }
440
-
441
- export function getResourceBySha1({
442
- fileSha1,
443
- ...params
444
- }: GetResourceBySha1ParamsType) {
445
- // return FUtil.Axios.get(`/v2/resources/files/${fileSha1}`, {
446
- // params,
447
- // });
448
- return FUtil.Request({
449
- method: 'GET',
450
- url: `/v2/resources/files/${fileSha1}`,
451
- params: params,
452
- });
453
- }
454
-
455
- // 更新资源版本信息
456
- interface UpdateResourceVersionInfoParamsType {
457
- version: string;
458
- resourceId: string;
459
- description?: string;
460
- customPropertyDescriptors?: {
461
- key: string;
462
- name: string;
463
- defaultValue: string;
464
- type: 'editableText' | 'readonlyText' | 'radio' | 'checkbox' | 'select';
465
- candidateItems?: string[];
466
- remark?: string;
467
- }[];
468
- resolveResources?: {
469
- resourceId: string;
470
- contracts: {
471
- policyId: string;
472
- }[];
473
- }[];
474
- inputAttrs: {
475
- key: string;
476
- value: string;
477
- }[];
478
- }
479
-
480
- export function updateResourceVersionInfo(
481
- params: UpdateResourceVersionInfoParamsType
482
- ) {
483
- // return FUtil.Axios.put(`/v2/resources/${params.resourceId}/versions/${params.version}`, params);
484
- return FUtil.Request({
485
- method: 'PUT',
486
- url: `/v2/resources/${params.resourceId}/versions/${params.version}`,
487
- data: params,
488
- });
489
- }
490
-
491
- // 保存或者更新资源版本草稿
492
- interface SaveVersionsDraftParamsType {
493
- resourceId: string;
494
- draftData: any;
495
- }
496
-
497
- export function saveVersionsDraft(params: SaveVersionsDraftParamsType) {
498
- // return FUtil.Axios.post(`/v2/resources/${params.resourceId}/versions/drafts`, params);
499
- return FUtil.Request({
500
- method: 'POST',
501
- url: `/v2/resources/${params.resourceId}/versions/drafts`,
502
- data: params,
503
- });
504
- }
505
-
506
- // 查看资源版本草稿
507
- interface LookDraftParamsType {
508
- resourceId: string;
509
- }
510
-
511
- export function lookDraft(params: LookDraftParamsType) {
512
- // return FUtil.Axios.get(`/v2/resources/${params.resourceId}/versions/drafts`);
513
- return FUtil.Request({
514
- method: 'GET',
515
- url: `/v2/resources/${params.resourceId}/versions/drafts`,
516
- params: params,
517
- });
518
- }
519
-
520
- // 删除资源版本草稿
521
- interface DeleteResourceDraftParamsType {
522
- resourceId: string;
523
- }
524
-
525
- export function deleteResourceDraft({
526
- resourceId,
527
- }: DeleteResourceDraftParamsType) {
528
- // return FUtil.Axios.post(`/v2/resources/${params.resourceId}/versions/drafts`, params);
529
- return FUtil.Request({
530
- method: 'DELETE',
531
- url: `/v2/resources/${resourceId}/versions/drafts`,
532
- // data: params,
533
- });
534
- }
535
-
536
- // 校验文件是否被引入资源
537
- interface ResourceIsUsedByOtherParamsType {
538
- fileSha1: string;
539
- }
540
-
541
- export function resourceIsUsedByOther(params: ResourceIsUsedByOtherParamsType) {
542
- // return FUtil.Axios.get(`/v2/resources/versions/isCanBeCreate`, {
543
- // params,
544
- // });
545
- return FUtil.Request({
546
- method: 'GET',
547
- url: `/v2/resources/versions/isCanBeCreate`,
548
- params: params,
549
- });
550
- }
551
-
552
- // 下载资源文件
553
- interface ResourcesDownloadParamsType {
554
- resourceId: string;
555
- version: string;
556
- }
557
-
558
- export function resourcesDownload(params: ResourcesDownloadParamsType) {
559
- return (window.location.href =
560
- FUtil.Format.completeUrlByDomain('api') +
561
- `/v2/resources/${params.resourceId}/versions/${params.version}/download`);
562
- // return request.get(`/v2/resources/${params.resourceId}/versions/${params.$version}/download`, {
563
- // responseType: 'arraybuffer',
564
- // });
565
- }
566
-
567
- // 批量查看合同覆盖的版本集
568
- interface BatchGetCoverageVersionsParamsType {
569
- resourceId: string;
570
- contractIds: string;
571
- }
572
-
573
- export function batchGetCoverageVersions({
574
- resourceId,
575
- ...params
576
- }: BatchGetCoverageVersionsParamsType) {
577
- // return FUtil.Axios.get(`/v2/resources/${resourceId}/contracts/coverageVersions`, {
578
- // params,
579
- // });
580
- return FUtil.Request({
581
- method: 'GET',
582
- url: `/v2/resources/${resourceId}/contracts/coverageVersions`,
583
- params: params,
584
- });
585
- }
586
-
587
- // 查询资源所解决的依赖集
588
- interface ResolveResourcesParamsType {
589
- resourceId: string;
590
- }
591
-
592
- interface CreateVersionReturnType extends CommonReturn {
593
- data: {
594
- resourceId: string;
595
- resourceName: string;
596
- versions: {
597
- version: string;
598
- versionId: string;
599
- contracts: {
600
- policyId: string;
601
- contractId: string;
602
- }[];
603
- }[];
604
- }[];
605
- }
606
-
607
- export function resolveResources(
608
- params: ResolveResourcesParamsType
609
- ): Promise<CreateVersionReturnType> {
610
- // return FUtil.Axios.get(`/v2/resources/${params.resourceId}/resolveResources`);
611
- return FUtil.Request({
612
- method: 'GET',
613
- url: `/v2/resources/${params.resourceId}/resolveResources`,
614
- // params: params,
615
- });
616
- }
617
-
618
- // 批量设置策略应用的版本
619
- interface BatchSetContractsParamsType {
620
- resourceId: string;
621
- subjects: {
622
- subjectId: string;
623
- versions: {
624
- version: string;
625
- policyId: string;
626
- operation: 0 | 1;
627
- }[];
628
- }[];
629
- }
630
-
631
- export function batchSetContracts({
632
- resourceId,
633
- ...params
634
- }: BatchSetContractsParamsType) {
635
- // return FUtil.Axios.put(`/v2/resources/${resourceId}/versions/batchSetContracts`, params);
636
- return FUtil.Request({
637
- method: 'PUT',
638
- url: `/v2/resources/${resourceId}/versions/batchSetContracts`,
639
- data: params,
640
- });
641
- }
642
-
643
- // 资源依赖循环性检查
644
- interface CycleDependencyCheckParamsType {
645
- resourceId: string;
646
- dependencies: {
647
- resourceId: string;
648
- versionRange: string;
649
- }[];
650
- }
651
-
652
- export function cycleDependencyCheck({
653
- resourceId,
654
- ...params
655
- }: CycleDependencyCheckParamsType) {
656
- // return FUtil.Axios.post(`/v2/resources/${resourceId}/versions/cycleDependencyCheck`, params);
657
- return FUtil.Request({
658
- method: 'POST',
659
- url: `/v2/resources/${resourceId}/versions/cycleDependencyCheck`,
660
- data: params,
661
- });
662
- }
663
-
664
- // 查看资源关系树
665
- interface RelationTreeParamsType {
666
- resourceId: string;
667
- version?: string;
668
- versionRange?: string;
669
- }
670
-
671
- export function relationTree({
672
- resourceId,
673
- ...params
674
- }: RelationTreeParamsType) {
675
- // return FUtil.Axios.get(`/v2/resources/${resourceId}/relationTree`, {
676
- // params,
677
- // });
678
- return FUtil.Request({
679
- method: 'GET',
680
- url: `/v2/resources/${resourceId}/relationTree`,
681
- params: params,
682
- });
683
- }
684
-
685
- // 查看含授权的资源关系树
686
- interface RelationTreeAuthParamsType {
687
- resourceId: string;
688
- version?: string;
689
- versionRange?: string;
690
- }
691
-
692
- export function relationTreeAuth({
693
- resourceId,
694
- ...params
695
- }: RelationTreeAuthParamsType) {
696
- return FUtil.Request({
697
- method: 'GET',
698
- url: `/v2/auths/resources/${resourceId}/relationTreeAuth`,
699
- params: params,
700
- });
701
- }
702
-
703
- // 查看资源创建数量
704
- interface ResourcesCountParamsType {
705
- userIds: string;
706
- status?: 0 | 1 | 2 | 3; // 0:下架 1:上架 2:冻结(冻结时处于下架状态) 3:冻结(冻结时处于上架状态)
707
- }
708
-
709
- export function resourcesCount({ ...params }: ResourcesCountParamsType) {
710
- return FUtil.Request({
711
- method: 'GET',
712
- url: `/v2/resources/count`,
713
- params: params,
714
- });
715
- }
716
-
717
- // 批量查询资源授权结果
718
- interface BatchAuthParamsType {
719
- resourceIds: string;
720
- versions?: string;
721
- versionRanges?: string;
722
- }
723
-
724
- export function batchAuth({ ...params }: BatchAuthParamsType) {
725
- return FUtil.Request({
726
- method: 'GET',
727
- url: `/v2/auths/resources/batchAuth/results`,
728
- params: params,
729
- });
730
- }
731
-
732
- // 批量查询资源授权结果
733
- interface ResourcesRecommendParamsType {
734
- recommendType: 1 | 2; // 1: 推荐主题 2:占位主题
735
- }
736
-
737
- export function resourcesRecommend({
738
- ...params
739
- }: ResourcesRecommendParamsType) {
740
- return FUtil.Request({
741
- method: 'GET',
742
- url: `/v2/resources/recommend`,
743
- params: params,
744
- });
745
- }
746
-
747
- // 根据资源类型查看推荐的标签
748
- interface AvailableTagsParamsType {
749
- resourceTypeCode: string;
750
- }
751
-
752
- export function availableTags({ ...params }: AvailableTagsParamsType) {
753
- return FUtil.Request({
754
- method: 'GET',
755
- url: `/v2/resources/tags/availableTags`,
756
- params: params,
757
- });
758
- }
759
-
760
- // 列出资源类型分组排序
761
- interface ResourceTypesParamsType {
762
- codeOrName?: string;
763
- category?: 1 | 2; // 种类 1:基础资源类型 2:自定义资源类型
764
- isMine?: boolean;
765
- status?: 0 | 1;
766
- supportCreateBatch?: 1 | 2;
767
- subjectType?: 1 | 4 | 5;
768
- }
769
-
770
- export function resourceTypes({ ...params }: ResourceTypesParamsType = {}) {
771
- return FUtil.Request({
772
- method: 'GET',
773
- url: `/v2/resources/types/listSimpleByGroup`,
774
- params: params,
775
- });
776
- }
777
-
778
- // 简单根据父类型列出资源类型
779
- interface ListSimpleByParentCodeParamsType {
780
- parentCode: string;
781
- name?: string;
782
- category?: 1 | 2; // 种类 1:基础资源类型 2:自定义资源类型
783
- excludeParentCode?: boolean;
784
- isTerminate?: boolean;
785
- nameChain?: string;
786
- subjectType?: 1 | 4 | 5;
787
- supportCreateBatch?: 1 | 2;
788
- status?: 0 | 1;
789
- }
790
-
791
- export function ListSimpleByParentCode({
792
- ...params
793
- }: ListSimpleByParentCodeParamsType) {
794
- return FUtil.Request({
795
- method: 'GET',
796
- url: `/v2/resources/types/listSimpleByParentCode`,
797
- params: params,
798
- });
799
- }
800
-
801
- // 根据编号取资源类型
802
- interface GetResourceTypeInfoByCodeParamsType {
803
- code: string;
804
- }
805
-
806
- export function getResourceTypeInfoByCode({
807
- ...params
808
- }: GetResourceTypeInfoByCodeParamsType) {
809
- return FUtil.Request({
810
- method: 'GET',
811
- url: `/v2/resources/types/getInfoByCode`,
812
- params: params,
813
- });
814
- }
815
-
816
- //
817
- interface GetResourceAttrListSimpleParamsType {}
818
-
819
- export function getResourceAttrListSimple({
820
- ...params
821
- }: GetResourceAttrListSimpleParamsType) {
822
- return FUtil.Request({
823
- method: 'GET',
824
- url: `/v2/resources/attrs/listSimple`,
825
- params: params,
826
- });
827
- }
828
-
829
- interface ListSimple4RecentlyParamsType {}
830
-
831
- export function listSimple4Recently({
832
- ...params
833
- }: ListSimple4RecentlyParamsType = {}) {
834
- return FUtil.Request({
835
- method: 'GET',
836
- url: `/v2/resources/types/listSimple4Recently`,
837
- params: params,
838
- });
839
- }
840
-
841
- // 通过key取资源属性
842
- interface GetAttrsInfoByKeyParamsType {
843
- key: string;
844
- }
845
-
846
- export function getAttrsInfoByKey({ ...params }: GetAttrsInfoByKeyParamsType) {
847
- return FUtil.Request({
848
- method: 'GET',
849
- url: `/v2/resources/attrs/getInfoByKey`,
850
- params: params,
851
- });
852
- }
853
-
854
- // 取可用的资源名称
855
- interface GenerateResourceNamesParamsType {
856
- resourceNames: string[];
857
- }
858
-
859
- export function generateResourceNames({
860
- resourceNames,
861
- }: GenerateResourceNamesParamsType) {
862
- return FUtil.Request({
863
- method: 'POST',
864
- url: `/v2/resources/generateResourceNames`,
865
- data: {
866
- resourceNames,
867
- },
868
- });
869
- }
870
-
871
- // 更新资源合集版本
872
- interface UpdateCollectionParamsType {
873
- resourceId: string;
874
- description?: string;
875
- // serializeStatus?: 0 | 1;
876
- customPropertyDescriptors?: {
877
- key: string;
878
- defaultValue: string;
879
- type: string;
880
- candidateItems?: string[];
881
- remark?: string;
882
- }[];
883
- // resolveResources?: {
884
- // resourceId: string;
885
- // contracts: {
886
- // policyId: string;
887
- // }[];
888
- // }[];
889
- // optionalResolveResources?: {
890
- // resourceId: string;
891
- // contracts: {
892
- // policyId: string;
893
- // }[]
894
- // }[];
895
- // addCollectionItems?: {
896
- // resourceId: string;
897
- // itemTitle: string;
898
- // }[];
899
- catalogueProperty?: {
900
- collection_item_no_display?:
901
- | 'collection_item_no_display_show'
902
- | 'collection_item_no_display_hide';
903
- collection_item_image_display?:
904
- | 'collection_item_image_display_show'
905
- | 'collection_item_image_display_hide';
906
- collection_item_descr_display?:
907
- | 'collection_item_descr_display_show'
908
- | 'collection_item_descr_display_hide';
909
- collection_view?: 'collection_view_list' | 'collection_view_card';
910
- };
911
- isMergeCatalogueDraft?: 0 | 1;
912
- inputAttrs?: {
913
- key: string;
914
- value: string;
915
- }[];
916
-
917
- // dependencies?: {
918
- // resourceId: string;
919
- // versionRange: string;
920
- // }[];
921
- dependencies?: {
922
- resourceId: string;
923
- versionRange: string;
924
- }[];
925
- baseUpcastResources?: {
926
- resourceId: string;
927
- }[];
928
- batchSignContracts?: {
929
- resourceId: string;
930
- policyIds: string[];
931
- }[];
932
- authExcludedItems: {
933
- resourceId: string;
934
- excludedType: 'contractId' | 'policyId';
935
- excludedValue: string;
936
- }[];
937
- }
938
-
939
- export function updateCollection({
940
- resourceId,
941
- ...params
942
- }: UpdateCollectionParamsType) {
943
- return FUtil.Request({
944
- method: 'PUT',
945
- url: `/v2/resources/catalogue/${resourceId}`,
946
- data: params,
947
- });
948
- }
949
-
950
- // 批量删除合集资源单品
951
- interface deleteCollectionUnitResourcesParamsType {
952
- resourceId: string;
953
- removeCollectionItemIds: string[];
954
- }
955
-
956
- export function deleteCollectionUnitResource({
957
- resourceId,
958
- removeCollectionItemIds,
959
- }: deleteCollectionUnitResourcesParamsType) {
960
- return FUtil.Request({
961
- method: 'DELETE',
962
- url: `/v2/resources/catalogue/${resourceId}?removeCollectionItemIds=${removeCollectionItemIds.join(
963
- ','
964
- )}`,
965
- // data: params,
966
- });
967
- }
968
-
969
- // 获取合集资源的单品列表
970
- interface GetCollectionItemsParamsType {
971
- resourceId: string;
972
- skip?: number;
973
- limit?: number;
974
- sortField?: string;
975
- sortType?: 1 | -1;
976
- keywords?: string;
977
- isLoadLatestVersionInfo?: 0 | 1;
978
- }
979
-
980
- export function getCollectionItems({
981
- resourceId,
982
- ...params
983
- }: GetCollectionItemsParamsType) {
984
- return FUtil.Request({
985
- method: 'GET',
986
- url: `/v2/resources/catalogue/${resourceId}/items`,
987
- params: params,
988
- });
989
- }
990
-
991
- // 获取合集资源的单品列表(草稿)
992
- interface GetCollectionItems_Draft_ParamsType {
993
- resourceId: string;
994
- skip?: number;
995
- limit?: number;
996
- sortField?: string;
997
- sortType?: 1 | -1;
998
- keywords?: string;
999
- isLoadLatestVersionInfo?: 0 | 1;
1000
- }
1001
-
1002
- export function getCollectionItems_Draft({
1003
- resourceId,
1004
- ...params
1005
- }: GetCollectionItems_Draft_ParamsType) {
1006
- return FUtil.Request({
1007
- method: 'GET',
1008
- url: `/v2/resources/catalogues/drafts/${resourceId}/items`,
1009
- params: params,
1010
- });
1011
- }
1012
-
1013
- // 设置合集资源的单品排序序号
1014
- interface SetCollectionItemSortParamsType {
1015
- resourceId: string;
1016
- itemId: string;
1017
- targetSortId: number;
1018
- }
1019
-
1020
- export function setCollectionItemSort({
1021
- resourceId,
1022
- ...params
1023
- }: SetCollectionItemSortParamsType) {
1024
- return FUtil.Request({
1025
- method: 'PUT',
1026
- url: `/v2/resources/catalogue/${resourceId}/manualSort`,
1027
- data: params,
1028
- });
1029
- }
1030
-
1031
- // 重置合集资源的单品排序序号
1032
- interface ReorderCollectionItemsSortParamsType {
1033
- resourceId: string;
1034
- sortField: string;
1035
- sortType: 1 | -1;
1036
- }
1037
-
1038
- export function reorderCollectionItemsSort({
1039
- resourceId,
1040
- ...params
1041
- }: ReorderCollectionItemsSortParamsType) {
1042
- return FUtil.Request({
1043
- method: 'PUT',
1044
- url: `/v2/resources/catalogue/${resourceId}/reorder`,
1045
- data: params,
1046
- });
1047
- }
1048
-
1049
- // 查看资源是否在单品目录中存在
1050
- interface CheckExistCollectionItemsParamsType {
1051
- resourceId: string;
1052
- resourceIds: string;
1053
- }
1054
-
1055
- export function checkExistCollectionItems({
1056
- resourceId,
1057
- ...params
1058
- }: CheckExistCollectionItemsParamsType) {
1059
- return FUtil.Request({
1060
- method: 'GET',
1061
- url: `/v2/resources/catalogue/${resourceId}/items/checkExists`,
1062
- params: params,
1063
- });
1064
- }
1065
-
1066
- // 批量查询单品在资源侧的授权
1067
- interface GetCollectionItemsAuthParamsType {
1068
- resourceId: string;
1069
- itemIds: string;
1070
- }
1071
-
1072
- export function getCollectionItemsAuth({
1073
- resourceId,
1074
- ...params
1075
- }: GetCollectionItemsAuthParamsType) {
1076
- return FUtil.Request({
1077
- method: 'GET',
1078
- url: `/v2/auths/resources/${resourceId}/items/batchAuth`,
1079
- params: params,
1080
- });
1081
- }
1082
-
1083
- // 批量分组获取合集资源的单品列表
1084
- interface BatchResourceItemsParamsType {
1085
- resourceIds: string;
1086
- limit?: number;
1087
- sortField?: string;
1088
- sortType?: 1 | -1;
1089
- isLoadItemResourceDetailInfo?: 0 | 1;
1090
- isLoadLatestVersionInfo?: 0 | 1;
1091
- }
1092
-
1093
- export function batchResourceItems({
1094
- ...params
1095
- }: BatchResourceItemsParamsType) {
1096
- return FUtil.Request({
1097
- method: 'GET',
1098
- url: `/v2/resources/catalogue/items/batch/list`,
1099
- params: params,
1100
- });
1101
- }
1102
-
1103
- // 批量分组获取合集资源的单品列表(草稿)
1104
- interface BatchResourceItems_Draft_ParamsType {
1105
- resourceIds: string;
1106
- limit?: number;
1107
- sortField?: string;
1108
- sortType?: 1 | -1;
1109
- isLoadItemResourceDetailInfo?: 0 | 1;
1110
- }
1111
-
1112
- export function batchResourceItems_Draft({
1113
- ...params
1114
- }: BatchResourceItems_Draft_ParamsType) {
1115
- return FUtil.Request({
1116
- method: 'GET',
1117
- url: `/v2/resources/catalogues/drafts/items/batch/list`,
1118
- params: params,
1119
- });
1120
- }
1121
-
1122
- // 查看合集更新日志分页列表
1123
- interface GetCollectionUpdateLogsParamsType {
1124
- resourceId: string;
1125
- skip?: number;
1126
- limit?: number;
1127
- sortType?: 1 | -1;
1128
- }
1129
-
1130
- export function getCollectionUpdateLogs({
1131
- resourceId,
1132
- ...params
1133
- }: GetCollectionUpdateLogsParamsType) {
1134
- return FUtil.Request({
1135
- method: 'GET',
1136
- url: `/v2/resources/catalogue/${resourceId}/updateLogs`,
1137
- params: params,
1138
- });
1139
- }
1140
-
1141
- // 获取合集单品自动收录规则
1142
- interface GetCollectionCollectRulesParamsType {
1143
- resourceId: string;
1144
- }
1145
-
1146
- export function getCollectionCollectRules({
1147
- resourceId,
1148
- }: GetCollectionCollectRulesParamsType) {
1149
- return FUtil.Request({
1150
- method: 'GET',
1151
- url: `/v2/resources/catalogue/${resourceId}/items/collectRules`,
1152
- // params: params,
1153
- });
1154
- }
1155
-
1156
- // 创建或更新合集单品自动收录规则
1157
- interface SetCollectRulesParamsType {
1158
- resourceId: string;
1159
- serializeStatus?: 0 | 1;
1160
- status: 0 | 1;
1161
- conditionType: 1 | 2;
1162
- filterConditions: {
1163
- key: 'resourceTitle' | 'resourceTypeCode' | 'authIdentity';
1164
- limitOperatorType:
1165
- | 'INCLUDES'
1166
- | 'NOT_INCLUDES'
1167
- | 'STARTS_WITH'
1168
- | 'ENDS_WITH'
1169
- | 'EQUAL'
1170
- | 'NOT_EQUAL';
1171
- value: string;
1172
- }[];
1173
- }
1174
-
1175
- export function setCollectRules({
1176
- resourceId,
1177
- ...params
1178
- }: SetCollectRulesParamsType) {
1179
- return FUtil.Request({
1180
- method: 'POST',
1181
- url: `/v2/resources/catalogue/${resourceId}/items/collectRules`,
1182
- data: params,
1183
- });
1184
- }
1185
-
1186
- // 批量更新同合集下的单品信息
1187
- interface SetItemsTitleParamsType {
1188
- resourceId: string;
1189
- data: {
1190
- itemId: string;
1191
- itemTitle?: string;
1192
- authExcludedItems?: {
1193
- resourceId: string;
1194
- excludedType: 'contractId' | 'policyId';
1195
- excludedValue: string;
1196
- }[];
1197
- }[];
1198
- }
1199
-
1200
- export function setItemsTitle({ resourceId, data }: SetItemsTitleParamsType) {
1201
- return FUtil.Request({
1202
- method: 'PUT',
1203
- url: `/v2/resources/catalogue/${resourceId}/items`,
1204
- data: data,
1205
- });
1206
- }
1207
-
1208
- // 批量删除合集资源单品(草稿)
1209
- interface deleteCollectionItems_Draft_ParamsType {
1210
- resourceId: string;
1211
- removeCollectionItemIds: string[];
1212
- }
1213
-
1214
- export function deleteCollectionItems_Draft({
1215
- resourceId,
1216
- removeCollectionItemIds,
1217
- }: deleteCollectionItems_Draft_ParamsType) {
1218
- return FUtil.Request({
1219
- method: 'DELETE',
1220
- url: `/v2/resources/catalogues/drafts/${resourceId}/items?removeCollectionItemIds=${removeCollectionItemIds.join(
1221
- ','
1222
- )}`,
1223
- // data: params,
1224
- });
1225
- }
1226
-
1227
- // 设置合集资源的单品排序序号(草稿)
1228
- interface SetCollectionItemsSortID_Draft_ParamsType {
1229
- resourceId: string;
1230
- data: {
1231
- itemIds: string[];
1232
- targetSortId: number;
1233
- };
1234
- }
1235
-
1236
- export function setCollectionItemsSortID_Draft({
1237
- resourceId,
1238
- data,
1239
- }: SetCollectionItemsSortID_Draft_ParamsType) {
1240
- return FUtil.Request({
1241
- method: 'PUT',
1242
- url: `/v2/resources/catalogues/drafts/${resourceId}/manualSort`,
1243
- data: data,
1244
- });
1245
- }
1246
-
1247
- // 重置合集资源的单品排序序号(草稿)
1248
- interface ReorderCollectionItems_Draft_ParamsType {
1249
- resourceId: string;
1250
- sortField: 'createDate' | 'itemTitle' | 'sortId' | 'resourceUpdateDate';
1251
- sortType: -1 | 1;
1252
- }
1253
-
1254
- export function reorderCollectionItems_Draft({
1255
- resourceId,
1256
- ...params
1257
- }: ReorderCollectionItems_Draft_ParamsType) {
1258
- return FUtil.Request({
1259
- method: 'PUT',
1260
- url: `/v2/resources/catalogues/drafts/${resourceId}/reorder`,
1261
- data: params,
1262
- });
1263
- }
1264
-
1265
- // 查看资源是否在单品目录中存在(草稿)
1266
- interface ResourceIsExistInItems_Draft_ParamsType {
1267
- resourceId: string;
1268
- resourceIds: string;
1269
- }
1270
-
1271
- export function resourceIsExistInItems_Draft({
1272
- resourceId,
1273
- ...params
1274
- }: ResourceIsExistInItems_Draft_ParamsType) {
1275
- return FUtil.Request({
1276
- method: 'GET',
1277
- url: `/v2/resources/catalogues/drafts/${resourceId}/items/checkExists`,
1278
- params: params,
1279
- });
1280
- }
1281
-
1282
- // 批量更新同合集下的单品信息(草稿)
1283
- interface UpdateCollectionItemsInfo_Draft_ParamsType {
1284
- resourceId: string;
1285
- data: {
1286
- itemId: string;
1287
- itemTitle: string;
1288
- }[];
1289
- }
1290
-
1291
- export function updateCollectionItemsInfo_Draft({
1292
- resourceId,
1293
- data,
1294
- }: UpdateCollectionItemsInfo_Draft_ParamsType) {
1295
- return FUtil.Request({
1296
- method: 'PUT',
1297
- // url: `/v2/resources/catalogue/${resourceId}/items`,
1298
- url: `/v2/resources/catalogues/drafts/${resourceId}/items`,
1299
- data: data,
1300
- });
1301
- }
1302
-
1303
- // 更新单品授权方案(草稿)
1304
- interface UpdateCollectionItemAuthorization_Draft_ParamsType {
1305
- resourceId: string;
1306
- itemId: string;
1307
- // resolveResources: {
1308
- // resourceId: string;
1309
- // contracts: {
1310
- // policyId: string;
1311
- // }[];
1312
- // }[];
1313
- }
1314
-
1315
- export function updateCollectionItemAuthorization_Draft({
1316
- resourceId,
1317
- itemId,
1318
- ...data
1319
- }: UpdateCollectionItemAuthorization_Draft_ParamsType) {
1320
- return FUtil.Request({
1321
- method: 'PUT',
1322
- // url: `/v2/resources/catalogues/${resourceId}/items/${itemId}`,
1323
- url: `/v2/resources/catalogues/drafts/${resourceId}/items/${itemId}`,
1324
- data: data,
1325
- });
1326
- }
1327
-
1328
- // 批量新增合集资源单品(草稿)
1329
- interface AddResourceItems_Draft_ParamsType {
1330
- resourceId: string;
1331
- addCollectionItems: {
1332
- resourceId: string;
1333
- itemTitle?: string;
1334
- // resolveResources?: {
1335
- // resourceId: string;
1336
- // contracts: {
1337
- // policyId: string;
1338
- // }[];
1339
- // }[];
1340
- authExcludedItems?: {
1341
- resourceId: string;
1342
- excludedType: 'contractId' | 'policyId';
1343
- excludedValue: string;
1344
- }[];
1345
- batchSignContracts?: {
1346
- resourceId: string;
1347
- policyIds: string[];
1348
- }[];
1349
- }[];
1350
- isPublish?: 1 | 0;
1351
- }
1352
-
1353
- export function addResourceItems_Draft({
1354
- resourceId,
1355
- ...params
1356
- }: AddResourceItems_Draft_ParamsType) {
1357
- return FUtil.Request({
1358
- method: 'POST',
1359
- url: `/v2/resources/catalogues/drafts/${resourceId}/items`,
1360
- data: params,
1361
- });
1362
- }
1363
-
1364
- // 批量查询草稿中的单品在资源侧的授权
1365
- interface GetCollectionItemsAuth_Draft_ParamsType {
1366
- resourceId: string;
1367
- itemIds: string;
1368
- }
1369
-
1370
- export function getCollectionItemsAuth_Draft({
1371
- resourceId,
1372
- ...params
1373
- }: GetCollectionItemsAuth_Draft_ParamsType) {
1374
- return FUtil.Request({
1375
- method: 'GET',
1376
- url: `/v2/resources/catalogues/drafts/${resourceId}/items/batchAuth`,
1377
- params: params,
1378
- });
1379
- }
1
+ import FUtil from '../utils';
2
+ import { CommonReturn } from './tools';
3
+
4
+ // interface IResourceInfo {
5
+ // baseUpcastResources: {
6
+ // resourceId: string;
7
+ // resourceName: string;
8
+ // }[],
9
+ // coverImages: string[],
10
+ // createDate: string;
11
+ // intro: string;
12
+ // latestVersion: string;
13
+ // policies: {
14
+ // policyId: string;
15
+ // policyName: string;
16
+ // status: 0 | 1;
17
+ // }[];
18
+ // resourceId: string;
19
+ // resourceName: string;
20
+ // resourceTitle: string;
21
+ // resourceType: string[];
22
+ // resourceVersions: {
23
+ // createDate: string;
24
+ // version: string;
25
+ // versionId: string;
26
+ // }[];
27
+ // status: 0 | 1 | 2 | 4; // 0:待发行(初始状态) 1:上架 2:冻结 4:下架(也叫待上架)
28
+ // tags: string[];
29
+ // updateDate: string;
30
+ // userId: number;
31
+ // username: string;
32
+ // operationType: number;
33
+ // }
34
+
35
+ // 创建资源
36
+ export interface CreateParamsType {
37
+ name: string;
38
+ subjectType?: 1 | 4; // 标的物类型(1:普通资源 4:合集资源) 默认是1
39
+ resourceTitle?: string;
40
+ // resourceType: string[]
41
+ resourceTypeCode: string;
42
+ resourceTypeName?: string;
43
+ policies?: {
44
+ policyName: string;
45
+ policyText: string;
46
+ status?: 0 | 1;
47
+ }[];
48
+ coverImages?: string[];
49
+ intro?: string;
50
+ tags?: string[];
51
+ }
52
+
53
+ export function create(params: CreateParamsType) {
54
+ return FUtil.Request({
55
+ method: 'POST',
56
+ url: `/v2/resources`,
57
+ data: params,
58
+ });
59
+ }
60
+
61
+ // 批量创建资源
62
+ export interface CreateBatchParamsType {
63
+ resourceTypeCode: string;
64
+ resourceTypeName?: string;
65
+ createResourceObjects: {
66
+ name: string;
67
+ resourceTitle?: string;
68
+ policies?: {
69
+ policyName: string;
70
+ policyText: string;
71
+ status?: 1 | 0;
72
+ }[];
73
+ coverImages?: string[];
74
+ intro?: string;
75
+ tags?: string[];
76
+
77
+ version: string;
78
+ fileSha1: string;
79
+ filename: string;
80
+ description?: string;
81
+ dependencies?: {
82
+ resourceId: string;
83
+ versionRange: string;
84
+ }[];
85
+ customPropertyDescriptors?: {
86
+ key: string;
87
+ name: string;
88
+ defaultValue: string;
89
+ type: 'editableText' | 'readonlyText' | 'radio' | 'checkbox' | 'select';
90
+ candidateItems?: string[];
91
+ remark?: string;
92
+ }[];
93
+ baseUpcastResources?: {
94
+ resourceId: string;
95
+ }[];
96
+ batchSignContracts?: {
97
+ resourceId: string;
98
+ // resourceName: string;
99
+ policyIds: string[];
100
+ // subjectType: 'resource' | '';
101
+ subjectType: string;
102
+ }[];
103
+ // resolveResources: {
104
+ // resourceId: string;
105
+ // contracts: {
106
+ // policyId: string;
107
+ // }[];
108
+ // }[];
109
+ inputAttrs?: {
110
+ key: string;
111
+ value: string;
112
+ }[];
113
+ }[];
114
+ }
115
+
116
+ export function createBatch(params: CreateBatchParamsType) {
117
+ return FUtil.Request({
118
+ method: 'POST',
119
+ url: `/v2/resources/createBatch`,
120
+ data: params,
121
+ });
122
+ }
123
+
124
+ // 更新资源信息
125
+ interface UpdateParamsType {
126
+ resourceId: string;
127
+ status?: 0 | 1;
128
+ resourceTitle?: string;
129
+ intro?: string;
130
+ tags?: string[];
131
+ coverImages?: string[];
132
+ addPolicies?: {
133
+ policyName: string;
134
+ policyText: string;
135
+ status?: 0 | 1; // 1:上线 0:下线
136
+ }[];
137
+ updatePolicies?: {
138
+ policyId: string;
139
+ status: 0 | 1; // 0:下线策略 1:上线策略
140
+ }[];
141
+ }
142
+
143
+ export function update(params: UpdateParamsType) {
144
+ return FUtil.Request({
145
+ method: 'PUT',
146
+ url: `/v2/resources/${params.resourceId}`,
147
+ data: params,
148
+ });
149
+ }
150
+
151
+ // 批量更新资源信息
152
+ interface BatchUpdateParamsType {
153
+ resourceIds: string[];
154
+ status?: 1 | 4;
155
+ // resourceTitle?: string;
156
+ // intro?: string;
157
+ // tags?: string[];
158
+ // coverImages?: string[];
159
+ addPolicies?: {
160
+ policyName: string;
161
+ policyText: string;
162
+ status?: 0 | 1; // 1:上线 0:下线
163
+ }[];
164
+ // updatePolicies?: {
165
+ // policyId: string;
166
+ // status: 0 | 1; // 0:下线策略 1:上线策略
167
+ // }[];
168
+ }
169
+
170
+ export function batchUpdate(params: BatchUpdateParamsType) {
171
+ return FUtil.Request({
172
+ method: 'PUT',
173
+ url: `/v2/resources/updateBatch`,
174
+ data: params,
175
+ });
176
+ }
177
+
178
+ // 查看资源分页列表
179
+ interface ListParamsType {
180
+ skip?: number;
181
+ limit?: number;
182
+ keywords?: string;
183
+ resourceType?: string;
184
+ resourceTypeCode?: string;
185
+ resourceTypeCategory?: 1 | 2; // 资源类型分类,1:基础类型,2:自定义类型,其实只有2时生效,生效时,resourceTypeCode为父类类型
186
+ omitResourceType?: string;
187
+ isSelf?: 0 | 1;
188
+ userId?: number;
189
+ status?: 0 | 1 | 2 | 4; // 分别是 0:待发行(初始状态) 1:上架 2:冻结 4:下架(也叫待上架)
190
+ isLoadPolicyInfo?: 0 | 1;
191
+ isLoadLatestVersionInfo?: 0 | 1;
192
+ isLoadFreezeReason?: 0 | 1;
193
+ projection?: string;
194
+ startCreateDate?: string;
195
+ endCreateDate?: string;
196
+ tags?: string;
197
+ sort?: string;
198
+ // startResourceId?: string;
199
+ operationCategoryCode?: string;
200
+ operationTypes?: string;
201
+ subjectType?: 1 | 4;
202
+ }
203
+
204
+ // interface ListReturnType extends CommonReturn {
205
+ // data: IResourceInfo[];
206
+ // }
207
+
208
+ export function list(params: ListParamsType) {
209
+ return FUtil.Request({
210
+ method: 'GET',
211
+ url: `/v2/resources`,
212
+ params: params,
213
+ });
214
+ }
215
+
216
+ // 查看单个资源详情
217
+ interface InfoParamsType {
218
+ resourceIdOrName: string;
219
+ isLoadPolicyInfo?: 0 | 1;
220
+ isTranslate?: 0 | 1;
221
+ isLoadLatestVersionInfo?: 0 | 1;
222
+ projection?: string;
223
+ isLoadFreezeReason?: 0 | 1;
224
+ }
225
+
226
+ // interface InfoReturnType extends CommonReturn {
227
+ // data: IResourceInfo
228
+ // }
229
+
230
+ export function info({ resourceIdOrName, ...params }: InfoParamsType) {
231
+ // : Promise<InfoReturnType>
232
+ return FUtil.Request({
233
+ method: 'GET',
234
+ url: `/v2/resources/${encodeURIComponent(resourceIdOrName)}`,
235
+ params: params,
236
+ });
237
+ }
238
+
239
+ // 批量查询资源列表
240
+ interface BatchInfoParamsType {
241
+ resourceIds?: string;
242
+ resourceNames?: string;
243
+ isLoadPolicyInfo?: 0 | 1;
244
+ isTranslate?: 0 | 1;
245
+ isLoadLatestVersionInfo?: 0 | 1;
246
+ projection?: string;
247
+ isLoadFreezeReason?: 0 | 1;
248
+ }
249
+
250
+ // interface BatchInfoReturnType extends CommonReturn {
251
+ // data: IResourceInfo[];
252
+ // }
253
+
254
+ export function batchInfo(params: BatchInfoParamsType) {
255
+ // : Promise<BatchInfoReturnType>
256
+ return FUtil.Request({
257
+ method: 'GET',
258
+ url: `/v2/resources/list`,
259
+ params: params,
260
+ });
261
+ }
262
+
263
+ // 查看资源的依赖树
264
+ interface DependencyTreeParamsType {
265
+ resourceId: string;
266
+ version?: string;
267
+ maxDeep?: string;
268
+ omitFields?: string;
269
+ isContainRootNode?: boolean;
270
+ }
271
+
272
+ export function dependencyTree({
273
+ resourceId,
274
+ ...params
275
+ }: DependencyTreeParamsType) {
276
+ return FUtil.Request({
277
+ method: 'GET',
278
+ url: `/v2/resources/${resourceId}/dependencyTree`,
279
+ params: params,
280
+ });
281
+ }
282
+
283
+ // 查看资源的授权树
284
+ interface AuthTreeParamsType {
285
+ resourceId: string;
286
+ version?: string;
287
+ }
288
+
289
+ export function authTree({ resourceId, ...params }: AuthTreeParamsType) {
290
+ return FUtil.Request({
291
+ method: 'GET',
292
+ url: `/v2/resources/${resourceId}/authTree`,
293
+ params: params,
294
+ });
295
+ }
296
+
297
+ // 创建资源版本
298
+ interface CreateVersionParamsType {
299
+ resourceId: string;
300
+ version: string;
301
+ fileSha1: string;
302
+ filename: string;
303
+ description?: string;
304
+ customPropertyDescriptors?: {
305
+ key: string;
306
+ name: string;
307
+ defaultValue: string;
308
+ type: 'editableText' | 'readonlyText' | 'radio' | 'checkbox' | 'select';
309
+ candidateItems?: string[];
310
+ remark?: string;
311
+ }[];
312
+ // resolveResources: {
313
+ // resourceId: string;
314
+ // contracts: {
315
+ // policyId: string;
316
+ // }[];
317
+ // }[];
318
+ inputAttrs?: {
319
+ key: string;
320
+ value: string;
321
+ }[];
322
+
323
+ dependencies?: {
324
+ resourceId: string;
325
+ versionRange: string;
326
+ }[];
327
+ baseUpcastResources?: {
328
+ resourceId: string;
329
+ }[];
330
+ batchSignContracts?: {
331
+ resourceId: string;
332
+ policyIds: string[];
333
+ }[];
334
+ authExcludedItems: {
335
+ resourceId: string;
336
+ excludedType: 'contractId' | 'policyId';
337
+ excludedValue: string;
338
+ }[];
339
+ }
340
+
341
+ export function createVersion({
342
+ resourceId,
343
+ ...params
344
+ }: CreateVersionParamsType) {
345
+ // return FUtil.Axios.post(`/v2/resources/${resourceId}/versions`, params);
346
+ return FUtil.Request({
347
+ method: 'POST',
348
+ url: `/v2/resources/${resourceId}/versions`,
349
+ data: params,
350
+ });
351
+ }
352
+
353
+ // 查看资源版本信息
354
+ interface ResourceVersionInfo1ParamsType {
355
+ resourceId: string;
356
+ version: string;
357
+ projection?: string;
358
+ }
359
+
360
+ interface ResourceVersionInfo2ParamsType {
361
+ versionId: string;
362
+ projection?: string;
363
+ }
364
+
365
+ export function resourceVersionInfo1({
366
+ resourceId,
367
+ version,
368
+ ...params
369
+ }: ResourceVersionInfo1ParamsType) {
370
+ return FUtil.Request({
371
+ method: 'GET',
372
+ url: `/v2/resources/${resourceId}/versions/${version}`,
373
+ params: params,
374
+ });
375
+ }
376
+
377
+ export function resourceVersionInfo2(params: ResourceVersionInfo2ParamsType) {
378
+ return FUtil.Request({
379
+ method: 'GET',
380
+ url: `/v2/resources/versions/detail`,
381
+ params: params,
382
+ });
383
+ }
384
+
385
+ // 查看资源版本列表
386
+ interface getVersionListByResourceIDParamsType {
387
+ resourceId: string;
388
+ version?: string;
389
+ projection?: string;
390
+ sort?: string;
391
+ }
392
+
393
+ export function getVersionListByResourceID({
394
+ resourceId,
395
+ ...params
396
+ }: getVersionListByResourceIDParamsType) {
397
+ return FUtil.Request({
398
+ method: 'GET',
399
+ url: `/v2/resources/${resourceId}/versions`,
400
+ params: params,
401
+ });
402
+ }
403
+
404
+ // 批量查询资源版本列表
405
+ interface GetVersionListParamsType {
406
+ versionIds: string;
407
+ projection?: string;
408
+ }
409
+
410
+ export function getVersionList({ ...params }: GetVersionListParamsType) {
411
+ return FUtil.Request({
412
+ method: 'GET',
413
+ url: `/v2/resources/versions/list`,
414
+ params: params,
415
+ });
416
+ }
417
+
418
+ // 根据sha1查询版本列表 (查询文件对象所挂载的资源及版本)
419
+ interface GetResourceVersionBySha1ParamsType {
420
+ fileSha1: string;
421
+ projection?: string;
422
+ }
423
+
424
+ export function getResourceVersionBySha1({
425
+ fileSha1,
426
+ ...params
427
+ }: GetResourceVersionBySha1ParamsType) {
428
+ return FUtil.Request({
429
+ method: 'GET',
430
+ url: `/v2/resources/files/${fileSha1}/versions`,
431
+ params: params,
432
+ });
433
+ }
434
+
435
+ // 根据sha1查询资源列表 (查询文件对象所挂载的资源)
436
+ interface GetResourceBySha1ParamsType {
437
+ fileSha1: string;
438
+ projection?: string;
439
+ }
440
+
441
+ export function getResourceBySha1({
442
+ fileSha1,
443
+ ...params
444
+ }: GetResourceBySha1ParamsType) {
445
+ // return FUtil.Axios.get(`/v2/resources/files/${fileSha1}`, {
446
+ // params,
447
+ // });
448
+ return FUtil.Request({
449
+ method: 'GET',
450
+ url: `/v2/resources/files/${fileSha1}`,
451
+ params: params,
452
+ });
453
+ }
454
+
455
+ // 更新资源版本信息
456
+ interface UpdateResourceVersionInfoParamsType {
457
+ version: string;
458
+ resourceId: string;
459
+ description?: string;
460
+ customPropertyDescriptors?: {
461
+ key: string;
462
+ name: string;
463
+ defaultValue: string;
464
+ type: 'editableText' | 'readonlyText' | 'radio' | 'checkbox' | 'select';
465
+ candidateItems?: string[];
466
+ remark?: string;
467
+ }[];
468
+ resolveResources?: {
469
+ resourceId: string;
470
+ contracts: {
471
+ policyId: string;
472
+ }[];
473
+ }[];
474
+ inputAttrs: {
475
+ key: string;
476
+ value: string;
477
+ }[];
478
+ }
479
+
480
+ export function updateResourceVersionInfo(
481
+ params: UpdateResourceVersionInfoParamsType
482
+ ) {
483
+ // return FUtil.Axios.put(`/v2/resources/${params.resourceId}/versions/${params.version}`, params);
484
+ return FUtil.Request({
485
+ method: 'PUT',
486
+ url: `/v2/resources/${params.resourceId}/versions/${params.version}`,
487
+ data: params,
488
+ });
489
+ }
490
+
491
+ // 保存或者更新资源版本草稿
492
+ interface SaveVersionsDraftParamsType {
493
+ resourceId: string;
494
+ draftData: any;
495
+ }
496
+
497
+ export function saveVersionsDraft(params: SaveVersionsDraftParamsType) {
498
+ // return FUtil.Axios.post(`/v2/resources/${params.resourceId}/versions/drafts`, params);
499
+ return FUtil.Request({
500
+ method: 'POST',
501
+ url: `/v2/resources/${params.resourceId}/versions/drafts`,
502
+ data: params,
503
+ });
504
+ }
505
+
506
+ // 查看资源版本草稿
507
+ interface LookDraftParamsType {
508
+ resourceId: string;
509
+ }
510
+
511
+ export function lookDraft(params: LookDraftParamsType) {
512
+ // return FUtil.Axios.get(`/v2/resources/${params.resourceId}/versions/drafts`);
513
+ return FUtil.Request({
514
+ method: 'GET',
515
+ url: `/v2/resources/${params.resourceId}/versions/drafts`,
516
+ params: params,
517
+ });
518
+ }
519
+
520
+ // 删除资源版本草稿
521
+ interface DeleteResourceDraftParamsType {
522
+ resourceId: string;
523
+ }
524
+
525
+ export function deleteResourceDraft({
526
+ resourceId,
527
+ }: DeleteResourceDraftParamsType) {
528
+ // return FUtil.Axios.post(`/v2/resources/${params.resourceId}/versions/drafts`, params);
529
+ return FUtil.Request({
530
+ method: 'DELETE',
531
+ url: `/v2/resources/${resourceId}/versions/drafts`,
532
+ // data: params,
533
+ });
534
+ }
535
+
536
+ // 校验文件是否被引入资源
537
+ interface ResourceIsUsedByOtherParamsType {
538
+ fileSha1: string;
539
+ }
540
+
541
+ export function resourceIsUsedByOther(params: ResourceIsUsedByOtherParamsType) {
542
+ // return FUtil.Axios.get(`/v2/resources/versions/isCanBeCreate`, {
543
+ // params,
544
+ // });
545
+ return FUtil.Request({
546
+ method: 'GET',
547
+ url: `/v2/resources/versions/isCanBeCreate`,
548
+ params: params,
549
+ });
550
+ }
551
+
552
+ // 下载资源文件
553
+ interface ResourcesDownloadParamsType {
554
+ resourceId: string;
555
+ version: string;
556
+ }
557
+
558
+ export function resourcesDownload(params: ResourcesDownloadParamsType) {
559
+ return (window.location.href =
560
+ FUtil.Format.completeUrlByDomain('api') +
561
+ `/v2/resources/${params.resourceId}/versions/${params.version}/download`);
562
+ // return request.get(`/v2/resources/${params.resourceId}/versions/${params.$version}/download`, {
563
+ // responseType: 'arraybuffer',
564
+ // });
565
+ }
566
+
567
+ // 批量查看合同覆盖的版本集
568
+ interface BatchGetCoverageVersionsParamsType {
569
+ resourceId: string;
570
+ contractIds: string;
571
+ }
572
+
573
+ export function batchGetCoverageVersions({
574
+ resourceId,
575
+ ...params
576
+ }: BatchGetCoverageVersionsParamsType) {
577
+ // return FUtil.Axios.get(`/v2/resources/${resourceId}/contracts/coverageVersions`, {
578
+ // params,
579
+ // });
580
+ return FUtil.Request({
581
+ method: 'GET',
582
+ url: `/v2/resources/${resourceId}/contracts/coverageVersions`,
583
+ params: params,
584
+ });
585
+ }
586
+
587
+ // 查询资源所解决的依赖集
588
+ interface ResolveResourcesParamsType {
589
+ resourceId: string;
590
+ }
591
+
592
+ interface CreateVersionReturnType extends CommonReturn {
593
+ data: {
594
+ resourceId: string;
595
+ resourceName: string;
596
+ versions: {
597
+ version: string;
598
+ versionId: string;
599
+ contracts: {
600
+ policyId: string;
601
+ contractId: string;
602
+ }[];
603
+ }[];
604
+ }[];
605
+ }
606
+
607
+ export function resolveResources(
608
+ params: ResolveResourcesParamsType
609
+ ): Promise<CreateVersionReturnType> {
610
+ // return FUtil.Axios.get(`/v2/resources/${params.resourceId}/resolveResources`);
611
+ return FUtil.Request({
612
+ method: 'GET',
613
+ url: `/v2/resources/${params.resourceId}/resolveResources`,
614
+ // params: params,
615
+ });
616
+ }
617
+
618
+ // 批量设置策略应用的版本
619
+ interface BatchSetContractsParamsType {
620
+ resourceId: string;
621
+ subjects: {
622
+ subjectId: string;
623
+ versions: {
624
+ version: string;
625
+ policyId: string;
626
+ operation: 0 | 1;
627
+ }[];
628
+ }[];
629
+ }
630
+
631
+ export function batchSetContracts({
632
+ resourceId,
633
+ ...params
634
+ }: BatchSetContractsParamsType) {
635
+ // return FUtil.Axios.put(`/v2/resources/${resourceId}/versions/batchSetContracts`, params);
636
+ return FUtil.Request({
637
+ method: 'PUT',
638
+ url: `/v2/resources/${resourceId}/versions/batchSetContracts`,
639
+ data: params,
640
+ });
641
+ }
642
+
643
+ // 资源依赖循环性检查
644
+ interface CycleDependencyCheckParamsType {
645
+ resourceId: string;
646
+ dependencies: {
647
+ resourceId: string;
648
+ versionRange: string;
649
+ }[];
650
+ }
651
+
652
+ export function cycleDependencyCheck({
653
+ resourceId,
654
+ ...params
655
+ }: CycleDependencyCheckParamsType) {
656
+ // return FUtil.Axios.post(`/v2/resources/${resourceId}/versions/cycleDependencyCheck`, params);
657
+ return FUtil.Request({
658
+ method: 'POST',
659
+ url: `/v2/resources/${resourceId}/versions/cycleDependencyCheck`,
660
+ data: params,
661
+ });
662
+ }
663
+
664
+ // 查看资源关系树
665
+ interface RelationTreeParamsType {
666
+ resourceId: string;
667
+ version?: string;
668
+ versionRange?: string;
669
+ }
670
+
671
+ export function relationTree({
672
+ resourceId,
673
+ ...params
674
+ }: RelationTreeParamsType) {
675
+ // return FUtil.Axios.get(`/v2/resources/${resourceId}/relationTree`, {
676
+ // params,
677
+ // });
678
+ return FUtil.Request({
679
+ method: 'GET',
680
+ url: `/v2/resources/${resourceId}/relationTree`,
681
+ params: params,
682
+ });
683
+ }
684
+
685
+ // 查看含授权的资源关系树
686
+ interface RelationTreeAuthParamsType {
687
+ resourceId: string;
688
+ version?: string;
689
+ versionRange?: string;
690
+ }
691
+
692
+ export function relationTreeAuth({
693
+ resourceId,
694
+ ...params
695
+ }: RelationTreeAuthParamsType) {
696
+ return FUtil.Request({
697
+ method: 'GET',
698
+ url: `/v2/auths/resources/${resourceId}/relationTreeAuth`,
699
+ params: params,
700
+ });
701
+ }
702
+
703
+ // 查看资源创建数量
704
+ interface ResourcesCountParamsType {
705
+ userIds: string;
706
+ status?: 0 | 1 | 2 | 3; // 0:下架 1:上架 2:冻结(冻结时处于下架状态) 3:冻结(冻结时处于上架状态)
707
+ }
708
+
709
+ export function resourcesCount({ ...params }: ResourcesCountParamsType) {
710
+ return FUtil.Request({
711
+ method: 'GET',
712
+ url: `/v2/resources/count`,
713
+ params: params,
714
+ });
715
+ }
716
+
717
+ // 批量查询资源授权结果
718
+ interface BatchAuthParamsType {
719
+ resourceIds: string;
720
+ versions?: string;
721
+ versionRanges?: string;
722
+ }
723
+
724
+ export function batchAuth({ ...params }: BatchAuthParamsType) {
725
+ return FUtil.Request({
726
+ method: 'GET',
727
+ url: `/v2/auths/resources/batchAuth/results`,
728
+ params: params,
729
+ });
730
+ }
731
+
732
+ // 批量查询资源授权结果
733
+ interface ResourcesRecommendParamsType {
734
+ recommendType: 1 | 2; // 1: 推荐主题 2:占位主题
735
+ }
736
+
737
+ export function resourcesRecommend({
738
+ ...params
739
+ }: ResourcesRecommendParamsType) {
740
+ return FUtil.Request({
741
+ method: 'GET',
742
+ url: `/v2/resources/recommend`,
743
+ params: params,
744
+ });
745
+ }
746
+
747
+ // 根据资源类型查看推荐的标签
748
+ interface AvailableTagsParamsType {
749
+ resourceTypeCode: string;
750
+ }
751
+
752
+ export function availableTags({ ...params }: AvailableTagsParamsType) {
753
+ return FUtil.Request({
754
+ method: 'GET',
755
+ url: `/v2/resources/tags/availableTags`,
756
+ params: params,
757
+ });
758
+ }
759
+
760
+ // 列出资源类型分组排序
761
+ interface ResourceTypesParamsType {
762
+ codeOrName?: string;
763
+ category?: 1 | 2; // 种类 1:基础资源类型 2:自定义资源类型
764
+ isMine?: boolean;
765
+ status?: 0 | 1;
766
+ supportCreateBatch?: 1 | 2;
767
+ subjectType?: 1 | 4 | 5;
768
+ }
769
+
770
+ export function resourceTypes({ ...params }: ResourceTypesParamsType = {}) {
771
+ return FUtil.Request({
772
+ method: 'GET',
773
+ url: `/v2/resources/types/listSimpleByGroup`,
774
+ params: params,
775
+ });
776
+ }
777
+
778
+ // 简单根据父类型列出资源类型
779
+ interface ListSimpleByParentCodeParamsType {
780
+ parentCode?: string;
781
+ name?: string;
782
+ category?: 1 | 2; // 种类 1:基础资源类型 2:自定义资源类型
783
+ excludeParentCode?: boolean;
784
+ isTerminate?: boolean;
785
+ nameChain?: string;
786
+ subjectType?: 1 | 4 | 5;
787
+ supportCreateBatch?: 1 | 2;
788
+ status?: 0 | 1;
789
+ }
790
+
791
+ export function ListSimpleByParentCode({
792
+ ...params
793
+ }: ListSimpleByParentCodeParamsType) {
794
+ return FUtil.Request({
795
+ method: 'GET',
796
+ url: `/v2/resources/types/listSimpleByParentCode`,
797
+ params: params,
798
+ });
799
+ }
800
+
801
+ // 根据编号取资源类型
802
+ interface GetResourceTypeInfoByCodeParamsType {
803
+ code: string;
804
+ }
805
+
806
+ export function getResourceTypeInfoByCode({
807
+ ...params
808
+ }: GetResourceTypeInfoByCodeParamsType) {
809
+ return FUtil.Request({
810
+ method: 'GET',
811
+ url: `/v2/resources/types/getInfoByCode`,
812
+ params: params,
813
+ });
814
+ }
815
+
816
+ //
817
+ interface GetResourceAttrListSimpleParamsType {}
818
+
819
+ export function getResourceAttrListSimple({
820
+ ...params
821
+ }: GetResourceAttrListSimpleParamsType) {
822
+ return FUtil.Request({
823
+ method: 'GET',
824
+ url: `/v2/resources/attrs/listSimple`,
825
+ params: params,
826
+ });
827
+ }
828
+
829
+ interface ListSimple4RecentlyParamsType {}
830
+
831
+ export function listSimple4Recently({
832
+ ...params
833
+ }: ListSimple4RecentlyParamsType = {}) {
834
+ return FUtil.Request({
835
+ method: 'GET',
836
+ url: `/v2/resources/types/listSimple4Recently`,
837
+ params: params,
838
+ });
839
+ }
840
+
841
+ // 通过key取资源属性
842
+ interface GetAttrsInfoByKeyParamsType {
843
+ key: string;
844
+ }
845
+
846
+ export function getAttrsInfoByKey({ ...params }: GetAttrsInfoByKeyParamsType) {
847
+ return FUtil.Request({
848
+ method: 'GET',
849
+ url: `/v2/resources/attrs/getInfoByKey`,
850
+ params: params,
851
+ });
852
+ }
853
+
854
+ // 取可用的资源名称
855
+ interface GenerateResourceNamesParamsType {
856
+ resourceNames: string[];
857
+ }
858
+
859
+ export function generateResourceNames({
860
+ resourceNames,
861
+ }: GenerateResourceNamesParamsType) {
862
+ return FUtil.Request({
863
+ method: 'POST',
864
+ url: `/v2/resources/generateResourceNames`,
865
+ data: {
866
+ resourceNames,
867
+ },
868
+ });
869
+ }
870
+
871
+ // 更新资源合集版本
872
+ interface UpdateCollectionParamsType {
873
+ resourceId: string;
874
+ description?: string;
875
+ // serializeStatus?: 0 | 1;
876
+ customPropertyDescriptors?: {
877
+ key: string;
878
+ defaultValue: string;
879
+ type: string;
880
+ candidateItems?: string[];
881
+ remark?: string;
882
+ }[];
883
+ // resolveResources?: {
884
+ // resourceId: string;
885
+ // contracts: {
886
+ // policyId: string;
887
+ // }[];
888
+ // }[];
889
+ // optionalResolveResources?: {
890
+ // resourceId: string;
891
+ // contracts: {
892
+ // policyId: string;
893
+ // }[]
894
+ // }[];
895
+ // addCollectionItems?: {
896
+ // resourceId: string;
897
+ // itemTitle: string;
898
+ // }[];
899
+ catalogueProperty?: {
900
+ collection_item_no_display?:
901
+ | 'collection_item_no_display_show'
902
+ | 'collection_item_no_display_hide';
903
+ collection_item_image_display?:
904
+ | 'collection_item_image_display_show'
905
+ | 'collection_item_image_display_hide';
906
+ collection_item_descr_display?:
907
+ | 'collection_item_descr_display_show'
908
+ | 'collection_item_descr_display_hide';
909
+ collection_view?: 'collection_view_list' | 'collection_view_card';
910
+ };
911
+ isMergeCatalogueDraft?: 0 | 1;
912
+ inputAttrs?: {
913
+ key: string;
914
+ value: string;
915
+ }[];
916
+
917
+ // dependencies?: {
918
+ // resourceId: string;
919
+ // versionRange: string;
920
+ // }[];
921
+ dependencies?: {
922
+ resourceId: string;
923
+ versionRange: string;
924
+ }[];
925
+ baseUpcastResources?: {
926
+ resourceId: string;
927
+ }[];
928
+ batchSignContracts?: {
929
+ resourceId: string;
930
+ policyIds: string[];
931
+ }[];
932
+ authExcludedItems: {
933
+ resourceId: string;
934
+ excludedType: 'contractId' | 'policyId';
935
+ excludedValue: string;
936
+ }[];
937
+ }
938
+
939
+ export function updateCollection({
940
+ resourceId,
941
+ ...params
942
+ }: UpdateCollectionParamsType) {
943
+ return FUtil.Request({
944
+ method: 'PUT',
945
+ url: `/v2/resources/catalogue/${resourceId}`,
946
+ data: params,
947
+ });
948
+ }
949
+
950
+ // 批量删除合集资源单品
951
+ interface deleteCollectionUnitResourcesParamsType {
952
+ resourceId: string;
953
+ removeCollectionItemIds: string[];
954
+ }
955
+
956
+ export function deleteCollectionUnitResource({
957
+ resourceId,
958
+ removeCollectionItemIds,
959
+ }: deleteCollectionUnitResourcesParamsType) {
960
+ return FUtil.Request({
961
+ method: 'DELETE',
962
+ url: `/v2/resources/catalogue/${resourceId}?removeCollectionItemIds=${removeCollectionItemIds.join(
963
+ ','
964
+ )}`,
965
+ // data: params,
966
+ });
967
+ }
968
+
969
+ // 获取合集资源的单品列表
970
+ interface GetCollectionItemsParamsType {
971
+ resourceId: string;
972
+ skip?: number;
973
+ limit?: number;
974
+ sortField?: string;
975
+ sortType?: 1 | -1;
976
+ keywords?: string;
977
+ isLoadLatestVersionInfo?: 0 | 1;
978
+ }
979
+
980
+ export function getCollectionItems({
981
+ resourceId,
982
+ ...params
983
+ }: GetCollectionItemsParamsType) {
984
+ return FUtil.Request({
985
+ method: 'GET',
986
+ url: `/v2/resources/catalogue/${resourceId}/items`,
987
+ params: params,
988
+ });
989
+ }
990
+
991
+ // 获取合集资源的单品列表(草稿)
992
+ interface GetCollectionItems_Draft_ParamsType {
993
+ resourceId: string;
994
+ skip?: number;
995
+ limit?: number;
996
+ sortField?: string;
997
+ sortType?: 1 | -1;
998
+ keywords?: string;
999
+ isLoadLatestVersionInfo?: 0 | 1;
1000
+ }
1001
+
1002
+ export function getCollectionItems_Draft({
1003
+ resourceId,
1004
+ ...params
1005
+ }: GetCollectionItems_Draft_ParamsType) {
1006
+ return FUtil.Request({
1007
+ method: 'GET',
1008
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items`,
1009
+ params: params,
1010
+ });
1011
+ }
1012
+
1013
+ // 设置合集资源的单品排序序号
1014
+ interface SetCollectionItemSortParamsType {
1015
+ resourceId: string;
1016
+ itemId: string;
1017
+ targetSortId: number;
1018
+ }
1019
+
1020
+ export function setCollectionItemSort({
1021
+ resourceId,
1022
+ ...params
1023
+ }: SetCollectionItemSortParamsType) {
1024
+ return FUtil.Request({
1025
+ method: 'PUT',
1026
+ url: `/v2/resources/catalogue/${resourceId}/manualSort`,
1027
+ data: params,
1028
+ });
1029
+ }
1030
+
1031
+ // 重置合集资源的单品排序序号
1032
+ interface ReorderCollectionItemsSortParamsType {
1033
+ resourceId: string;
1034
+ sortField: string;
1035
+ sortType: 1 | -1;
1036
+ }
1037
+
1038
+ export function reorderCollectionItemsSort({
1039
+ resourceId,
1040
+ ...params
1041
+ }: ReorderCollectionItemsSortParamsType) {
1042
+ return FUtil.Request({
1043
+ method: 'PUT',
1044
+ url: `/v2/resources/catalogue/${resourceId}/reorder`,
1045
+ data: params,
1046
+ });
1047
+ }
1048
+
1049
+ // 查看资源是否在单品目录中存在
1050
+ interface CheckExistCollectionItemsParamsType {
1051
+ resourceId: string;
1052
+ resourceIds: string;
1053
+ }
1054
+
1055
+ export function checkExistCollectionItems({
1056
+ resourceId,
1057
+ ...params
1058
+ }: CheckExistCollectionItemsParamsType) {
1059
+ return FUtil.Request({
1060
+ method: 'GET',
1061
+ url: `/v2/resources/catalogue/${resourceId}/items/checkExists`,
1062
+ params: params,
1063
+ });
1064
+ }
1065
+
1066
+ // 批量查询单品在资源侧的授权
1067
+ interface GetCollectionItemsAuthParamsType {
1068
+ resourceId: string;
1069
+ itemIds: string;
1070
+ }
1071
+
1072
+ export function getCollectionItemsAuth({
1073
+ resourceId,
1074
+ ...params
1075
+ }: GetCollectionItemsAuthParamsType) {
1076
+ return FUtil.Request({
1077
+ method: 'GET',
1078
+ url: `/v2/auths/resources/${resourceId}/items/batchAuth`,
1079
+ params: params,
1080
+ });
1081
+ }
1082
+
1083
+ // 批量分组获取合集资源的单品列表
1084
+ interface BatchResourceItemsParamsType {
1085
+ resourceIds: string;
1086
+ limit?: number;
1087
+ sortField?: string;
1088
+ sortType?: 1 | -1;
1089
+ isLoadItemResourceDetailInfo?: 0 | 1;
1090
+ isLoadLatestVersionInfo?: 0 | 1;
1091
+ }
1092
+
1093
+ export function batchResourceItems({
1094
+ ...params
1095
+ }: BatchResourceItemsParamsType) {
1096
+ return FUtil.Request({
1097
+ method: 'GET',
1098
+ url: `/v2/resources/catalogue/items/batch/list`,
1099
+ params: params,
1100
+ });
1101
+ }
1102
+
1103
+ // 批量分组获取合集资源的单品列表(草稿)
1104
+ interface BatchResourceItems_Draft_ParamsType {
1105
+ resourceIds: string;
1106
+ limit?: number;
1107
+ sortField?: string;
1108
+ sortType?: 1 | -1;
1109
+ isLoadItemResourceDetailInfo?: 0 | 1;
1110
+ }
1111
+
1112
+ export function batchResourceItems_Draft({
1113
+ ...params
1114
+ }: BatchResourceItems_Draft_ParamsType) {
1115
+ return FUtil.Request({
1116
+ method: 'GET',
1117
+ url: `/v2/resources/catalogues/drafts/items/batch/list`,
1118
+ params: params,
1119
+ });
1120
+ }
1121
+
1122
+ // 查看合集更新日志分页列表
1123
+ interface GetCollectionUpdateLogsParamsType {
1124
+ resourceId: string;
1125
+ skip?: number;
1126
+ limit?: number;
1127
+ sortType?: 1 | -1;
1128
+ }
1129
+
1130
+ export function getCollectionUpdateLogs({
1131
+ resourceId,
1132
+ ...params
1133
+ }: GetCollectionUpdateLogsParamsType) {
1134
+ return FUtil.Request({
1135
+ method: 'GET',
1136
+ url: `/v2/resources/catalogue/${resourceId}/updateLogs`,
1137
+ params: params,
1138
+ });
1139
+ }
1140
+
1141
+ // 获取合集单品自动收录规则
1142
+ interface GetCollectionCollectRulesParamsType {
1143
+ resourceId: string;
1144
+ }
1145
+
1146
+ export function getCollectionCollectRules({
1147
+ resourceId,
1148
+ }: GetCollectionCollectRulesParamsType) {
1149
+ return FUtil.Request({
1150
+ method: 'GET',
1151
+ url: `/v2/resources/catalogue/${resourceId}/items/collectRules`,
1152
+ // params: params,
1153
+ });
1154
+ }
1155
+
1156
+ // 创建或更新合集单品自动收录规则
1157
+ interface SetCollectRulesParamsType {
1158
+ resourceId: string;
1159
+ serializeStatus?: 0 | 1;
1160
+ status: 0 | 1;
1161
+ conditionType: 1 | 2;
1162
+ filterConditions: {
1163
+ key: 'resourceTitle' | 'resourceTypeCode' | 'authIdentity';
1164
+ limitOperatorType:
1165
+ | 'INCLUDES'
1166
+ | 'NOT_INCLUDES'
1167
+ | 'STARTS_WITH'
1168
+ | 'ENDS_WITH'
1169
+ | 'EQUAL'
1170
+ | 'NOT_EQUAL';
1171
+ value: string;
1172
+ }[];
1173
+ }
1174
+
1175
+ export function setCollectRules({
1176
+ resourceId,
1177
+ ...params
1178
+ }: SetCollectRulesParamsType) {
1179
+ return FUtil.Request({
1180
+ method: 'POST',
1181
+ url: `/v2/resources/catalogue/${resourceId}/items/collectRules`,
1182
+ data: params,
1183
+ });
1184
+ }
1185
+
1186
+ // 批量更新同合集下的单品信息
1187
+ interface SetItemsTitleParamsType {
1188
+ resourceId: string;
1189
+ data: {
1190
+ itemId: string;
1191
+ itemTitle?: string;
1192
+ authExcludedItems?: {
1193
+ resourceId: string;
1194
+ excludedType: 'contractId' | 'policyId';
1195
+ excludedValue: string;
1196
+ }[];
1197
+ }[];
1198
+ }
1199
+
1200
+ export function setItemsTitle({ resourceId, data }: SetItemsTitleParamsType) {
1201
+ return FUtil.Request({
1202
+ method: 'PUT',
1203
+ url: `/v2/resources/catalogue/${resourceId}/items`,
1204
+ data: data,
1205
+ });
1206
+ }
1207
+
1208
+ // 批量删除合集资源单品(草稿)
1209
+ interface deleteCollectionItems_Draft_ParamsType {
1210
+ resourceId: string;
1211
+ removeCollectionItemIds: string[];
1212
+ }
1213
+
1214
+ export function deleteCollectionItems_Draft({
1215
+ resourceId,
1216
+ removeCollectionItemIds,
1217
+ }: deleteCollectionItems_Draft_ParamsType) {
1218
+ return FUtil.Request({
1219
+ method: 'DELETE',
1220
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items?removeCollectionItemIds=${removeCollectionItemIds.join(
1221
+ ','
1222
+ )}`,
1223
+ // data: params,
1224
+ });
1225
+ }
1226
+
1227
+ // 设置合集资源的单品排序序号(草稿)
1228
+ interface SetCollectionItemsSortID_Draft_ParamsType {
1229
+ resourceId: string;
1230
+ data: {
1231
+ itemIds: string[];
1232
+ targetSortId: number;
1233
+ };
1234
+ }
1235
+
1236
+ export function setCollectionItemsSortID_Draft({
1237
+ resourceId,
1238
+ data,
1239
+ }: SetCollectionItemsSortID_Draft_ParamsType) {
1240
+ return FUtil.Request({
1241
+ method: 'PUT',
1242
+ url: `/v2/resources/catalogues/drafts/${resourceId}/manualSort`,
1243
+ data: data,
1244
+ });
1245
+ }
1246
+
1247
+ // 重置合集资源的单品排序序号(草稿)
1248
+ interface ReorderCollectionItems_Draft_ParamsType {
1249
+ resourceId: string;
1250
+ sortField: 'createDate' | 'itemTitle' | 'sortId' | 'resourceUpdateDate';
1251
+ sortType: -1 | 1;
1252
+ }
1253
+
1254
+ export function reorderCollectionItems_Draft({
1255
+ resourceId,
1256
+ ...params
1257
+ }: ReorderCollectionItems_Draft_ParamsType) {
1258
+ return FUtil.Request({
1259
+ method: 'PUT',
1260
+ url: `/v2/resources/catalogues/drafts/${resourceId}/reorder`,
1261
+ data: params,
1262
+ });
1263
+ }
1264
+
1265
+ // 查看资源是否在单品目录中存在(草稿)
1266
+ interface ResourceIsExistInItems_Draft_ParamsType {
1267
+ resourceId: string;
1268
+ resourceIds: string;
1269
+ }
1270
+
1271
+ export function resourceIsExistInItems_Draft({
1272
+ resourceId,
1273
+ ...params
1274
+ }: ResourceIsExistInItems_Draft_ParamsType) {
1275
+ return FUtil.Request({
1276
+ method: 'GET',
1277
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items/checkExists`,
1278
+ params: params,
1279
+ });
1280
+ }
1281
+
1282
+ // 批量更新同合集下的单品信息(草稿)
1283
+ interface UpdateCollectionItemsInfo_Draft_ParamsType {
1284
+ resourceId: string;
1285
+ data: {
1286
+ itemId: string;
1287
+ itemTitle: string;
1288
+ }[];
1289
+ }
1290
+
1291
+ export function updateCollectionItemsInfo_Draft({
1292
+ resourceId,
1293
+ data,
1294
+ }: UpdateCollectionItemsInfo_Draft_ParamsType) {
1295
+ return FUtil.Request({
1296
+ method: 'PUT',
1297
+ // url: `/v2/resources/catalogue/${resourceId}/items`,
1298
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items`,
1299
+ data: data,
1300
+ });
1301
+ }
1302
+
1303
+ // 更新单品授权方案(草稿)
1304
+ interface UpdateCollectionItemAuthorization_Draft_ParamsType {
1305
+ resourceId: string;
1306
+ itemId: string;
1307
+ // resolveResources: {
1308
+ // resourceId: string;
1309
+ // contracts: {
1310
+ // policyId: string;
1311
+ // }[];
1312
+ // }[];
1313
+ }
1314
+
1315
+ export function updateCollectionItemAuthorization_Draft({
1316
+ resourceId,
1317
+ itemId,
1318
+ ...data
1319
+ }: UpdateCollectionItemAuthorization_Draft_ParamsType) {
1320
+ return FUtil.Request({
1321
+ method: 'PUT',
1322
+ // url: `/v2/resources/catalogues/${resourceId}/items/${itemId}`,
1323
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items/${itemId}`,
1324
+ data: data,
1325
+ });
1326
+ }
1327
+
1328
+ // 批量新增合集资源单品(草稿)
1329
+ interface AddResourceItems_Draft_ParamsType {
1330
+ resourceId: string;
1331
+ addCollectionItems: {
1332
+ resourceId: string;
1333
+ itemTitle?: string;
1334
+ // resolveResources?: {
1335
+ // resourceId: string;
1336
+ // contracts: {
1337
+ // policyId: string;
1338
+ // }[];
1339
+ // }[];
1340
+ authExcludedItems?: {
1341
+ resourceId: string;
1342
+ excludedType: 'contractId' | 'policyId';
1343
+ excludedValue: string;
1344
+ }[];
1345
+ batchSignContracts?: {
1346
+ resourceId: string;
1347
+ policyIds: string[];
1348
+ }[];
1349
+ }[];
1350
+ isPublish?: 1 | 0;
1351
+ }
1352
+
1353
+ export function addResourceItems_Draft({
1354
+ resourceId,
1355
+ ...params
1356
+ }: AddResourceItems_Draft_ParamsType) {
1357
+ return FUtil.Request({
1358
+ method: 'POST',
1359
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items`,
1360
+ data: params,
1361
+ });
1362
+ }
1363
+
1364
+ // 批量查询草稿中的单品在资源侧的授权
1365
+ interface GetCollectionItemsAuth_Draft_ParamsType {
1366
+ resourceId: string;
1367
+ itemIds: string;
1368
+ }
1369
+
1370
+ export function getCollectionItemsAuth_Draft({
1371
+ resourceId,
1372
+ ...params
1373
+ }: GetCollectionItemsAuth_Draft_ParamsType) {
1374
+ return FUtil.Request({
1375
+ method: 'GET',
1376
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items/batchAuth`,
1377
+ params: params,
1378
+ });
1379
+ }