Skip to content

Commit

Permalink
fix: 微信提现历史接口也放进去
Browse files Browse the repository at this point in the history
  • Loading branch information
zoujingli committed Sep 23, 2024
1 parent 752680a commit c1c7ddd
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions plugin/think-plugs-wemall/src/command/Trans.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,101 @@ private function queryTransferV3(PluginWemallUserTransfer $model): void
}
}


/**
* 企业付款到银行卡
* @param PluginWemallUserTransfer $model
* @return array
* @throws \WeChat\Exceptions\InvalidDecryptException
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws \think\admin\Exception
* @deprecated 微信商户已不再提供此接口
*/
private function createTransferBank(PluginWemallUserTransfer $model): array
{
return TransfersBank::instance($this->getConfig($model))->create([
'partner_trade_no' => $model->getAttr('code'),
'enc_bank_no' => $model->getAttr('bank_code'),
'enc_true_name' => $model->getAttr('bank_user'),
'bank_code' => $model->getAttr('bank_wseq'),
'amount' => intval($model->getAttr('amount') - $model->getAttr('charge_amount')) * 100,
'desc' => '微信银行卡提现',
]);
}

/**
* 企业付款到零钱
* @param PluginWemallUserTransfer $model
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws \think\admin\Exception
* @deprecated 微信商户已不再提供此接口
*/
private function createTransferWallet(PluginWemallUserTransfer $model): array
{
return Transfers::instance($this->getConfig($model))->create([
'openid' => $model->getAttr('openid'),
'amount' => intval($model->getAttr('amount') - $model->getAttr('charge_amount')) * 100,
'partner_trade_no' => $model->getAttr('code'),
'spbill_create_ip' => '127.0.0.1',
'check_name' => 'NO_CHECK',
'desc' => '微信余额提现!',
]);
}

/**
* 查询企业付款到银行卡
* @param PluginWemallUserTransfer $model
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws \think\admin\Exception
* @deprecated 微信商户已不再提供此接口
*/
private function queryTransferBank(PluginWemallUserTransfer $model)
{
$result = TransfersBank::instance($this->getConfig($model))->query($model->getAttr('trade_no'));
if ($result['return_code'] === 'SUCCESS' && $result['result_code'] === 'SUCCESS') {
if ($result['status'] === 'SUCCESS') {
$model->save([
'status' => 5,
'trade_time' => $result['pay_succ_time'] ?: date('Y-m-d H:i:s'),
'change_time' => date('Y-m-d H:i:s'),
'change_desc' => '微信提现打款成功',
]);
} elseif (in_array($result['status'], ['FAILED', 'BANK_FAIL'])) {
$model->save([
'status' => 0,
'change_time' => date('Y-m-d H:i:s'),
'change_desc' => '微信提现打款失败',
]);
// 刷新用户可提现余额
UserRebate::recount($model->getAttr('unid'));
}
}
}

/**
* 查询企业付款到零钱
* @param PluginWemallUserTransfer $model
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
* @throws \think\admin\Exception
*/
private function queryTransferWallet(PluginWemallUserTransfer $model)
{
$result = Transfers::instance($this->getConfig($model))->query($model->getAttr('trade_no'));
if ($result['return_code'] === 'SUCCESS' && $result['result_code'] === 'SUCCESS') {
$model->save([
'status' => 5,
'trade_time' => $result['payment_time'],
'change_time' => date('Y-m-d H:i:s'),
'change_desc' => '微信提现打款成功!',
]);
}
}

/**
* 获取微信提现参数
* @param PluginWemallUserTransfer $model
Expand Down

0 comments on commit c1c7ddd

Please sign in to comment.