Commit 2116139e authored by 姜登's avatar 姜登

nodegjj

parent abcb28ad
Pipeline #9254 passed with stage
in 1 minute 33 seconds
......@@ -144,6 +144,7 @@ class TaskController extends Controller {
delete insertData.code;
await service.storage.write(insertData);
await service.partner.notice(order);
await service.order.oldgjjStatus({ orderId, status: 'success' });
} catch (err) {
ctx.logger.error('handleCallback', JSON.stringify(err), JSON.stringify(result));
taskNote = {
......
'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 gjjStatus = app.nodemodel.define('gjjStatus', {
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: 'gjjh5_status',
});
return gjjStatus;
};
......@@ -46,8 +46,38 @@ class OrderService extends Service {
} else {
await order[0].update(params);
}
await ctx.nodemodel.GjjStatus.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 oldgjjStatus(params) {
const { ctx } = this;
await ctx.nodemodel.GjjStatus.update({ status: params.status }, {
where: {
orderId: params.orderId,
},
limit: 1,
});
}
}
module.exports = OrderService;
......@@ -57,7 +57,12 @@ class StorageService extends Service {
await ctx.model.Cusdata.create({
appKey,
orderId,
type: 'gjj',
type: 'gjjH5',
});
await ctx.nodemodel.Cusdata.create({
appkey: appKey,
orderSn: orderId,
type: 'gjjH5',
});
return result.data.data[readDataKey];
}
......
......@@ -90,6 +90,17 @@ module.exports = () => {
datasources: [{
// 东八时区
timezone: '+08:00',
delegate: 'nodemodel',
baseDir: 'model/nodegjj',
dialect: 'mysql',
host: 'rm-bp1272001633qc0x9o.mysql.rds.aliyuncs.com',
database: 'nodetest',
username: 'hexin',
password: 'gYUHszn9#q',
port: 3306,
}, {
// 东八时区
timezone: '+08:00',
delegate: 'model',
baseDir: 'model',
dialect: 'mysql',
......
......@@ -102,6 +102,17 @@ module.exports = () => {
username: process.env.MYSQL_USER || 'kf_jiandeng',
password: process.env.MYSQL_PWD || 'Zg23Is9c7d2uKz15abZcV',
port: process.env.MYSQL_PORT || 3306,
}, {
// 东八时区
timezone: '+08:00',
delegate: 'nodemodel',
baseDir: 'model/nodegjj',
dialect: 'mysql',
host: process.env.MYSQL_PACHONG_HOST || 'rm-bp1272001633qc0x9o.mysql.rds.aliyuncs.com',
database: process.env.MYSQL_NODE_SERVER_DB_NAME || 'nodetest',
username: process.env.MYSQL_USER || 'hexin',
password: process.env.MYSQL_PWD || 'gYUHszn9#q',
port: process.env.MYSQL_PORT || 3306,
}],
};
......
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