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