new files

This commit is contained in:
panchengyong
2026-03-07 22:29:07 +08:00
parent cd7e80b502
commit 7acbf45ff7
12516 changed files with 1808447 additions and 194 deletions

View File

@@ -0,0 +1,68 @@
<?php
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\AppVersion;
class AppVersionDao extends BaseDao
{
/**
* 设置模型名
* @return string
*/
protected function setModel(): string
{
return AppVersion::class;
}
/**
* 获取条件模型
* @param $where
* @return \crmeb\basic\BaseModel
* @author wuhaotian
* @email 442384644@qq.com
* @date 2025/7/4
*/
public function getConditionModel($where)
{
return $this->getModel()->when($where['platform'] != '', function ($query) use ($where) {
$query->where('platform', $where['platform']);
});
}
/**
* 版本列表
* @param $where
* @param int $page
* @param int $limit
* @param string $order
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author wuhaotian
* @email 442384644@qq.com
* @date 2025/7/4
*/
public function versionList($where, $page = 0, $limit = 0, $order = 'id desc')
{
return $this->getConditionModel($where)->order('id desc')->when($page != 0, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order($order)->select()->toArray();
}
/**
* 获取版本数量
* @param $where
* @return int
* @throws \think\db\exception\DbException
* @author wuhaotian
* @email 442384644@qq.com
* @date 2025/7/4
*/
public function versionCount($where)
{
return $this->getConditionModel($where)->count();
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\CapitalFlow;
class CapitalFlowDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return CapitalFlow::class;
}
/**
* 资金流水
* @param array $where
* @param string $field
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList(array $where, string $field = '*', int $page = 0, int $limit = 0)
{
return $this->search($where)->field($field)->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order('id desc')->select()->toArray();
}
/**
* 账单记录
* @param $where
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getRecordList($where, $page = 0, $limit = 0)
{
$model = $this->search($where)
->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where) {
$timeUnix = '%d';
switch ($where['type']) {
case "day" :
$timeUnix = "%d";
break;
case "week" :
$timeUnix = "%u";
break;
case "month" :
$timeUnix = "%m";
break;
}
$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,group_concat(id) as ids");
$query->group("FROM_UNIXTIME(add_time, '$timeUnix')");
});
$count = $model->count();
$list = $model->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order('add_time desc')->select()->toArray();
return compact('list', 'count');
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\PrintDocument;
class PrintDocumentDao extends BaseDao
{
protected function setModel(): string
{
return PrintDocument::class;
}
/**
* 条件查询
* @param $where
* @return \crmeb\basic\BaseModel
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function getConditionModel($where)
{
return $this->getModel()->where('is_del', 0)
->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) {
$query->where('print_name', 'like', '%' . $where['keyword'] . '%');
})->when(isset($where['type']) && $where['type'], function ($query) use ($where) {
$query->where('type', $where['type']);
})->when(isset($where['status']) && $where['status'] !== '', function ($query) use ($where) {
$query->where('status', $where['status']);
})->when(isset($where['print_type']) && $where['print_type'] !== '' && $where['print_type'] !== 0, function ($query) use ($where) {
$query->where('print_type', $where['print_type']);
})->when(isset($where['supplier_id']) && $where['supplier_id'] !== '', function ($query) use ($where) {
$query->where('supplier_id', $where['supplier_id']);
});
}
/**
* 获取打印机列表
* @param $where
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function printList($where, $page = 0, $limit = 0)
{
return $this->getConditionModel($where)->order('id desc')->when($page != 0, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->select()->toArray();
}
/**
* 获取打印机数量
* @param $where
* @return int
* @throws \think\db\exception\DbException
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function printCount($where)
{
return $this->getConditionModel($where)->count();
}
}

View File

@@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\SystemMenus;
/**
* 菜单dao层
* Class SystemMenusDao
* @package app\dao\system
*/
class SystemMenusDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemMenus::class;
}
/**
* 获取权限菜单列表
* @param array $where
* @param array|null $field
* @return array|\crmeb\basic\BaseModel[]|\think\Collection
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getMenusRoule(array $where, ?array $field = [])
{
if (!$field) {
$field = ['id', 'menu_name', 'icon', 'pid', 'sort', 'menu_path', 'is_show', 'header', 'is_header', 'is_show_path'];
}
return $this->search($where)->field($field)->order('sort DESC,id DESC')->failException(false)->select();
}
/**
* 获取菜单中的唯一权限
* @param array $where
* @return array
*/
public function getMenusUnique(array $where)
{
return $this->search($where)->where('unique_auth', '<>', '')->column('unique_auth', '');
}
/**
* 根据访问地址获得菜单名
* @param string $rule
* @return mixed
*/
public function getVisitName(string $rule)
{
return $this->search(['url' => $rule])->value('menu_name');
}
/**
* 获取后台菜单列表并分页
* @param array $where
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getMenusList(array $where)
{
$where = array_merge($where, ['is_del' => 0]);
return $this->search($where)->order('sort DESC,id ASC')->select();
}
/**
* 指定条件获取某些菜单的名称以数组形式返回
* @param array $where
* @param string $field
* @param string $key
* @return array
*/
public function column(array $where, string $field, string $key)
{
return $this->search($where)->column($field, $key);
}
/**
* 搜索列表
* @param int $type
* @return array|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getSearchList($type = 1, $keyword = '')
{
return $this->search(['is_show' => 1, 'auth_type' => 1, 'is_del' => 0, 'is_show_path' => 0, 'keywords' => $keyword])->where('type', $type)
->field('id,pid,menu_name,menu_path,unique_auth,sort,path')->order('sort DESC')->select();
}
}

View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\SystemMenusRelevance;
/**
* 菜单关联dao层
* Class SystemMenusDao
* @package app\dao\system
*/
class SystemMenusRelevanceDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemMenusRelevance::class;
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\SystemRecommend;
class SystemRecommendDao extends BaseDao
{
/**
* 设置模型名
* @return string
*/
protected function setModel(): string
{
return SystemRecommend::class;
}
/**
* 获取条件查询模型
* @param array $where 查询条件
* @return \think\Model
*/
public function getConditionModel($where)
{
return $this->getModel();
}
/**
* 获取推荐列表
* @param array $where 查询条件
* @param int $page 页码
* @param int $limit 每页数量
* @param string $field 查询字段
* @param string $order 排序
* @return array
*/
public function recommendList($where, $page = 0, $limit = 0, $field = '*', $order = 'id desc')
{
return $this->getConditionModel($where)->when($page != 0, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->field($field)->order($order)->select()->toArray();
}
/**
* 获取推荐数量
* @param array $where 查询条件
* @return int
*/
public function recommendCount($where)
{
return $this->getConditionModel($where)->count();
}
}

View File

@@ -0,0 +1,57 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\SystemRole;
/**
* Class SystemRoleDao
* @package app\dao\system\admin
*/
class SystemRoleDao extends BaseDao
{
/**
* 设置模型名
* @return string
*/
protected function setModel(): string
{
return SystemRole::class;
}
/**
* 获取权限
* @param string $field
* @param string $key
* @return mixed
*/
public function getRoule(array $where = [], ?string $field = null, ?string $key = null)
{
return $this->search($where)->column($field ?: 'role_name', $key ?: 'id');
}
/**
* 获取身份列表
* @param array $where
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getRouleList(array $where, int $page, int $limit)
{
return $this->search($where)->page($page, $limit)->select()->toArray();
}
}

View File

@@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\SystemSignReward;
/**
* 签到奖励
* Class SystemSignRewardDao
* @package app\dao\system
*/
class SystemSignRewardDao extends BaseDao
{
/**
* 设置模型名
* @return string
*/
protected function setModel(): string
{
return SystemSignReward::class;
}
/**
* 获取列表
* @param array $where
* @param string $field
* @param int $page
* @param int $limit
* @param array $typeWhere
* @return array
*/
public function getList(array $where, string $field = '*', array $with = [], int $page = 0, int $limit = 0)
{
return $this->search($where)->field($field)->when($with, function ($query) use ($with) {
$query->with($with);
})->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order('id desc')->select()->toArray();
}
}

View File

@@ -0,0 +1,51 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system;
use app\dao\BaseDao;
use app\model\system\SystemUserApply;
/**
* Class SystemRoleDao
* @package app\dao\system\admin
*/
class SystemUserApplyDao extends BaseDao
{
/**
* 设置模型名
* @return string
*/
protected function setModel(): string
{
return SystemUserApply::class;
}
/**
* 获取列表
* @param array $where
* @param string $field
* @param int $page
* @param int $limit
* @param array $typeWhere
* @return array
*/
public function getList(array $where, string $field = '*', array $with = [], int $page = 0, int $limit = 0)
{
return $this->search($where)->field($field)->when($with, function ($query) use ($with) {
$query->with($with);
})->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order('id desc')->select()->toArray();
}
}

View File

@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\admin;
use app\dao\BaseDao;
use app\model\system\admin\SystemAdmin;
/**
* admin授权dao
* Class AdminAuthDao
* @package app\dao\system\admin
*/
class AdminAuthDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemAdmin::class;
}
}

View File

@@ -0,0 +1,110 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\admin;
use app\dao\BaseDao;
use app\model\system\admin\SystemAdmin;
/**
* Class SystemAdminDao
* @package app\dao\system\admin
*/
class SystemAdminDao extends BaseDao
{
protected function setModel(): string
{
return SystemAdmin::class;
}
/**
* 获取列表
* @param array $where
* @param int $page
* @param int $limit
* @param string $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList(array $where, int $page = 0, int $limit = 0, string $field = '*')
{
return $this->search($where)->field($field)->when($page && $limit, function ($query) use($page, $limit) {
$query->page($page, $limit);
})->select()->toArray();
}
/**
* 用管理员名查找管理员信息
* @param string $account
* @param int $adminType
* @return array|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function accountByAdmin(string $account, int $adminType)
{
return $this->search(['account' => $account, 'is_del' => 0, 'status' => 1, 'admin_type' => $adminType])->find();
}
/**
* 用电话查找管理员信息
* @param string $phone
* @param int $adminType
* @return array|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function phoneByAdmin(string $phone, int $adminType = 1)
{
return $this->search(['phone' => $phone, 'is_del' => 0, 'status' => 1, 'admin_type' => $adminType])->find();
}
/**
* 当前账号是否可用
* @param string $account
* @param int $id
* @param int $admin_type
* @return int
* @throws \think\db\exception\DbException
*/
public function isAccountUsable(string $account, int $id, int $admin_type = 1)
{
return $this->search(['account' => $account, 'is_del' => 0])->where('admin_type', $admin_type)->where('id', '<>', $id)->count();
}
/**
* 获取adminid
* @param int $level
* @return array
*/
public function getAdminIds(int $level)
{
return $this->getModel()->where('level', '>=', $level)->column('id', 'id');
}
/**
* 获取低于等级的管理员名称和id
* @param string $field
* @param int $level
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getOrdAdmin(string $field = 'real_name,id', int $level = 0)
{
return $this->getModel()->where('level', '>=', $level)->field($field)->select()->toArray();
}
}

View File

@@ -0,0 +1,72 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\dao\system\attachment;
use app\dao\BaseDao;
use app\model\system\attachment\SystemAttachmentCategory;
use crmeb\basic\BaseModel;
/**
*
* Class SystemAttachmentCategoryDao
* @package app\dao\attachment
*/
class SystemAttachmentCategoryDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemAttachmentCategory::class;
}
/**
* 获取列表
* @param array $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList(array $where)
{
return $this->search($where)->select()->toArray();
}
/**
* 获取数量
* @param array $where
* @return int
*/
public function getCount(array $where): int
{
return $this->search($where)->count();
}
/**
* 搜索附件分类search
* @param array $where
* @param bool $search
* @return BaseModel
* @throws \ReflectionException
*/
public function search(array $where = [], bool $search = false)
{
return parent::search($where, $search)->when(isset($where['id']), function ($query) use ($where) {
$query->whereIn('id', $where['id']);
});
}
}

