Commit a9df38d1 authored by 姜登's avatar 姜登

gjj

parent a992ea2b
Pipeline #3934 passed with stage
in 8 seconds
...@@ -28,14 +28,15 @@ class OrderController extends Controller { ...@@ -28,14 +28,15 @@ class OrderController extends Controller {
const { ctx, service } = this; const { ctx, service } = this;
const uuid = require('node-uuid'); const uuid = require('node-uuid');
ctx.validate(this.createRule); ctx.validate(this.createRule);
const { appKey, userId, notifyUrl } = ctx.request.body; const { appKey, userId, notifyUrl, backUrl } = ctx.request.body;
const orderId = uuid.v1(); const orderId = uuid.v1();
await service.order.create({ await service.order.create({
orderId, orderId,
taskId: '', taskId: '',
userId: userId, userId: userId,
cityId: '', cityId: '',
callbackUrl: notifyUrl || '', notifyUrl: notifyUrl || '',
backUrl: backUrl || '',
appKey: appKey, appKey: appKey,
status: 'init', status: 'init',
}); });
......
...@@ -19,7 +19,7 @@ module.exports = app => { ...@@ -19,7 +19,7 @@ module.exports = app => {
}, },
taskId: { taskId: {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
allowNull: false, allowNull: true,
defaultValue: '', defaultValue: '',
field: 'taskId', field: 'taskId',
}, },
...@@ -40,11 +40,17 @@ module.exports = app => { ...@@ -40,11 +40,17 @@ module.exports = app => {
allowNull: false, allowNull: false,
field: 'appKey', field: 'appKey',
}, },
callbackUrl: { notifyUrl: {
type: DataTypes.STRING(255), type: DataTypes.STRING(500),
allowNull: false, allowNull: true,
defaultValue: '',
field: 'notifyUrl',
},
backUrl: {
type: DataTypes.STRING(500),
allowNull: true,
defaultValue: '', defaultValue: '',
field: 'callbackUrl', field: 'backUrl',
}, },
status: { status: {
type: DataTypes.STRING(255), type: DataTypes.STRING(255),
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
module.exports = app => { module.exports = app => {
const { router, controller } = app; const { router, controller } = app;
const gjjRouter = app.router.namespace(app.config.path); const gjjRouter = app.router.namespace(app.config.projectRootPath);
gjjRouter.post('/tasks', controller.task.create); // 创建任务 gjjRouter.post('/tasks', controller.task.create); // 创建任务
gjjRouter.get('/tasks/:taskId', controller.task.show); // 获取任务状态 gjjRouter.get('/tasks/:taskId', controller.task.show); // 获取任务状态
gjjRouter.post('/tasks/:taskId/submit', controller.task.submit); // 提交任务参数 gjjRouter.post('/tasks/:taskId/submit', controller.task.submit); // 提交任务参数
......
...@@ -38,9 +38,9 @@ class OrderService extends Service { ...@@ -38,9 +38,9 @@ class OrderService extends Service {
if (!order) { if (!order) {
ctx.throw(400, { message: 'no order' }); ctx.throw(400, { message: 'no order' });
} }
const { appKey, taskId } = order; const { appKey, taskId, notifyUrl, backUrl, userId } = order;
if (taskId) { if (taskId) {
await ctx.model.TaskStatus.create({ appKey, status: 'init', ...params }) await ctx.model.TaskStatus.create({ appKey, status: 'init', notifyUrl, backUrl, userId, ...params })
} else { } else {
await order.update(params); await order.update(params);
} }
......
...@@ -89,9 +89,9 @@ class PartnerService extends Service { ...@@ -89,9 +89,9 @@ class PartnerService extends Service {
async notice(order) { async notice(order) {
const { ctx } = this; const { ctx } = this;
const { orderId, callbackUrl, userId, notice } = order; const { orderId, notifyUrl, userId, notice } = order;
if (callbackUrl && notice !== '1') { if (notifyUrl && notice !== '1') {
const ret = await ctx.curl(callbackUrl, { const ret = await ctx.curl(notifyUrl, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: ['30s', '30s'],
contentType: 'json', contentType: 'json',
...@@ -103,7 +103,7 @@ class PartnerService extends Service { ...@@ -103,7 +103,7 @@ class PartnerService extends Service {
}, },
} }
) )
ctx.logger.info(`【Partner】 notice ${callbackUrl}`, 'orderId:', orderId, 'result:', ret.status, JSON.stringify(ret.data)); ctx.logger.info(`【Partner】 notice ${notifyUrl}`, 'orderId:', orderId, 'result:', ret.status, JSON.stringify(ret.data));
if (ret.status == 200) { if (ret.status == 200) {
await order.update({ notice: '1' }); await order.update({ notice: '1' });
} }
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
module.exports = appInfo => { module.exports = appInfo => {
const config = exports = {}; const config = exports = {};
config.path = '/gjjh5';
// use for cookie sign key, should change to your own and keep security // use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1542452126322_5140'; config.keys = appInfo.name + '_1542452126322_5140';
......
...@@ -4,6 +4,8 @@ module.exports = () => { ...@@ -4,6 +4,8 @@ module.exports = () => {
const config = exports = {}; const config = exports = {};
config.debug = true; config.debug = true;
config.projectRootPath = '/gjjh5';
// config.redis = { // config.redis = {
// client: { // client: {
// port: 6379, // port: 6379,
...@@ -74,7 +76,6 @@ module.exports = () => { ...@@ -74,7 +76,6 @@ module.exports = () => {
fecthParnters: 'URANUS.PARNTERS.LOCK', fecthParnters: 'URANUS.PARNTERS.LOCK',
taskPrefix: 'URANUS.TASK', taskPrefix: 'URANUS.TASK',
}; };
config.projectRootPath = '';
config.sequelize = { config.sequelize = {
datasources: [{ datasources: [{
......
...@@ -8,7 +8,7 @@ module.exports = () => { ...@@ -8,7 +8,7 @@ module.exports = () => {
dir: '/jianbing/logs/gjjh5', dir: '/jianbing/logs/gjjh5',
}; };
config.projectRootPath = '/gjjh5';
// config.redis = { // config.redis = {
// client: { // client: {
// port: 6379, // port: 6379,
...@@ -18,7 +18,7 @@ module.exports = () => { ...@@ -18,7 +18,7 @@ module.exports = () => {
// }, // },
// }; // };
config.taskAPI = { config.taskAPI = {
host: 'http://tm.51gjj.com:4821', host: process.env.TASKAPI_HOST || 'http://tm.51gjj.com:4821',
fetchHubsUrl: '', fetchHubsUrl: '',
createTaskUrl: '/gjjServices/createGjjTask', createTaskUrl: '/gjjServices/createGjjTask',
fetchCodeUrl: '/gjjServices/queryGjjCode', fetchCodeUrl: '/gjjServices/queryGjjCode',
...@@ -27,7 +27,7 @@ module.exports = () => { ...@@ -27,7 +27,7 @@ module.exports = () => {
}; };
config.scriptsAPI = { config.scriptsAPI = {
host: 'https://uat-nginx.jianbing.com/zeus-api/v1', host: process.env.SCRIPTSAPI_HOST || 'https://uat-nginx.jianbing.com/zeus-api/v1',
fetchScriptsUrl: '/chaos/hf/two_dimension_array/queries', fetchScriptsUrl: '/chaos/hf/two_dimension_array/queries',
fetchOneScriptUrl: '/chaos/hf/two_dimension_array/info', fetchOneScriptUrl: '/chaos/hf/two_dimension_array/info',
fetchParamsInfoUrl: '/chaos/hf/login_param_map', fetchParamsInfoUrl: '/chaos/hf/login_param_map',
...@@ -41,7 +41,7 @@ module.exports = () => { ...@@ -41,7 +41,7 @@ module.exports = () => {
}; };
config.storageAPI = { config.storageAPI = {
host: 'http://tv.51gjj.com:11252', host: process.env.STORAGEAPI_HOST || 'http://tv.51gjj.com:11252',
writeUrl: '/data', writeUrl: '/data',
readUrl: '/gjj', readUrl: '/gjj',
writeType: 'gjj', writeType: 'gjj',
...@@ -49,12 +49,12 @@ module.exports = () => { ...@@ -49,12 +49,12 @@ module.exports = () => {
}; };
config.washAPI = { config.washAPI = {
host: 'http://tt.51gjj.com:11101', host: process.env.WASHAPI_HOST || 'http://tt.51gjj.com:11101',
washUrl: '/gjj/analyzeGjj', washUrl: '/gjj/analyzeGjj',
}; };
config.signatureAPI = { config.signatureAPI = {
host: 'http://tj3.51gjj.com:5118', host: process.env.SIGNATUREAPI_HOST || 'http://tj3.51gjj.com:5118',
fetchTokenUrl: '/Access/GetToken', fetchTokenUrl: '/Access/GetToken',
fetchOrderIdUrl: '/Order/GetOrderSn', fetchOrderIdUrl: '/Order/GetOrderSn',
signatureUrl: '/Access/SignValidityCheck', signatureUrl: '/Access/SignValidityCheck',
...@@ -63,7 +63,7 @@ module.exports = () => { ...@@ -63,7 +63,7 @@ module.exports = () => {
}; };
config.partnerAPI = { config.partnerAPI = {
host: 'https://uat-nginx.jianbing.com/zeus-api/v1', host: process.env.PARTNERAPI_HOST || 'https://uat-nginx.jianbing.com/zeus-api/v1',
fetchTheme: '/chaos/hf/partners', fetchTheme: '/chaos/hf/partners',
fetchScripts: '/chaos/partners/scripts', fetchScripts: '/chaos/partners/scripts',
fetchAgreements: '/chaos/agreements', fetchAgreements: '/chaos/agreements',
...@@ -79,7 +79,6 @@ module.exports = () => { ...@@ -79,7 +79,6 @@ module.exports = () => {
fecthParnters: 'URANUS.PARNTERS.LOCK', fecthParnters: 'URANUS.PARNTERS.LOCK',
taskPrefix: 'URANUS.HFH5.TASK', taskPrefix: 'URANUS.HFH5.TASK',
}; };
config.projectRootPath = '';
config.sequelize = { config.sequelize = {
datasources: [{ datasources: [{
......
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