youzanyun-devtool-worker
Version:
- web - ws - proxy
64 lines (63 loc) • 2.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const spring4js_nodejs_1 = require("spring4js-nodejs");
let CustomApiService = class CustomApiService {
constructor() {
}
async start() {
}
async checkUserAuth(params) {
const resData = await this.requestService.get('https://diy.youzanyun.com/api/custom/devtool/app/auth', {
params,
});
return resData;
}
async saveCustomContent(data) {
const request = JSON.stringify(data);
const result = await this.requestService.dubboCallWithAuth("com.youzan.baymax.api.FrontPagePushRecordService", "saveFrontPagePushRecord", [request]);
if (+result.code === 0 || +result.code === 200) {
return result.data || {};
}
else {
throw new Error('网络错误');
}
}
async saveCustomContentAndCreateImpl(data) {
let res = await this.requestService.post('https://diy.youzanyun.com/api/custom/devtool/pc/save-create-impl', data);
if (+res.data.code !== 200 && +res.data.code !== 0) {
throw new Error(res.data.message);
}
return res.data.data;
}
async getRemoteToolConfig() {
let resData = await this.requestService.get('https://diy.youzanyun.com/api/mall-cloud/dev-tool/config/get');
if (+resData.code !== 200 && +resData.code !== 0) {
throw new Error(resData.message);
}
return resData.data;
}
async getH5TemplatesByNodeId(params) {
let resData = await this.requestService.get('https://diy.youzanyun.com/api/mall-cloud/node/templete/list', {
params
});
if (+resData.code !== 200 && +resData.code !== 0) {
throw new Error(resData.message);
}
return resData.data;
}
async getH5NodeList() {
let resData = await this.requestService.get('https://diy.youzanyun.com/api/mall-cloud/node/list');
if (!resData || +resData.code !== 200 && +resData.code !== 0) {
throw new Error(resData.message);
}
return resData.data;
}
};
tslib_1.__decorate([
spring4js_nodejs_1.Resource()
], CustomApiService.prototype, "requestService", void 0);
CustomApiService = tslib_1.__decorate([
spring4js_nodejs_1.Service()
], CustomApiService);
exports.default = CustomApiService;