Commit 3bb20aca authored by 何娜's avatar 何娜

taxh5 拉数据优化

parent 5c96b54d
Pipeline #7082 passed with stage
in 2 seconds
...@@ -97,11 +97,16 @@ class OrderController extends Controller { ...@@ -97,11 +97,16 @@ class OrderController extends Controller {
async partnerData() { async partnerData() {
const {ctx, service} = this; const {ctx, service} = this;
ctx.validate(this.showRule); ctx.validate(this.showRule);
const {appKey, orderSn} = ctx.request.body.params; let {appKey, orderSn, orderId} = ctx.request.body.params;
orderId = orderId || orderSn;
const appKeyInfo = await service.partner.fetchInfo(appKey);
if (!(appKeyInfo && appKeyInfo.valid === true && appKeyInfo.enableHfData === true)) {
return ctx.fail('未开通此服务');
}
await service.signature.signatureCheck(ctx.request.body); await service.signature.signatureCheck(ctx.request.body);
const data = await service.order.getOneByOrderId(orderSn); const data = await service.order.getOneByOrderId({ orderId, status: 'success' });
if (data && data.status === 'success') { if (data) {
const result = await service.storage.read(orderSn, appKey); const result = await service.storage.read(orderId, appKey);
ctx.body = { ctx.body = {
code: 0, code: 0,
data: result data: result
...@@ -121,8 +126,7 @@ class OrderController extends Controller { ...@@ -121,8 +126,7 @@ class OrderController extends Controller {
if (!(appKeyInfo && appKeyInfo.valid === true && appKeyInfo.enableItView === true)) { if (!(appKeyInfo && appKeyInfo.valid === true && appKeyInfo.enableItView === true)) {
return ctx.fail('未开通此服务'); return ctx.fail('未开通此服务');
} }
const data = await service.order.getOneByOrderId(orderId); const data = await service.order.getOneByOrderId({orderId, status: 'success' });
ctx.logger.info('【orderShow】 getOneByOrderId', data)
if (data) { if (data) {
if (data.status === 'success' && (data.appkey === appKey)) { if (data.status === 'success' && (data.appkey === appKey)) {
const result = await service.storage.read(orderId, appKey); const result = await service.storage.read(orderId, appKey);
......
...@@ -125,14 +125,8 @@ class PartnerService extends Service { ...@@ -125,14 +125,8 @@ class PartnerService extends Service {
async notice(order) { async notice(order) {
const {ctx, service} = this; const {ctx, service} = this;
ctx.logger.info('【notice】order------',order);
const {orderId, notifyUrl, userId, notice} = order; const {orderId, notifyUrl, userId, notice} = order;
ctx.logger.info('【notice】orderId------',orderId);
ctx.logger.info('【notice】notifyUrl------',notifyUrl);
ctx.logger.info('【notice】userId------',userId);
ctx.logger.info('【notice】notice------',notice);
const dbRes = await service.order.getOneByOrderId({ orderId, notice: 1 }); const dbRes = await service.order.getOneByOrderId({ orderId, notice: 1 });
ctx.logger.info('【notice】dbRes------',dbRes);
if (!dbRes && notifyUrl && notice !== '1') { if (!dbRes && notifyUrl && notice !== '1') {
try { try {
const ret = await ctx.curl(notifyUrl, { const ret = await ctx.curl(notifyUrl, {
......
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