From 90b1dcf440eb944367684deaf341f7a507c1a4e5 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Tue, 9 Apr 2024 16:46:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=88=86=E9=94=80?= =?UTF-8?q?=E5=95=86=E4=B8=AD=E5=BF=83=20-=20=E7=B4=AF=E8=AE=A1=E6=8F=90?= =?UTF-8?q?=E7=8E=B0=E7=BB=9F=E8=AE=A1=E5=B7=B2=E5=AE=A1=E6=A0=B8=E5=92=8C?= =?UTF-8?q?=E5=BE=85=E5=AE=A1=E6=A0=B8=E7=9A=84=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/user/UserExtractDao.php | 50 ++++++++++++------- .../user/UserExtractRepository.php | 2 +- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/app/common/dao/user/UserExtractDao.php b/app/common/dao/user/UserExtractDao.php index ea107fd..56bbcc1 100644 --- a/app/common/dao/user/UserExtractDao.php +++ b/app/common/dao/user/UserExtractDao.php @@ -17,30 +17,42 @@ class UserExtractDao extends BaseDao public function search(array $where) { - if(isset($where['wechat']) && $where['wechat'] != '') { - $query = model::hasWhere('user',function ($query)use($where){ + if(isset($where['wechat']) && $where['wechat'] != ''){ + $query = model::hasWhere('user',function($query) use ($where){ $query->where('nickname',"%{$where['wechat']}%"); }); - }else{ + } + else{ $query = model::alias('UserExtract'); } - $query->when(isset($where['uid']) && $where['uid'] != '',function($query)use($where){ + $query->when(isset($where['uid']) && $where['uid'] != '',function($query) use ($where){ $query->where('uid',$where['uid']); - })->when(isset($where['extract_type']) && $where['extract_type'] != '',function($query)use($where){ - $query->where('extract_type',$where['extract_type']); - })->when(isset($where['keyword']) && $where['keyword'] != '',function($query)use($where){ - $query->whereLike('UserExtract.real_name|UserExtract.uid|bank_code|alipay_code|wechat',"%{$where['keyword']}%"); - })->when(isset($where['status']) && $where['status'] != '',function($query)use($where){ - $query->where('UserExtract.status',$where['status']); - })->when(isset($where['real_name']) && $where['real_name'] != '',function($query)use($where){ - $query->where('UserExtract.real_name','%'.$where['real_name'].'%'); - })->when(isset($where['date']) && $where['date'] != '',function($query)use($where){ - getModelTime($query, $where['date']); - })->when(isset($where['brokerage_level']) && $where['brokerage_level'], function ($query) use ($where) { - $query->join('User user', 'UserExtract.uid = user.uid', 'left')->where('user.brokerage_level', intval($where['brokerage_level'])); - })->when(isset($where['user_keyword']) && $where['user_keyword'], function ($query) use ($where) { - $query->join('User user', 'UserExtract.uid = user.uid', 'left')->where('user.uid|user.real_name|user.nickname|user.phone', 'like', '%' . $where['keyword'] . '%'); - })->order('UserExtract.create_time DESC'); + }) + ->when(isset($where['extract_type']) && $where['extract_type'] != '',function($query) use ($where){ + $query->where('extract_type',$where['extract_type']); + }) + ->when(isset($where['keyword']) && $where['keyword'] != '',function($query) use ($where){ + $query->whereLike('UserExtract.real_name|UserExtract.uid|bank_code|alipay_code|wechat',"%{$where['keyword']}%"); + }) + ->when(isset($where['status']) && $where['status'] != '',function($query) use ($where){ + if(is_array($where['status'])) $query->whereIn('UserExtract.status',$where['status']); + else $query->where('UserExtract.status',$where['status']); + }) + ->when(isset($where['real_name']) && $where['real_name'] != '',function($query) use ($where){ + $query->where('UserExtract.real_name','%'.$where['real_name'].'%'); + }) + ->when(isset($where['date']) && $where['date'] != '',function($query) use ($where){ + getModelTime($query,$where['date']); + }) + ->when(isset($where['brokerage_level']) && $where['brokerage_level'],function($query) use ($where){ + $query->join('User user','UserExtract.uid = user.uid','left') + ->where('user.brokerage_level',intval($where['brokerage_level'])); + }) + ->when(isset($where['user_keyword']) && $where['user_keyword'],function($query) use ($where){ + $query->join('User user','UserExtract.uid = user.uid','left') + ->where('user.uid|user.real_name|user.nickname|user.phone','like','%'.$where['keyword'].'%'); + }) + ->order('UserExtract.create_time DESC'); return $query; } diff --git a/app/common/repositories/user/UserExtractRepository.php b/app/common/repositories/user/UserExtractRepository.php index 0c22960..2e91b8f 100644 --- a/app/common/repositories/user/UserExtractRepository.php +++ b/app/common/repositories/user/UserExtractRepository.php @@ -80,7 +80,7 @@ class UserExtractRepository extends BaseRepository */ public function userTotalExtract($uid) { - return $this->dao->search(['status' => 1, 'uid' => $uid])->sum('extract_price'); + return $this->dao->search(['status' => [0,1], 'uid' => $uid])->sum('extract_price'); } /**