فهرست منبع

提现与收支流水日志

lizhen_gitee 1 سال پیش
والد
کامیت
50ec41ef9e
3فایلهای تغییر یافته به همراه19 افزوده شده و 24 حذف شده
  1. 2 6
      application/api/controller/company/Index.php
  2. 15 16
      application/api/controller/company/Takecash.php
  3. 2 2
      application/extra/site.php

+ 2 - 6
application/api/controller/company/Index.php

@@ -33,19 +33,15 @@ class Index extends Apic
 
     //商家钱包明细
     public function money_log(){
-        $type = input('type',0);
 
         $map = [
-            'user_id' => $this->auth->id,
+            'user_id' => $this->auth->company_id,
         ];
-        if($type){
-            $map['log_type'] = $type;
-        }
 
         $list = Db::name('company_money_log')
             ->field('id,log_type,change_value,remain,remark,createtime')
             ->where($map)->order('id desc')->autopage()->select();
-        $list = $this->list_appen_logtext($list);
+        //$list = $this->list_appen_logtext($list);
 
         $this->success(1,$list);
     }

+ 15 - 16
application/api/controller/company/Takecash.php

@@ -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);
     }

+ 2 - 2
application/extra/site.php

@@ -41,8 +41,8 @@ return array (
     'custom' => '自定义',
   ),
   'withdrawal_service_fee' => '2',
-  'min_withdrawal_money' => '0.3',
-  'max_withdrawal_money' => '1000000',
+  'min_withdrawal_money' => '1',
+  'max_withdrawal_money' => '10000',
   'article_name' => '蓝精灵官方',
   'article_avatar' => '/uploads/20230531/68bab200ae016db0fbe31e91ff370ecf.png',
 );