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 { ...@@ -98,27 +98,30 @@ class PartnerService extends Service {
// orderId/userId/status // orderId/userId/status
async notify(order) { async notify(order) {
const { ctx, service } = this; const { ctx, service } = this;
const { orderId, notifyUrl, userId, notice } = order; try {
const dbRes = await service.order.getOneByOrderId({ orderId, notice: 1 }); const { orderId, notifyUrl, userId, notice } = order;
if (!dbRes && notifyUrl && notice !== '1') { const dbRes = await service.order.getOneByOrderId({ orderId, notice: 1 });
const ret = await ctx.curl(notifyUrl, { if (!dbRes && notifyUrl && notice !== '1') {
charset: 'utf-8', const ret = await ctx.curl(notifyUrl, {
timeout: [30000, 30000], charset: 'utf-8',
contentType: 'json', timeout: [30000, 30000],
method: 'POST', contentType: 'json',
data: { method: 'POST',
order_id: orderId, data: {
user_id: userId, order_id: orderId,
status: 'success', user_id: userId,
}, status: 'success',
} },
); }
ctx.logger.info(`【Partner】 notice ${notifyUrl}`, 'orderId:', orderId, 'result:', ret.status, JSON.stringify(ret.data)); );
if (ret.status === 200) { ctx.logger.info(`【Partner】 notice ${notifyUrl}`, 'orderId:', orderId, 'result:', ret.status, JSON.stringify(ret.data));
await order.update({ notice: '1' }); 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