diff --git a/app/controller/admin/user/UserBill.php b/app/controller/admin/user/UserBill.php index 040c4f77..57a341a4 100644 --- a/app/controller/admin/user/UserBill.php +++ b/app/controller/admin/user/UserBill.php @@ -54,17 +54,17 @@ class UserBill extends BaseController public function deposit(){ $where = $this->request->params(['keyword', 'date']); - // ->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) { - // getModelTime($query, $where['date'], 'create_time'); - // }) - // ->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) { - // $query->whereLike('a.uid|b.nickname|a.title', "%{$where['keyword']}%"); - // }) - // whereTime('birthday', 'between', ['1970-10-1', '2000-10-1']) - [$page, $limit] = $this->getPage(); $query= Db::name('margin_order')->where('paid',1); - // if(isset($where['date'])) + if(isset($where['date'])&& $where['date']!=''){ + $a=explode(' ',$where['date']); + $query->whereTime('birthday', 'between', [$a[0],$a[1]]); + } + if(isset($where['keyword'])&& $where['date']!=''){ + $a=Db::name('merchant')->whereLike('mer_name',$where['mer_name'])->column('mer_id'); + $query->where('mer_id', 'in', [$a[0],$a[1]]); + } + $count=$query->count(); $list=$query->withAttr('mer_name',function($value,$data){ return Db::name('merchant')->where('mer_id',$data['mer_id'])->value('mer_name'); @@ -73,6 +73,6 @@ class UserBill extends BaseController return Db::name('user')->where('uid',$data['uid'])->value('nickname'); }) ->page($page, $limit)->order('order_id', 'desc')->select()->toArray(); - return app('json')->success($list); + return app('json')->success(['count'=>$count,'list'=>$list]); } }