Commit 84cae192 authored by 姜登's avatar 姜登

gjj

parent f8202ade
Pipeline #3917 passed with stage
in 3 seconds
...@@ -16,7 +16,7 @@ class OrderController extends Controller { ...@@ -16,7 +16,7 @@ class OrderController extends Controller {
type: 'object', type: 'object',
rule: { rule: {
token: 'string', token: 'string',
orderSn: 'string', orderId: 'string',
appKey: 'string', appKey: 'string',
timestamp: 'string', timestamp: 'string',
}, },
...@@ -66,12 +66,12 @@ class OrderController extends Controller { ...@@ -66,12 +66,12 @@ class OrderController extends Controller {
const { ctx, service } = this; const { ctx, service } = this;
try { try {
ctx.validate(this.showRule); ctx.validate(this.showRule);
const orderId = ctx.request.body.params.orderSn; const { appKey, orderId } = ctx.request.body.params;
await service.signature.signatureCheck(ctx.request.body); await service.signature.signatureCheck(ctx.request.body);
const data = await service.order.getOneByOrderId(orderId); const data = await service.order.getOneByOrderId(orderId);
if (data) { if (data) {
if (data.status === 'success') { if (data.status === 'success') {
const result = await service.storage.read(orderId); const result = await service.storage.read(orderId, appKey);
ctx.body = { ctx.body = {
code: 0, code: 0,
data: result data: result
......
'use strict';
module.exports = app => {
const { DataTypes } = app.Sequelize;
const cusDatas = app.model.define('cusDatas', {
id: {
type: DataTypes.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true,
field: 'id',
},
orderId: {
type: DataTypes.STRING(255),
allowNull: false,
defaultValue: '',
primaryKey: true,
field: 'orderId',
},
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,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
field: 'date1',
},
date2: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
field: 'date2',
},
},
{
tableName: 'cus_data',
timestamps: false,
});
return cusDatas;
}
\ No newline at end of file
...@@ -15,7 +15,6 @@ module.exports = app => { ...@@ -15,7 +15,6 @@ module.exports = app => {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
allowNull: false, allowNull: false,
defaultValue: '', defaultValue: '',
primaryKey: true,
field: 'orderId', field: 'orderId',
}, },
taskId: { taskId: {
...@@ -76,7 +75,6 @@ module.exports = app => { ...@@ -76,7 +75,6 @@ module.exports = app => {
createDate: { createDate: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: true, allowNull: true,
primaryKey: true,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'), defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
field: 'createDate', field: 'createDate',
}, },
...@@ -84,7 +82,6 @@ module.exports = app => { ...@@ -84,7 +82,6 @@ module.exports = app => {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: false, allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'), defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
primaryKey: true,
field: 'updateDate', field: 'updateDate',
}, },
text1: { text1: {
......
...@@ -35,7 +35,7 @@ module.exports = app => { ...@@ -35,7 +35,7 @@ module.exports = app => {
gjjRouter.post('/getToken', controller.token.partnerCreate);// 合作方创建token gjjRouter.post('/getToken', controller.token.partnerCreate);// 合作方创建token
gjjRouter.post('/getdata', controller.order.partnerShow);// 合作方获取订单数据 gjjRouter.post('/getData', controller.order.partnerShow);// 合作方获取订单数据
gjjRouter.post('/getCityConfig', controller.task.fetchCityConfig)//获取城市配置 gjjRouter.post('/getCityConfig', controller.task.fetchCityConfig)//获取城市配置
......
...@@ -42,7 +42,7 @@ class StorageService extends Service { ...@@ -42,7 +42,7 @@ class StorageService extends Service {
return; return;
} }
async read(orderId) { async read(orderId, appKey) {
const { readUrl, readDataKey, ctx } = this; const { readUrl, readDataKey, ctx } = this;
const result = await this._request(`${readUrl}/${orderId}`, { const result = await this._request(`${readUrl}/${orderId}`, {
method: 'get', method: 'get',
...@@ -54,6 +54,11 @@ class StorageService extends Service { ...@@ -54,6 +54,11 @@ class StorageService extends Service {
ctx.logger.error(`storageAPI read ${readUrl}/${orderId}`, JSON.stringify(result.data)); ctx.logger.error(`storageAPI read ${readUrl}/${orderId}`, JSON.stringify(result.data));
ctx.throw(400, { message: result.data.msg }); ctx.throw(400, { message: result.data.msg });
} }
await ctx.model.Cusdata.create({
appKey,
orderId,
type: 'gjj'
})
return result.data.data[readDataKey]; return result.data.data[readDataKey];
} }
} }
......
...@@ -11,6 +11,10 @@ module.exports = appInfo => { ...@@ -11,6 +11,10 @@ module.exports = appInfo => {
// add your config here // add your config here
config.middleware = ['requestLog', 'errorHandler']; config.middleware = ['requestLog', 'errorHandler'];
config.logrotator = {
maxDays: 1,
}
// config.verifyAppKey = { // config.verifyAppKey = {
// match: '/orders', // match: '/orders',
// } // }
......
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