店主充值
parent
59f0e326a0
commit
fdfc786bd7
|
|
@ -51,6 +51,42 @@ class HandleAlipayResultNotice implements ShouldQueue
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rechargeSn = $this->data['out_trade_no'];
|
||||||
|
$rechargeObj = new ShopRecharge();
|
||||||
|
$recharge = $rechargeObj->where('recharge_sn', $rechargeSn)->first();
|
||||||
|
if (!$recharge) {
|
||||||
|
Log::error('HandleAlipayResultNotice 表中充值单号', [
|
||||||
|
'data' => $this->data,
|
||||||
|
'rechargeSn' => $rechargeSn,
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$paystate = PayState::ERROR;
|
||||||
|
if ($aliNotice->trade_status == 'TRADE_SUCCESS') {
|
||||||
|
$paystate = PayState::SUCCESS;
|
||||||
|
if (!bc_equal($recharge->pay_money, $this->data['receipt_amount'])) {
|
||||||
|
$paystate = PayState::UNEQUAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$res =$rechargeObj->where('id',$recharge->id)
|
||||||
|
->where('recharge_sn', $rechargeSn)
|
||||||
|
->whereNotIn('pay_state', [PayState::ERROR,PayState::SUCCESS,PayState::UNEQUAL])
|
||||||
|
->update([
|
||||||
|
'out_trade_no' => $this->data['trade_no'],
|
||||||
|
'received_money' => $this->data['receipt_amount'],
|
||||||
|
'pay_at' => $this->data['gmt_create'],
|
||||||
|
'pay_state' => $paystate,
|
||||||
|
]);
|
||||||
|
if (!$res) {
|
||||||
|
Log::error('HandleAlipayResultNotice recharge_update_fail', [
|
||||||
|
'data' => $this->data,
|
||||||
|
'rechargeSn' => $rechargeSn,
|
||||||
|
'res' => $res,
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$aliNotice = new AliNotice();
|
$aliNotice = new AliNotice();
|
||||||
$aliNotice->notify_id = Arr::get($this->data, 'notify_id', '');
|
$aliNotice->notify_id = Arr::get($this->data, 'notify_id', '');
|
||||||
|
|
@ -68,31 +104,8 @@ class HandleAlipayResultNotice implements ShouldQueue
|
||||||
$aliNotice->response = $this->data;
|
$aliNotice->response = $this->data;
|
||||||
$aliNotice->save();
|
$aliNotice->save();
|
||||||
|
|
||||||
$rechargeSn = $this->data['out_trade_no'];
|
|
||||||
$rechargeObj = new ShopRecharge();
|
|
||||||
$recharge = $rechargeObj->where('recharge_sn', $rechargeSn)->first();
|
|
||||||
if (!$recharge) {
|
|
||||||
Log::error('HandleAlipayResultNotice 表中充值单号', [
|
|
||||||
'data' => $this->data,
|
|
||||||
'rechargeSn' => $rechargeSn,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($aliNotice->trade_status == 'TRADE_SUCCESS') {
|
|
||||||
$recharge->pay_state = PayState::SUCCESS;
|
|
||||||
if (!bc_equal($recharge->pay_money, $this->data['receipt_amount'])) {
|
|
||||||
$recharge->pay_state = PayState::UNEQUAL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$recharge->pay_state = PayState::ERROR;
|
|
||||||
}
|
|
||||||
$recharge->out_trade_no = $this->data['trade_no'];
|
|
||||||
$recharge->received_money = $this->data['receipt_amount'];
|
|
||||||
$recharge->pay_at = $this->data['gmt_create'];
|
|
||||||
$recharge->save();
|
|
||||||
if ($recharge->pay_state == PayState::SUCCESS) {
|
if ($recharge->pay_state == PayState::SUCCESS) {
|
||||||
|
$recharge = $rechargeObj->where('recharge_sn', $rechargeSn)->first();
|
||||||
SellerWalletService::recharge($recharge);
|
SellerWalletService::recharge($recharge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue