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 {
type: 'object',
rule: {
token: 'string',
orderSn: 'string',
orderId: 'string',
appKey: 'string',
timestamp: 'string',
},
......@@ -66,12 +66,12 @@ class OrderController extends Controller {
const { ctx, service } = this;
try {
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);
const data = await service.order.getOneByOrderId(orderId);
if (data) {
if (data.status === 'success') {
const result = await service.storage.read(orderId);
const result = await service.storage.read(orderId, appKey);
ctx.body = {
code: 0,
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 => {
type: DataTypes.STRING(255),
allowNull: false,
defaultValue: '',
primaryKey: true,
field: 'orderId',
},
taskId: {
......@@ -76,7 +75,6 @@ module.exports = app => {
createDate: {
type: DataTypes.DATE,
allowNull: true,
primaryKey: true,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
field: 'createDate',
},
......@@ -84,7 +82,6 @@ module.exports = app => {
type: DataTypes.DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
primaryKey: true,
field: 'updateDate',
},
text1: {
......
......@@ -35,7 +35,7 @@ module.exports = app => {
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)//获取城市配置
......
......@@ -42,7 +42,7 @@ class StorageService extends Service {
return;
}
async read(orderId) {
async read(orderId, appKey) {
const { readUrl, readDataKey, ctx } = this;
const result = await this._request(`${readUrl}/${orderId}`, {
method: 'get',
......@@ -54,6 +54,11 @@ class StorageService extends Service {
ctx.logger.error(`storageAPI read ${readUrl}/${orderId}`, JSON.stringify(result.data));
ctx.throw(400, { message: result.data.msg });
}
await ctx.model.Cusdata.create({
appKey,
orderId,
type: 'gjj'
})
return result.data.data[readDataKey];
}
}
......
......@@ -11,6 +11,10 @@ module.exports = appInfo => {
// add your config here
config.middleware = ['requestLog', 'errorHandler'];
config.logrotator = {
maxDays: 1,
}
// config.verifyAppKey = {
// 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