Commit a682ce4b authored by 姜登's avatar 姜登

sbh5

parent 2871a40b
Pipeline #12951 passed with stage
in 17 seconds
......@@ -2,8 +2,10 @@ sudo: false
language: node_js
node_js:
- '8'
before_install:
- npm i npminstall -g
install:
- npm i npminstall && npminstall
- npminstall
script:
- npm run ci
after_script:
......
......@@ -146,7 +146,7 @@ class OrderController extends Controller {
const { ctx, service } = this;
const { appKey, orderId } = ctx.params;
const appKeyInfo = await service.partner.fetchInfo(appKey);
if (!(appKeyInfo && appKeyInfo.valid === true && appKeyInfo.enableHfView === true)) {
if (!(appKeyInfo && appKeyInfo.valid === true && appKeyInfo.enableSsView === true)) {
return ctx.fail('未开通此服务');
}
const data = await service.order.getOneByOrderId({ orderId });
......
......@@ -150,6 +150,7 @@ class TaskController extends Controller {
insertData.appKey = appKey;
delete insertData.code;
await service.storage.write(insertData);
await service.order.oldsbStatus({ orderId, status: 'success' });
await service.partner.notify(order);
} catch (err) {
ctx.logger.error(`【controller/task/handleCallback err】:${err}${JSON.stringify(result)}`);
......
'use strict';
module.exports = app => {
const { DataTypes } = app.Sequelize;
const cusDatas = app.nodemodel.define('cusDatas', {
id: {
type: DataTypes.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true,
field: 'id',
},
orderSn: {
type: DataTypes.STRING(255),
allowNull: false,
field: 'orderSn',
},
appkey: {
type: DataTypes.STRING(255),
allowNull: false,
field: 'appkey',
},
type: {
type: DataTypes.STRING(255),
allowNull: true,
defaultValue: '',
field: 'type',
},
date: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
field: 'date',
},
// text1: {
// type: DataTypes.STRING(255),
// allowNull: true,
// defaultValue: '',
// field: 'text1',
// },
// text2: {
// type: DataTypes.STRING(255),
// allowNull: true,
// defaultValue: '',
// field: 'text2',
// },
// text3: {
// type: DataTypes.STRING(255),
// allowNull: true,
// defaultValue: '',
// field: 'text3',
// },
// text4: {
// type: DataTypes.STRING(255),
// allowNull: true,
// defaultValue: '',
// field: 'text4',
// },
// date1: {
// type: DataTypes.DATE,
// allowNull: true,
// field: 'date1',
// },
// date2: {
// type: DataTypes.DATE,
// allowNull: true,
// field: 'date2',
// },
},
{
tableName: 'cus_data',
timestamps: false,
});
return cusDatas;
};
'use strict';
module.exports = app => {
const { DataTypes } = app.Sequelize;
const sbStatus = app.nodemodel.define('sbStatus', {
orderId: {
type: DataTypes.STRING(255),
allowNull: false,
primaryKey: true,
field: 'orderId',
},
taskId: {
type: DataTypes.STRING(255),
allowNull: false,
defaultValue: '',
field: 'taskId',
},
userId: {
type: DataTypes.STRING(500),
allowNull: true,
defaultValue: '',
field: 'userId',
},
cityId: {
type: DataTypes.STRING(10),
allowNull: true,
defaultValue: '',
field: 'cityId',
},
appkey: {
type: DataTypes.STRING(50),
allowNull: false,
field: 'appkey',
},
callbackUrl: {
type: DataTypes.STRING(500),
allowNull: true,
defaultValue: '',
field: 'callbackUrl',
},
status: {
type: DataTypes.STRING(20),
allowNull: true,
defaultValue: '',
field: 'status',
},
note: {
type: DataTypes.STRING(8000),
allowNull: true,
defaultValue: '',
field: 'note',
get() {
const note = this.getDataValue('note');
if (note) {
try {
return JSON.parse(note);
} catch (error) {
return {};
}
}
return {};
},
set(val) {
this.setDataValue('note', JSON.stringify(val));
},
},
created_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
field: 'createDate',
},
updated_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
field: 'updateDate',
},
text2: {
type: DataTypes.STRING(255),
allowNull: true,
defaultValue: '',
field: 'text2',
},
text3: {
type: DataTypes.STRING(255),
allowNull: true,
defaultValue: '',
field: 'text3',
},
text4: {
type: DataTypes.STRING(255),
allowNull: true,
defaultValue: '',
field: 'text4',
},
text5: {
type: DataTypes.STRING(255),
allowNull: true,
defaultValue: '',
field: 'text5',
},
},
{
tableName: 'sbh5_status',
});
return sbStatus;
};
......@@ -46,8 +46,37 @@ class OrderService extends Service {
} else {
await order[0].update(params);
}
await ctx.nodemodel.SbStatus.findOrCreate({
where: {
orderId: params.orderId,
},
defaults: {
appkey: appKey,
orderId: params.orderId,
callbackUrl: notifyUrl,
taskId: params.taskId,
cityId: params.cityId,
userId,
status: 'init',
},
})
.spread(async (info, created) => {
if (created === false) {
await info.update({ taskId, cityId: params.cityId, status: 'init' });
}
});
return order[0];
}
async oldsbStatus(params) {
const { ctx } = this;
await ctx.nodemodel.SbStatus.update({ status: params.status }, {
where: {
orderId: params.orderId,
},
limit: 1,
});
}
}
module.exports = OrderService;
......@@ -58,7 +58,12 @@ class StorageService extends Service {
await ctx.model.Cusdata.create({
appKey,
orderId,
type: 'shebao',
type: 'sbH5',
});
await ctx.nodemodel.Cusdata.create({
appkey: appKey,
orderSn: orderId,
type: 'sbH5',
});
return result.data.data[readDataKey];
}
......
......@@ -87,33 +87,33 @@ module.exports = () => {
datasources: [{
// 东八时区
timezone: '+08:00',
delegate: 'model',
baseDir: 'model',
delegate: 'nodemodel',
baseDir: 'model/nodegjj',
dialect: 'mysql',
host: 'rm-bp1272001633qc0x9o.mysql.rds.aliyuncs.com',
database: 'data_service_dev',
database: 'nodetest',
username: 'hexin',
password: 'gYUHszn9#q',
port: 3306,
}, {
// 东八时区
timezone: '+08:00',
delegate: 'javaSb',
delegate: 'model',
baseDir: 'model',
dialect: 'mysql',
host: 'rm-bp1272001633qc0x9o.mysql.rds.aliyuncs.com',
database: 'java_sb',
database: 'data_service_dev',
username: 'hexin',
password: 'gYUHszn9#q',
port: 3306,
}, {
// 东八时区
timezone: '+08:00',
delegate: 'nodeGjj',
delegate: 'javaSb',
baseDir: 'model',
dialect: 'mysql',
host: 'rm-bp1272001633qc0x9o.mysql.rds.aliyuncs.com',
database: 'nodetest',
database: 'java_sb',
username: 'hexin',
password: 'gYUHszn9#q',
port: 3306,
......
......@@ -78,6 +78,17 @@ module.exports = () => {
datasources: [{
// 东八时区
timezone: '+08:00',
delegate: 'nodemodel',
baseDir: 'model/nodegjj',
dialect: 'mysql',
host: process.env.MYSQL_PACHONG_HOST,
database: process.env.MYSQL_NODE_DB_NAME || 'node_gjj',
username: process.env.MYSQL_USER,
password: process.env.MYSQL_PWD,
port: process.env.MYSQL_PORT,
}, {
// 东八时区
timezone: '+08:00',
delegate: 'model',
baseDir: 'model',
dialect: 'mysql',
......
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