Commit 7325211d by 王昆

gsb

parent 7038f1f7
......@@ -34,7 +34,6 @@ class BpoSDPJApi {
this.ecompanybusiSve = system.getObject("service.ecompanybusiSve");
this.tdevApi = require("./tdevApi");
this.redisLock = system.getObject("util.redisLock");
this.bankthreelogSve = system.getObject("service.bankthreelogSve");
this.etemplateSve = system.getObject("service.etemplateSve")
......@@ -520,20 +519,21 @@ class BpoSDPJApi {
console.log(JSON.stringify(param));
try {
let url = settings.apiconfig.payDomain(api.env) + "/merchant/order/transfer";
console.log("-----request smart transfer ------------", url, param);
let rs = await axios({
method: 'post',
url: settings.apiconfig.payDomain() + "/merchant/order/transfer",
url: url,
data: param,
});
console.log(rs.data);
console.log("-----response smart transfer ------------", rs.data);
if (rs.data.code === 0) {
cashInfo.trade_status = "01";
cashInfo.trade_desc = "提现申请成功";
try {
// 张娇强烈要求
let actualAmt = await this.getActualAmt(cashInfo, api);
cashInfo.actual_amt = actualAmt;
let item = await this.getActualAmt(cashInfo, api);
cashInfo.actual_amt = item.actualAmt || 0;
} catch (eeee) {
console.log(eeee);
}
......@@ -557,19 +557,22 @@ class BpoSDPJApi {
let cashInfo = await this.ccashinfoSve.findById(id);
// 查是否成功
let item = await this.esettleSve.findOrderItemByOutTradeNo({
busi_id: cashInfo.mchtId,
out_trade_no: cashInfo.outTradeNo,
seq_no: "1000",
let api = await this.ecompanybusiSve.findOne({
appId: cashInfo.app_id,
etemplate_id: cashInfo.ecid,
mchtId: cashInfo.mchtId,
});
let item = await this.getActualAmt(cashInfo, api);
cashInfo.actual_amt = item.actualAmt || 0;
console.log("查smart ------------------", id, item, new Date().getTime());
// let actualAmt = await this.getActualAmt(cashInfo, api);
// cashInfo.actual_amt = actualAmt;
// await cashInfo.save();
if (item.trade_status == "00" || item.trade_status == "02" || item.trade_status == "03") {
if (item.tradeStatus == "00" || item.tradeStatus == "02" || item.tradeStatus == "03") {
// 1 认证页面 2 二维码已失效 3 红包领取页面 4 红包领取结果页面(心跳查询) 5 红包已被领取
let rc = item.trade_status == "00" ? 4 : 6;
let rc = item.tradeStatus == "00" ? 4 : 6;
return this.getBaseResult(0, cashInfo.trade_desc, {
redirect_code: rc,
trade_desc: cashInfo.trade_desc,
......@@ -588,10 +591,10 @@ class BpoSDPJApi {
etemplate_id: cashInfo.ecid,
mchtId: cashInfo.mchtId,
});
let actualAmt = await this.getActualAmt(cashInfo, api);
cashInfo.actual_amt = actualAmt;
let item = await this.getActualAmt(cashInfo, api);
cashInfo.actual_amt = item.actualAmt || 0;
await cashInfo.save();
return data;
return cashInfo;
}
async getActualAmt(cashInfo, api) {
......@@ -605,21 +608,23 @@ class BpoSDPJApi {
"signType": "MD5",
};
let url = settings.apiconfig.payDomain(api.env) + "/merchant/order/query";
params.sign = system.getSign(params, api.key, this.EXCEPT_KEYS);
console.log("-----request smart query ------------", url, params);
let rs = await axios({
method: 'post',
url: settings.apiconfig.payDomain() + "/merchant/order/query",
url: url ,
data: params,
});
console.log(rs.data);
console.log("-----response smart query ------------", rs.data);
if (rs.status == 200 && rs.data.code == 0) {
let bizArr = (rs.data.data || {}).bizContent || [];
if (bizArr.length > 0) {
let item = bizArr[0] || {};
return item.actualAmt || 0;
return item;
}
}
return -1;
return {};
}
async getUidStr(len, radix) {
......
......@@ -12,6 +12,7 @@ module.exports = (db, DataTypes) => {
postwxurl: DataTypes.STRING(300),
postsignurl: DataTypes.STRING(300),
app_type: DataTypes.BIGINT,
env: DataTypes.STRING,
}, {
paranoid: true, //假的删除
underscored: true,
......
......@@ -59,7 +59,8 @@ var settings = {
createMerchantApi: domain + "/merchant/busi/reg"
}
},
payDomain: function () {
payDomain: function (penv) {
penv = penv || settings.env;
if (settings.env == "dev") {
return "http://39.106.185.66:8000";
} else {
......
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