@freelog/tools-lib 0.1.125 → 0.1.128

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.125",
3
+ "version": "0.1.128",
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,109 @@ 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
+ }