Commit 94635caa by 王昆

gsb

parent ff9dd34a
...@@ -471,6 +471,20 @@ class BpoSDPJApi { ...@@ -471,6 +471,20 @@ class BpoSDPJApi {
} }
} }
// async testCashOut() {
// let cashInfo = await this.ccashinfoSve.findById(22);
// let api = await this.ecompanybusiSve.findOne({
// appId: cashInfo.app_id,
// etemplate_id: cashInfo.ecid,
// mchtId: cashInfo.mchtId,
// });
//
// let cashUser = await this.ccashuserSve.findById(1);
//
// let cashRes = await this.cashOut(cashInfo, api, cashUser);
// console.log(cashRes);
// }
async cashOut(cashInfo, api, cashUser) { async cashOut(cashInfo, api, cashUser) {
if (cashInfo.qrcode_status != 1) { if (cashInfo.qrcode_status != 1) {
// 1 认证页面 2 二维码已失效 3 红包领取页面 4 红包领取结果页面(心跳查询) 5 红包已被领取 // 1 认证页面 2 二维码已失效 3 红包领取页面 4 红包领取结果页面(心跳查询) 5 红包已被领取
...@@ -551,8 +565,9 @@ class BpoSDPJApi { ...@@ -551,8 +565,9 @@ class BpoSDPJApi {
return this.getSuccessResult("领取中", {redirect_code: 4}); return this.getSuccessResult("领取中", {redirect_code: 4});
} else { } else {
cashInfo.trade_status = "02"; cashInfo.trade_status = "02";
cashInfo.trade_desc = "领取失败"; cashInfo.trade_desc = rs.data.msg || "领取失败";
await cashInfo.save(); await cashInfo.save();
this.notifyCash(cashInfo.id);
return this.getSuccessResult("领取失败", {redirect_code: 6}); return this.getSuccessResult("领取失败", {redirect_code: 6});
} }
} catch (error) { } catch (error) {
...@@ -601,18 +616,18 @@ class BpoSDPJApi { ...@@ -601,18 +616,18 @@ class BpoSDPJApi {
return this.getBaseResult(0, "交易未完成", {complete: false, actual_amt: system.f2y(cashInfo.actual_amt)}); return this.getBaseResult(0, "交易未完成", {complete: false, actual_amt: system.f2y(cashInfo.actual_amt)});
} }
async testCashOutResult(obj, req) { // async testCashOutResult(obj, req) {
let cashInfo = await this.ccashinfoSve.findById(obj.id); // let cashInfo = await this.ccashinfoSve.findById(obj.id);
let api = await this.ecompanybusiSve.findOne({ // let api = await this.ecompanybusiSve.findOne({
appId: cashInfo.app_id, // appId: cashInfo.app_id,
etemplate_id: cashInfo.ecid, // etemplate_id: cashInfo.ecid,
mchtId: cashInfo.mchtId, // mchtId: cashInfo.mchtId,
}); // });
let item = await this.getActualAmt(cashInfo, api); // let item = await this.getActualAmt(cashInfo, api);
cashInfo.actual_amt = item.actualAmt || 0; // cashInfo.actual_amt = item.actualAmt || 0;
await cashInfo.save(); // await cashInfo.save();
return cashInfo; // return cashInfo;
} // }
async getActualAmt(cashInfo, api) { async getActualAmt(cashInfo, api) {
let params = { let params = {
...@@ -726,12 +741,26 @@ class BpoSDPJApi { ...@@ -726,12 +741,26 @@ class BpoSDPJApi {
} }
} }
// 通过postman推送回调 // 推送回调
async notifyGuestById(obj, req) { async notifyGuestById(obj, req) {
let res = await this.notifyCash(obj.no); let res = await this.notifyCash(obj.no);
return this.getBaseResult(0, "调用成功", res); return this.getBaseResult(0, "调用成功", res);
} }
// 推送回调批量
async notifyGuestByIds(obj, req) {
let result = {};
let ids = obj.ids;
for (let id of ids) {
try {
result[id] = await this.notifyCash(id);
} catch (e) {
console.log("notifyGuestByIds---error", id, e);
}
}
return result;
}
// 推送回调 // 推送回调
async notifyCash(id) { async notifyCash(id) {
try { // 签名验证 try { // 签名验证
......
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