66 lines
2.1 KiB
JavaScript
66 lines
2.1 KiB
JavaScript
'use strict';
|
|
|
|
const MainService = require('../main');
|
|
|
|
class storeWarehouseAliasService extends MainService {
|
|
constructor(ctx) {
|
|
super(ctx);
|
|
const _noNeedLogin = '';
|
|
const _noNeedRight = 'list,sign,unbind,rename,getPolicyConfig,savePolicyConfig,listQimenConfig,saveQimenConfig,deleteQimenConfig';
|
|
const _noNeedLog = '*';
|
|
const _noNeedAuth = 'list,sign,unbind,rename,getPolicyConfig,savePolicyConfig,listQimenConfig,saveQimenConfig,deleteQimenConfig';
|
|
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
|
|
this.store = this;
|
|
}
|
|
|
|
async callSystemStoreWarehouse(methodName, data, defaultMessage) {
|
|
const { service } = this;
|
|
try {
|
|
const result = await service.systems.storeWarehouse[methodName](data);
|
|
return this.success('ok', result);
|
|
} catch (error) {
|
|
return this.fail(error.message || defaultMessage, {
|
|
code: Number(error.code) || 500,
|
|
});
|
|
}
|
|
}
|
|
|
|
async list(data = {}) {
|
|
return this.callSystemStoreWarehouse('list', data, '获取签约列表失败');
|
|
}
|
|
|
|
async sign(data = {}) {
|
|
return this.callSystemStoreWarehouse('sign', data, '签约失败');
|
|
}
|
|
|
|
async rename(data = {}) {
|
|
return this.callSystemStoreWarehouse('rename', data, '修改签约名称失败');
|
|
}
|
|
|
|
async unbind(data = {}) {
|
|
return this.callSystemStoreWarehouse('unbind', data, '解除签约失败');
|
|
}
|
|
|
|
async getPolicyConfig(data = {}) {
|
|
return this.callSystemStoreWarehouse('getPolicyConfig', data, '获取合约策略配置失败');
|
|
}
|
|
|
|
async savePolicyConfig(data = {}) {
|
|
return this.callSystemStoreWarehouse('savePolicyConfig', data, '保存合约策略配置失败');
|
|
}
|
|
|
|
async listQimenConfig(data = {}) {
|
|
return this.callSystemStoreWarehouse('listQimenConfig', data, '获取奇门接口配置列表失败');
|
|
}
|
|
|
|
async saveQimenConfig(data = {}) {
|
|
return this.callSystemStoreWarehouse('saveQimenConfig', data, '保存奇门接口配置失败');
|
|
}
|
|
|
|
async deleteQimenConfig(data = {}) {
|
|
return this.callSystemStoreWarehouse('deleteQimenConfig', data, '删除奇门接口配置失败');
|
|
}
|
|
}
|
|
|
|
module.exports = storeWarehouseAliasService;
|