mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 22:10:49 +00:00
search 优化
This commit is contained in:
parent
f7387c7369
commit
c6f8ef070a
@ -54,7 +54,7 @@ class StoreIntegralDao extends BaseDao
|
||||
*/
|
||||
public function getList(array $where, int $page = 0, int $limit = 0, string $field = '*')
|
||||
{
|
||||
return $this->search($where)->where('is_del', 0)
|
||||
return $this->search($where, false)->where('is_del', 0)
|
||||
->when(isset($where['integral_time']) && $where['integral_time'] !== '', function ($query) use ($where) {
|
||||
list($startTime, $endTime) = explode('-', $where['integral_time']);
|
||||
$query->where('add_time', '>', strtotime($startTime))
|
||||
|
||||
@ -46,7 +46,7 @@ class AgentLevelDao extends BaseDao
|
||||
*/
|
||||
public function getList(array $where = [], string $field = '*', array $with = [], int $page = 0, int $limit = 0, $grade = 0)
|
||||
{
|
||||
return $this->search($where)->when($grade, function ($query) use ($grade) {
|
||||
return $this->search($where, false)->when($grade, function ($query) use ($grade) {
|
||||
$query->where('grade', '>=', $grade);
|
||||
})->field($field)->when($with, function ($query) use ($with) {
|
||||
$query->with($with);
|
||||
|
||||
@ -59,7 +59,7 @@ class StoreOrderStoreOrderStatusDao extends BaseDao
|
||||
* @param array $where
|
||||
* @return \crmeb\basic\BaseModel|mixed|\think\Model
|
||||
*/
|
||||
protected function search(array $where = [])
|
||||
public function search(array $where = [], bool $search = false)
|
||||
{
|
||||
return $this->getModel()->when(isset($where['paid']), function ($query) use ($where) {
|
||||
$query->where($this->alias . '.paid', $where['paid']);
|
||||
|
||||
@ -25,7 +25,9 @@ class StoreServiceAuxiliaryDao extends AuxiliaryDao
|
||||
/**
|
||||
* 搜索
|
||||
* @param array $where
|
||||
* @param bool $search
|
||||
* @return \crmeb\basic\BaseModel|mixed|\think\Model
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function search(array $where = [], bool $search = false)
|
||||
{
|
||||
|
||||
@ -57,7 +57,7 @@ class StoreServiceDao extends BaseDao
|
||||
*/
|
||||
public function getServiceList(array $where, int $page, int $limit)
|
||||
{
|
||||
return $this->search($where)->with('user')->when($page && $limit, function ($query) use ($page, $limit) {
|
||||
return $this->search($where, false)->with('user')->when($page && $limit, function ($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->when(isset($where['noId']), function ($query) use ($where) {
|
||||
$query->whereNotIn('uid', $where['noId']);
|
||||
|
||||
@ -91,6 +91,7 @@ class SystemConfigDao extends BaseDao
|
||||
* 获取上传配置中的上传类型
|
||||
* @param string $configName
|
||||
* @return array
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function getUploadTypeList(string $configName)
|
||||
{
|
||||
|
||||
@ -242,7 +242,7 @@ class UserBillDao 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']);
|
||||
})
|
||||
@ -257,7 +257,7 @@ class UserBillDao 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";
|
||||
|
||||
@ -74,7 +74,7 @@ class UserMoneyDao 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']);
|
||||
})
|
||||
@ -93,7 +93,7 @@ class UserMoneyDao 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']);
|
||||
if ($where['timeKey']['days'] == 1) {
|
||||
|
||||
@ -74,7 +74,7 @@ class WechatReplyKeyDao extends BaseDao
|
||||
* @param bool $group
|
||||
* @return \crmeb\basic\BaseModel|mixed|Model
|
||||
*/
|
||||
protected function search(array $where = [])
|
||||
public function search(array $where = [], bool $search = false)
|
||||
{
|
||||
return $this->getModel()->when(isset($where['key']) && $where['key'], function ($query) use ($where) {
|
||||
$query->where($this->joinAlis . '.keys', 'LIKE', "%$where[key]%");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user