|
@@ -21,12 +21,9 @@ class Takecash extends Apic
|
|
|
$max_withdrawal_money = config('site.max_withdrawal_money') ? config('site.max_withdrawal_money') : 50000;
|
|
|
$data = [
|
|
|
'money' => model('walletcompany')->getwallet($this->auth->company_id,'money'),
|
|
|
- 'bank_name' => $this->auth->bank_name,
|
|
|
- 'bank_branchname' => $this->auth->bank_branchname,
|
|
|
- 'bank_account' => $this->auth->bank_account,
|
|
|
- 'bank_card' => $this->auth->bank_card,
|
|
|
'min' => $min_withdrawal_money,
|
|
|
'max' => $max_withdrawal_money,
|
|
|
+ 'bank_info' => Db::name('company_bank')->where('company_id',$this->auth->company_id)->find(),
|
|
|
];
|
|
|
|
|
|
$this->success('success',$data);
|
|
@@ -53,34 +50,36 @@ class Takecash extends Apic
|
|
|
}
|
|
|
|
|
|
//查重
|
|
|
- $check = Db::name('company_take_cash')->where(['user_id'=>$this->auth->id,'status'=>0])->find();
|
|
|
+ $check = Db::name('company_take_cash')->where(['user_id'=>$this->auth->company_id,'status'=>0])->find();
|
|
|
if($check){
|
|
|
$this->error('您已经申请了提现,请等待审核');
|
|
|
}
|
|
|
|
|
|
//对比
|
|
|
- $user_money = model('walletcompany')->getwallet($this->auth->id,'money');
|
|
|
+ $user_money = model('walletcompany')->getwallet($this->auth->company_id,'money');
|
|
|
if($money > $user_money){
|
|
|
$this->error('提现金额不能大于可提现余额');
|
|
|
}
|
|
|
|
|
|
//查询提现手续费百分比
|
|
|
- $withdrawal_server_fee = (int)config('site.withdrawal_server_fee') ? : 0;
|
|
|
- if ($withdrawal_server_fee < 0 || $withdrawal_server_fee >= 100) {
|
|
|
+ $withdrawal_service_fee = (int)config('site.withdrawal_service_fee') ? : 0;
|
|
|
+ if ($withdrawal_service_fee < 0 || $withdrawal_service_fee >= 100) {
|
|
|
$this->error('提现手续费异常');
|
|
|
}
|
|
|
|
|
|
+ $bank_info = Db::name('company_bank')->where('company_id',$this->auth->company_id)->find();
|
|
|
+
|
|
|
//
|
|
|
- $real_money = bcdiv(bcmul($money,bcsub(100,$withdrawal_server_fee,2),2),100,2);
|
|
|
+ $real_money = bcdiv(bcmul($money,bcsub(100,$withdrawal_service_fee,2),2),100,2);
|
|
|
$data = [
|
|
|
'order_no' => createUniqueNo('T',$this->auth->id),
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
+ 'user_id' => $this->auth->company_id,
|
|
|
'money' => $money,
|
|
|
'real_money' => $real_money,
|
|
|
- 'bank_name' => $this->auth->bank_name,
|
|
|
- 'bank_branchname' => $this->auth->bank_branchname,
|
|
|
- 'bank_account' => $this->auth->bank_account,
|
|
|
- 'bank_card' => $this->auth->bank_card,
|
|
|
+ 'bank_name' => $bank_info['bank_name'],
|
|
|
+ 'bank_branchname' => $bank_info['bank_branchname'],
|
|
|
+ 'bank_account' => $bank_info['bank_account'],
|
|
|
+ 'bank_card' => $bank_info['bank_card'],
|
|
|
'status' => 0,
|
|
|
'createtime' => time(),
|
|
|
'updatetime' => time(),
|
|
@@ -93,7 +92,7 @@ class Takecash extends Apic
|
|
|
$this->error('提现失败');
|
|
|
}
|
|
|
|
|
|
- $rs_wallet = model('walletcompany')->lockChangeAccountRemain($this->auth->id,'money',-$money,101,'提现','company_take_cash',$logid);
|
|
|
+ $rs_wallet = model('walletcompany')->lockChangeAccountRemain($this->auth->company_id,'money',-$money,204,'提现','company_take_cash',$logid);
|
|
|
if($rs_wallet['status'] === false){
|
|
|
Db::rollback();
|
|
|
$this->error($rs_wallet['msg']);
|
|
@@ -105,7 +104,7 @@ class Takecash extends Apic
|
|
|
|
|
|
//提现记录
|
|
|
public function take_cash_log(){
|
|
|
- $list = Db::name('company_take_cash')->where(['user_id'=>$this->auth->id])->autopage()->select();
|
|
|
+ $list = Db::name('company_take_cash')->where('user_id',$this->auth->company_id)->autopage()->select();
|
|
|
|
|
|
$this->success('success',$list);
|
|
|
}
|