Commit 2b0bc7a1 authored by 姜登's avatar 姜登

sb

parent a682ce4b
Pipeline #12964 passed with stage
in 16 seconds
......@@ -98,27 +98,30 @@ class PartnerService extends Service {
// orderId/userId/status
async notify(order) {
const { ctx, service } = this;
const { orderId, notifyUrl, userId, notice } = order;
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],
contentType: 'json',
method: 'POST',
data: {
order_id: orderId,
user_id: userId,
status: 'success',
},
}
);
ctx.logger.info(`【Partner】 notice ${notifyUrl}`, 'orderId:', orderId, 'result:', ret.status, JSON.stringify(ret.data));
if (ret.status === 200) {
await order.update({ notice: '1' });
try {
const { orderId, notifyUrl, userId, notice } = order;
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],
contentType: 'json',
method: 'POST',
data: {
order_id: orderId,
user_id: userId,
status: 'success',
},
}
);
ctx.logger.info(`【Partner】 notice ${notifyUrl}`, 'orderId:', orderId, 'result:', ret.status, JSON.stringify(ret.data));
if (ret.status === 200) {
await order.update({ notice: '1' });
}
}
} catch (err) {
ctx.logger.warn('【Partner】 notice error', JSON.stringify(order), JSON.stringify(err));
}
return;
}
}
......
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