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); } diff --git a/crmeb/app/dao/BaseDao.php b/crmeb/app/dao/BaseDao.php index 7061af2b0..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]; @@ -324,25 +326,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/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'); } 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']); }); }