From 6a4693fdee40a6a5f779e1c0307c19b63fd723e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Mon, 20 Mar 2023 10:37:22 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BD=A3=E9=87=91=E8=BD=AC=E5=85=A5?= =?UTF-8?q?=E4=BD=99=E9=A2=9D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/adminapi/controller/Common.php | 8 ++++---- .../app/api/controller/v1/user/UserRechargeController.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crmeb/app/adminapi/controller/Common.php b/crmeb/app/adminapi/controller/Common.php index 92df9cd54..e32274043 100644 --- a/crmeb/app/adminapi/controller/Common.php +++ b/crmeb/app/adminapi/controller/Common.php @@ -235,28 +235,28 @@ class Common extends AuthController if ($data['ordernum'] != 0) { $value[] = [ 'title' => "您有$data[ordernum]个待发货的订单", - 'type' => 'bulb', + 'type' => 1, 'url' => '/admin/order/list?status=1' ]; } if ($data['inventory'] != 0) { $value[] = [ 'title' => "您有$data[inventory]个商品库存预警", - 'type' => 'information', + 'type' => 2, 'url' => '/admin/product/product_list?type=5', ]; } if ($data['commentnum'] != 0) { $value[] = [ 'title' => "您有$data[commentnum]条评论待回复", - 'type' => 'bulb', + 'type' => 3, 'url' => '/admin/product/product_reply?is_reply=0' ]; } if ($data['reflectnum'] != 0) { $value[] = [ 'title' => "您有$data[reflectnum]个提现申请待审核", - 'type' => 'bulb', + 'type' => 4, 'url' => '/admin/finance/user_extract/index?status=0', ]; } diff --git a/crmeb/app/api/controller/v1/user/UserRechargeController.php b/crmeb/app/api/controller/v1/user/UserRechargeController.php index 57302764d..3c4be9601 100644 --- a/crmeb/app/api/controller/v1/user/UserRechargeController.php +++ b/crmeb/app/api/controller/v1/user/UserRechargeController.php @@ -53,7 +53,7 @@ class UserRechargeController $uid = (int)$request->uid(); $re = $this->services->recharge($uid, $price, $recharId, $type, $from, true); if ($re) { - $payType = $re['pay_type']; + $payType = $re['pay_type'] ?? ''; unset($re['pay_type']); return app('json')->status($payType, 410125, $re); } From aeca0e3936e8ce7ea9d1767c6c9ecdc8b3b85b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Mon, 20 Mar 2023 11:36:52 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/dao/BaseDao.php | 11 ++++++++--- .../dao/activity/combination/StoreCombinationDao.php | 9 +++++++-- crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php | 2 +- .../dao/activity/integral/StoreIntegralOrderDao.php | 2 +- crmeb/app/dao/activity/lottery/LuckLotteryDao.php | 2 +- crmeb/app/dao/activity/seckill/StoreSeckillDao.php | 2 +- crmeb/app/dao/article/ArticleDao.php | 2 +- crmeb/app/dao/order/OtherOrderDao.php | 2 +- crmeb/app/dao/order/StoreCartDao.php | 2 +- crmeb/app/dao/order/StoreOrderDao.php | 3 ++- crmeb/app/dao/order/StoreOrderInvoiceDao.php | 2 +- crmeb/app/dao/order/StoreOrderRefundDao.php | 2 +- crmeb/app/dao/service/StoreServiceAuxiliaryDao.php | 2 +- .../system/attachment/SystemAttachmentCategoryDao.php | 2 +- crmeb/app/dao/system/config/SystemStorageDao.php | 2 +- crmeb/app/dao/user/UserBrokerageFrozenDao.php | 2 +- crmeb/app/dao/wechat/WechatKeyDao.php | 2 +- 17 files changed, 31 insertions(+), 20 deletions(-) diff --git a/crmeb/app/dao/BaseDao.php b/crmeb/app/dao/BaseDao.php index 7061af2b0..89e7a01cf 100644 --- a/crmeb/app/dao/BaseDao.php +++ b/crmeb/app/dao/BaseDao.php @@ -318,31 +318,36 @@ abstract class BaseDao /** * 根据搜索器获取搜索内容 * @param $where + * @param $search * @return BaseModel * @throws \ReflectionException * @author 吴汐 * @email 442384644@qq.com * @date 2023/03/18 */ - protected function withSearchSelect($where) + protected function withSearchSelect($where, $search) { [$with, $otherWhere] = $this->getSearchData($where); + if (!$search) { + $otherWhere = []; + } return $this->getModel()->withSearch($with, $where)->where($otherWhere); } /** * 搜索 * @param array $where + * @param bool $search * @return BaseModel * @throws \ReflectionException * @author 吴汐 * @email 442384644@qq.com * @date 2023/03/18 */ - protected function search(array $where = []) + protected function search(array $where = [], $search = true) { if ($where) { - return $this->withSearchSelect($where); + return $this->withSearchSelect($where, $search); } else { return $this->getModel(); } diff --git a/crmeb/app/dao/activity/combination/StoreCombinationDao.php b/crmeb/app/dao/activity/combination/StoreCombinationDao.php index b5de5a3b1..6f514f735 100644 --- a/crmeb/app/dao/activity/combination/StoreCombinationDao.php +++ b/crmeb/app/dao/activity/combination/StoreCombinationDao.php @@ -39,7 +39,7 @@ class StoreCombinationDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where)->when(isset($where['pinkIngTime']), function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['pinkIngTime']), function ($query) use ($where) { $time = time(); [$startTime, $stopTime] = is_array($where['pinkIngTime']) ? $where['pinkIngTime'] : [$time, $time]; $query->where('start_time', '<=', $startTime)->where('stop_time', '>=', $stopTime); @@ -100,6 +100,7 @@ class StoreCombinationDao extends BaseDao $query->page($page, $limit); })->order('sort desc,id desc')->select()->toArray(); } + /**获取列表 * @param array $where * @param int $page @@ -164,6 +165,7 @@ class StoreCombinationDao extends BaseDao { return $this->search($where)->with('getPrice')->page($page, $limit)->order('sort desc,id desc')->select()->toArray(); } + /** * 条件获取数量 * @param array $where @@ -173,6 +175,7 @@ class StoreCombinationDao extends BaseDao { return $this->search($where)->count(); } + /** * 页面设计获取商拼团列表 * @param array $where @@ -183,9 +186,11 @@ class StoreCombinationDao extends BaseDao * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function diyCombinationList(array $where, int $page, int $limit){ + public function diyCombinationList(array $where, int $page, int $limit) + { return $this->search($where)->with('getCategory')->page($page, $limit)->order('sort desc,id desc')->select()->toArray(); } + /** * 根据id获取拼团数据 * @param array $ids diff --git a/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php b/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php index 911ddf959..e117f5a92 100644 --- a/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php +++ b/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php @@ -38,7 +38,7 @@ class StoreCouponIssueDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where)->when(isset($where['type']) && $where['type'] != '', function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['type']) && $where['type'] != '', function ($query) use ($where) { if ($where['type'] == 'send') { $query->where('receive_type', 3)->where(function ($query1) { $query1->where(function ($query2) { diff --git a/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php b/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php index 4f40242c4..ba63ad6ec 100644 --- a/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php +++ b/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php @@ -48,7 +48,7 @@ class StoreIntegralOrderDao extends BaseDao $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; - return parent::search($where)->when($isDel, function ($query) use ($where) { + return parent::search($where, false)->when($isDel, function ($query) use ($where) { $query->where('is_del', $where['is_del']); })->when(isset($where['is_system_del']), function ($query) { $query->where('is_system_del', 0); diff --git a/crmeb/app/dao/activity/lottery/LuckLotteryDao.php b/crmeb/app/dao/activity/lottery/LuckLotteryDao.php index a523f0729..aa4b8b09f 100644 --- a/crmeb/app/dao/activity/lottery/LuckLotteryDao.php +++ b/crmeb/app/dao/activity/lottery/LuckLotteryDao.php @@ -34,7 +34,7 @@ class LuckLotteryDao extends BaseDao public function search(array $data = []) { - return parent::search($data)->when(isset($data['id']) && $data['id'], function ($query) use ($data) { + return parent::search($data, false)->when(isset($data['id']) && $data['id'], function ($query) use ($data) { $query->where('id', $data['id']); })->when(isset($data['start']) && $data['start'] !== '', function ($query) use ($data) { $time = time(); diff --git a/crmeb/app/dao/activity/seckill/StoreSeckillDao.php b/crmeb/app/dao/activity/seckill/StoreSeckillDao.php index 5dd67812c..52176a73c 100644 --- a/crmeb/app/dao/activity/seckill/StoreSeckillDao.php +++ b/crmeb/app/dao/activity/seckill/StoreSeckillDao.php @@ -39,7 +39,7 @@ class StoreSeckillDao extends BaseDao */ protected function search(array $where = []) { - return parent::search($where)->when(isset($where['seckllTime']), function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['seckllTime']), function ($query) use ($where) { [$startTime, $stopTime] = is_array($where['seckllTime']) ? $where['seckllTime'] : [time(), time() - 86400]; $query->where('start_time', '<=', $startTime)->where('stop_time', '>=', $stopTime); })->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) { diff --git a/crmeb/app/dao/article/ArticleDao.php b/crmeb/app/dao/article/ArticleDao.php index 94d8e917f..7cc3115e6 100644 --- a/crmeb/app/dao/article/ArticleDao.php +++ b/crmeb/app/dao/article/ArticleDao.php @@ -32,7 +32,7 @@ class ArticleDao extends BaseDao public function search(array $where = []) { - return parent::search($where)->when(isset($where['ids']) && count($where['ids']), function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['ids']) && count($where['ids']), function ($query) use ($where) { $query->whereNotIn('id', $where['ids']); }); } diff --git a/crmeb/app/dao/order/OtherOrderDao.php b/crmeb/app/dao/order/OtherOrderDao.php index 60d76d6bd..8bf89a952 100644 --- a/crmeb/app/dao/order/OtherOrderDao.php +++ b/crmeb/app/dao/order/OtherOrderDao.php @@ -163,7 +163,7 @@ class OtherOrderDao extends BaseDao public function search(array $where = []) { - return parent::search($where)->when(isset($where['name']) && $where['name'], function ($query) use($where){ + return parent::search($where, false)->when(isset($where['name']) && $where['name'], function ($query) use($where){ $query->where('uid', 'in', function ($que) use($where){ $nickname = trim($where['name']); $que->name('user')->where('nickname', 'like', $nickname.'%')->field(['uid'])->select(); diff --git a/crmeb/app/dao/order/StoreCartDao.php b/crmeb/app/dao/order/StoreCartDao.php index 9529a1643..95bd2d5dc 100644 --- a/crmeb/app/dao/order/StoreCartDao.php +++ b/crmeb/app/dao/order/StoreCartDao.php @@ -49,7 +49,7 @@ class StoreCartDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where)->when(isset($where['id']) && $where['id'], function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['id']) && $where['id'], function ($query) use ($where) { $query->whereIn('id', $where['id']); })->when(isset($where['status']), function ($query) use ($where) { //兼容之前老用户 数据库默认值null diff --git a/crmeb/app/dao/order/StoreOrderDao.php b/crmeb/app/dao/order/StoreOrderDao.php index d99febb71..d5d093789 100644 --- a/crmeb/app/dao/order/StoreOrderDao.php +++ b/crmeb/app/dao/order/StoreOrderDao.php @@ -41,6 +41,7 @@ class StoreOrderDao extends BaseDao * 订单搜索 * @param array $where * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ public function search(array $where = []) { @@ -48,7 +49,7 @@ class StoreOrderDao extends BaseDao $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; - return parent::search($where)->when($isDel, function ($query) use ($where) { + return parent::search($where, false)->when($isDel, function ($query) use ($where) { $query->where('is_del', $where['is_del']); })->when(isset($where['is_system_del']), function ($query) { $query->where('is_system_del', 0); diff --git a/crmeb/app/dao/order/StoreOrderInvoiceDao.php b/crmeb/app/dao/order/StoreOrderInvoiceDao.php index 75e8080ad..41b48a245 100644 --- a/crmeb/app/dao/order/StoreOrderInvoiceDao.php +++ b/crmeb/app/dao/order/StoreOrderInvoiceDao.php @@ -40,7 +40,7 @@ class StoreOrderInvoiceDao extends BaseDao $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; $type = $where['type'] ?? ''; unset($where['type']); - return parent::search($where)->when($type, function ($query) use ($type) { + return parent::search($where, false)->when($type, function ($query) use ($type) { switch ($type) { case 1://待开 $query->where('is_invoice', 0)->where('invoice_time', 0)->where('is_refund', 0); diff --git a/crmeb/app/dao/order/StoreOrderRefundDao.php b/crmeb/app/dao/order/StoreOrderRefundDao.php index f043e0a94..215acf46c 100644 --- a/crmeb/app/dao/order/StoreOrderRefundDao.php +++ b/crmeb/app/dao/order/StoreOrderRefundDao.php @@ -26,7 +26,7 @@ class StoreOrderRefundDao extends BaseDao $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; - return parent::search($where)->when(isset($where['refund_type']) && $where['refund_type'] !== '', function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['refund_type']) && $where['refund_type'] !== '', function ($query) use ($where) { if ($where['refund_type'] == 0) { $query->where('refund_type', '>', 0); } else { diff --git a/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php b/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php index b0142bff3..15eab0457 100644 --- a/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php +++ b/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php @@ -29,7 +29,7 @@ class StoreServiceAuxiliaryDao extends AuxiliaryDao */ protected function search(array $where = []) { - return parent::search($where)->where('type', 0); + return parent::search($where, false)->where('type', 0); } } diff --git a/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php b/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php index 7afbffe02..c3d2a78e8 100644 --- a/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php +++ b/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php @@ -62,7 +62,7 @@ class SystemAttachmentCategoryDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where)->when(isset($where['id']), function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['id']), function ($query) use ($where) { $query->whereIn('id', $where['id']); }); } diff --git a/crmeb/app/dao/system/config/SystemStorageDao.php b/crmeb/app/dao/system/config/SystemStorageDao.php index 0329e566b..a5e685b22 100644 --- a/crmeb/app/dao/system/config/SystemStorageDao.php +++ b/crmeb/app/dao/system/config/SystemStorageDao.php @@ -68,7 +68,7 @@ class SystemStorageDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where)->when(isset($where['type']), function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['type']), function ($query) use ($where) { $query->where('type', $where['type']); })->where('is_delete', 0)->when(isset($where['access_key']), function ($query) use ($where) { $query->where('access_key', $where['access_key']); diff --git a/crmeb/app/dao/user/UserBrokerageFrozenDao.php b/crmeb/app/dao/user/UserBrokerageFrozenDao.php index 4ca41e05b..2135521bd 100644 --- a/crmeb/app/dao/user/UserBrokerageFrozenDao.php +++ b/crmeb/app/dao/user/UserBrokerageFrozenDao.php @@ -38,7 +38,7 @@ class UserBrokerageFrozenDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where)->when(isset($where['isFrozen']), function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['isFrozen']), function ($query) use ($where) { if ($where['isFrozen']) { $query->where('frozen_time', '>', time()); } else { diff --git a/crmeb/app/dao/wechat/WechatKeyDao.php b/crmeb/app/dao/wechat/WechatKeyDao.php index 33fe3e8e3..4a8197b86 100644 --- a/crmeb/app/dao/wechat/WechatKeyDao.php +++ b/crmeb/app/dao/wechat/WechatKeyDao.php @@ -35,7 +35,7 @@ class WechatKeyDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where)->when(isset($where['id']), function ($query) use ($where) { + return parent::search($where, false)->when(isset($where['id']), function ($query) use ($where) { $query->where('id', $where['id']); }); } From 37f73c7392e492b8edb5ae1cb66d0c1df2dabe42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Mon, 20 Mar 2023 11:47:17 +0800 Subject: [PATCH 3/6] =?UTF-8?q?Revert=20"=E6=9B=B4=E6=96=B0search"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit aeca0e3936e8ce7ea9d1767c6c9ecdc8b3b85b33. --- crmeb/app/dao/BaseDao.php | 11 +++-------- .../dao/activity/combination/StoreCombinationDao.php | 9 ++------- crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php | 2 +- .../dao/activity/integral/StoreIntegralOrderDao.php | 2 +- crmeb/app/dao/activity/lottery/LuckLotteryDao.php | 2 +- crmeb/app/dao/activity/seckill/StoreSeckillDao.php | 2 +- crmeb/app/dao/article/ArticleDao.php | 2 +- crmeb/app/dao/order/OtherOrderDao.php | 2 +- crmeb/app/dao/order/StoreCartDao.php | 2 +- crmeb/app/dao/order/StoreOrderDao.php | 3 +-- crmeb/app/dao/order/StoreOrderInvoiceDao.php | 2 +- crmeb/app/dao/order/StoreOrderRefundDao.php | 2 +- crmeb/app/dao/service/StoreServiceAuxiliaryDao.php | 2 +- .../system/attachment/SystemAttachmentCategoryDao.php | 2 +- crmeb/app/dao/system/config/SystemStorageDao.php | 2 +- crmeb/app/dao/user/UserBrokerageFrozenDao.php | 2 +- crmeb/app/dao/wechat/WechatKeyDao.php | 2 +- 17 files changed, 20 insertions(+), 31 deletions(-) diff --git a/crmeb/app/dao/BaseDao.php b/crmeb/app/dao/BaseDao.php index 89e7a01cf..7061af2b0 100644 --- a/crmeb/app/dao/BaseDao.php +++ b/crmeb/app/dao/BaseDao.php @@ -318,36 +318,31 @@ abstract class BaseDao /** * 根据搜索器获取搜索内容 * @param $where - * @param $search * @return BaseModel * @throws \ReflectionException * @author 吴汐 * @email 442384644@qq.com * @date 2023/03/18 */ - protected function withSearchSelect($where, $search) + protected function withSearchSelect($where) { [$with, $otherWhere] = $this->getSearchData($where); - if (!$search) { - $otherWhere = []; - } return $this->getModel()->withSearch($with, $where)->where($otherWhere); } /** * 搜索 * @param array $where - * @param bool $search * @return BaseModel * @throws \ReflectionException * @author 吴汐 * @email 442384644@qq.com * @date 2023/03/18 */ - protected function search(array $where = [], $search = true) + protected function search(array $where = []) { if ($where) { - return $this->withSearchSelect($where, $search); + return $this->withSearchSelect($where); } else { return $this->getModel(); } diff --git a/crmeb/app/dao/activity/combination/StoreCombinationDao.php b/crmeb/app/dao/activity/combination/StoreCombinationDao.php index 6f514f735..b5de5a3b1 100644 --- a/crmeb/app/dao/activity/combination/StoreCombinationDao.php +++ b/crmeb/app/dao/activity/combination/StoreCombinationDao.php @@ -39,7 +39,7 @@ class StoreCombinationDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where, false)->when(isset($where['pinkIngTime']), function ($query) use ($where) { + return parent::search($where)->when(isset($where['pinkIngTime']), function ($query) use ($where) { $time = time(); [$startTime, $stopTime] = is_array($where['pinkIngTime']) ? $where['pinkIngTime'] : [$time, $time]; $query->where('start_time', '<=', $startTime)->where('stop_time', '>=', $stopTime); @@ -100,7 +100,6 @@ class StoreCombinationDao extends BaseDao $query->page($page, $limit); })->order('sort desc,id desc')->select()->toArray(); } - /**获取列表 * @param array $where * @param int $page @@ -165,7 +164,6 @@ class StoreCombinationDao extends BaseDao { return $this->search($where)->with('getPrice')->page($page, $limit)->order('sort desc,id desc')->select()->toArray(); } - /** * 条件获取数量 * @param array $where @@ -175,7 +173,6 @@ class StoreCombinationDao extends BaseDao { return $this->search($where)->count(); } - /** * 页面设计获取商拼团列表 * @param array $where @@ -186,11 +183,9 @@ class StoreCombinationDao extends BaseDao * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function diyCombinationList(array $where, int $page, int $limit) - { + public function diyCombinationList(array $where, int $page, int $limit){ return $this->search($where)->with('getCategory')->page($page, $limit)->order('sort desc,id desc')->select()->toArray(); } - /** * 根据id获取拼团数据 * @param array $ids diff --git a/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php b/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php index e117f5a92..911ddf959 100644 --- a/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php +++ b/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php @@ -38,7 +38,7 @@ class StoreCouponIssueDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where, false)->when(isset($where['type']) && $where['type'] != '', function ($query) use ($where) { + return parent::search($where)->when(isset($where['type']) && $where['type'] != '', function ($query) use ($where) { if ($where['type'] == 'send') { $query->where('receive_type', 3)->where(function ($query1) { $query1->where(function ($query2) { diff --git a/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php b/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php index ba63ad6ec..4f40242c4 100644 --- a/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php +++ b/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php @@ -48,7 +48,7 @@ class StoreIntegralOrderDao extends BaseDao $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; - return parent::search($where, false)->when($isDel, function ($query) use ($where) { + return parent::search($where)->when($isDel, function ($query) use ($where) { $query->where('is_del', $where['is_del']); })->when(isset($where['is_system_del']), function ($query) { $query->where('is_system_del', 0); diff --git a/crmeb/app/dao/activity/lottery/LuckLotteryDao.php b/crmeb/app/dao/activity/lottery/LuckLotteryDao.php index aa4b8b09f..a523f0729 100644 --- a/crmeb/app/dao/activity/lottery/LuckLotteryDao.php +++ b/crmeb/app/dao/activity/lottery/LuckLotteryDao.php @@ -34,7 +34,7 @@ class LuckLotteryDao extends BaseDao public function search(array $data = []) { - return parent::search($data, false)->when(isset($data['id']) && $data['id'], function ($query) use ($data) { + return parent::search($data)->when(isset($data['id']) && $data['id'], function ($query) use ($data) { $query->where('id', $data['id']); })->when(isset($data['start']) && $data['start'] !== '', function ($query) use ($data) { $time = time(); diff --git a/crmeb/app/dao/activity/seckill/StoreSeckillDao.php b/crmeb/app/dao/activity/seckill/StoreSeckillDao.php index 52176a73c..5dd67812c 100644 --- a/crmeb/app/dao/activity/seckill/StoreSeckillDao.php +++ b/crmeb/app/dao/activity/seckill/StoreSeckillDao.php @@ -39,7 +39,7 @@ class StoreSeckillDao extends BaseDao */ protected function search(array $where = []) { - return parent::search($where, false)->when(isset($where['seckllTime']), function ($query) use ($where) { + return parent::search($where)->when(isset($where['seckllTime']), function ($query) use ($where) { [$startTime, $stopTime] = is_array($where['seckllTime']) ? $where['seckllTime'] : [time(), time() - 86400]; $query->where('start_time', '<=', $startTime)->where('stop_time', '>=', $stopTime); })->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) { diff --git a/crmeb/app/dao/article/ArticleDao.php b/crmeb/app/dao/article/ArticleDao.php index 7cc3115e6..94d8e917f 100644 --- a/crmeb/app/dao/article/ArticleDao.php +++ b/crmeb/app/dao/article/ArticleDao.php @@ -32,7 +32,7 @@ class ArticleDao extends BaseDao public function search(array $where = []) { - return parent::search($where, false)->when(isset($where['ids']) && count($where['ids']), function ($query) use ($where) { + return parent::search($where)->when(isset($where['ids']) && count($where['ids']), function ($query) use ($where) { $query->whereNotIn('id', $where['ids']); }); } diff --git a/crmeb/app/dao/order/OtherOrderDao.php b/crmeb/app/dao/order/OtherOrderDao.php index 8bf89a952..60d76d6bd 100644 --- a/crmeb/app/dao/order/OtherOrderDao.php +++ b/crmeb/app/dao/order/OtherOrderDao.php @@ -163,7 +163,7 @@ class OtherOrderDao extends BaseDao public function search(array $where = []) { - return parent::search($where, false)->when(isset($where['name']) && $where['name'], function ($query) use($where){ + return parent::search($where)->when(isset($where['name']) && $where['name'], function ($query) use($where){ $query->where('uid', 'in', function ($que) use($where){ $nickname = trim($where['name']); $que->name('user')->where('nickname', 'like', $nickname.'%')->field(['uid'])->select(); diff --git a/crmeb/app/dao/order/StoreCartDao.php b/crmeb/app/dao/order/StoreCartDao.php index 95bd2d5dc..9529a1643 100644 --- a/crmeb/app/dao/order/StoreCartDao.php +++ b/crmeb/app/dao/order/StoreCartDao.php @@ -49,7 +49,7 @@ class StoreCartDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where, false)->when(isset($where['id']) && $where['id'], function ($query) use ($where) { + return parent::search($where)->when(isset($where['id']) && $where['id'], function ($query) use ($where) { $query->whereIn('id', $where['id']); })->when(isset($where['status']), function ($query) use ($where) { //兼容之前老用户 数据库默认值null diff --git a/crmeb/app/dao/order/StoreOrderDao.php b/crmeb/app/dao/order/StoreOrderDao.php index d5d093789..d99febb71 100644 --- a/crmeb/app/dao/order/StoreOrderDao.php +++ b/crmeb/app/dao/order/StoreOrderDao.php @@ -41,7 +41,6 @@ class StoreOrderDao extends BaseDao * 订单搜索 * @param array $where * @return \crmeb\basic\BaseModel|mixed|\think\Model - * @throws \ReflectionException */ public function search(array $where = []) { @@ -49,7 +48,7 @@ class StoreOrderDao extends BaseDao $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; - return parent::search($where, false)->when($isDel, function ($query) use ($where) { + return parent::search($where)->when($isDel, function ($query) use ($where) { $query->where('is_del', $where['is_del']); })->when(isset($where['is_system_del']), function ($query) { $query->where('is_system_del', 0); diff --git a/crmeb/app/dao/order/StoreOrderInvoiceDao.php b/crmeb/app/dao/order/StoreOrderInvoiceDao.php index 41b48a245..75e8080ad 100644 --- a/crmeb/app/dao/order/StoreOrderInvoiceDao.php +++ b/crmeb/app/dao/order/StoreOrderInvoiceDao.php @@ -40,7 +40,7 @@ class StoreOrderInvoiceDao extends BaseDao $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; $type = $where['type'] ?? ''; unset($where['type']); - return parent::search($where, false)->when($type, function ($query) use ($type) { + return parent::search($where)->when($type, function ($query) use ($type) { switch ($type) { case 1://待开 $query->where('is_invoice', 0)->where('invoice_time', 0)->where('is_refund', 0); diff --git a/crmeb/app/dao/order/StoreOrderRefundDao.php b/crmeb/app/dao/order/StoreOrderRefundDao.php index 215acf46c..f043e0a94 100644 --- a/crmeb/app/dao/order/StoreOrderRefundDao.php +++ b/crmeb/app/dao/order/StoreOrderRefundDao.php @@ -26,7 +26,7 @@ class StoreOrderRefundDao extends BaseDao $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; - return parent::search($where, false)->when(isset($where['refund_type']) && $where['refund_type'] !== '', function ($query) use ($where) { + return parent::search($where)->when(isset($where['refund_type']) && $where['refund_type'] !== '', function ($query) use ($where) { if ($where['refund_type'] == 0) { $query->where('refund_type', '>', 0); } else { diff --git a/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php b/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php index 15eab0457..b0142bff3 100644 --- a/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php +++ b/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php @@ -29,7 +29,7 @@ class StoreServiceAuxiliaryDao extends AuxiliaryDao */ protected function search(array $where = []) { - return parent::search($where, false)->where('type', 0); + return parent::search($where)->where('type', 0); } } diff --git a/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php b/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php index c3d2a78e8..7afbffe02 100644 --- a/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php +++ b/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php @@ -62,7 +62,7 @@ class SystemAttachmentCategoryDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where, false)->when(isset($where['id']), function ($query) use ($where) { + return parent::search($where)->when(isset($where['id']), function ($query) use ($where) { $query->whereIn('id', $where['id']); }); } diff --git a/crmeb/app/dao/system/config/SystemStorageDao.php b/crmeb/app/dao/system/config/SystemStorageDao.php index a5e685b22..0329e566b 100644 --- a/crmeb/app/dao/system/config/SystemStorageDao.php +++ b/crmeb/app/dao/system/config/SystemStorageDao.php @@ -68,7 +68,7 @@ class SystemStorageDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where, false)->when(isset($where['type']), function ($query) use ($where) { + return parent::search($where)->when(isset($where['type']), function ($query) use ($where) { $query->where('type', $where['type']); })->where('is_delete', 0)->when(isset($where['access_key']), function ($query) use ($where) { $query->where('access_key', $where['access_key']); diff --git a/crmeb/app/dao/user/UserBrokerageFrozenDao.php b/crmeb/app/dao/user/UserBrokerageFrozenDao.php index 2135521bd..4ca41e05b 100644 --- a/crmeb/app/dao/user/UserBrokerageFrozenDao.php +++ b/crmeb/app/dao/user/UserBrokerageFrozenDao.php @@ -38,7 +38,7 @@ class UserBrokerageFrozenDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where, false)->when(isset($where['isFrozen']), function ($query) use ($where) { + return parent::search($where)->when(isset($where['isFrozen']), function ($query) use ($where) { if ($where['isFrozen']) { $query->where('frozen_time', '>', time()); } else { diff --git a/crmeb/app/dao/wechat/WechatKeyDao.php b/crmeb/app/dao/wechat/WechatKeyDao.php index 4a8197b86..33fe3e8e3 100644 --- a/crmeb/app/dao/wechat/WechatKeyDao.php +++ b/crmeb/app/dao/wechat/WechatKeyDao.php @@ -35,7 +35,7 @@ class WechatKeyDao extends BaseDao */ public function search(array $where = []) { - return parent::search($where, false)->when(isset($where['id']), function ($query) use ($where) { + return parent::search($where)->when(isset($where['id']), function ($query) use ($where) { $query->where('id', $where['id']); }); } From f40cdf47b6d430e55a904b46d71e58256aa0633d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Mon, 20 Mar 2023 12:08:46 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BC=98=E5=8C=96search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/dao/BaseDao.php | 11 +++++--- .../combination/StoreCombinationDao.php | 13 +++++++-- .../activity/coupon/StoreCouponIssueDao.php | 6 ++-- .../integral/StoreIntegralOrderDao.php | 6 ++-- .../dao/activity/lottery/LuckLotteryDao.php | 20 +++++++++---- .../dao/activity/seckill/StoreSeckillDao.php | 6 ++-- crmeb/app/dao/article/ArticleDao.php | 14 ++++++++-- crmeb/app/dao/order/OtherOrderDao.php | 28 +++++++++++++------ crmeb/app/dao/order/StoreCartDao.php | 6 ++-- crmeb/app/dao/order/StoreOrderDao.php | 6 ++-- crmeb/app/dao/order/StoreOrderInvoiceDao.php | 14 ++++++++-- crmeb/app/dao/order/StoreOrderRefundDao.php | 6 ++-- .../dao/service/StoreServiceAuxiliaryDao.php | 4 +-- .../SystemAttachmentCategoryDao.php | 6 ++-- .../dao/system/config/SystemStorageDao.php | 6 ++-- crmeb/app/dao/user/UserBrokerageFrozenDao.php | 6 ++-- crmeb/app/dao/wechat/WechatKeyDao.php | 6 ++-- 17 files changed, 117 insertions(+), 47 deletions(-) diff --git a/crmeb/app/dao/BaseDao.php b/crmeb/app/dao/BaseDao.php index 7061af2b0..919d5e625 100644 --- a/crmeb/app/dao/BaseDao.php +++ b/crmeb/app/dao/BaseDao.php @@ -324,25 +324,28 @@ abstract class BaseDao * @email 442384644@qq.com * @date 2023/03/18 */ - protected function withSearchSelect($where) + protected function withSearchSelect($where, $search) { [$with, $otherWhere] = $this->getSearchData($where); - return $this->getModel()->withSearch($with, $where)->where($otherWhere); + return $this->getModel()->withSearch($with, $where)->when($search, function ($query) use ($otherWhere) { + $query->where($otherWhere); + }); } /** * 搜索 * @param array $where + * @param bool $search * @return BaseModel * @throws \ReflectionException * @author 吴汐 * @email 442384644@qq.com * @date 2023/03/18 */ - protected function search(array $where = []) + public function search(array $where = [], bool $search = true) { if ($where) { - return $this->withSearchSelect($where); + return $this->withSearchSelect($where, $search); } else { return $this->getModel(); } diff --git a/crmeb/app/dao/activity/combination/StoreCombinationDao.php b/crmeb/app/dao/activity/combination/StoreCombinationDao.php index b5de5a3b1..93cbad977 100644 --- a/crmeb/app/dao/activity/combination/StoreCombinationDao.php +++ b/crmeb/app/dao/activity/combination/StoreCombinationDao.php @@ -35,11 +35,13 @@ class StoreCombinationDao extends BaseDao /** * 搜索 * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['pinkIngTime']), function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['pinkIngTime']), function ($query) use ($where) { $time = time(); [$startTime, $stopTime] = is_array($where['pinkIngTime']) ? $where['pinkIngTime'] : [$time, $time]; $query->where('start_time', '<=', $startTime)->where('stop_time', '>=', $stopTime); @@ -100,6 +102,7 @@ class StoreCombinationDao extends BaseDao $query->page($page, $limit); })->order('sort desc,id desc')->select()->toArray(); } + /**获取列表 * @param array $where * @param int $page @@ -164,6 +167,7 @@ class StoreCombinationDao extends BaseDao { return $this->search($where)->with('getPrice')->page($page, $limit)->order('sort desc,id desc')->select()->toArray(); } + /** * 条件获取数量 * @param array $where @@ -173,6 +177,7 @@ class StoreCombinationDao extends BaseDao { return $this->search($where)->count(); } + /** * 页面设计获取商拼团列表 * @param array $where @@ -183,9 +188,11 @@ class StoreCombinationDao extends BaseDao * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function diyCombinationList(array $where, int $page, int $limit){ + public function diyCombinationList(array $where, int $page, int $limit) + { return $this->search($where)->with('getCategory')->page($page, $limit)->order('sort desc,id desc')->select()->toArray(); } + /** * 根据id获取拼团数据 * @param array $ids diff --git a/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php b/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php index 911ddf959..f33313e1f 100644 --- a/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php +++ b/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php @@ -34,11 +34,13 @@ class StoreCouponIssueDao extends BaseDao /** * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['type']) && $where['type'] != '', function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['type']) && $where['type'] != '', function ($query) use ($where) { if ($where['type'] == 'send') { $query->where('receive_type', 3)->where(function ($query1) { $query1->where(function ($query2) { diff --git a/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php b/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php index 4f40242c4..31f6142bc 100644 --- a/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php +++ b/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php @@ -40,15 +40,17 @@ class StoreIntegralOrderDao extends BaseDao /** * 订单搜索 * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { $isDel = isset($where['is_del']) && $where['is_del'] !== '' && $where['is_del'] != -1; $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; - return parent::search($where)->when($isDel, function ($query) use ($where) { + return parent::search($where, $search)->when($isDel, function ($query) use ($where) { $query->where('is_del', $where['is_del']); })->when(isset($where['is_system_del']), function ($query) { $query->where('is_system_del', 0); diff --git a/crmeb/app/dao/activity/lottery/LuckLotteryDao.php b/crmeb/app/dao/activity/lottery/LuckLotteryDao.php index a523f0729..b594a36e6 100644 --- a/crmeb/app/dao/activity/lottery/LuckLotteryDao.php +++ b/crmeb/app/dao/activity/lottery/LuckLotteryDao.php @@ -32,13 +32,23 @@ class LuckLotteryDao extends BaseDao return LuckLottery::class; } - public function search(array $data = []) + /** + * 抽奖搜索 + * @param array $data + * @param bool $search + * @return \crmeb\basic\BaseModel + * @throws \ReflectionException + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/03/20 + */ + public function search(array $where = [], bool $search = false) { - return parent::search($data)->when(isset($data['id']) && $data['id'], function ($query) use ($data) { - $query->where('id', $data['id']); - })->when(isset($data['start']) && $data['start'] !== '', function ($query) use ($data) { + return parent::search($where, $search)->when(isset($where['id']) && $where['id'], function ($query) use ($where) { + $query->where('id', $where['id']); + })->when(isset($where['start']) && $where['start'] !== '', function ($query) use ($where) { $time = time(); - switch ($data['start']) { + switch ($where['start']) { case 0: $query->where('start_time', '>', $time)->where('status', 1); break; diff --git a/crmeb/app/dao/activity/seckill/StoreSeckillDao.php b/crmeb/app/dao/activity/seckill/StoreSeckillDao.php index 5dd67812c..7034905d1 100644 --- a/crmeb/app/dao/activity/seckill/StoreSeckillDao.php +++ b/crmeb/app/dao/activity/seckill/StoreSeckillDao.php @@ -35,11 +35,13 @@ class StoreSeckillDao extends BaseDao /** * 搜索 * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - protected function search(array $where = []) + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['seckllTime']), function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['seckllTime']), function ($query) use ($where) { [$startTime, $stopTime] = is_array($where['seckllTime']) ? $where['seckllTime'] : [time(), time() - 86400]; $query->where('start_time', '<=', $startTime)->where('stop_time', '>=', $stopTime); })->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) { diff --git a/crmeb/app/dao/article/ArticleDao.php b/crmeb/app/dao/article/ArticleDao.php index 94d8e917f..e77339d70 100644 --- a/crmeb/app/dao/article/ArticleDao.php +++ b/crmeb/app/dao/article/ArticleDao.php @@ -30,9 +30,19 @@ class ArticleDao extends BaseDao return Article::class; } - public function search(array $where = []) + /** + * 文章搜索 + * @param array $where + * @param bool $search + * @return \crmeb\basic\BaseModel + * @throws \ReflectionException + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/03/20 + */ + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['ids']) && count($where['ids']), function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['ids']) && count($where['ids']), function ($query) use ($where) { $query->whereNotIn('id', $where['ids']); }); } diff --git a/crmeb/app/dao/order/OtherOrderDao.php b/crmeb/app/dao/order/OtherOrderDao.php index 60d76d6bd..770eddaf5 100644 --- a/crmeb/app/dao/order/OtherOrderDao.php +++ b/crmeb/app/dao/order/OtherOrderDao.php @@ -38,11 +38,11 @@ class OtherOrderDao extends BaseDao public function getPayUserCount(int $time, string $channel_type = '') { return $this->getModel()->when($channel_type != '', function ($query) use ($channel_type) { - $query->where('channel_type', $channel_type); - })->field('distinct(uid),add_time') - ->group('uid')->having('add_time < ' . $time) - ->order('add_time desc') - ->select()->toArray(); + $query->where('channel_type', $channel_type); + })->field('distinct(uid),add_time') + ->group('uid')->having('add_time < ' . $time) + ->order('add_time desc') + ->select()->toArray(); } /** @@ -161,12 +161,22 @@ class OtherOrderDao extends BaseDao ->page($page, $limit)->select()->toArray(); } - public function search(array $where = []) + /** + * 其他订单搜索 + * @param array $where + * @param bool $search + * @return \crmeb\basic\BaseModel + * @throws \ReflectionException + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/03/20 + */ + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['name']) && $where['name'], function ($query) use($where){ - $query->where('uid', 'in', function ($que) use($where){ + return parent::search($where, $search)->when(isset($where['name']) && $where['name'], function ($query) use ($where) { + $query->where('uid', 'in', function ($que) use ($where) { $nickname = trim($where['name']); - $que->name('user')->where('nickname', 'like', $nickname.'%')->field(['uid'])->select(); + $que->name('user')->where('nickname', 'like', $nickname . '%')->field(['uid'])->select(); }); }); } diff --git a/crmeb/app/dao/order/StoreCartDao.php b/crmeb/app/dao/order/StoreCartDao.php index 9529a1643..5b90e9f40 100644 --- a/crmeb/app/dao/order/StoreCartDao.php +++ b/crmeb/app/dao/order/StoreCartDao.php @@ -45,11 +45,13 @@ class StoreCartDao extends BaseDao /** * 搜索 * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['id']) && $where['id'], function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['id']) && $where['id'], function ($query) use ($where) { $query->whereIn('id', $where['id']); })->when(isset($where['status']), function ($query) use ($where) { //兼容之前老用户 数据库默认值null diff --git a/crmeb/app/dao/order/StoreOrderDao.php b/crmeb/app/dao/order/StoreOrderDao.php index d99febb71..7b375e80d 100644 --- a/crmeb/app/dao/order/StoreOrderDao.php +++ b/crmeb/app/dao/order/StoreOrderDao.php @@ -40,15 +40,17 @@ class StoreOrderDao extends BaseDao /** * 订单搜索 * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { $isDel = isset($where['is_del']) && $where['is_del'] !== '' && $where['is_del'] != -1; $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; - return parent::search($where)->when($isDel, function ($query) use ($where) { + return parent::search($where, $search)->when($isDel, function ($query) use ($where) { $query->where('is_del', $where['is_del']); })->when(isset($where['is_system_del']), function ($query) { $query->where('is_system_del', 0); diff --git a/crmeb/app/dao/order/StoreOrderInvoiceDao.php b/crmeb/app/dao/order/StoreOrderInvoiceDao.php index 75e8080ad..21c80f97b 100644 --- a/crmeb/app/dao/order/StoreOrderInvoiceDao.php +++ b/crmeb/app/dao/order/StoreOrderInvoiceDao.php @@ -33,14 +33,24 @@ class StoreOrderInvoiceDao extends BaseDao return StoreOrderInvoice::class; } - public function search(array $where = []) + /** + * 发票搜索 + * @param array $where + * @param bool $search + * @return \crmeb\basic\BaseModel + * @throws \ReflectionException + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/03/20 + */ + public function search(array $where = [], bool $search = false) { $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; $type = $where['type'] ?? ''; unset($where['type']); - return parent::search($where)->when($type, function ($query) use ($type) { + return parent::search($where, $search)->when($type, function ($query) use ($type) { switch ($type) { case 1://待开 $query->where('is_invoice', 0)->where('invoice_time', 0)->where('is_refund', 0); diff --git a/crmeb/app/dao/order/StoreOrderRefundDao.php b/crmeb/app/dao/order/StoreOrderRefundDao.php index f043e0a94..110d98890 100644 --- a/crmeb/app/dao/order/StoreOrderRefundDao.php +++ b/crmeb/app/dao/order/StoreOrderRefundDao.php @@ -19,14 +19,16 @@ class StoreOrderRefundDao extends BaseDao /** * 搜索器 * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { $realName = $where['real_name'] ?? ''; $fieldKey = $where['field_key'] ?? ''; $fieldKey = $fieldKey == 'all' ? '' : $fieldKey; - return parent::search($where)->when(isset($where['refund_type']) && $where['refund_type'] !== '', function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['refund_type']) && $where['refund_type'] !== '', function ($query) use ($where) { if ($where['refund_type'] == 0) { $query->where('refund_type', '>', 0); } else { diff --git a/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php b/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php index b0142bff3..eca06987f 100644 --- a/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php +++ b/crmeb/app/dao/service/StoreServiceAuxiliaryDao.php @@ -27,9 +27,9 @@ class StoreServiceAuxiliaryDao extends AuxiliaryDao * @param array $where * @return \crmeb\basic\BaseModel|mixed|\think\Model */ - protected function search(array $where = []) + public function search(array $where = [], bool $search = false) { - return parent::search($where)->where('type', 0); + return parent::search($where, $search)->where('type', 0); } } diff --git a/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php b/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php index 7afbffe02..e293c79dc 100644 --- a/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php +++ b/crmeb/app/dao/system/attachment/SystemAttachmentCategoryDao.php @@ -58,11 +58,13 @@ class SystemAttachmentCategoryDao extends BaseDao /** * 搜索附件分类search * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['id']), function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['id']), function ($query) use ($where) { $query->whereIn('id', $where['id']); }); } diff --git a/crmeb/app/dao/system/config/SystemStorageDao.php b/crmeb/app/dao/system/config/SystemStorageDao.php index 0329e566b..606b45780 100644 --- a/crmeb/app/dao/system/config/SystemStorageDao.php +++ b/crmeb/app/dao/system/config/SystemStorageDao.php @@ -64,11 +64,13 @@ class SystemStorageDao extends BaseDao /** * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['type']), function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['type']), function ($query) use ($where) { $query->where('type', $where['type']); })->where('is_delete', 0)->when(isset($where['access_key']), function ($query) use ($where) { $query->where('access_key', $where['access_key']); diff --git a/crmeb/app/dao/user/UserBrokerageFrozenDao.php b/crmeb/app/dao/user/UserBrokerageFrozenDao.php index 4ca41e05b..0d8376ffe 100644 --- a/crmeb/app/dao/user/UserBrokerageFrozenDao.php +++ b/crmeb/app/dao/user/UserBrokerageFrozenDao.php @@ -34,11 +34,13 @@ class UserBrokerageFrozenDao extends BaseDao /** * 搜索 * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|\think\Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['isFrozen']), function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['isFrozen']), function ($query) use ($where) { if ($where['isFrozen']) { $query->where('frozen_time', '>', time()); } else { diff --git a/crmeb/app/dao/wechat/WechatKeyDao.php b/crmeb/app/dao/wechat/WechatKeyDao.php index 33fe3e8e3..1bee525aa 100644 --- a/crmeb/app/dao/wechat/WechatKeyDao.php +++ b/crmeb/app/dao/wechat/WechatKeyDao.php @@ -31,11 +31,13 @@ class WechatKeyDao extends BaseDao /** * 搜索器 * @param array $where + * @param bool $search * @return \crmeb\basic\BaseModel|mixed|Model + * @throws \ReflectionException */ - public function search(array $where = []) + public function search(array $where = [], bool $search = false) { - return parent::search($where)->when(isset($where['id']), function ($query) use ($where) { + return parent::search($where, $search)->when(isset($where['id']), function ($query) use ($where) { $query->where('id', $where['id']); }); } From d4a9167edbdec323ad6276711491c55f40ad7953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Mon, 20 Mar 2023 14:25:38 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BC=98=E5=8C=96search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/dao/BaseDao.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crmeb/app/dao/BaseDao.php b/crmeb/app/dao/BaseDao.php index 919d5e625..d1e69ece7 100644 --- a/crmeb/app/dao/BaseDao.php +++ b/crmeb/app/dao/BaseDao.php @@ -309,7 +309,9 @@ abstract class BaseDao if ($responses->hasMethod($method)) { $with[] = $key; } else { - $otherWhere[] = $value; + if ($key != 'timeKey') { + $otherWhere[] = $value; + } } } return [$with, $otherWhere]; From 3f3453b78432c74b86ba714de733f9ec7e775f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Mon, 20 Mar 2023 14:37:44 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/dao/system/config/SystemConfigDao.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crmeb/app/dao/system/config/SystemConfigDao.php b/crmeb/app/dao/system/config/SystemConfigDao.php index 0f8487d76..3d17b5314 100644 --- a/crmeb/app/dao/system/config/SystemConfigDao.php +++ b/crmeb/app/dao/system/config/SystemConfigDao.php @@ -34,20 +34,23 @@ class SystemConfigDao extends BaseDao * 获取某个系统配置 * @param string $configNmae * @return mixed + * @throws \ReflectionException */ public function getConfigValue(string $configNmae) { - return $this->withSearchSelect(['menu_name'], ['menu_name' => $configNmae])->value('value'); + return $this->search(['menu_name' => $configNmae])->value('value'); } /** * 获取所有配置 + * @param array $configName * @return array + * @throws \ReflectionException */ public function getConfigAll(array $configName = []) { if ($configName) { - return $this->withSearchSelect(['menu_name'], ['menu_name' => $configName])->column('value', 'menu_name'); + return $this->search(['menu_name' => $configName])->column('value', 'menu_name'); } else { return $this->getModel()->column('value', 'menu_name'); }