Commit 810b1d6a by zhaoxiqing

gsb

parent 91ac22e9
...@@ -20,6 +20,21 @@ class ChannelmerchantDao extends Dao { ...@@ -20,6 +20,21 @@ class ChannelmerchantDao extends Dao {
}) || []; }) || [];
} }
async findListByChannel(ids) {
if (!ids || ids.length == 0) {
return [];
}
var sql = [];
sql.push("SELECT");
sql.push("`origin_merchant_id`,`channel_id`,`merchant_name`");
sql.push("FROM");
sql.push(this.model.tableName);
sql.push("WHERE channel_id IN (:ids)");
return await this.customQuery(sql.join(" "), {
ids: ids
}) || [];
}
async findMapByIds(ids) { async findMapByIds(ids) {
var result = {}; var result = {};
if (!ids || ids.length == 0) { if (!ids || ids.length == 0) {
...@@ -47,4 +62,4 @@ module.exports = ChannelmerchantDao; ...@@ -47,4 +62,4 @@ module.exports = ChannelmerchantDao;
// console.log(i); // console.log(i);
// } // }
// //
// })(); // })();
\ No newline at end of file
...@@ -5,6 +5,11 @@ class PlatformchannelDao extends Dao { ...@@ -5,6 +5,11 @@ class PlatformchannelDao extends Dao {
super(Dao.getModelName(PlatformchannelDao)); super(Dao.getModelName(PlatformchannelDao));
} }
async findByamong(params) {
var sql = "SELECT pc.platform_id,pc.channel_id,cm.origin_merchant_id,cm.origin_id,cm.merchant_name 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) || [];
}
} }
module.exports = PlatformchannelDao; module.exports = PlatformchannelDao;
...@@ -6,6 +6,7 @@ class PlatformchannelService extends ServiceBase { ...@@ -6,6 +6,7 @@ class PlatformchannelService extends ServiceBase {
constructor() { constructor() {
super("channel", ServiceBase.getDaoName(PlatformchannelService)); super("channel", ServiceBase.getDaoName(PlatformchannelService));
this.channelDao = system.getObject("db.channel.channelDao"); this.channelDao = system.getObject("db.channel.channelDao");
this.channelmerchantDao = system.getObject("db.channel.channelmerchantDao");
} }
async bindPlatform(params){ async bindPlatform(params){
...@@ -31,7 +32,13 @@ class PlatformchannelService extends ServiceBase { ...@@ -31,7 +32,13 @@ class PlatformchannelService extends ServiceBase {
//绑定渠道推送 //绑定渠道推送
async pushbindingchannel(params){ async pushbindingchannel(params){
console.log(params) var merchantS = await this.dao.findByamong(params);
if(merchantS.length > 0){
return system.getSuccResult(merchantS)
}
return system.getSuccResult(null)
} }
...@@ -41,6 +48,20 @@ class PlatformchannelService extends ServiceBase { ...@@ -41,6 +48,20 @@ class PlatformchannelService extends ServiceBase {
} }
return o.toString().trim(); return o.toString().trim();
} }
unique(arr) {
if (!Array.isArray(arr)) {
console.log('type error!')
return
}
var array = [];
for (var i = 0; i < arr.length; i++) {
if (array .indexOf(arr[i]) === -1) {
array .push(arr[i])
}
}
return array;
}
} }
module.exports = PlatformchannelService; module.exports = PlatformchannelService;
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