Commit f740b8ec by zhaoxiqing

gsb

parent 3b49459b
......@@ -51,6 +51,9 @@ class ActionAPI extends APIBase {
case "channelSuggest":
opResult = await this.channelSve.suggest(action_body);
break;
case "channelIds":
opResult = await this.platformchannelService.channelIds(action_body);
break;
case "channelDicts":
opResult = await this.channelSve.dics(action_body);
break;
......@@ -68,6 +71,9 @@ class ActionAPI extends APIBase {
case "merchantInfo":
opResult = await this.channelmerchantSve.info(action_body);
break;
case "getchannelmerchantIds":
opResult = await this.channelmerchantSve.getchannelmerchantIds(action_body);
break;
case "merchantSave":
opResult = await this.channelmerchantSve.save(action_body);
break;
......
......@@ -26,7 +26,7 @@ class ChannelmerchantDao extends Dao {
}
var sql = [];
sql.push("SELECT");
sql.push("`origin_merchant_id`,`channel_id`,`merchant_name`");
sql.push("`origin_merchant_id`,`channel_id`,`merchant_name`,`merchant_id`");
sql.push("FROM");
sql.push(this.model.tableName);
sql.push("WHERE channel_id IN (:ids)");
......
......@@ -10,6 +10,16 @@ class PlatformchannelDao extends Dao {
return await this.customQuery(sql) || [];
}
async channelIds(){
var sql = [];
sql.push("SELECT");
sql.push("p.platform_id,p.channel_id,c.name");
sql.push("FROM");
sql.push("ch_platform_channel p");
sql.push("LEFT JOIN ch_channel c ON p.channel_id = c.id")
return await this.customQuery(sql.join(" ")) || [];
}
async allChannelIds() {
let sql = "SELECT channel_id FROM `ch_platform_channel`";
let list = await this.customQuery(sql) || [];
......
......@@ -11,6 +11,7 @@ module.exports = (db, DataTypes) => {
contact_mobile: DataTypes.STRING,
contact_email: DataTypes.STRING,
contact_addr: DataTypes.STRING,
merchant_id : DataTypes.STRING,
origin_merchant_name: DataTypes.STRING,
}, {
paranoid: true, //假的删除
......
......@@ -17,6 +17,10 @@ class ChannelmerchantService extends ServiceBase {
return system.getResultSuccess(channel);
}
async getchannelmerchantIds(params){
return await this.dao.findListByChannel(params.channel_id);
}
async save(params) {
let mcht;
......@@ -72,6 +76,7 @@ class ChannelmerchantService extends ServiceBase {
mcht.contact_mobile = this.trim(params.contact_mobile);
mcht.contact_email = this.trim(params.contact_email);
mcht.contact_addr = this.trim(params.contact_addr);
mcht.merchanmt_id = this.trim(params.merchanmt_id);
if(mcht.id) {
await mcht.save();
......@@ -160,7 +165,6 @@ class ChannelmerchantService extends ServiceBase {
row.channel_idcode = obj.idcode || "";
}
}
async getPushMerchantIds(params) {
let rs = [];
let allChannelIds = await this.platformchannelDao.allChannelIds() || [];
......
......@@ -45,6 +45,11 @@ class PlatformchannelService extends ServiceBase {
}
async channelIds(){
return await this.dao.channelIds();
}
trim(o) {
if(!o) {
return "";
......
......@@ -6,7 +6,7 @@ var settings={
db:10,
},
database:{
dbname : "bpo_channel2",
dbname : "bpo_channel",
user: "write",
password: "write",
config: {
......
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