@freelog/tools-lib 0.1.126 → 0.1.129

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.
@@ -137,10 +137,19 @@ export declare function userFreeze({}?: UserFreezeParamsType): string;
137
137
  interface WalletParamsType {
138
138
  }
139
139
  export declare function wallet({}?: WalletParamsType): string;
140
+ interface RewardParamsType {
141
+ }
142
+ export declare function reward({}?: RewardParamsType): string;
140
143
  interface ContractParamsType {
141
144
  }
142
145
  export declare function contract({}?: ContractParamsType): string;
143
146
  interface SettingParamsType {
144
147
  }
145
148
  export declare function setting({}?: SettingParamsType): string;
149
+ interface BindingParamsType {
150
+ }
151
+ export declare function binding({}?: BindingParamsType): string;
152
+ interface ResultBindingSuccessParamsType {
153
+ }
154
+ export declare function resultBindingSuccess({}?: ResultBindingSuccessParamsType): string;
146
155
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freelog/tools-lib",
3
- "version": "0.1.126",
3
+ "version": "0.1.129",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "size-limit": "^4.11.0",
53
53
  "tsdx": "^0.14.1",
54
54
  "tslib": "^2.2.0",
55
- "typescript": "^4.3.2"
55
+ "typescript": "^4.7.4"
56
56
  },
