20261008
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
'use strict';
|
||||
const balanceUtil = require('./util.js');
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* 查询状态
|
||||
* @url admin/finance/balance/sys/getActionLog 前端调用的url参数地址
|
||||
* @param {String} accNo 账号
|
||||
* @param {String} reqDate 请求日期,格式:yyyyMMdd
|
||||
* @param {String} reqJournalNo 请求流水号
|
||||
*/
|
||||
main: async (event) => {
|
||||
let { data = {}, util } = event;
|
||||
let { vk } = util;
|
||||
let { accNo, reqDate, reqJournalNo } = data;
|
||||
|
||||
accNo = String(accNo || '').trim();
|
||||
reqDate = String(reqDate || '').trim();
|
||||
reqJournalNo = String(reqJournalNo || '').trim();
|
||||
|
||||
if (!accNo) {
|
||||
return {
|
||||
code: -1,
|
||||
msg: 'accNo不能为空'
|
||||
};
|
||||
}
|
||||
|
||||
if (!reqDate) {
|
||||
return {
|
||||
code: -1,
|
||||
msg: 'reqDate不能为空'
|
||||
};
|
||||
}
|
||||
|
||||
if (!/^\d{8}$/.test(reqDate)) {
|
||||
return {
|
||||
code: -1,
|
||||
msg: 'reqDate格式不正确'
|
||||
};
|
||||
}
|
||||
|
||||
if (!reqJournalNo) {
|
||||
return {
|
||||
code: -1,
|
||||
msg: 'reqJournalNo不能为空'
|
||||
};
|
||||
}
|
||||
|
||||
let res = await vk.request({
|
||||
url: 'http://jjx-union-pay.gxwebsoft.com/api/union-pay-jjx/getActionLog',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
header: {
|
||||
'content-type': 'application/json; charset=utf-8'
|
||||
},
|
||||
data: {
|
||||
accNo,
|
||||
reqDate,
|
||||
reqJournalNo
|
||||
},
|
||||
timeout: 60000
|
||||
});
|
||||
|
||||
if (res && typeof res === 'object' && typeof res.code === 'undefined') {
|
||||
res.code = 0;
|
||||
}
|
||||
|
||||
const responseObjects = balanceUtil.getRemoteResponseObjects(res);
|
||||
const list = balanceUtil.pickFirstDefined([
|
||||
Array.isArray(res.list) ? res.list : undefined,
|
||||
Array.isArray(res.rows) ? res.rows : undefined,
|
||||
Array.isArray(res.data) ? res.data : undefined,
|
||||
Array.isArray(res.data && res.data.list) ? res.data.list : undefined,
|
||||
Array.isArray(res.data && res.data.rows) ? res.data.rows : undefined,
|
||||
Array.isArray(res.info && res.info.list) ? res.info.list : undefined,
|
||||
Array.isArray(res.info && res.info.rows) ? res.info.rows : undefined,
|
||||
Array.isArray(res.content && res.content.list) ? res.content.list : undefined,
|
||||
Array.isArray(res.content && res.content.rows) ? res.content.rows : undefined
|
||||
]) || [];
|
||||
|
||||
if (responseObjects.data && typeof responseObjects.data === 'object' && !Array.isArray(responseObjects.data)) {
|
||||
responseObjects.data.list = list;
|
||||
} else if (res && typeof res === 'object') {
|
||||
res.data = {
|
||||
list
|
||||
};
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user