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