From f7387c7369f2775565518e1c50c539d2479d20de 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 15:53:58 +0800 Subject: [PATCH] =?UTF-8?q?search=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/dao/activity/advance/StoreAdvanceDao.php | 11 ++++++++--- crmeb/app/dao/activity/bargain/StoreBargainDao.php | 8 ++++---- .../dao/activity/combination/StoreCombinationDao.php | 3 +++ crmeb/app/dao/activity/combination/StorePinkDao.php | 2 +- crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php | 2 -- crmeb/app/dao/activity/coupon/StoreCouponUserDao.php | 6 +++--- crmeb/app/dao/activity/live/LiveGoodsDao.php | 2 ++ crmeb/app/dao/order/DeliveryServiceDao.php | 2 +- crmeb/app/dao/product/product/StoreProductDao.php | 4 ++-- crmeb/app/dao/system/statistics/CapitalFlowDao.php | 2 +- crmeb/app/dao/user/UserExtractDao.php | 4 ++-- crmeb/app/dao/user/UserRechargeDao.php | 4 ++-- .../product/product/StoreProductRelationServices.php | 2 +- 13 files changed, 30 insertions(+), 22 deletions(-) diff --git a/crmeb/app/dao/activity/advance/StoreAdvanceDao.php b/crmeb/app/dao/activity/advance/StoreAdvanceDao.php index 5690c3038..cf62743a7 100644 --- a/crmeb/app/dao/activity/advance/StoreAdvanceDao.php +++ b/crmeb/app/dao/activity/advance/StoreAdvanceDao.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -declare (strict_types = 1); +declare (strict_types=1); namespace app\dao\activity\advance; @@ -37,13 +37,17 @@ class StoreAdvanceDao extends BaseDao * @param int $page * @param int $limit * @return array + * @throws \ReflectionException * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/03/20 */ public function getList(array $where, int $page = 0, int $limit = 0) { - return $this->search($where) + return $this->search($where, false) ->when($where['time_type'], function ($query) use ($where) { if ($where['time_type'] == 1) $query->whereTime('start_time', '>', time()); if ($where['time_type'] == 2) $query->whereTime('start_time', '<=', time())->whereTime('stop_time', '>=', time()); @@ -57,10 +61,11 @@ class StoreAdvanceDao extends BaseDao /** * @param array $where * @return int + * @throws \ReflectionException */ public function getCount(array $where) { - return $this->search($where) + return $this->search($where, false) ->when($where['time_type'], function ($query) use ($where) { if ($where['time_type'] == 1) $query->whereTime('start_time', '>', time()); if ($where['time_type'] == 2) $query->whereTime('start_time', '<=', time())->whereTime('stop_time', '>=', time()); diff --git a/crmeb/app/dao/activity/bargain/StoreBargainDao.php b/crmeb/app/dao/activity/bargain/StoreBargainDao.php index 1ab005015..02165ead2 100644 --- a/crmeb/app/dao/activity/bargain/StoreBargainDao.php +++ b/crmeb/app/dao/activity/bargain/StoreBargainDao.php @@ -44,7 +44,7 @@ class StoreBargainDao extends BaseDao */ public function getList(array $where, int $page = 0, int $limit = 0) { - return $this->search($where)->where('is_del', 0) + return $this->search($where, false)->where('is_del', 0) ->when(isset($where['start_status']) && $where['start_status'] !== '', function ($query) use ($where) { $time = time(); switch ($where['start_status']) { @@ -135,7 +135,7 @@ class StoreBargainDao extends BaseDao */ public function DiyBargainList(array $where, int $page, int $limit) { - return $this->search($where) + return $this->search($where, false) ->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) { $query->whereIn('id', function ($query) use ($where) { $query->name('store_product_cate')->where('cate_id', $where['sid'])->field('product_id')->select(); @@ -165,7 +165,7 @@ class StoreBargainDao extends BaseDao */ public function getHomeList(array $where, int $page, int $limit) { - return $this->search($where) + return $this->search($where, false) ->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) { $query->whereIn('id', function ($query) use ($where) { $query->name('store_product_cate')->where('cate_id', $where['sid'])->field('product_id')->select(); @@ -215,7 +215,7 @@ class StoreBargainDao extends BaseDao */ public function getCount(array $where) { - return $this->search($where) + return $this->search($where, false) ->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) { $query->whereIn('product_id', function ($query) use ($where) { $query->name('store_product_cate')->where('cate_id', $where['sid'])->field('product_id')->select(); diff --git a/crmeb/app/dao/activity/combination/StoreCombinationDao.php b/crmeb/app/dao/activity/combination/StoreCombinationDao.php index 93cbad977..ef78215ce 100644 --- a/crmeb/app/dao/activity/combination/StoreCombinationDao.php +++ b/crmeb/app/dao/activity/combination/StoreCombinationDao.php @@ -66,6 +66,7 @@ class StoreCombinationDao extends BaseDao * 获取指定条件下的条数 * @param array $where * @return int + * @throws \ReflectionException */ public function count(array $where = []): int { @@ -147,6 +148,7 @@ class StoreCombinationDao extends BaseDao * @param array $ids ids 为空返回所有 * @param array $field * @return array + * @throws \ReflectionException */ public function getPinkIdsArray(array $ids = [], array $field = []) { @@ -172,6 +174,7 @@ class StoreCombinationDao extends BaseDao * 条件获取数量 * @param array $where * @return int + * @throws \ReflectionException */ public function getCount(array $where) { diff --git a/crmeb/app/dao/activity/combination/StorePinkDao.php b/crmeb/app/dao/activity/combination/StorePinkDao.php index d6b18ffca..5fba71984 100644 --- a/crmeb/app/dao/activity/combination/StorePinkDao.php +++ b/crmeb/app/dao/activity/combination/StorePinkDao.php @@ -54,7 +54,7 @@ class StorePinkDao extends BaseDao */ public function getList(array $where, int $page = 0, int $limit = 0) { - return $this->search($where)->when($where['k_id'] != 0, function ($query) use ($where) { + return $this->search($where, false)->when($where['k_id'] != 0, function ($query) use ($where) { $query->whereOr('id', $where['k_id']); })->with('getProduct')->when($page != 0, function ($query) use ($page, $limit) { $query->page($page, $limit); diff --git a/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php b/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php index f33313e1f..dd06cd2e0 100644 --- a/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php +++ b/crmeb/app/dao/activity/coupon/StoreCouponIssueDao.php @@ -308,13 +308,11 @@ class StoreCouponIssueDao extends BaseDao */ public function getTodayCoupon($uid) { -// return $this->getModel()->where('receive_type', 1)->where('is_del', 0)->whereDay('add_time')->select()->toArray(); return $this->getModel()->where('status', 1) ->where('is_del', 0) ->where('remain_count > 0 OR is_permanent = 1') ->where(function ($query) { $query->where('receive_type', 1)->whereOr('receive_type', 4); -// $query->where('receive_type', 1); })->where(function ($query) { $query->where(function ($query) { $query->where('start_time', '<', time())->where('end_time', '>', time()); diff --git a/crmeb/app/dao/activity/coupon/StoreCouponUserDao.php b/crmeb/app/dao/activity/coupon/StoreCouponUserDao.php index e2dadfe89..d1d291a5d 100644 --- a/crmeb/app/dao/activity/coupon/StoreCouponUserDao.php +++ b/crmeb/app/dao/activity/coupon/StoreCouponUserDao.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -declare (strict_types = 1); +declare (strict_types=1); namespace app\dao\activity\coupon; @@ -145,7 +145,7 @@ class StoreCouponUserDao extends BaseDao */ public function getCouponListByOrder(array $where, $order, int $page = 0, int $limit = 0) { - return $this->search($where)->with('issue')->when($page > 0 && $limit > 0, function ($qeury) use ($page, $limit) { + return $this->search($where, false)->with('issue')->when($page > 0 && $limit > 0, function ($qeury) use ($page, $limit) { $qeury->page($page, $limit); })->when($order != '', function ($query) use ($order) { $query->order($order); @@ -172,7 +172,7 @@ class StoreCouponUserDao extends BaseDao */ public function memberCouponUserGroupBymonth(array $where) { - return $this->search($where) + return $this->search($where, false) ->whereMonth('add_time') ->whereIn('cid', $where['couponIds']) ->field('count(id) as num,FROM_UNIXTIME(add_time, \'%Y-%m\') as time') diff --git a/crmeb/app/dao/activity/live/LiveGoodsDao.php b/crmeb/app/dao/activity/live/LiveGoodsDao.php index 5e5d76af5..23d99646c 100644 --- a/crmeb/app/dao/activity/live/LiveGoodsDao.php +++ b/crmeb/app/dao/activity/live/LiveGoodsDao.php @@ -31,9 +31,11 @@ class LiveGoodsDao extends BaseDao /** * @param array $where * @param string $field + * @param array $with * @param int $page * @param int $limit * @return array + * @throws \ReflectionException * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException diff --git a/crmeb/app/dao/order/DeliveryServiceDao.php b/crmeb/app/dao/order/DeliveryServiceDao.php index e7f839d15..5050a60ea 100644 --- a/crmeb/app/dao/order/DeliveryServiceDao.php +++ b/crmeb/app/dao/order/DeliveryServiceDao.php @@ -41,7 +41,7 @@ class DeliveryServiceDao extends BaseDao */ public function getServiceList(array $where, int $page, int $limit) { - return $this->search($where)->when($page && $limit, function ($query) use ($page, $limit) { + return $this->search($where, false)->when($page && $limit, function ($query) use ($page, $limit) { $query->page($page, $limit); })->when(isset($where['noId']), function ($query) use ($where) { $query->where('id', '<>', $where['noId']); diff --git a/crmeb/app/dao/product/product/StoreProductDao.php b/crmeb/app/dao/product/product/StoreProductDao.php index 1ea673faf..0048a885d 100644 --- a/crmeb/app/dao/product/product/StoreProductDao.php +++ b/crmeb/app/dao/product/product/StoreProductDao.php @@ -39,7 +39,7 @@ class StoreProductDao extends BaseDao */ public function getCount(array $where) { - return $this->search($where)->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) { + return $this->search($where, false)->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) { $query->whereIn('id', function ($query) use ($where) { $query->name('store_product_cate')->where('cate_id', $where['sid'])->field('product_id')->select(); }); @@ -112,7 +112,7 @@ class StoreProductDao extends BaseDao public function getSearchList(array $where, int $page = 0, int $limit = 0, array $field = ['*'], array $with = ['couponId', 'description']) { if (isset($where['star'])) $with[] = 'star'; - return $this->search($where)->with($with)->when($page != 0 && $limit != 0, function ($query) use ($page, $limit) { + return $this->search($where, false)->with($with)->when($page != 0 && $limit != 0, function ($query) use ($page, $limit) { $query->page($page, $limit); })->when(isset($where['sid']) && $where['sid'], function ($query) use ($where) { $query->whereIn('id', function ($query) use ($where) { diff --git a/crmeb/app/dao/system/statistics/CapitalFlowDao.php b/crmeb/app/dao/system/statistics/CapitalFlowDao.php index 629b9cfb6..0d6de0cd4 100644 --- a/crmeb/app/dao/system/statistics/CapitalFlowDao.php +++ b/crmeb/app/dao/system/statistics/CapitalFlowDao.php @@ -66,7 +66,7 @@ class CapitalFlowDao extends BaseDao $timeUnix = "%Y-%m"; break; } - $model = $this->search($where) + $model = $this->search($where, false) ->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where, $timeUnix) { $query->field("FROM_UNIXTIME(add_time,'$timeUnix') as day,sum(if(price >= 0,price,0)) as income_price,sum(if(price < 0,price,0)) as exp_price,add_time"); $query->group("FROM_UNIXTIME(add_time, '$timeUnix')"); diff --git a/crmeb/app/dao/user/UserExtractDao.php b/crmeb/app/dao/user/UserExtractDao.php index efce1bfac..2bb55cb40 100644 --- a/crmeb/app/dao/user/UserExtractDao.php +++ b/crmeb/app/dao/user/UserExtractDao.php @@ -81,7 +81,7 @@ class UserExtractDao extends BaseDao */ public function getWhereSumField(array $where, string $field) { - return $this->search($where) + return $this->search($where, false) ->when(isset($where['timeKey']), function ($query) use ($where) { $query->whereBetweenTime('add_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']); }) @@ -96,7 +96,7 @@ class UserExtractDao extends BaseDao */ public function getGroupField(array $where, string $field, string $group) { - return $this->search($where) + return $this->search($where, false) ->when(isset($where['timeKey']), function ($query) use ($where, $field, $group) { $query->whereBetweenTime('add_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']); $timeUinx = "%H"; diff --git a/crmeb/app/dao/user/UserRechargeDao.php b/crmeb/app/dao/user/UserRechargeDao.php index 06837dae4..e7446da85 100644 --- a/crmeb/app/dao/user/UserRechargeDao.php +++ b/crmeb/app/dao/user/UserRechargeDao.php @@ -57,7 +57,7 @@ class UserRechargeDao extends BaseDao */ public function getWhereSumField(array $where, string $field) { - return $this->search($where) + return $this->search($where, false) ->when(isset($where['timeKey']), function ($query) use ($where) { $query->whereBetweenTime('pay_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']); }) @@ -72,7 +72,7 @@ class UserRechargeDao extends BaseDao */ public function getGroupField(array $where, string $field, string $group) { - return $this->search($where) + return $this->search($where, false) ->when(isset($where['timeKey']), function ($query) use ($where, $field, $group) { $query->whereBetweenTime('pay_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']); $timeUinx = "%H"; diff --git a/crmeb/app/services/product/product/StoreProductRelationServices.php b/crmeb/app/services/product/product/StoreProductRelationServices.php index 05bc023c8..13cec3782 100644 --- a/crmeb/app/services/product/product/StoreProductRelationServices.php +++ b/crmeb/app/services/product/product/StoreProductRelationServices.php @@ -57,7 +57,7 @@ class StoreProductRelationServices extends BaseServices */ public function getUserCollectCount(int $uid) { - return $this->dao->count(['uid' => $uid, 'tye' => 'collect']); + return $this->dao->count(['uid' => $uid, 'type' => 'collect']); } /**