Commit f6677b87 authored by 何娜's avatar 何娜

taxh5 通知优化

parent 22dec9f0
Pipeline #6360 passed with stage
in 6 seconds
...@@ -125,28 +125,33 @@ class PartnerService extends Service { ...@@ -125,28 +125,33 @@ class PartnerService extends Service {
async notice(order) { async notice(order) {
const { ctx } = this; const { ctx } = this;
ctx.logger.info(`【Partner】 notice into`); ctx.logger.info(`【Partner】 notice into`);
const { orderId, notifyUrl, userId, notice } = order; const { orderId, notifyUrl, userId } = order;
if (notifyUrl && notice !== '1') { if (notifyUrl) {
const ret = await ctx.curl(notifyUrl, { try{
charset: 'utf-8', const ret = await ctx.curl(notifyUrl, {
timeout: ['30s', '30s'], charset: 'utf-8',
contentType: 'json', timeout: ['30s', '30s'],
method: 'POST', contentType: 'json',
data: { method: 'POST',
orderId, data: {
userId, orderId,
status: 'success' 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) {
}else{ await order.update({ notice: 1 });
await order.update({ notice: ret.status }); }else{
} await order.update({ notice: ret.status });
}
}catch (e) {
ctx.logger.info(`【Partner】 notice err ${e}`)
}finally {
return
}
} }
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