Commit cd731130 by zhaoxiqing

gsb

parent 224d99df
......@@ -71,13 +71,16 @@ class ActionAPI extends APIBase {
case "merchantSave":
opResult = await this.channelmerchantSve.save(action_body);
break;
case "merchantSaves":
opResult = await this.channelmerchantSve.merchantSaves(action_body);
break;
case "merchantPage":
opResult = await this.channelmerchantSve.page(action_body);
break;
case "getPushMerchantIds" :
opResult = await this.channelmerchantSve.getPushMerchantIds(action_body);
break;
//渠道绑定
case "bindPlatform":
opResult = await this.platformchannelService.bindPlatform(action_body);
......
......@@ -53,6 +53,37 @@ class ChannelmerchantService extends ServiceBase {
}
async merchantSaves(params) {
let mcht;
if(params.id) {
mcht = await this.dao.findById(params.id);
} else {
mcht = {};
}
let origin = await this.originDao.findById(params.origin_id);
if(!origin) {
return system.getResult(null, "商户来源不存在");
}
mcht.origin_merchant_name = this.trim(params.origin_merchant_name);
mcht.merchant_name = this.trim(params.merchant_name);
mcht.contact_man = this.trim(params.contact_man);
mcht.contact_mobile = this.trim(params.contact_mobile);
mcht.contact_email = this.trim(params.contact_email);
mcht.contact_addr = this.trim(params.contact_addr);
if(mcht.id) {
await mcht.save();
} else {
mcht.channel_id = Number(params.channel_id);
mcht.origin_id = 10000;
mcht.origin_merchant_id = params.origin_merchant_id;
mcht = await this.dao.create(mcht);
}
return system.getResultSuccess(mcht);
}
async page(params) {
let currentPage = Number(params.currentPage || 1);
let pageSize = Number(params.pageSize || 10);
......@@ -71,6 +102,11 @@ class ChannelmerchantService extends ServiceBase {
[this.db.Op.like]: "%" + params.merchant_name + "%"
};
}
if(params.types == 1){
where.origin_merchant_id = "";
where.origin_merchant_name = "";
}
let orderby = [
["id", 'desc']
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment