|
@@ -49,16 +49,16 @@ class Withdraw extends Api
|
|
|
|
|
|
|
|
|
//自由输入覆盖
|
|
|
- $money = floatval($freemoney);
|
|
|
+ $agentjewel = floatval($freemoney);
|
|
|
|
|
|
//
|
|
|
- if($money<=0)
|
|
|
+ if($agentjewel<=0)
|
|
|
{
|
|
|
$this->error('金额必须大于0');
|
|
|
}
|
|
|
|
|
|
$min = config('site.withdraw_min_price');
|
|
|
- if($money < $min){
|
|
|
+ if($agentjewel < $min){
|
|
|
$this->error('提现金额不能小于'.$min);
|
|
|
}
|
|
|
|
|
@@ -68,7 +68,7 @@ class Withdraw extends Api
|
|
|
}
|
|
|
|
|
|
$user_money = model('wallet')->getwallet($this->auth->id,'agentjewel');
|
|
|
- if($money > $user_money){
|
|
|
+ if($agentjewel > $user_money){
|
|
|
$this->error('提现金额不能大于可提现余额');
|
|
|
}
|
|
|
|
|
@@ -86,21 +86,32 @@ class Withdraw extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //除汇率,得人民币
|
|
|
+ $huilv = config('agentjewel_to_money') ?: 10;
|
|
|
+ $money = bcdiv($agentjewel,$huilv,2);
|
|
|
+
|
|
|
+ //平台手续费
|
|
|
$plat_bilv = config('site.withdrawal_plat_bili');
|
|
|
- $get_money = bcdiv(bcmul($money,(100-$plat_bilv),2),100,2);
|
|
|
+ $plat_money = bcdiv(bcmul($money,(100-$plat_bilv),2),100,2);
|
|
|
+
|
|
|
+ //减去手续费,得实得金额
|
|
|
+ $get_money = bcsub($money,$plat_money,2);
|
|
|
+
|
|
|
|
|
|
- $huilv = config('agentjewel_to_money') ?: 10;
|
|
|
- $get_money = bcdiv($get_money,$huilv,2);
|
|
|
|
|
|
$data = [
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
- 'money' => $get_money,
|
|
|
- 'agentjewel' => $money,
|
|
|
- 'type' => $type,
|
|
|
- 'acount_json' => json_encode($account_json),
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'agentjewel' => $agentjewel,
|
|
|
+ 'huilv' => $huilv,
|
|
|
+ 'money' => $money,
|
|
|
+ 'plat_bilv' => $plat_bilv,
|
|
|
+ 'plat_money' => $plat_money,
|
|
|
+ 'get_money' => $get_money,
|
|
|
+ 'type' => $type,
|
|
|
+ 'acount_json'=> json_encode($account_json),
|
|
|
'createtime' => time(),
|
|
|
'updatetime' => time(),
|
|
|
- 'status' => 0,
|
|
|
+ 'status' => 0,
|
|
|
];
|
|
|
Db::startTrans();
|
|
|
|
|
@@ -111,7 +122,7 @@ class Withdraw extends Api
|
|
|
}
|
|
|
|
|
|
//扣除money
|
|
|
- $rs_wallet = model('Wallet')->lockChangeAccountRemain($this->auth->id,'agentjewel',-$money,55,'提现','withdraw',$log_id);
|
|
|
+ $rs_wallet = model('Wallet')->lockChangeAccountRemain($this->auth->id,'agentjewel',-$agentjewel,55,'提现(审核中)','withdraw',$log_id);
|
|
|
if($rs_wallet['status']===false)
|
|
|
{
|
|
|
Db::rollback();
|
|
@@ -124,7 +135,7 @@ class Withdraw extends Api
|
|
|
}
|
|
|
|
|
|
//提现记录
|
|
|
- public function withdraw_log(){
|
|
|
+ /*public function withdraw_log(){
|
|
|
$list = Db::name('withdraw')->field('id,money,type,createtime')->where(['user_id'=>$this->auth->id])->autopage()->select();
|
|
|
foreach($list as $key => &$val){
|
|
|
$val['remark'] = '';
|
|
@@ -139,6 +150,6 @@ class Withdraw extends Api
|
|
|
}
|
|
|
|
|
|
$this->success('success',$list);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
}
|