easywechat4.x升级到6.x
This commit is contained in:
@@ -105,12 +105,13 @@ class AccountWithdrawService
|
||||
AccountService::updateData($userId, 0, -$amount, 0,0, $log_res->id);
|
||||
|
||||
if($type == AccountWithdrawService::TYPE_WECHAT){
|
||||
//发起微信付款到用户微信余额
|
||||
//发起微信商家转账到用户零钱(v3,原 v2 企业付款已停用)
|
||||
$payRes = (new EasyWeChatService())->mchPay($withdraw_record->apply_sn, $user->openid, $user->username, $amount);
|
||||
if (!(isset($payRes['result_code']) && in_array($payRes['result_code'], ['SUCCESS']))) {
|
||||
throw new \Exception(($payRes['return_msg'] ?? '企业付款给用户失败') . ':' . ($payRes['err_code_des'] ?? ''));
|
||||
if (empty($payRes['batch_id'])) {
|
||||
throw new \Exception($payRes['message'] ?? '商家转账发起失败');
|
||||
}
|
||||
$withdraw_record->result_status = $payRes['result_code'];
|
||||
//批次受理成功(资金到账以微信侧为准,可通过 queryBalance 查询批次状态)
|
||||
$withdraw_record->result_status = 'SUCCESS';
|
||||
$withdraw_record->save();
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user