View File

@@ -0,0 +1,113 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\dao\system\attachment;
use app\dao\BaseDao;
use app\model\system\attachment\SystemAttachment;
/**
*
* Class SystemAttachmentDao
* @package app\dao\attachment
*/
class SystemAttachmentDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemAttachment::class;
}
/**
* 获取图片列表
* @param array $where
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList(array $where, int $page, int $limit)
{
return $this->search($where)->where('module_type', 1)->page($page, $limit)->order('att_id DESC')->select()->toArray();
}
/**
* 获取扫码上传的图片数据
* @param $scan_token
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function scanUploadImage($scan_token)
{
return $this->getModel()->where('scan_token', $scan_token)->field('att_dir,att_id')->select()->toArray();
}
/**
* 移动图片
* @param array $data
* @return \crmeb\basic\BaseModel
*/
public function move(array $data)
{
return $this->getModel()->whereIn('att_id', $data['images'])->update(['pid' => $data['pid']]);
}
/**
* 获取名称
* @param array $where
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getLikeNameList(array $where, int $page, int $limit)
{
return $this->search($where)->page($page, $limit)->order('att_id desc')->select()->toArray();
}
/**
* 获取昨日系统生成
* @param int $type
* @param int $relationId
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getYesterday(int $type = 1, $relationId = 0)
{
return $this->getModel()->where('type', $type)->when($relationId, function ($query) use ($relationId) {
$query->where('relation_id', $relationId);
})->whereTime('time', 'yesterday')->where('module_type', 2)->field(['name', 'att_dir', 'att_id', 'image_type'])->select();
}
/**
* 删除昨日生成海报
* @throws \Exception
*/
public function delYesterday()
{
$this->getModel()->whereTime('time', 'yesterday')->where('module_type', 2)->delete();
}
}

View File

@@ -0,0 +1,144 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\config;
use app\dao\BaseDao;
use app\model\system\config\SystemConfig;
/**
* 系统配置
* Class SystemConfigDao
* @package app\dao\system\config
*/
class SystemConfigDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemConfig::class;
}
/**
* 获取某个系统配置
* @param string $configNmae
* @param int $storeId
* @return mixed
*/
public function getConfigValue(string $configNmae, int $storeId = 0)
{
return $this->search(['menu_name' => $configNmae, 'store_id' => $storeId])->value('value');
}
/**
* 获取所有配置
* @param array $configName
* @param int $storeId
* @return array
*/
public function getConfigAll(array $configName = [], int $storeId = 0)
{
if ($configName) {
return $this->search(['menu_name' => $configName, 'store_id' => $storeId])->column('value', 'menu_name');
} else {
return $this->getModel()->column('value', 'menu_name');
}
}
/**
* @param array $configName
* @param int $storeId
* @param array $field
* @return array
* @throws \ReflectionException
*/
public function getConfigAllField(array $configName = [], int $storeId = 0, array $field = [])
{
return $this->search(['menu_name' => $configName, 'store_id' => $storeId])->column(implode(',', $field), 'menu_name');
}
/**
* 获取配置列表分页
* @param array $where
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getConfigList(array $where, int $page, int $limit)
{
return $this->search($where)->page($page, $limit)->order('sort desc,id desc')->select()->toArray();
}
/**
* 获取某些分类配置下的配置列表
* @param int $tabId
* @param int $status
* @param int $store_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getConfigTabAllList(int $tabId, int $status = 1, int $type = 1, int $relation_id = 0)
{
$where['tab_id'] = $tabId;
if ($status == 1) $where['status'] = $status;
if ($relation_id != 0) $where['is_store'] = 1;
return $this->search($where)
->when(isset($relation_id) && $relation_id != 0, function ($query) use ($type, $relation_id) {
$query->with(['storeConfig' => function ($querys) use ($type, $relation_id) {
$querys->where('type', $type)->where('relation_id', $relation_id);
}]);
})
->order('sort desc')->select()->toArray();
}
/**
* 根据条件获取配置
* @param array $where
* @param int $type
* @param int $relation_id
* @param array $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getConfigAllListByWhere(array $where, int $type = 1, int $relation_id = 0, array $field = ['*'])
{
if ($relation_id != 0) $where['is_store'] = 1;
return $this->search($where)->field($field)
->when(isset($relation_id) && $relation_id != 0, function ($query) use ($type, $relation_id) {
$query->with(['storeConfig' => function ($querys) use ($type, $relation_id) {
$querys->where('type', $type)->where('relation_id', $relation_id);
}]);
})
->order('sort desc')->select()->toArray();
}
/**
* 获取上传配置中的上传类型
* @param string $configName
* @return array
*/
public function getUploadTypeList(string $configName)
{
return $this->search(['menu_name' => $configName])->column('upload_type', 'type');
}
}

View File

@@ -0,0 +1,66 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\config;
use app\dao\BaseDao;
use app\model\system\config\SystemConfigTab;
/**
* 配置分类
* Class SystemConfigTabDao
* @package app\dao\system\config
*/
class SystemConfigTabDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemConfigTab::class;
}
/**
* 获取配置分类
* @param array $searchWhere
* @param array $field
* @param array $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getConfigTabAll(array $searchWhere, array $field = ['*'], array $where = [])
{
return $this->search($searchWhere)->when(count($where), function ($query) use ($where) {
$query->where($where);
})->field($field)->order('sort desc,id asc')->select()->toArray();
}
/**
* 配置分类列表
* @param array $where
* @param int $page
* @param int $limit
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getConfgTabList(array $where, int $page, int $limit)
{
return $this->search($where)->order('sort desc,id asc')->page($page, $limit)->select();
}
}

View File

@@ -0,0 +1,58 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\config;
use app\dao\BaseDao;
use app\model\system\config\SystemGroup;
/**
* Class SystemGroupDao
* @package app\dao\system\config
*/
class SystemGroupDao extends BaseDao
{
/**
* @return string
*/
protected function setModel(): string
{
return SystemGroup::class;
}
/**
* 获取组合数据分页列表
* @param array $where
* @param array $field
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getGroupList(array $where, array $field = ['*'], int $page = 0, int $limit = 0)
{
return $this->search($where)->field($field)->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->select()->toArray();
}
/**
* 根据配置名称获取配置id
* @param string $configName
* @return mixed
*/
public function getConfigNameId(string $configName)
{
return $this->value(['config_name' => $configName]);
}
}

View File

@@ -0,0 +1,99 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\config;
use app\dao\BaseDao;
use app\model\system\config\SystemGroupData;
/**
* 组合数据
* Class SystemGroupDataDao
* @package app\dao\system\config
*/
class SystemGroupDataDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemGroupData::class;
}
/**
* 获取组合数据列表
* @param array $where
* @param int $page
* @param int $limit
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getGroupDataList(array $where, int $page, int $limit)
{
return $this->search($where)->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order('sort desc,id DESC')->select()->toArray();
}
/**
* 获取某个gid下的组合数据
* @param int $gid
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getGroupDate(int $gid, int $limit = 0)
{
return $this->search(['gid' => $gid, 'status' => 1])->when($limit, function ($query) use ($limit) {
$query->limit($limit);
})->field('value,id')->order('sort DESC,id DESC')->select()->toArray();
}
/**
* 根据gid删除组合数据
* @param int $gid
* @return bool
*/
public function delGroupDate(int $gid)
{
return $this->getModel()->where('gid', $gid)->delete();
}
/**
* 批量保存
* @param array $data
* @return mixed|\think\Collection
* @throws \Exception
*/
public function saveAll(array $data)
{
return $this->getModel()->saveAll($data);
}
/**
* 根据id获取秒杀数据
* @param array $ids
* @param string $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function idByGroupList(array $ids, string $field)
{
return $this->getModel()->whereIn('id', $ids)->field($field)->select()->toArray();
}
}

View File

@@ -0,0 +1,78 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\config;
use app\dao\BaseDao;
use app\model\system\config\SystemStorage;
use crmeb\basic\BaseModel;
use crmeb\traits\SearchDaoTrait;
/**
* Class SystemStorageDao
* @package app\dao\system\config
*/
class SystemStorageDao extends BaseDao
{
use SearchDaoTrait;
/**
* @return string
*/
protected function setModel(): string
{
return SystemStorage::class;
}
/**
* 获取分页列表
* @param array $where
* @param array $field
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getStorageList(array $where, array $field = ['*'], int $page = 0, int $limit = 0)
{
return $this->search($where)->field($field)->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order('add_time desc')->select()->toArray();
}
/**
* @param array $where
* @return int
*/
public function getCount(array $where): int
{
return $this->search($where)->count();
}
/**
* @param array $where
* @param bool $search
* @return BaseModel
* @throws \ReflectionException
*/
public function search(array $where = [], bool $search = false)
{
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']);
});
}
}

