Commit 2421f144 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 15298dac 24e6347b
......@@ -6,6 +6,7 @@ class ActionAPI extends APIBase {
constructor() {
super();
this.merchantSve = system.getObject("service.merchant.merchantSve");
this.merchantapiSve = system.getObject("service.merchant.merchantapiSve");
this.merchanttradeSve = system.getObject("service.merchant.merchanttradeSve");
this.merchantaccountSve = system.getObject("service.merchant.merchantaccountSve");
}
......@@ -97,6 +98,11 @@ class ActionAPI extends APIBase {
opResult = await this.merchantaccountSve.addordelavailable(action_body);
break;
// api信息查询
case "apiInfoById" :
opResult = await this.merchantapiSve.infoById(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
module.exports = (db, DataTypes) => {
return db.define("merchantapi", {
secret: DataTypes.STRING,
merchant_id: DataTypes.BIGINT,
name : DataTypes.STRING,
ip: DataTypes.TINYINT,
secret: DataTypes.STRING,
ip: DataTypes.STRING,
is_enabled:{
type:DataTypes.BOOLEAN,
defaultValue: true
},
},{
paranoid: true, //假的删除
underscored: true,
......
......@@ -68,8 +68,8 @@ class MerchantService extends ServiceBase {
} else {
params.id = id;
rtn = await this.dao.create(params);
var secret = await this.getUidInfo(32);
this.merchantapiSve.create({id: id, secret: secret});
var secret = (await this.getUidInfo(32)).toLowerCase();
this.merchantapiSve.create({merchant_id: id, name: rtn.name, secret: secret, is_enabled: true});
}
return system.getResultSuccess(rtn);
} catch (e) {
......
const ServiceBase = require("../../sve.base");
const system = require("../../../system");
class merchantapiService extends ServiceBase {
constructor() {
super("merchant", ServiceBase.getDaoName(merchantapiService));
}
async infoById(params) {
let info = await this.dao.getById(params.id);
return system.getResultSuccess(info);
}
}
module.exports = merchantapiService;
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