Commit 3095eda2 by 王昆

gsb

parent 236911cd
...@@ -4,8 +4,8 @@ const uiconfig = system.getUiConfig2(settings.appKey); ...@@ -4,8 +4,8 @@ const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => { module.exports = (db, DataTypes) => {
return db.define("deliverbase", { return db.define("deliverbase", {
order_id: DataTypes.STRING(32), order_id: DataTypes.STRING(32),
// 1注册订单 2代开订单 3代账订单 // 产品类型 1000注册订单 1010代开订单 1030代账订单 1040增值服务
productType: DataTypes.INTEGER, productType: DataTypes.STRING,
deliver_id: DataTypes.STRING(32), deliver_id: DataTypes.STRING(32),
deliverName: DataTypes.STRING(50), deliverName: DataTypes.STRING(50),
deliverDivide: DataTypes.BIGINT, deliverDivide: DataTypes.BIGINT,
......
...@@ -7,7 +7,7 @@ module.exports = (db, DataTypes) => { ...@@ -7,7 +7,7 @@ module.exports = (db, DataTypes) => {
businessmen_id: DataTypes.STRING(32), businessmen_id: DataTypes.STRING(32),
channelNo: DataTypes.STRING(32), channelNo: DataTypes.STRING(32),
thirdNo: DataTypes.STRING(32), thirdNo: DataTypes.STRING(32),
productType: DataTypes.INTEGER, productType: DataTypes.STRING,
bdId: DataTypes.STRING, bdId: DataTypes.STRING,
bdPath: DataTypes.STRING, bdPath: DataTypes.STRING,
price: DataTypes.BIGINT, price: DataTypes.BIGINT,
......
...@@ -167,6 +167,14 @@ class IborderService extends ServiceBase { ...@@ -167,6 +167,14 @@ class IborderService extends ServiceBase {
// -----------------------以此间隔,上面为API,下面为service--------------------------------- // -----------------------以此间隔,上面为API,下面为service---------------------------------
async createOrder(params, t) {
// 处理注册订单
let productType = Number(params.productType || 1);
}
async statTransData(params) { async statTransData(params) {
var result = { var result = {
orderCount: 0, orderCount: 0,
......
...@@ -6,9 +6,21 @@ const moment = require("moment"); ...@@ -6,9 +6,21 @@ const moment = require("moment");
class IborderbaseService extends ServiceBase { class IborderbaseService extends ServiceBase {
constructor() { constructor() {
super("order", ServiceBase.getDaoName(IborderbaseService)); super("order", ServiceBase.getDaoName(IborderbaseService));
this.orderSve_1 = system.getObject("service.order.iborderSve"); this.iborderSve = system.getObject("service.order.iborderSve");
this.orderSve_2 = system.getObject("service.order.iborderdkSve"); this.iborderdkSve = system.getObject("service.order.iborderdkSve");
this.orderSve_3 = system.getObject("service.order.iborderdzSve"); this.iborderdzSve = system.getObject("service.order.iborderdzSve");
this.services = {
"1000": this.iborderSve, // 注册订单
"1010": this.iborderdzSve, // 代开订单
"1030": this.iborderdkSve, // 代账订单
"1040": this.iborderSve, // 增值服务
}
}
getService(productType) {
return this.services[productType];
} }
/** /**
...@@ -45,6 +57,12 @@ class IborderbaseService extends ServiceBase { ...@@ -45,6 +57,12 @@ class IborderbaseService extends ServiceBase {
// return system.getResult(null, `参数错误 发票类型错误`); // return system.getResult(null, `参数错误 发票类型错误`);
// } // }
let productType = this.trim(params.productTypes);
let childSve = this.getService(productType);
if(!childSve) {
return system.getResult(null, `暂不支持此种产品类型:${productType}`);
}
try { try {
params.channelNo = this.trim(params.channelNo); params.channelNo = this.trim(params.channelNo);
params.thirdNo = this.trim(params.thirdNo); params.thirdNo = this.trim(params.thirdNo);
...@@ -55,12 +73,11 @@ class IborderbaseService extends ServiceBase { ...@@ -55,12 +73,11 @@ class IborderbaseService extends ServiceBase {
params.payType = Number(params.payType || 1); params.payType = Number(params.payType || 1);
params.productType = Number(params.productType || 1); params.productType = Number(params.productType || 1);
params.price = Number(params.price || 0); params.price = Number(params.price || 0);
var self = this; let self = this;
//1 保存基类的信息 //1 保存基类的信息
await this.db.transaction(async t => { await this.db.transaction(async t => {
//创建基类表 //创建基类表
let _baseOrder = await self.create(params, t); let _baseOrder = await self.create(params, t);
let childSve = self.getService(params);
//将id 赋值 //将id 赋值
params.id = _baseOrder.id; params.id = _baseOrder.id;
await childSve.createOrder(params, t); await childSve.createOrder(params, t);
...@@ -82,10 +99,6 @@ class IborderbaseService extends ServiceBase { ...@@ -82,10 +99,6 @@ class IborderbaseService extends ServiceBase {
//3 完善信息 //3 完善信息
} }
getService(productType) {
return this["orderSve_" + productType];
}
async apiAdd(params) { async apiAdd(params) {
try { try {
let sve = this.getService(params.productType); let sve = this.getService(params.productType);
......
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