mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
修改提现
This commit is contained in:
parent
560e18ac31
commit
0a74d053f5
@ -81,7 +81,7 @@ class UserTransfer extends Command
|
||||
'enc_bank_no' => $item['bank_code'],
|
||||
'enc_true_name' => $item['bank_user'],
|
||||
'bank_code' => '1002',
|
||||
'amount' => $item['amount'] * 100,
|
||||
'amount' => intval($item['amount'] - $item['charge_amount']) * 100,
|
||||
'desc' => '微信银行卡提现',
|
||||
]);
|
||||
}
|
||||
@ -105,7 +105,7 @@ class UserTransfer extends Command
|
||||
if (empty($openid)) throw new Exception("提现{$item['code']}获取用户OPENID失败");
|
||||
return $wechat->create([
|
||||
'openid' => $openid,
|
||||
'amount' => $item['amount'] * 100,
|
||||
'amount' => intval($item['amount'] - $item['charge_amount']) * 100,
|
||||
'partner_trade_no' => $item['code'],
|
||||
'spbill_create_ip' => '127.0.0.1',
|
||||
'check_name' => 'NO_CHECK',
|
||||
|
@ -60,12 +60,6 @@ class Transfer extends Auth
|
||||
// 检查可提现余额
|
||||
[$total, $count] = UserRebateService::instance()->amount($this->uuid);
|
||||
if ($total - $count < $data['amount']) $this->error('可提现余额不足!');
|
||||
// 如果手续费不够扣时,提现金额减少
|
||||
if ($total - $count < $data['amount'] + $data['charge_amount']) {
|
||||
$data['amount'] = $data['amount'] - $data['charge_amount'];
|
||||
$data['charge_amount'] = $chargeRate * $data['amount'] / 100;
|
||||
$data['amount'] = $total - $count - $data['charge_amount'];
|
||||
}
|
||||
// 提现方式处理
|
||||
if (in_array($data['type'], ['alipay_account'])) {
|
||||
$data = array_merge($data, $this->_vali([
|
||||
|
@ -19,14 +19,13 @@ class UserRebateService extends Service
|
||||
*/
|
||||
public function amount(int $uuid): array
|
||||
{
|
||||
$raw = $this->app->db->raw('amount+charge_amount');
|
||||
if ($uuid > 0) {
|
||||
$count = $this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>0")->sum($raw);
|
||||
$count = $this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>0")->sum('amount');
|
||||
$total = $this->app->db->name('DataUserRebate')->whereRaw("uid='{$uuid}' and status=1 and deleted=0")->sum('amount');
|
||||
$locks = $this->app->db->name('DataUserRebate')->whereRaw("uid='{$uuid}' and status=0 and deleted=0")->sum('amount');
|
||||
$this->app->db->name('DataUser')->where(['id' => $uuid])->update(['rebate_total' => $total, 'rebate_used' => $count, 'rebate_lock' => $locks]);
|
||||
} else {
|
||||
$count = $this->app->db->name('DataUserTransfer')->whereRaw("status>0")->sum($raw);
|
||||
$count = $this->app->db->name('DataUserTransfer')->whereRaw("status>0")->sum('amount');
|
||||
$total = $this->app->db->name('DataUserRebate')->whereRaw("status=1 and deleted=0")->sum('amount');
|
||||
$locks = $this->app->db->name('DataUserRebate')->whereRaw("status=0 and deleted=0")->sum('amount');
|
||||
}
|
||||
|
@ -31,17 +31,16 @@ class UserTransferService extends Service
|
||||
*/
|
||||
public function amount(int $uuid): array
|
||||
{
|
||||
$raw = $this->app->db->raw('amount+charge_amount');
|
||||
if ($uuid > 0) {
|
||||
$locks = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status=3")->sum($raw));
|
||||
$total = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>=1")->sum($raw));
|
||||
$count = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>=4")->sum($raw));
|
||||
$audit = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>=1 and status<3")->sum($raw));
|
||||
$locks = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status=3")->sum('amount'));
|
||||
$total = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>=1")->sum('amount'));
|
||||
$count = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>=4")->sum('amount'));
|
||||
$audit = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>=1 and status<3")->sum('amount'));
|
||||
} else {
|
||||
$locks = abs($this->app->db->name('DataUserTransfer')->whereRaw("status=3")->sum($raw));
|
||||
$total = abs($this->app->db->name('DataUserTransfer')->whereRaw("status>=1")->sum($raw));
|
||||
$count = abs($this->app->db->name('DataUserTransfer')->whereRaw("status>=4")->sum($raw));
|
||||
$audit = abs($this->app->db->name('DataUserTransfer')->whereRaw("status>=1 and status<3")->sum($raw));
|
||||
$locks = abs($this->app->db->name('DataUserTransfer')->whereRaw("status=3")->sum('amount'));
|
||||
$total = abs($this->app->db->name('DataUserTransfer')->whereRaw("status>=1")->sum('amount'));
|
||||
$count = abs($this->app->db->name('DataUserTransfer')->whereRaw("status>=4")->sum('amount'));
|
||||
$audit = abs($this->app->db->name('DataUserTransfer')->whereRaw("status>=1 and status<3")->sum('amount'));
|
||||
}
|
||||
return [$total, $count, $audit, $locks];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user