57
57
  "dependencies": {
58
58
  "@freelog/resource-policy-lang": "1.1.26",
@@ -6,6 +6,7 @@ import FUtil from '../utils';
6
6
  type LanguageKeyType = 'zh_CN' | 'en_US';
7
7
 
8
8
  const ossJsonUrl: string = 'https://freelog-i18n.oss-cn-shenzhen.aliyuncs.com/configs/i18n.json';
9
+ const ossJsonUrl_Test: string = 'https://freelog-i18n.oss-cn-shenzhen.aliyuncs.com/configs-test/i18n.json';
9
10
  const localStorage_i18nextLng_key: string = 'locale';
10
11
  const localStorage_i18nextResources_key: string = 'i18nextResources';
11
12
 
@@ -14,8 +15,6 @@ const allLanguage = [
14
15
  {value: 'zh_CN', label: '简体中文'},
15
16
  ];
16
17
 
17
- let self: I18nNext;
18
-
19
18
  class I18nNext {
20
19
 
21
20
  private _loadingData: 'NotStart' | 'Start' | 'End' = 'NotStart';
@@ -24,45 +23,51 @@ class I18nNext {
24
23
  private _currentLanguage: LanguageKeyType = Cookies.get(localStorage_i18nextLng_key) as undefined || 'zh_CN';
25
24
 
26
25
  constructor() {
27
- self = this;
28
- self.ready();
26
+ this.ready();
27
+
28
+ this.ready = this.ready.bind(this);
29
+ this.t = this.t.bind(this);
30
+ this.changeLanguage = this.changeLanguage.bind(this);
31
+ this.getAllLanguage = this.getAllLanguage.bind(this);
32
+ this.getCurrentLanguage = this.getCurrentLanguage.bind(this);
29
33
  }
30
34
 
31
- async ready() {
35
+ async ready(this: I18nNext) {
32
36
  const exc = () => {
33
- while (self._taskQueue.length > 0) {
34
- const task = self._taskQueue.shift();
37
+ while (this._taskQueue.length > 0) {
38
+ const task = this._taskQueue.shift();
35
39
  task && task();
36
40
  }
37
41
  };
38
42
  const handleTasks = async () => {
39
- if (self._loadingData === 'End') {
43
+ // console.log(this._loadingData, 'this._loadingData90iowejflksdfjlsdk');
44
+ if (this._loadingData === 'End') {
40
45
  exc();
41
46
  return;
42
47
  }
43
- if (self._loadingData === 'Start') {
48
+ if (this._loadingData === 'Start') {
44
49
  return;
45
50
  }
46
51
 
47
52
  // NO_START
48
- self._loadingData = 'Start';
53
+ this._loadingData = 'Start';
49
54
 
50
- await self._handleData();
55
+ await this._handleData();
51
56
  // console.log('######');
52
57
  exc();
53
58
  };
54
59
  const promise = new Promise((resolve) => {
55
- self._taskQueue.push(resolve);
60
+ this._taskQueue.push(resolve);
56
61
  });
57
62
  handleTasks();
58
63
  return promise;
59
64
  }
60
65
 
61
- t(key: string, options?: { [key: string]: any }) {
66
+ t(this: I18nNext, key: string, options?: { [key: string]: any }) {
62
67
  return i18next.t(key, options);
63
68
  }
64
69
 
65
- changeLanguage(lng: LanguageKeyType) {
70
+ changeLanguage(this: I18nNext, lng: LanguageKeyType) {
66
71
  // return i18next.changeLanguage(lng);
67
72
  // window.localStorage.setItem(localStorage_i18nextLng_key, lng)
68
73
  Cookies.set(localStorage_i18nextLng_key, lng, {
@@ -71,26 +76,26 @@ class I18nNext {
71
76
  });
72
77
  }
73
78
 
74
- getAllLanguage(): typeof allLanguage {
79
+ getAllLanguage(this: I18nNext): typeof allLanguage {
75
80
  return allLanguage;
76
81
  }
77
82
 
78
- getCurrentLanguage(): LanguageKeyType {
79
- return self._currentLanguage;
83
+ getCurrentLanguage(this: I18nNext): LanguageKeyType {
84
+ return this._currentLanguage;
80
85
  }
81
86
 
82
- private async _handleData() {
87
+ private async _handleData(this: I18nNext) {
83
88
 
84
- const lng: string = self._currentLanguage;
89
+ const lng: string = this._currentLanguage;
85
90
  const resource: string | null = window.localStorage.getItem(localStorage_i18nextResources_key);
86
91
  // const resource: string | undefined = Cookies.get(decodeURIComponent(localStorage_i18nextResources_key));
87
92
  let i18nextResources: Resource | null = resource ? JSON.parse(resource) : null;
88
93
 
89
94
  if (!i18nextResources) {
90
95
  // console.log('######892io3jlkl')
91
- i18nextResources = await self._fetchData();
96
+ i18nextResources = await this._fetchData();
92
97
  } else {
93
- self._fetchData();
98
+ this._fetchData();
94
99
  }
95
100
 
96
101
  await i18next
@@ -108,10 +113,11 @@ class I18nNext {
108
113
  suffix: '}',
109
114
  },
110
115
  });
116
+ this._loadingData = 'End';
111
117
  }
112
118
 
113
- private async _fetchData(): Promise<Resource> {
114
- const res: any = await axios.get(ossJsonUrl, {
119
+ private async _fetchData(this: I18nNext): Promise<Resource> {
120
+ const res: any = await axios.get(window.location.origin.includes('.freelog.com') ? ossJsonUrl : ossJsonUrl_Test, {
115
121
  withCredentials: false,
116
122
  });
117
123
  // console.log(res, 'data09oiw3qjelsfkdfjlsdkfjl');
@@ -93,3 +93,124 @@ export function getNodeTaskInfo(params: GetNodeTaskInfoParamsType = {}) {
93
93
  params: params,
94
94
  });
95
95
  }
96
+
97
+ // 获取奖励记录详情
98
+ interface GetRewardRecordInfoParamsType {
99
+ rewardConfigCode: string;
100
+ }
101
+
102
+ export function getRewardRecordInfo(params: GetRewardRecordInfoParamsType) {
103
+ return FUtil.Request({
104
+ method: 'GET',
105
+ url: `/v2/activities/facade/getRewardRecordInfo`,
106
+ params: params,
107
+ });
108
+ }
109
+
110
+ // 推送任务消息埋点
111
+ interface PushMessageTaskParamsType {
112
+ taskConfigCode: string;
113
+ }
114
+
115
+ export function pushMessageTask(params: PushMessageTaskParamsType) {
116
+ return FUtil.Request({
117
+ method: 'POST',
118
+ url: `/v2/activities/facade/pushMessage4Task`,
119
+ data: params,
120
+ });
121
+ }
122
+
123
+ // 运营钱包详情
124
+ interface GetCoinAccountParamsType {
125
+ type: 1;
126
+ }
127
+
128
+ export function getCoinAccount(params: GetCoinAccountParamsType) {
129
+ return FUtil.Request({
130
+ method: 'GET',
131
+ url: `/v2/activities/coin/account/find4Client`,
132
+ params: params,
133
+ });
134
+ }
135
+
136
+ // 运营钱包提现
137
+ interface WithdrawCoinAccountParamsType {
138
+ reUserName: string;
139
+ amount: number;
140
+ }
141
+
142
+ export function withdrawCoinAccount(params: WithdrawCoinAccountParamsType) {
143
+ return FUtil.Request({
144
+ method: 'POST',
145
+ url: `/v2/activities/coin/account/cash4Client`,
146
+ data: params,
147
+ });
148
+ }
149
+
150
+ // 运营钱包流水
151
+ interface GetCoinAccountRecordsParamsType {
152
+ skip?: number;
153
+ limit?: number;
154
+ coinAccountType: 1;
155
+ }
156
+
157
+ export function getCoinAccountRecords(params: GetCoinAccountRecordsParamsType) {
158
+ return FUtil.Request({
159
+ method: 'GET',
160
+ url: `/v2/activities/coin/record/list4Client`,
161
+ params: params,
162
+ });
163
+ }
164
+
165
+ // 获取公众号绑定信息
166
+ interface GetWechatOfficialAccountInfoParamsType {
167
+ }
168
+
169
+ export function getWechatOfficialAccountInfo(params: GetWechatOfficialAccountInfoParamsType = {}) {
170
+ return FUtil.Request({
171
+ method: 'GET',
172
+ url: `/v2/extensions/wechat/getRelationship4Client`,
173
+ params: params,
174
+ });
175
+ }
176
+
177
+ // 列出抽奖结果
178
+ interface LotteryListParamsType {
179
+ }
180
+
181
+ export function lotteryList(params: LotteryListParamsType = {}) {
182
+ return FUtil.Request({
183
+ method: 'GET',
184
+ url: `/v2/activities/lottery/resource/list`,
185
+ params: params,
186
+ });
187
+ }
188
+
189
+ // 显示抽奖结果
190
+ interface LotteryShowParamsType {
191
+ startDate: string;
192
+ limitDate: string;
193
+ }
194
+
195
+ export function lotteryShow(params: LotteryShowParamsType) {
196
+ return FUtil.Request({
197
+ method: 'GET',
198
+ url: `/v2/activities/lottery/resource/show`,
199
+ params: params,
200
+ });
201
+ }
202
+
203
+ // 列出邀请好友详情
204
+ type ListInviteFriendInfosParamsType = {
205
+ userId: number;
206
+ username: string;
207
+ createDate: string;
208
+ }[];
209
+
210
+ export function listInviteFriendInfos(params: ListInviteFriendInfosParamsType) {
211
+ return FUtil.Request({
212
+ method: 'POST',
213
+ url: `/v2/activities/facade/listInviteFriendInfos`,
214
+ data: params,
215
+ });
216
+ }
@@ -82,3 +82,20 @@ export function transitionRecords({contractId, ...params}: TransitionRecordsPara
82
82
  params: params,
83
83
  });
84
84
  }
85
+
86
+ // 统计合约签约量
87
+ interface ContractsSignCountParamsType {
88
+ objectIds: string | number;
89
+ objectType: 1 | 2 | 3 | 4 | 5; // 统计对象类型(1:甲方ID 2:甲方所属ID 3:乙方ID 4:乙方所属ID 5:标的物ID)
90
+ subjectType: 1 | 2 | 3; // 标的物类型(1:资源 2:展品 3:用户组)
91
+ startDate?: string;
92
+ endDate?: string;
93
+ }
94
+
95
+ export function contractsSignCount(params: ContractsSignCountParamsType) {
96
+ return FUtil.Request({
97
+ method: 'GET',
98
+ url: `/v2/contracts/signCount`,
99
+ params: params,
100
+ });
101
+ }
@@ -13,6 +13,7 @@ import * as Activity from './activities';
13
13
  import * as TestQualification from './testQualifications';
14
14
  import * as Statistic from './statistics';
15
15
  import * as I18n from './i18n';
16
+ import * as Policy from './policies';
16
17
  import * as recombination from './recombinations';
17
18
 
18
19
  const FServiceAPI = {
@@ -31,6 +32,7 @@ const FServiceAPI = {
31
32
  TestQualification,
32
33
  Statistic,
33
34
  I18n,
35
+ Policy,
34
36
  recombination,
35
37
  };
36
38
 
@@ -9,9 +9,6 @@ interface PoliciesParamsType {
9
9
  }
10
10
 
11
11
  export function policies(params: PoliciesParamsType) {
12
- // return FUtil.Axios.get('/v2/policies', {
13
- // params,
14
- // });
15
12
  return FUtil.Request({
16
13
  method: 'GET',
17
14
  url: `/v2/policies`,
@@ -28,12 +25,21 @@ interface PoliciesListParamsType {
28
25
  }
29
26
 
30
27
  export function policiesList(params: PoliciesListParamsType) {
31
- // return FUtil.Axios.get('/v2/policies/list', {
32
- // params,
33
- // });
34
28
  return FUtil.Request({
35
29
  method: 'GET',
36
30
  url: `/v2/policies/list`,
37
31
  params: params,
38
32
  });
39
33
  }
34
+
35
+ // 策略模板
36
+ interface PolicyTemplatesParamsType {
37
+ }
38
+
39
+ export function policyTemplates(params: PolicyTemplatesParamsType = {}) {
40
+ return FUtil.Request({
41
+ method: 'GET',
42
+ url: `/v2/translate/translate-config/list4Client`,
43
+ params: params,
44
+ });
45
+ }
@@ -94,11 +94,11 @@ interface ListParamsType {
94
94
  // startResourceId?: string;
95
95
  }
96
96
 
97
- interface ListReturnType extends CommonReturn {
98
- data: IResourceInfo[];
99
- }
97
+ // interface ListReturnType extends CommonReturn {
98
+ // data: IResourceInfo[];
99
+ // }
100
100
 
101
- export function list(params: ListParamsType): Promise<ListReturnType> {
101
+ export function list(params: ListParamsType){
102
102
  return FUtil.Request({
103
103
  method: 'GET',
104
104
  url: `/v2/resources`,
@@ -91,6 +91,19 @@ export function getBetaApply2({recordId, ...params}: GetBetaApply2ParamsType) {
91
91
  return FUtil.Request({
92
92
  method: 'GET',
93
93
  url: `/v2/testQualifications/beta/apply/${recordId}`,
94
- data: params,
94
+ params: params,
95
+ });
96
+ }
97
+
98
+ // 被邀请列表
99
+ interface InviteesParamsType {
100
+ userId: number;
101
+ }
102
+
103
+ export function invitees({...params}: InviteesParamsType) {
104
+ return FUtil.Request({
105
+ method: 'GET',
106
+ url: `/v2/testQualifications/beta/codes/invitees`,
107
+ params: params,
95
108
  });
96
109
  }
@@ -341,6 +341,14 @@ export function wallet({}: WalletParamsType = {}) {
341
341
  return `/logged/wallet`;
342
342
  }
343
343
 
344
+ // 活动奖励
345
+ interface RewardParamsType {
346
+ }
347
+
348
+ export function reward({}: RewardParamsType = {}) {
349
+ return `/logged/reward`;
350
+ }
351
+
344
352
  // 我的合约
345
353
  interface ContractParamsType {
346
354
  }
@@ -358,6 +366,22 @@ export function setting({}: SettingParamsType = {}) {
358
366
  }
359
367
 
360
368
 
369
+ // 绑定成功
370
+ interface BindingParamsType {
371
+ }
372
+
373
+ export function binding({}: BindingParamsType = {}) {
374
+ return `/logged/binding`;
375
+ }
376
+
377
+ // 绑定成功
378
+ interface ResultBindingSuccessParamsType {
379
+ }
380
+
381
+ export function resultBindingSuccess({}: ResultBindingSuccessParamsType = {}) {
382
+ return `/result/binding`;
383
+ }
384
+
361
385
 
362
386
  /************** user End ******************************************************/
363
387