Commit f364a599 by 王昆

gsb

parent f654d830
......@@ -74,6 +74,10 @@ class ActionAPI extends APIBase {
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);
......
......@@ -49,6 +49,22 @@ class ChannelmerchantDao extends Dao {
}
return result;
}
async findIdsByChannelIds(ids) {
let sql = [];
sql.push("SELECT id");
sql.push("FROM");
sql.push(this.model.tableName);
sql.push("WHERE channel_id IN (:ids)");
let list = await this.customQuery(sql.join(" "), {
ids: ids
}) || [];
let rs = [];
for(let item of list) {
rs.push(item.id);
}
return rs;
}
}
module.exports = ChannelmerchantDao;
// var u=new UserDao();
......
......@@ -6,10 +6,18 @@ class PlatformchannelDao extends Dao {
}
async findByamong(params) {
var sql = "SELECT pc.platform_id,pc.channel_id,cm.origin_merchant_id,cm.origin_id,cm.merchant_name,cm.id,cm.contact_mobile from ch_platform_channel pc JOIN ch_channel_merchant cm ON pc.channel_id = cm.channel_id WHERE pc.created_at >='"+params.begin+"' AND pc.created_at <= '"+params.end+"'";
return await this.customQuery(sql) || [];
var sql = "SELECT pc.platform_id,pc.channel_id,cm.origin_merchant_id,cm.origin_id,cm.merchant_name,cm.id,cm.contact_mobile from ch_platform_channel pc JOIN ch_channel_merchant cm ON pc.channel_id = cm.channel_id ";
return await this.customQuery(sql) || [];
}
async allChannelIds() {
let sql = "SELECT channel_id FROM `ch_platform_channel`";
let list = await this.customQuery(sql) || [];
let rs = [];
for(let item of list) {
rs.push(item.channel_id);
}
return rs;
}
}
module.exports = PlatformchannelDao;
......@@ -8,6 +8,7 @@ class ChannelmerchantService extends ServiceBase {
super("channel", ServiceBase.getDaoName(ChannelmerchantService));
this.originDao = system.getObject("db.channel.originDao");
this.channelDao = system.getObject("db.channel.channelDao");
this.platformchannelDao = system.getObject("db.channel.platformchannelDao");
}
async info(params) {
......@@ -99,7 +100,18 @@ class ChannelmerchantService extends ServiceBase {
row.channel_name = obj.name || "";
row.channel_idcode = obj.idcode || "";
}
}
}
async getPushMerchantIds(params) {
let rs = [];
let allChannelIds = await this.platformchannelDao.allChannelIds() || [];
if(allChannelIds.length == 0) {
return rs;
}
return await this.dao.findIdsByChannelIds(allChannelIds) || [];
}
}
module.exports = ChannelmerchantService;
......@@ -38,7 +38,10 @@ class PlatformchannelService extends ServiceBase {
return system.getSuccResult(merchantS)
}
return system.getSuccResult(null)
}
async allChannelIds(params) {
return await this.dao.allChannelIds();
}
......
......@@ -6,7 +6,7 @@ var settings={
db:10,
},
database:{
dbname : "bpo_channel",
dbname : "bpo_channel2",
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