View File

@@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\dao\system\form;
use app\dao\BaseDao;
use app\model\system\form\SystemForm;
/**
*
* Class SystemFormDao
* @package app\dao\system\form
*/
class SystemFormDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemForm::class;
}
/**
* 获取系统表单
* @param array $where
* @param array $field
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getFormList(array $where, array $field = ['*'], int $page = 0, int $limit = 0)
{
return $this->search($where)->field($field)->where('is_del', 0)
->when($page && $limit, function($query) use ($page, $limit){$query->page($page, $limit);
})->order('id desc')->select()->toArray();
}
}

View File

@@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\dao\system\form;
use app\dao\BaseDao;
use app\model\system\form\SystemFormData;
/**
*
* Class SystemFormDataDao
* @package app\dao\system\form
*/
class SystemFormDataDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemFormData::class;
}
/**
* 获取表单数据
* @param array $where
* @param array $field
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList(array $where, array $field = ['*'], int $page = 0, int $limit = 0, array $with = [])
{
return $this->search($where)->field($field)
->when($with, function ($query) use ($with) {
$query->with($with);
})->when($page && $limit, function($query) use ($page, $limit){
$query->page($page, $limit);
})->order('id desc')->select()->toArray();
}
}

View File

@@ -0,0 +1,46 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\log;
use app\dao\BaseDao;
use app\model\system\log\SystemFile;
/**
* 文件校验模型
* Class SystemFileDao
* @package app\dao\system\log
*/
class SystemFileDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemFile::class;
}
/**
* 获取全部
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getAll()
{
return $this->getModel()->order('atime desc')->select()->toArray();
}
}

View File

@@ -0,0 +1,58 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\log;
use app\dao\BaseDao;
use app\model\system\log\SystemLog;
/**
* 系统日志
* Class SystemLogDao
* @package app\dao\system\log
*/
class SystemLogDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemLog::class;
}
/**
* 删除过期日志
* @throws \Exception
*/
public function deleteLog()
{
$this->getModel()->where('add_time', '<', time() - 7776000)->delete();
}
/**
* 获取系统日志列表
* @param array $where
* @param int $page
* @param int $limit
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getLogList(array $where, int $page, int $limit)
{
return $this->search($where)->page($page, $limit)->order('add_time DESC')->select()->toArray();
}
}

View File

@@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\dao\system\timer;
use app\dao\BaseDao;
use app\model\system\timer\SystemTimer;
/**
* Class SystemTimerDao
* @package app\dao\system\timer
*/
class SystemTimerDao extends BaseDao
{
protected function setModel(): string
{
return SystemTimer::class;
}
/**
* 获取列表
* @param array $where
* @param int $page
* @param int $limit
* @param string $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList(array $where, int $page = 0, int $limit = 0, string $field = '*')
{
return $this->search($where)->field($field)->when($page && $limit, function ($query) use($page, $limit) {
$query->page($page, $limit);
})->select()->toArray();
}
}