mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 14:31:04 +00:00
Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev
This commit is contained in:
commit
d4e3744e11
@ -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',
|
||||
];
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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']);
|
||||
});
|
||||
}
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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']);
|
||||
});
|
||||
}
|
||||
|
||||
@ -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');
|
||||
}
|
||||
|
||||
@ -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']);
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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']);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user