Commit 805ef6c9 by zhaoxiqing

gsb

parent 080ca5e1
......@@ -82,6 +82,9 @@ class ActionAPI extends APIBase {
case "merchantOfInfo":
opResult = await this.merchantSve.merchantOfInfo(action_body);
break;
case "merchantToIdsInfo":
opResult = await this.merchantSve.merchantToIdsInfo(action_body);
break;
//商户审核
case "auditMerchant":
opResult = await this.merchantSve.auditMerchant(action_body);
......
......@@ -31,6 +31,24 @@ class MerchantDao extends Dao {
return result;
}
async findMapInIds(ids, attrs) {
var result = [];
if (!ids || ids.length == 0) {
return result;
}
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM e_merchant where id IN (:ids) ";
var list = await this.customQuery(sql, {ids: ids});
if (!list || list.length == 0) {
return result;
}
return list;
}
}
module.exports = MerchantDao;
......@@ -120,6 +120,22 @@ class MerchantService extends ServiceBase {
}
}
async merchantToIdsInfo(params) {
try {
if (params.merchantIds.length == 0) {
return system.getResultFail(-1, "请提供商户ID");
}
var merchantMap = await this.dao.findMapInIds(params.merchantIds);
return system.getResultSuccess(merchantMap);
} catch (e) {
console.log(e);
return system.getResultFail();
}
}
async auditMerchant(params) {
try {
if (!params.id) {
......
......@@ -98,6 +98,7 @@ class MerchanttradeService extends ServiceBase {
merchantIds.push(item.merchant_id || 0);
}
var merchantMap = await this.merchantDao.findMapByIds(merchantIds, " id, name ");
for (var item of list) {
item.merchant = merchantMap[item.merchant_id] || {};
}
......
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