Commit f740b8ec by zhaoxiqing

gsb

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