Commit cf0aeb2a by zhaoxiqing

Merge branch 'esign-sve-merchant' of…

Merge branch 'esign-sve-merchant' of http://gitlab.gongsibao.com/jiangyong/zhichan into esign-sve-merchant
parents f01d3a3f 49cdea2f
......@@ -61,6 +61,10 @@ class ActionAPI extends APIBase {
case "merchantSuggest":
opResult = await this.merchantSve.merchantSuggest(action_body);
break;
//根据商户ID查询商户信息MAP
case "merchantMapByIds":
opResult = await this.merchantSve.merchantMapByIds(action_body);
break;
//资金调账
// 新增充值
case "addMerchanttrades":
......
......@@ -6,7 +6,7 @@ class MerchantDao extends Dao {
}
async suggest(name) {
var sql = "SELECT id, name FROM `e_merchant` WHERE deleted_at IS NULL ";
var sql = "SELECT id, name FROM `e_merchant` WHERE deleted_at IS NULL AND audit_status='1' ";
var list = await this.customQuery(sql);
return list || [];
}
......
......@@ -6,6 +6,23 @@ class MerchantapiDao extends Dao {
super(Dao.getModelName(MerchantapiDao));
}
async infoById(id) {
let sql = [];
sql.push("SELECT");
sql.push("t1.*,");
sql.push("t2.`name` AS merchant_name");
sql.push("FROM `e_merchant_api` t1");
sql.push("INNER JOIN `e_merchant` t2 ON t1.`merchant_id` = t2.`id`");
sql.push("WHERE t1.id = :id");
sql.push("LIMIT 1");
let list = await this.customQuery(sql.join(" "), {id: id});
if (!list || list.length == 0) {
return null;
}
return list[0];
}
}
module.exports = MerchantapiDao;
......
......@@ -99,7 +99,7 @@ class MerchantService extends ServiceBase {
}
this.addWhereTime(where, 'created_at', params.beginTime, params.entTime, true);
var orderby = [["id", 'desc']];
var attributes = [`id`, `name`, `credit_code`, `contact_man`, `contact_mobile`, `contact_email`, `account_name`, `audit_status`];
var attributes = [`id`, `name`, `credit_code`, `contact_man`, `contact_mobile`, `contact_email`, `account_name`, `audit_status`, `bd_id`];
var page = await this.getPageList(currentPage, pageSize, where, orderby, attributes);
return system.getResultSuccess(page);
} catch (e) {
......@@ -113,7 +113,7 @@ class MerchantService extends ServiceBase {
if (!params.id) {
return system.getResultFail(-1, "商户ID为空");
}
var merchant = await this.dao.findById(params.id) || {};
var merchant = await this.dao.getById(params.id) || {};
return system.getResultSuccess(merchant);
} catch (e) {
console.log(e);
......@@ -169,6 +169,33 @@ class MerchantService extends ServiceBase {
}
}
/**
*fn:根据商户ID查询商户信息MAP
* @returns {Promise<void>}
*/
async merchantMapByIds(params){
try{
let listMerchant = await this.dao.model.findAll({
where:{
id:{
[this.db.Op.in]:params.ids
}
}
});
if(listMerchant.length==0){
return system.getResult({});
}
let mapMerchant ={};
for (let item of listMerchant) {
mapMerchant[item.id] = item.name;
}
return system.getResult(mapMerchant);
}catch (e) {
console.log(e);
return system.getResult(null, `系统错误`);
}
}
}
module.exports = MerchantService;
......@@ -7,7 +7,7 @@ class merchantapiService extends ServiceBase {
}
async infoById(params) {
let info = await this.dao.getById(params.id);
let info = await this.dao.infoById(params.id);
return system.getResultSuccess(info);
}
}
......
......@@ -73,7 +73,7 @@ class MerchanttradeService extends ServiceBase {
}
this.addWhereTime(where, 'created_at', params.beginTime, params.entTime, true);
var orderby = [["id", 'desc']];
var attributes = [`id`, `trade_data_id`, `trade_time`, `merchant_id`, `amount`, `audit_status`, `audit_remark`];
var attributes = [`id`, `trade_data_id`, `trade_time`, `merchant_id`, `amount`, `audit_status`, `audit_remark`,'trade_voucher'];
var page = await this.getPageList(currentPage, pageSize, where, orderby, attributes);
if (page && page.rows) {
for (var row of page.rows) {
......
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