WithdrawalController.php
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?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;
}
}
}