youzanyun-devtool-worker
Version:
90 lines (89 loc) • 4.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const spring4js_nodejs_1 = require("spring4js-nodejs");
let H5RequestService = class H5RequestService {
constructor() {
}
async start() {
}
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;
}
async getPageRuleList(data, options = {}) {
let res = await this.requestService.dubboCallWithAuthV2("com.youzan.cloud.darwin.api.service.local.LocalExtRuleService", "queryConfigTemplateList", [data], options);
if (+res.code !== 200 && +res.code !== 0) {
throw new Error(res.message || res.msg);
}
return res.data;
}
async savePageRule(data, options = {}) {
let res = await this.requestService.dubboCallWithAuthV2("com.youzan.cloud.darwin.api.service.rule.FrontendPageConfigService", "saveConfigTemplate", [data], options);
if (+res.code !== 200 && +res.code !== 0) {
throw new Error(res.message || res.msg);
}
return res.data;
}
async deletePageRule(data, options = {}) {
let res = await this.requestService.dubboCallWithAuthV2("com.youzan.cloud.darwin.api.service.rule.FrontendPageConfigService", "deleteConfigTemplate", [data], options);
if (+res.code !== 200 && +res.code !== 0) {
throw new Error(res.message || res.msg);
}
return res.data;
}
async getPageImplDetail(uuid, zone, options = {}) {
let res = await this.requestService.dubboCallWithAuthV2('com.youzan.baymax.api.ImplementedPageService', 'findByUuid', [uuid, zone], options);
if (+res.code !== 200 && +res.code !== 0) {
throw new Error(res.message || res.msg);
}
return res.data;
}
async getPageOfficalComps(id, options = {}) {
let res = await this.requestService.dubboCallWithAuthV2("com.youzan.baymax.api.CanCustomizedPageComponentService", "getCanCustomizedPageComponentByPageId", [id], options);
if (+res.code !== 200 && +res.code !== 0) {
throw new Error(res.message || res.msg);
}
return res.data;
}
async getPageOfficalCompExtenions(componentId, options = {}) {
let res = await this.requestService.dubboCallWithAuthV2("com.youzan.baymax.api.ExtensionComponentService", "getExtensionComponent", [componentId], options);
if (+res.code !== 200 && +res.code !== 0) {
throw new Error(res.message || res.msg);
}
return res.data;
}
async batchUpdateImplPage(params, options = {}) {
let res = await this.requestService.dubboCallWithAuthV2("com.youzan.baymax.api.plugin.AppExtensionImplService", "batchUpdateImplPage", [params], options);
if (+res.code !== 200 && +res.code !== 0) {
throw new Error(res.message || res.msg);
}
return res.data;
}
async isUsedOldTemplate(appId, options = {}) {
let res = await this.requestService.dubboCallWithAuth("com.youzan.cloud.darwin.api.service.local.LocalExtRuleService", "isUsedOldTemplate", [appId], options);
if (+res.code !== 200 && +res.code !== 0) {
throw new Error(res.message || res.msg);
}
return res.data;
}
};
tslib_1.__decorate([
(0, spring4js_nodejs_1.Resource)()
], H5RequestService.prototype, "requestService", void 0);
H5RequestService = tslib_1.__decorate([
(0, spring4js_nodejs_1.Service)()
], H5RequestService);
exports.default = H5RequestService;