Commit 9dd91203 authored by 姜登's avatar 姜登

gjj

parent b995c5ad
Pipeline #6201 passed with stage
in 2 seconds
......@@ -79,26 +79,6 @@ class OrderController extends Controller {
ctx.success({ orderId: object.orderId });
}
async show() {
const { ctx, service } = this;
ctx.validate(this.showRule);
const { orderId } = ctx.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);
ctx.success(result);
return;
}
ctx.success({
status: data.status,
});
return;
}
ctx.fail('无此订单号');
}
async partnerShow() {
const { ctx, service } = this;
try {
......@@ -110,16 +90,14 @@ class OrderController extends Controller {
return ctx.fail('未开通此服务');
}
await service.signature.signatureCheck(ctx.request.body);
const data = await service.order.getOneByOrderId(orderId);
const data = await service.order.getOneByOrderId({ orderId, status: 'success' });
if (data) {
if (data.status === 'success') {
const result = await service.storage.read(orderId, appKey);
ctx.body = {
code: 0,
data: result,
};
return;
}
const result = await service.storage.read(orderId, appKey);
ctx.body = {
code: 0,
data: result,
};
return;
}
ctx.body = {
code: -1,
......@@ -138,7 +116,7 @@ class OrderController extends Controller {
if (!(appKeyInfo && appKeyInfo.valid === true && appKeyInfo.enableHfView === true)) {
return ctx.fail('未开通此服务');
}
const data = await service.order.getOneByOrderId(orderId);
const data = await service.order.getOneByOrderId({ orderId, status: 'success' });
if (data) {
if (data.status === 'success' && (data.appKey === appKey)) {
const result = await service.storage.read(orderId, appKey);
......
......@@ -3,10 +3,10 @@
const Service = require('egg').Service;
class OrderService extends Service {
async getOneByOrderId(orderId) {
async getOneByOrderId(params) {
const { ctx } = this;
const order = await ctx.model.TaskStatus.findOne({
where: { orderId },
where: params,
});
return order;
}
......
......@@ -94,9 +94,10 @@ class PartnerService extends Service {
}
async notice(order) {
const { ctx } = this;
const { ctx, service } = this;
const { orderId, notifyUrl, userId, notice } = order;
if (notifyUrl && notice !== '1') {
const dbRes = await service.order.getOneByOrderId({ orderId, notice: 1 });
if (!dbRes && notifyUrl && notice !== '1') {
const ret = await ctx.curl(notifyUrl, {
charset: 'utf-8',
timeout: [30000, 30000],
......
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