WithdrawalController.php 1.9 KB
<?php
namespace app\admin\controller;

use app\admin\model\RouteModel;
use cmf\controller\AdminBaseController;
use function GuzzleHttp\Psr7\str;
use think\Db;

class WithdrawalController extends AdminBaseController{

    /**
     * 提现审核
     */
     public function withd_audit(){

         return $this -> fetch();

     }

     /**
      * 提现列表
      */
     public function withd_list(){

         if($this -> request -> isPost()){
             $where['state'] = [['=',1],['=',2],'or'];
             if(!empty($_POST['start_time']) && !empty($_POST['end_time'])){
                 $start_time = strtotime($_POST['start_time']);
                 $end_time = strtotime($_POST['end_time']);
                 $where['a.create_time'] = [['>=',$start_time],['<=',$end_time]];
             }
             if(!empty($_POST['keyword'])){
                 $where['b.phone'] = $_POST['keyword'];
             }
             $data = Db::name('money_expend') -> alias('a') -> join('my_user b','a.uid=b.uid','LEFT') -> where($where) -> paginate(12);
             $data_arr = $data -> toArray();
         }else{
             $data = Db::name('money_expend') -> alias('a') -> join('my_user b','a.uid=b.uid','LEFT') -> where("state = 1 or state = 2") -> paginate(12);
             $data_arr = $data -> toArray();
         }
         foreach($data_arr['data'] as $key => $val){
             $name = Db::name('user') -> where('id',$val['uid']) -> find();
             $data_arr['data'][$key]['name'] = $name['user_nickname'];
         }
         $this -> assign('data_arr',$data_arr['data']);
         $this -> assign('data',$data);
         return $this -> fetch();

     }

     /**
      * 提现列表删除
      */
    public function withd_del(){

        $id = $_POST['id'];
        $data = Db::name('money_expend') -> delete($id);
        if($data){
            return true;
        }else{
            return false;
        }

    }
























}