@be-link/ecs-cli-nodejs 0.0.2
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.
- package/README.md +2 -0
- package/ecs/http.d.ts +1 -0
- package/ecs/http.js +66 -0
- package/ecs/modules/service.d.ts +14 -0
- package/ecs/modules/service.js +31 -0
- package/ecs/modules/userBindRelation/service.d.ts +12 -0
- package/ecs/modules/userBindRelation/service.js +30 -0
- package/ecs/modules/userBindRelation/types.d.ts +81 -0
- package/ecs/modules/userBindRelation/types.js +2 -0
- package/ecs/modules/vzanData/service.d.ts +12 -0
- package/ecs/modules/vzanData/service.js +30 -0
- package/ecs/modules/vzanData/types.d.ts +60 -0
- package/ecs/modules/vzanData/types.js +2 -0
- package/ecs/modules/vzanDataJob/service.d.ts +17 -0
- package/ecs/modules/vzanDataJob/service.js +45 -0
- package/ecs/modules/vzanDataJob/types.d.ts +22 -0
- package/ecs/modules/vzanDataJob/types.js +2 -0
- package/errors/BizError.d.ts +4 -0
- package/errors/BizError.js +10 -0
- package/errors/SystemError.d.ts +4 -0
- package/errors/SystemError.js +10 -0
- package/index.d.ts +8 -0
- package/index.js +10 -0
- package/package.json +56 -0
- package/types.d.ts +0 -0
- package/types.js +1 -0
- package/utils/env.d.ts +6 -0
- package/utils/env.js +15 -0
- package/utils/string.d.ts +5 -0
- package/utils/string.js +9 -0
package/README.md
ADDED
package/ecs/http.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function callApi<T extends (args: any) => Promise<any>>(url: string, ...request: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
|
package/ecs/http.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.callApi = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
const BizError_1 = __importDefault(require("../errors/BizError"));
|
|
10
|
+
const SystemError_1 = __importDefault(require("../errors/SystemError"));
|
|
11
|
+
const axios_retry_1 = __importDefault(require("axios-retry"));
|
|
12
|
+
const axiosInstance = axios_1.default.create({
|
|
13
|
+
timeout: 55000,
|
|
14
|
+
httpsAgent: new (require('https').Agent)({ keepAlive: true }),
|
|
15
|
+
httpAgent: new (require('http').Agent)({ keepAlive: true }),
|
|
16
|
+
});
|
|
17
|
+
(0, axios_retry_1.default)(axiosInstance, {
|
|
18
|
+
retries: 1,
|
|
19
|
+
retryCondition(error) {
|
|
20
|
+
console.info('errorMessage', error.message);
|
|
21
|
+
console.info('errorResponse', error.response ? error.response.data : null);
|
|
22
|
+
const isSocketHangUp = error.message.includes('socket hang up');
|
|
23
|
+
return isSocketHangUp || error.message.includes('getaddrinfo ENOTFOUND') || (Boolean(error.response) && [502, 503].includes(error.response.status));
|
|
24
|
+
},
|
|
25
|
+
retryDelay: (retryCount, error) => {
|
|
26
|
+
console.info(`retryCount: ${retryCount}, retryDelay: ${retryCount * 500}`);
|
|
27
|
+
return retryCount * 500;
|
|
28
|
+
},
|
|
29
|
+
onRetry(retryCount, error, requestConfig) {
|
|
30
|
+
console.info(`retryCount: ${retryCount}, onRetry: ${error}, requestHeader: ${JSON.stringify(requestConfig.headers)}`);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
async function callApi(url, ...request) {
|
|
34
|
+
const requestId = (0, uuid_1.v4)();
|
|
35
|
+
try {
|
|
36
|
+
console.info(`准备发起ECS请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
|
|
37
|
+
const response = await axiosInstance.post(url, request[0], {
|
|
38
|
+
headers: {
|
|
39
|
+
'X-Request-Id': requestId,
|
|
40
|
+
'x-belink-accessType': 'authorizationTokenInside',
|
|
41
|
+
'x-belink-authorization': process.env.authorizationTokenInside || ""
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const responseData = response.data;
|
|
45
|
+
return responseData.data;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
const axiosError = error;
|
|
49
|
+
const ErrorClass = axiosError.response
|
|
50
|
+
? axiosError.response.status === 400
|
|
51
|
+
? BizError_1.default
|
|
52
|
+
: SystemError_1.default
|
|
53
|
+
: SystemError_1.default;
|
|
54
|
+
if (axiosError.response) {
|
|
55
|
+
const response = axiosError.response;
|
|
56
|
+
const data = response.data;
|
|
57
|
+
console.error(`ECS 异常[${requestId}]: ${axiosError.message}`);
|
|
58
|
+
console.info('响应信息', data.message);
|
|
59
|
+
console.error('异常堆栈', JSON.stringify(error.stack));
|
|
60
|
+
throw new ErrorClass(data.message || 'ECS Error', response.status);
|
|
61
|
+
}
|
|
62
|
+
console.error(`ECS 未知异常[${requestId}]: ${axiosError.message}`, error.stack);
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.callApi = callApi;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default abstract class BaseService {
|
|
2
|
+
private isPublicEnv;
|
|
3
|
+
/** URL一级路径 */
|
|
4
|
+
protected abstract prefixUrl: string;
|
|
5
|
+
/** 子网域名 */
|
|
6
|
+
protected readonly natDevHost = "http://qgostaxv.ecs.nmkh74o4.rlwzae9d.com:8090";
|
|
7
|
+
protected readonly natProdHost = "http://bxbvjnca.ecs.cwl9ok0a.mk2u3r3l.com:8090";
|
|
8
|
+
/** 公网域名 */
|
|
9
|
+
protected readonly publicDevHost = "https://ecs-74680-5-1304510571.sh.run.tcloudbase.com";
|
|
10
|
+
protected readonly publicProdHost = "https://ecs-60660-10-1304510571.sh.run.tcloudbase.com";
|
|
11
|
+
constructor();
|
|
12
|
+
/** 获取API URL */
|
|
13
|
+
protected getApiUrl(func: Function): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const env_1 = __importDefault(require("../../utils/env"));
|
|
7
|
+
const string_1 = require("../../utils/string");
|
|
8
|
+
class BaseService {
|
|
9
|
+
constructor() {
|
|
10
|
+
/** 子网域名 */
|
|
11
|
+
this.natDevHost = 'http://qgostaxv.ecs.nmkh74o4.rlwzae9d.com:8090';
|
|
12
|
+
this.natProdHost = 'http://bxbvjnca.ecs.cwl9ok0a.mk2u3r3l.com:8090';
|
|
13
|
+
/** 公网域名 */
|
|
14
|
+
this.publicDevHost = 'https://ecs-74680-5-1304510571.sh.run.tcloudbase.com';
|
|
15
|
+
this.publicProdHost = 'https://ecs-60660-10-1304510571.sh.run.tcloudbase.com';
|
|
16
|
+
/** 如果是云函数环境, 默认走公网访问 */
|
|
17
|
+
this.isPublicEnv = (process.env.CONTAINER_ENV || 'SCF') === 'SCF';
|
|
18
|
+
}
|
|
19
|
+
/** 获取API URL */
|
|
20
|
+
getApiUrl(func) {
|
|
21
|
+
const host = this.isPublicEnv
|
|
22
|
+
? env_1.default.isProduction()
|
|
23
|
+
? this.publicProdHost
|
|
24
|
+
: this.publicDevHost
|
|
25
|
+
: env_1.default.isProduction()
|
|
26
|
+
? this.natProdHost
|
|
27
|
+
: this.natDevHost;
|
|
28
|
+
return `${host}${this.prefixUrl}/${(0, string_1.camelToKebabCase)(func.name)}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.default = BaseService;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import BaseService from "../service";
|
|
2
|
+
import { Service } from './types';
|
|
3
|
+
declare class UserBindRelationService extends BaseService implements Service.UserBindRelationController {
|
|
4
|
+
protected prefixUrl: string;
|
|
5
|
+
bindVzanUser(request: Service.Request.bindVzanUser): Promise<Service.Response.bindVzanUser>;
|
|
6
|
+
bindVzanUserCommunity(request: Service.Request.bindVzanUserCommunity): Promise<Service.Response.bindVzanUserCommunity>;
|
|
7
|
+
queryByConditions(request: Service.Request.queryByConditions): Promise<Service.Response.queryByConditions>;
|
|
8
|
+
asyncBindWeworkUserFirstAttach(request: Service.Request.asyncBindWeworkUserFirstAttach): Promise<void>;
|
|
9
|
+
manualBindVzanUserByUnionId(request: Service.Request.manualBindVzanUserByUnionId): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
declare const userBindRelationService: UserBindRelationService;
|
|
12
|
+
export default userBindRelationService;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const service_1 = __importDefault(require("../service"));
|
|
7
|
+
const http_1 = require("../../http");
|
|
8
|
+
class UserBindRelationService extends service_1.default {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.prefixUrl = '/user-bind-relation';
|
|
12
|
+
}
|
|
13
|
+
bindVzanUser(request) {
|
|
14
|
+
return (0, http_1.callApi)(this.getApiUrl(this.bindVzanUser), request);
|
|
15
|
+
}
|
|
16
|
+
bindVzanUserCommunity(request) {
|
|
17
|
+
return (0, http_1.callApi)(this.getApiUrl(this.bindVzanUserCommunity), request);
|
|
18
|
+
}
|
|
19
|
+
queryByConditions(request) {
|
|
20
|
+
return (0, http_1.callApi)(this.getApiUrl(this.queryByConditions), request);
|
|
21
|
+
}
|
|
22
|
+
asyncBindWeworkUserFirstAttach(request) {
|
|
23
|
+
return (0, http_1.callApi)(this.getApiUrl(this.asyncBindWeworkUserFirstAttach), request);
|
|
24
|
+
}
|
|
25
|
+
manualBindVzanUserByUnionId(request) {
|
|
26
|
+
return (0, http_1.callApi)(this.getApiUrl(this.manualBindVzanUserByUnionId), request);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const userBindRelationService = new UserBindRelationService();
|
|
30
|
+
exports.default = userBindRelationService;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare namespace Service {
|
|
2
|
+
namespace Request {
|
|
3
|
+
interface bindVzanUser {
|
|
4
|
+
unionid: string;
|
|
5
|
+
phone: string;
|
|
6
|
+
nickname: string;
|
|
7
|
+
mobile: string;
|
|
8
|
+
sign: string;
|
|
9
|
+
sharetuid: string;
|
|
10
|
+
shareuid: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
ts: string;
|
|
13
|
+
}
|
|
14
|
+
interface bindVzanUserCommunity {
|
|
15
|
+
unionid: string;
|
|
16
|
+
phone: string;
|
|
17
|
+
nickname: string;
|
|
18
|
+
mobile: string;
|
|
19
|
+
sign: string;
|
|
20
|
+
sharetuid: string;
|
|
21
|
+
shareuid: string;
|
|
22
|
+
userId: string;
|
|
23
|
+
ts: string;
|
|
24
|
+
}
|
|
25
|
+
interface queryByConditions {
|
|
26
|
+
conditions: {
|
|
27
|
+
unionIds?: string[];
|
|
28
|
+
vzanUserIds?: string[];
|
|
29
|
+
vzanCommunityUserIds?: string[];
|
|
30
|
+
externalUserIds?: string[];
|
|
31
|
+
juziIds?: string[];
|
|
32
|
+
pendingIds?: string[];
|
|
33
|
+
};
|
|
34
|
+
pageSize: number;
|
|
35
|
+
pageIndex: number;
|
|
36
|
+
}
|
|
37
|
+
interface asyncBindWeworkUserFirstAttach {
|
|
38
|
+
externalUserId: string;
|
|
39
|
+
unionId: string;
|
|
40
|
+
}
|
|
41
|
+
interface compensateJuziRelation {
|
|
42
|
+
externalUserId: string;
|
|
43
|
+
juziId: string;
|
|
44
|
+
}
|
|
45
|
+
interface manualBindVzanUserByUnionId {
|
|
46
|
+
unionId: string;
|
|
47
|
+
vzanUserId: string;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
namespace Response {
|
|
51
|
+
interface bindVzanUser {
|
|
52
|
+
msg: string;
|
|
53
|
+
code: string;
|
|
54
|
+
data: {
|
|
55
|
+
tuid: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
interface bindVzanUserCommunity {
|
|
59
|
+
msg: string;
|
|
60
|
+
code: string;
|
|
61
|
+
data: {
|
|
62
|
+
tuid: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
type queryByConditions = {
|
|
66
|
+
unionId: string;
|
|
67
|
+
vzanUserId: string;
|
|
68
|
+
vzanCommunityUserId: string;
|
|
69
|
+
externalUserId: string;
|
|
70
|
+
juziId: string;
|
|
71
|
+
}[];
|
|
72
|
+
}
|
|
73
|
+
interface UserBindRelationController {
|
|
74
|
+
bindVzanUser(request: Request.bindVzanUser): Promise<Response.bindVzanUser>;
|
|
75
|
+
bindVzanUserCommunity(request: Request.bindVzanUserCommunity): Promise<Response.bindVzanUserCommunity>;
|
|
76
|
+
queryByConditions(request: Request.queryByConditions): Promise<Response.queryByConditions>;
|
|
77
|
+
asyncBindWeworkUserFirstAttach(request: Request.asyncBindWeworkUserFirstAttach): Promise<void>;
|
|
78
|
+
/** 通过unionId手动绑定微赞用户 */
|
|
79
|
+
manualBindVzanUserByUnionId(request: Request.manualBindVzanUserByUnionId): Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import BaseService from "../service";
|
|
2
|
+
import { Service } from './types';
|
|
3
|
+
declare class VzanDataService extends BaseService implements Service.VzanDataController {
|
|
4
|
+
protected prefixUrl: string;
|
|
5
|
+
syncDataEntry(param: Service.Request.syncDataEntry): Promise<void>;
|
|
6
|
+
syncVzanTopicWatchData(param: Service.Request.syncVzanTopicWatchData): Promise<void>;
|
|
7
|
+
updateUserPoints(param: Service.Request.updateUserPoints): Promise<void>;
|
|
8
|
+
queryVzanStoreConfig(): Promise<Service.Response.queryVzanStoreConfig>;
|
|
9
|
+
queryUserStoreIds(param: Service.Request.queryUserStoreIds): Promise<Service.Response.queryUserStoreIds>;
|
|
10
|
+
}
|
|
11
|
+
declare const vzanDataService: VzanDataService;
|
|
12
|
+
export default vzanDataService;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const service_1 = __importDefault(require("../service"));
|
|
7
|
+
const http_1 = require("../../http");
|
|
8
|
+
class VzanDataService extends service_1.default {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.prefixUrl = '/vzan-data';
|
|
12
|
+
}
|
|
13
|
+
syncDataEntry(param) {
|
|
14
|
+
return (0, http_1.callApi)(this.getApiUrl(this.syncDataEntry), param);
|
|
15
|
+
}
|
|
16
|
+
syncVzanTopicWatchData(param) {
|
|
17
|
+
return (0, http_1.callApi)(this.getApiUrl(this.syncVzanTopicWatchData), param);
|
|
18
|
+
}
|
|
19
|
+
updateUserPoints(param) {
|
|
20
|
+
return (0, http_1.callApi)(this.getApiUrl(this.updateUserPoints), param);
|
|
21
|
+
}
|
|
22
|
+
queryVzanStoreConfig() {
|
|
23
|
+
return (0, http_1.callApi)(this.getApiUrl(this.queryVzanStoreConfig));
|
|
24
|
+
}
|
|
25
|
+
queryUserStoreIds(param) {
|
|
26
|
+
return (0, http_1.callApi)(this.getApiUrl(this.queryUserStoreIds), param);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const vzanDataService = new VzanDataService();
|
|
30
|
+
exports.default = vzanDataService;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare namespace Service {
|
|
2
|
+
namespace Request {
|
|
3
|
+
interface syncDataEntry {
|
|
4
|
+
topicId: string;
|
|
5
|
+
}
|
|
6
|
+
interface syncVzanOrderData {
|
|
7
|
+
orderId: string;
|
|
8
|
+
type: 'VZAN' | 'VZAN_COMMUNITY';
|
|
9
|
+
}
|
|
10
|
+
interface syncVzanTopicWatchData {
|
|
11
|
+
topicId: string;
|
|
12
|
+
}
|
|
13
|
+
interface updateUserPoints {
|
|
14
|
+
tuid?: string;
|
|
15
|
+
userId?: string;
|
|
16
|
+
userIds?: string[];
|
|
17
|
+
type?: number;
|
|
18
|
+
integralNum: number;
|
|
19
|
+
reason: string;
|
|
20
|
+
}
|
|
21
|
+
interface queryUserStoreIds {
|
|
22
|
+
userIds: string[];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
namespace Response {
|
|
26
|
+
type queryVzanStoreConfig = {
|
|
27
|
+
id: string;
|
|
28
|
+
latitude: string;
|
|
29
|
+
longitude: string;
|
|
30
|
+
addressDec: string;
|
|
31
|
+
addressName: string;
|
|
32
|
+
name: string;
|
|
33
|
+
managerVzanId: string;
|
|
34
|
+
managerWechatName: string;
|
|
35
|
+
addressDetail: string;
|
|
36
|
+
managerName: string;
|
|
37
|
+
assistantWechatId: string;
|
|
38
|
+
isOpenLocation: boolean;
|
|
39
|
+
shortUrl: string;
|
|
40
|
+
assistantName: string[];
|
|
41
|
+
managerWechatId: string;
|
|
42
|
+
addQrCode: {
|
|
43
|
+
url: string;
|
|
44
|
+
fileToken: string;
|
|
45
|
+
name: string;
|
|
46
|
+
};
|
|
47
|
+
}[];
|
|
48
|
+
type queryUserStoreIds = {
|
|
49
|
+
userId: string;
|
|
50
|
+
storeId: string;
|
|
51
|
+
}[];
|
|
52
|
+
}
|
|
53
|
+
interface VzanDataController {
|
|
54
|
+
syncDataEntry(param: Request.syncDataEntry): Promise<void>;
|
|
55
|
+
syncVzanTopicWatchData(param: Request.syncVzanTopicWatchData): Promise<void>;
|
|
56
|
+
updateUserPoints(param: Request.updateUserPoints): Promise<void>;
|
|
57
|
+
queryVzanStoreConfig(): Promise<Response.queryVzanStoreConfig>;
|
|
58
|
+
queryUserStoreIds(param: Request.queryUserStoreIds): Promise<Response.queryUserStoreIds>;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import BaseService from '../service';
|
|
2
|
+
import { Service } from './types';
|
|
3
|
+
declare class VzanDataJobService extends BaseService implements Service.VzanDataJobController {
|
|
4
|
+
protected prefixUrl: string;
|
|
5
|
+
pushVzanOrderDataToFeishu(): Promise<void>;
|
|
6
|
+
jobSyncVzanOrderData(): Promise<void>;
|
|
7
|
+
jobDelayRefreshVzanOrderData(): Promise<void>;
|
|
8
|
+
jobSyncVzanTopicWatchData(): Promise<void>;
|
|
9
|
+
jobSyncVzanTopicData(): Promise<void>;
|
|
10
|
+
jobSyncVzanStoreList(): Promise<void>;
|
|
11
|
+
jobSyncVzanAgentList(): Promise<void>;
|
|
12
|
+
jobSyncVzanCouponList(): Promise<void>;
|
|
13
|
+
jobSyncVzanCouponDetail(): Promise<void>;
|
|
14
|
+
jobSyncFeishuStoreData(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
declare const vzanDataJobService: VzanDataJobService;
|
|
17
|
+
export default vzanDataJobService;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const service_1 = __importDefault(require("../service"));
|
|
7
|
+
const http_1 = require("../../http");
|
|
8
|
+
class VzanDataJobService extends service_1.default {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.prefixUrl = '/vzan-data-job';
|
|
12
|
+
}
|
|
13
|
+
pushVzanOrderDataToFeishu() {
|
|
14
|
+
return (0, http_1.callApi)(this.getApiUrl(this.pushVzanOrderDataToFeishu));
|
|
15
|
+
}
|
|
16
|
+
jobSyncVzanOrderData() {
|
|
17
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobSyncVzanOrderData));
|
|
18
|
+
}
|
|
19
|
+
jobDelayRefreshVzanOrderData() {
|
|
20
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobDelayRefreshVzanOrderData));
|
|
21
|
+
}
|
|
22
|
+
jobSyncVzanTopicWatchData() {
|
|
23
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobSyncVzanTopicWatchData));
|
|
24
|
+
}
|
|
25
|
+
jobSyncVzanTopicData() {
|
|
26
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobSyncVzanTopicData));
|
|
27
|
+
}
|
|
28
|
+
jobSyncVzanStoreList() {
|
|
29
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobSyncVzanStoreList));
|
|
30
|
+
}
|
|
31
|
+
jobSyncVzanAgentList() {
|
|
32
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobSyncVzanAgentList));
|
|
33
|
+
}
|
|
34
|
+
jobSyncVzanCouponList() {
|
|
35
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobSyncVzanCouponList));
|
|
36
|
+
}
|
|
37
|
+
jobSyncVzanCouponDetail() {
|
|
38
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobSyncVzanCouponDetail));
|
|
39
|
+
}
|
|
40
|
+
jobSyncFeishuStoreData() {
|
|
41
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobSyncFeishuStoreData));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const vzanDataJobService = new VzanDataJobService();
|
|
45
|
+
exports.default = vzanDataJobService;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare namespace Service {
|
|
2
|
+
interface VzanDataJobController {
|
|
3
|
+
/** 推送正向订单数据到飞书表 */
|
|
4
|
+
pushVzanOrderDataToFeishu(): Promise<void>;
|
|
5
|
+
/** 同步正向订单数据到飞书表 */
|
|
6
|
+
jobSyncVzanOrderData(): Promise<void>;
|
|
7
|
+
/** 延迟刷新正向订单数据 */
|
|
8
|
+
jobDelayRefreshVzanOrderData(): Promise<void>;
|
|
9
|
+
jobSyncVzanTopicWatchData(): Promise<void>;
|
|
10
|
+
jobSyncVzanTopicData(): Promise<void>;
|
|
11
|
+
/** 同步飞书表门店数据 */
|
|
12
|
+
jobSyncVzanStoreList(): Promise<void>;
|
|
13
|
+
/** 同步代理列表 */
|
|
14
|
+
jobSyncVzanAgentList(): Promise<void>;
|
|
15
|
+
/** 同步优惠券列表 */
|
|
16
|
+
jobSyncVzanCouponList(): Promise<void>;
|
|
17
|
+
/** 同步优惠券明细 */
|
|
18
|
+
jobSyncVzanCouponDetail(): Promise<void>;
|
|
19
|
+
/** 同步飞书表门店数据 */
|
|
20
|
+
jobSyncFeishuStoreData(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BizError = exports.vzanDataJobService = void 0;
|
|
7
|
+
const BizError_1 = __importDefault(require("./errors/BizError"));
|
|
8
|
+
exports.BizError = BizError_1.default;
|
|
9
|
+
const service_1 = __importDefault(require("./ecs/modules/vzanDataJob/service"));
|
|
10
|
+
exports.vzanDataJobService = service_1.default;
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@be-link/ecs-cli-nodejs",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "ECS服务Nodejs客户端",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rm -rf ./dist && tsc && cp package.json README.md ./dist/",
|
|
8
|
+
"test": "npx jest",
|
|
9
|
+
"gen-doc": "npx typedoc --options typedoc.json",
|
|
10
|
+
"update:major": "standard-version --release-as major",
|
|
11
|
+
"update:minor": "standard-version --release-as minor",
|
|
12
|
+
"update:patch": "standard-version --release-as patch",
|
|
13
|
+
"update:beta": "standard-version --prerelease beta",
|
|
14
|
+
"publish": "ts-node ./ci/index"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/snowmountain-top/ecs-cli-nodejs.git"
|
|
19
|
+
},
|
|
20
|
+
"author": "dev@8848top.com",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/snowmountain-top/ecs-cli-nodejs/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/snowmountain-top/ecs-cli-nodejs#readme",
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"registry": "https://registry.npmjs.org/"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@commitlint/cli": "^18.4.3",
|
|
32
|
+
"@commitlint/config-conventional": "^18.4.3",
|
|
33
|
+
"@types/inquirer": "^9.0.7",
|
|
34
|
+
"@types/jest": "29.5.6",
|
|
35
|
+
"@types/node": "^20.8.9",
|
|
36
|
+
"@types/uuid": "^9.0.6",
|
|
37
|
+
"husky": "^8.0.3",
|
|
38
|
+
"inquirer": "8.2.6",
|
|
39
|
+
"jest": "29.7.0",
|
|
40
|
+
"standard-version": "^9.5.0",
|
|
41
|
+
"ts-jest": "29.1.1",
|
|
42
|
+
"ts-node": "^10.9.2",
|
|
43
|
+
"typedoc": "0.25.2",
|
|
44
|
+
"typedoc-plugin-missing-exports": "2.1.0",
|
|
45
|
+
"typescript": "5.2.2",
|
|
46
|
+
"@types/lodash": "4.14.202"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"axios": "0.27.2",
|
|
50
|
+
"axios-retry": "^4.0.0",
|
|
51
|
+
"uuid": "^9.0.1",
|
|
52
|
+
"vitality-meta": "1.0.215",
|
|
53
|
+
"@be-link/cs-cli-nodejs": "0.1.97",
|
|
54
|
+
"lodash": "4.17.21"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/types.d.ts
ADDED
|
File without changes
|
package/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/utils/env.d.ts
ADDED
package/utils/env.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const envUtils = {
|
|
4
|
+
// 环境判断
|
|
5
|
+
isProduction() {
|
|
6
|
+
return process.env.NODE_ENV === 'prod';
|
|
7
|
+
},
|
|
8
|
+
isDevelopment() {
|
|
9
|
+
return process.env.NODE_ENV === 'development';
|
|
10
|
+
},
|
|
11
|
+
isPPE() {
|
|
12
|
+
return process.env.NODE_ENV === 'ppe';
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.default = envUtils;
|
package/utils/string.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.camelToKebabCase = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Camel case to kebab case
|
|
6
|
+
* e.g. camelToKebabCase('camelCase') => 'camel-case'
|
|
7
|
+
*/
|
|
8
|
+
const camelToKebabCase = (str) => str.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);
|
|
9
|
+
exports.camelToKebabCase = camelToKebabCase;
|