|
@@ -12,6 +12,50 @@ class Takecash extends Api
|
|
|
protected $noNeedLogin = [];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
+ //提现before
|
|
|
+ public function take_cash_before(){
|
|
|
+ $freemoney = input('freemoney',0);
|
|
|
+ if(!$freemoney){
|
|
|
+ $this->error('请填写金额');
|
|
|
+ }
|
|
|
+
|
|
|
+ $money = floatval($freemoney);
|
|
|
+
|
|
|
+ if($money<=0)
|
|
|
+ {
|
|
|
+ $this->error('金额必须大于0');
|
|
|
+ }
|
|
|
+
|
|
|
+ $min = config('site.min_takecash_money');
|
|
|
+ $max = config('site.max_takecash_money');
|
|
|
+ if($money < $min){
|
|
|
+ $this->error('提现金额不能小于'.$min);
|
|
|
+ }
|
|
|
+ if($money > $max){
|
|
|
+ $this->error('提现金额不能大于'.$max);
|
|
|
+ }
|
|
|
+
|
|
|
+ $user_money = model('wallet')->getwallet($this->auth->id,'money');
|
|
|
+ if($money > $user_money){
|
|
|
+ $this->error('提现金额不能大于可提现余额');
|
|
|
+ }
|
|
|
+
|
|
|
+ //平台手续费
|
|
|
+ $plat_bilv = config('site.takecash_plat_bili');
|
|
|
+ $plat_money = bcdiv(bcmul($money,$plat_bilv,2),100,2);
|
|
|
+
|
|
|
+ //减去手续费,得实得金额
|
|
|
+ $get_money = bcsub($money,$plat_money,2);
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'money' => $money,
|
|
|
+ 'plat_bilv' => $plat_bilv,
|
|
|
+ 'plat_money' => $plat_money,
|
|
|
+ 'get_money' => $get_money,
|
|
|
+ ];
|
|
|
+ $this->success(1,$data);
|
|
|
+ }
|
|
|
+
|
|
|
//提现
|
|
|
public function take_cash(){
|
|
|
$freemoney = input('freemoney',0);
|