WithdrawController.php
4.2 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/4/17
* Time: 2:21
*/
namespace app\user\controller;
use cmf\controller\AdminBaseController;
use think\Db;
class WithdrawController extends AdminBaseController
{
/*
* 获取提现列表
*/
public function getList() {
$where = ['w.state' => 1];
$request = input('request.');
$keywordComplex = [];
if (!empty($request['keyword'])) {
$keyword = $request['keyword'];
$keywordComplex['u.user_nickname'] = ['like', "%$keyword%"];
}
if (!empty($request['start_time']) && !empty($request['end_time'])) {
$keywordComplex['w.create_time'] = ['>=', $request['start_time']];
$keywordComplex['w.create_time'] = ['<=', $request['end_time']];
}
$list = Db::name('withdraw_log')
->alias('w')
->join('user u','w.user_id = u.id','left')
->whereOr($keywordComplex)
->where($where)
->field('w.id,w.money,w.blance,w.pay_time,w.charge,u.user_nickname,u.user_type')
->order("w.pay_time DESC")
->paginate(10);
// 获取分页显示
$page = $list->render();
$this->assign('list', $list);
$this->assign('page', $page);
// 渲染模板输出
return $this->fetch('list');
}
/*
* 获取领取列表
*/
public function getPullList() {
$where = ['s.state' => 1];
$request = input('request.');
$keywordComplex = [];
if (!empty($request['keyword'])) {
$keyword = $request['keyword'];
$keywordComplex['u.user_nickname|c.name'] = ['like', "%$keyword%"];
}
if (!empty($request['start_time']) && !empty($request['end_time'])) {
$keywordComplex['s.create_time'] = ['>=', $request['start_time']];
$keywordComplex['s.create_time'] = ['<=', $request['end_time']];
}
$list = Db::name('share_log')
->alias('s')
->join('user u','s.user_id = u.id','left')
->join('card c','s.card_id = c.id','left')
->whereOr($keywordComplex)
->where($where)
->field('s.id,s.money,s.create_time,u.user_nickname,c.name')
->order("s.create_time DESC")
->paginate(10);
$count = Db::name('share_log')
->alias('s')
->join('user u','s.user_id = u.id','left')
->join('card c','s.card_id = c.id','left')
->whereOr($keywordComplex)
->where($where)
->sum('s.money');
// 获取分页显示
$page = $list->render();
$this->assign('count', $count);
$this->assign('list', $list);
$this->assign('page', $page);
// 渲染模板输出
return $this->fetch('log');
}
/*
* 充值列表
*/
public function getRechargeList() {
$where = ['r.state' => 1];
$request = input('request.');
$keywordComplex = [];
if (!empty($request['keyword'])) {
$keyword = $request['keyword'];
$keywordComplex['c.name'] = ['like', "%$keyword%"];
}
if (!empty($request['start_time']) && !empty($request['end_time'])) {
$keywordComplex['r.create_time'] = ['>=', $request['start_time']];
$keywordComplex['r.create_time'] = ['<=', $request['end_time']];
}
$list = Db::name('recharge_log')
->alias('r')
->join('user u','r.user_id = u.id','left')
->join('card c','u.id = c.user_id','left')
->whereOr($keywordComplex)
->where($where)
->field('r.id,r.order_sn,r.num,r.money,r.create_time,r.pay_time,u.user_nickname,u.avatar,c.name,u.id user_id')
->order("r.create_time DESC")
->paginate(10);
// 获取分页显示
$page = $list->render();
$this->assign('start_time', isset($request['start_time']) ? $request['start_time'] : '');
$this->assign('end_time', isset($request['end_time']) ? $request['end_time'] : '');
$this->assign('list', $list);
$this->assign('page', $page);
// 渲染模板输出
return $this->fetch('rechargeList');
}
}