作者 李涵
1 个管道 的构建 通过 耗费 1 秒

合并分支 'li' 到 'master'

赠送积分和角色管理



查看合并请求 !585
... ... @@ -56,9 +56,9 @@ class AdminIndexController extends AdminBaseController
*/
public function index()
{
$where = ['user_type'=>2];
$where1=[];
$where3=[];
$where = ['user_type' => 2];
$where1 = [];
$where3 = [];
$param = request()->param();
... ... @@ -67,53 +67,69 @@ class AdminIndexController extends AdminBaseController
$keyword = $param['keyword'];
$keywordComplex['mobile|id'] = $keyword;
}
if (!empty($param['start_time'])){
$where['create_time']=['egt',strtotime($param['start_time'])];
}
if (!empty($param['end_time'])){
$where1['create_time']=['elt',strtotime($param['end_time'])];
if (!empty($param['start_time'])) {
$where['create_time'] = ['egt', strtotime($param['start_time'])];
}
if (!empty($param['end_time'])) {
$where1['create_time'] = ['elt', strtotime($param['end_time'])];
}
if (!empty($param['min'])){
$where['balance']=['egt',$param['min']];
if (!empty($param['min'])) {
$where['balance'] = ['egt', $param['min']];
}
if (!empty($param['max'])){
$where1['balance']=['elt',$param['max']];
if (!empty($param['max'])) {
$where1['balance'] = ['elt', $param['max']];
}
$uid = (isset($param['uid'])) ? $param['uid'] : null;
//下级人员
if($uid) {
if ($uid) {
$where3['parent_id'] = ['eq', $uid];
}
$usersQuery = Db::name('user');
$list = $usersQuery->whereOr($keywordComplex)->where($where)->where($where1)->where($where3)->order("create_time DESC")->paginate(10);
//获取订单数和会员专区金额统计
foreach ($list as $k => $item) {
$uid = $item['id'];
$role = $item['role'];
$map = [
'uid' => ['eq', $item['id']],
'pay_type' => ['eq', 3],
'step' => ['neq', 1]
];
$data = [];
//如果此人为普通会员,只统计其金额总和
if($role == 1) {
if ($role == 1) {
$map = [
'uid' => ['eq', $item['id']],
'pay_type' => ['eq', 3],
'step' => ['neq', 1]
];
$data = Db::name('zj_order')->where($map)->field('sum(whole) as whole,sum(whole_num) as whole_num')->select();
$whole = $data[0]['whole'];
$whole_num = $data[0]['whole_num'];
$total = $whole - $whole_num;
}else {
$total = '下级';
} else {
//先查此人的下级
$son_arr = Db::name('user')->where(['parent_id' => $item['id']])->field('id')->select();
if (!empty($son_arr)) {
$son_str = '';
foreach ($son_arr as $k => $v) {
if ($k == count($son_arr) - 1) {
$son_str .= $v['id'];
} else {
$son_str .= $v['id'] . ',';
}
}
$map = [
'uid' => ['in', $son_str],
'pay_type' => ['eq', 3],
'step' => ['neq', 1]
];
$data = Db::name('zj_order')->where($map)->field('sum(whole) as whole,sum(whole_num) as whole_num')->select();
}
}
$whole = $data[0]['whole'];
$whole_num = $data[0]['whole_num'];
$total = $whole - $whole_num;
$item['total'] = $total;
$list[$k] = $item;
}
// 获取分页显示
$list->appends($param);
$this->assign('start_time', isset($param['start_time']) ? $param['start_time'] : '');
... ... @@ -183,12 +199,13 @@ class AdminIndexController extends AdminBaseController
/**
* 用户积分详情
*/
public function balance(){
if ($this->request->param()){
$id=input('param.id');
$all=Db::name('zj_integral_log')->where('uid',$id)->paginate(20);
$this->assign('list',$all);
$this->assign('page',$all->render());
public function balance()
{
if ($this->request->param()) {
$id = input('param.id');
$all = Db::name('zj_integral_log')->where('uid', $id)->paginate(20);
$this->assign('list', $all);
$this->assign('page', $all->render());
return $this->fetch();
}
}
... ...