no message
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\lists;
|
||||
|
||||
|
||||
use app\common\lists\BaseDataLists;
|
||||
|
||||
/**
|
||||
* 管理员模块数据列表基类
|
||||
* Class BaseAdminDataLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
abstract class BaseAdminDataLists extends BaseDataLists
|
||||
{
|
||||
protected array $adminInfo;
|
||||
protected int $adminId;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->adminInfo = $this->request->adminInfo;
|
||||
$this->adminId = $this->request->adminId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\ai;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\ai\AiAnalysis;
|
||||
|
||||
class AiAnalysisLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['type', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = AiAnalysis::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['create_time'] = is_numeric($item['create_time']) ? date('Y-m-d H:i:s', $item['create_time']) : $item['create_time'];
|
||||
$item['expire_time'] = !empty($item['expire_time']) && is_numeric($item['expire_time']) ? date('Y-m-d H:i:s', $item['expire_time']) : $item['expire_time'];
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return AiAnalysis::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\ai;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\ai\AiConfig;
|
||||
|
||||
class AiConfigLists extends BaseAdminDataLists
|
||||
{
|
||||
public function lists(): array
|
||||
{
|
||||
return AiConfig::limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'asc')
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return AiConfig::count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\ai;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\ai\AiLog;
|
||||
|
||||
class AiLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['type', 'status', 'user_id'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = AiLog::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['create_time'] = !empty($item['create_time']) && is_numeric($item['create_time']) ? date('Y-m-d H:i:s', $item['create_time']) : ($item['create_time'] ?: '-');
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return AiLog::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\ai;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\ai\AiConfig;
|
||||
|
||||
class KbConfigLists extends BaseAdminDataLists
|
||||
{
|
||||
public function lists(): array
|
||||
{
|
||||
return AiConfig::where(function ($query) {
|
||||
$query->whereLike('name', 'embedding_%')
|
||||
->whereOrLike('name', 'kb_%')
|
||||
->whereOrLike('name', 'qwen_%')
|
||||
->whereOrLike('name', 'openai_%')
|
||||
->whereOrLike('name', 'mtranserver_%')
|
||||
->whereOrLike('name', 'assistant_%')
|
||||
->whereOr('name', '=', 'post_analysis_prompt');
|
||||
})->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'asc')
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return AiConfig::where(function ($query) {
|
||||
$query->whereLike('name', 'embedding_%')
|
||||
->whereOrLike('name', 'kb_%')
|
||||
->whereOrLike('name', 'qwen_%')
|
||||
->whereOrLike('name', 'openai_%')
|
||||
->whereOrLike('name', 'mtranserver_%')
|
||||
->whereOrLike('name', 'assistant_%')
|
||||
->whereOr('name', '=', 'post_analysis_prompt');
|
||||
})->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\ai;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\ai\AiKbDocument;
|
||||
|
||||
class KbDocumentLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['domain', 'subtype', 'is_active'],
|
||||
'%like%' => ['title', 'keywords'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = AiKbDocument::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['source_updated_at_text'] = !empty($item['source_updated_at']) ? date('Y-m-d H:i:s', (int) $item['source_updated_at']) : '-';
|
||||
$item['update_time_text'] = !empty($item['update_time']) ? date('Y-m-d H:i:s', (int) $item['update_time']) : '-';
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return AiKbDocument::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\ai;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\ai\AiKbQueryLog;
|
||||
|
||||
class KbQueryLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['scene', 'status', 'user_id'],
|
||||
'%like%' => ['query_text'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = AiKbQueryLog::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['create_time_text'] = !empty($item['create_time']) ? date('Y-m-d H:i:s', (int) $item['create_time']) : '-';
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return AiKbQueryLog::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\ai;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\ai\AiKbSyncJob;
|
||||
|
||||
class KbSyncJobLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['domain', 'subtype', 'action', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = AiKbSyncJob::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['scheduled_at_text'] = !empty($item['scheduled_at']) ? date('Y-m-d H:i:s', (int) $item['scheduled_at']) : '-';
|
||||
$item['processed_at_text'] = !empty($item['processed_at']) ? date('Y-m-d H:i:s', (int) $item['processed_at']) : '-';
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return AiKbSyncJob::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\app;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\app\AppVersion;
|
||||
|
||||
/**
|
||||
* APP 版本列表
|
||||
* Class AppVersionLists
|
||||
* @package app\adminapi\lists\app
|
||||
*/
|
||||
class AppVersionLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['version_name', 'title'],
|
||||
'=' => ['platform', 'package_type', 'update_type', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
return AppVersion::where($this->searchWhere)
|
||||
->append(['platform_text', 'package_type_text', 'update_type_text'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return AppVersion::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\article;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\article\ArticleAiCommentTask;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class ArticleAiCommentTaskLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['article_id', 'status'],
|
||||
'%like%' => [],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = ArticleAiCommentTask::where($this->searchWhere)
|
||||
->whereNull('delete_time')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$userIds = array_unique(array_column($lists, 'virtual_user_id'));
|
||||
$users = [];
|
||||
if (!empty($userIds)) {
|
||||
$users = User::whereIn('id', $userIds)->column('nickname', 'id');
|
||||
}
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['virtual_nickname'] = $users[$item['virtual_user_id']] ?? '-';
|
||||
$item['create_time_text'] = is_numeric($item['create_time']) ? date('Y-m-d H:i:s', $item['create_time']) : $item['create_time'];
|
||||
$item['run_at_text'] = is_numeric($item['run_at']) ? date('Y-m-d H:i:s', $item['run_at']) : $item['run_at'];
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return ArticleAiCommentTask::where($this->searchWhere)
|
||||
->whereNull('delete_time')
|
||||
->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\article;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsSortInterface;
|
||||
use app\common\model\article\ArticleCate;
|
||||
|
||||
/**
|
||||
* 资讯分类列表
|
||||
* Class ArticleCateLists
|
||||
* @package app\adminapi\lists\article
|
||||
*/
|
||||
class ArticleCateLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/8 18:39
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置支持排序字段
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:11
|
||||
*/
|
||||
public function setSortFields(): array
|
||||
{
|
||||
return ['create_time' => 'create_time', 'id' => 'id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置默认排序
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:08
|
||||
*/
|
||||
public function setDefaultOrder(): array
|
||||
{
|
||||
return ['sort' => 'desc', 'id' => 'desc'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取管理列表
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:11
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = ArticleCate::where($this->searchWhere)
|
||||
->append(['is_show_desc', 'article_count'])
|
||||
->order($this->sortOrder)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$pid = 0;
|
||||
if (!empty($lists)) {
|
||||
$pid = min(array_column($lists, 'pid'));
|
||||
}
|
||||
return self::getTree($lists, $pid);
|
||||
}
|
||||
|
||||
public static function getTree($array, $pid = 0)
|
||||
{
|
||||
$list = [];
|
||||
foreach ($array as $item) {
|
||||
if ($item['pid'] == $pid) {
|
||||
$item['children'] = self::getTree($array, $item['id']);
|
||||
$list[] = $item;
|
||||
}
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:12
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ArticleCate::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function extend()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\article;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsSortInterface;
|
||||
use app\common\model\article\Article;
|
||||
|
||||
/**
|
||||
* 资讯列表
|
||||
* Class ArticleLists
|
||||
* @package app\adminapi\lists\article
|
||||
*/
|
||||
class ArticleLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/8 18:39
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['title'],
|
||||
'=' => ['cid', 'is_show', 'is_recommend']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置支持排序字段
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:11
|
||||
*/
|
||||
public function setSortFields(): array
|
||||
{
|
||||
return ['create_time' => 'create_time', 'id' => 'id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置默认排序
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:08
|
||||
*/
|
||||
public function setDefaultOrder(): array
|
||||
{
|
||||
return ['sort' => 'desc', 'id' => 'desc'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取管理列表
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:11
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$ArticleLists = Article::where($this->searchWhere)
|
||||
->append(['cate_name', 'click'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order($this->sortOrder)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $ArticleLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:12
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Article::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function extend()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\auth;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsSortInterface;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\auth\AdminRole;
|
||||
use app\common\model\auth\SystemRole;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Jobs;
|
||||
|
||||
/**
|
||||
* 管理员列表
|
||||
* Class AdminLists
|
||||
* @package app\adminapi\lists\auth
|
||||
*/
|
||||
class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, ListsSearchInterface, ListsSortInterface,ListsExcelInterface
|
||||
{
|
||||
/**
|
||||
* @notes 设置导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 10:08
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'account' => '账号',
|
||||
'name' => '名称',
|
||||
'role_name' => '角色',
|
||||
'dept_name' => '部门',
|
||||
'create_time' => '创建时间',
|
||||
'login_time' => '最近登录时间',
|
||||
'login_ip' => '最近登录IP',
|
||||
'disable_desc' => '状态',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置导出文件名
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 10:08
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '管理员列表';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 10:07
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name', 'account'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置支持排序字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 10:07
|
||||
* @remark 格式: ['前端传过来的字段名' => '数据库中的字段名'];
|
||||
*/
|
||||
public function setSortFields(): array
|
||||
{
|
||||
return ['create_time' => 'create_time', 'id' => 'id'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置默认排序
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 10:06
|
||||
*/
|
||||
public function setDefaultOrder(): array
|
||||
{
|
||||
return ['id' => 'desc'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 查询条件
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2022/11/29 11:33
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
if (isset($this->params['role_id']) && $this->params['role_id'] != '') {
|
||||
$adminIds = AdminRole::where('role_id', $this->params['role_id'])->column('admin_id');
|
||||
if (!empty($adminIds)) {
|
||||
$where[] = ['id', 'in', $adminIds];
|
||||
}
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取管理列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 10:05
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$field = [
|
||||
'id', 'name', 'account', 'create_time', 'disable', 'root',
|
||||
'login_time', 'login_ip', 'multipoint_login', 'avatar'
|
||||
];
|
||||
|
||||
$adminLists = Admin::field($field)
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order($this->sortOrder)
|
||||
->append(['role_id', 'dept_id', 'jobs_id', 'disable_desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// 角色数组('角色id'=>'角色名称')
|
||||
$roleLists = SystemRole::column('name', 'id');
|
||||
// 部门列表
|
||||
$deptLists = Dept::column('name', 'id');
|
||||
// 岗位列表
|
||||
$jobsLists = Jobs::column('name', 'id');
|
||||
|
||||
//管理员列表增加角色名称
|
||||
foreach ($adminLists as $k => $v) {
|
||||
$roleName = '';
|
||||
if ($v['root'] == 1) {
|
||||
$roleName = '系统管理员';
|
||||
} else {
|
||||
foreach ($v['role_id'] as $roleId) {
|
||||
$roleName .= $roleLists[$roleId] ?? '';
|
||||
$roleName .= '/';
|
||||
}
|
||||
}
|
||||
|
||||
$deptName = '';
|
||||
foreach ($v['dept_id'] as $deptId) {
|
||||
$deptName .= $deptLists[$deptId] ?? '';
|
||||
$deptName .= '/';
|
||||
}
|
||||
|
||||
$jobsName = '';
|
||||
foreach ($v['jobs_id'] as $jobsId) {
|
||||
$jobsName .= $jobsLists[$jobsId] ?? '';
|
||||
$jobsName .= '/';
|
||||
}
|
||||
|
||||
$adminLists[$k]['role_name'] = trim($roleName, '/');
|
||||
$adminLists[$k]['dept_name'] = trim($deptName, '/');
|
||||
$adminLists[$k]['jobs_name'] = trim($jobsName, '/');
|
||||
}
|
||||
|
||||
return $adminLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/13 00:52
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Admin::where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->count();
|
||||
}
|
||||
|
||||
public function extend()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\auth;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\SystemMenu;
|
||||
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
* Class MenuLists
|
||||
* @package app\adminapi\lists\auth
|
||||
*/
|
||||
class MenuLists extends BaseAdminDataLists
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取菜单列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/6/29 16:41
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = SystemMenu::order(['sort' => 'desc', 'id' => 'asc'])
|
||||
->select()
|
||||
->toArray();
|
||||
return linear_to_tree($lists, 'children');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取菜单数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/6/29 16:41
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return SystemMenu::count();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\auth;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\AdminRole;
|
||||
use app\common\model\auth\SystemRole;
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
* Class RoleLists
|
||||
* @package app\adminapi\lists\auth
|
||||
*/
|
||||
class RoleLists extends BaseAdminDataLists
|
||||
{
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author Tab
|
||||
* @date 2021/9/22 18:52
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'name' => '角色名称',
|
||||
'desc' => '备注',
|
||||
'create_time' => '创建时间'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出表名
|
||||
* @return string
|
||||
* @author Tab
|
||||
* @date 2021/9/22 18:52
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '角色表';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 角色列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author cjhao
|
||||
* @date 2021/8/25 18:00
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = SystemRole::with(['role_menu_index'])
|
||||
->field('id,name,desc,sort,create_time')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as $key => $role) {
|
||||
//使用角色的人数
|
||||
$lists[$key]['num'] = AdminRole::where('role_id', $role['id'])->count();
|
||||
$menuId = array_column($role['role_menu_index'], 'menu_id');
|
||||
$lists[$key]['menu_id'] = $menuId;
|
||||
unset($lists[$key]['role_menu_index']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 总记录数
|
||||
* @return int
|
||||
* @author Tab
|
||||
* @date 2021/7/13 11:26
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return SystemRole::count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\channel;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\channel\OfficialAccountReply;
|
||||
|
||||
/**
|
||||
* 微信公众号回复列表
|
||||
* Class OfficialAccountLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
class OfficialAccountReplyLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2022/3/30 15:02
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['reply_type']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 回复列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/3/30 15:02
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$field = 'id,name,keyword,matching_type,content,content_type,status,sort';
|
||||
$field .= ',matching_type as matching_type_desc,content_type as content_type_desc,status as status_desc';
|
||||
|
||||
$lists = OfficialAccountReply::field($field)
|
||||
->where($this->searchWhere)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 回复记录数
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/3/30 15:02
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$count = OfficialAccountReply::where($this->searchWhere)->count();
|
||||
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\community;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\community\CommunityComment;
|
||||
use app\common\model\community\CommunityPost;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class CommunityCommentLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['post_id', 'user_id', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = CommunityComment::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$userIds = array_unique(array_column($lists, 'user_id'));
|
||||
$users = User::whereIn('id', $userIds)->column('nickname,avatar', 'id');
|
||||
|
||||
$postIds = array_unique(array_column($lists, 'post_id'));
|
||||
$posts = CommunityPost::whereIn('id', $postIds)->column('content,user_id', 'id');
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$user = $users[$item['user_id']] ?? [];
|
||||
$item['nickname'] = $user['nickname'] ?? '-';
|
||||
$item['create_time'] = is_numeric($item['create_time']) ? date('Y-m-d H:i:s', $item['create_time']) : $item['create_time'];
|
||||
$post = $posts[$item['post_id']] ?? [];
|
||||
$item['post_content'] = isset($post['content']) ? mb_substr($post['content'], 0, 50) : '-';
|
||||
$postUser = !empty($post['user_id']) ? (User::field('nickname')->findOrEmpty($post['user_id'])->toArray()) : [];
|
||||
$item['post_nickname'] = $postUser['nickname'] ?? '-';
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return CommunityComment::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\community;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\community\CommunityPost;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class CommunityPostLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['status', 'post_type', 'is_top', 'is_hot', 'is_recommend', 'user_id'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = CommunityPost::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$userIds = array_unique(array_column($lists, 'user_id'));
|
||||
$users = User::whereIn('id', $userIds)->column('nickname,avatar', 'id');
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$user = $users[$item['user_id']] ?? [];
|
||||
$item['nickname'] = $user['nickname'] ?? '-';
|
||||
$item['avatar'] = $user['avatar'] ?? '';
|
||||
$item['create_time'] = is_numeric($item['create_time']) ? date('Y-m-d H:i:s', $item['create_time']) : $item['create_time'];
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return CommunityPost::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\community;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\community\CommunityTag;
|
||||
|
||||
class CommunityTagLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name'],
|
||||
'=' => ['status'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
return CommunityTag::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('sort', 'desc')
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return CommunityTag::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\crawler;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\CrawlErrorLog;
|
||||
|
||||
class CrawlErrorLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['task_name', 'error_type', 'channel', 'http_status'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = CrawlErrorLog::field('id,task_name,request_url,request_method,http_status,error_type,error_message,channel,notified,created_at')
|
||||
->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return CrawlErrorLog::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\crontab;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\Crontab;
|
||||
|
||||
/**
|
||||
* 定时任务列表
|
||||
* Class CrontabLists
|
||||
* @package app\adminapi\lists\crontab
|
||||
*/
|
||||
class CrontabLists extends BaseAdminDataLists
|
||||
{
|
||||
/**
|
||||
* @notes 定时任务列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 14:30
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$field = 'id,name,type,type as type_desc,command,params,expression,
|
||||
status,status as status_desc,error,last_time,time,max_time';
|
||||
|
||||
$lists = Crontab::field($field)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 定时任务数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 14:38
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Crontab::count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\decorate;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\MenuEnum;
|
||||
use app\common\model\decorate\Menu;
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
* Class MenuLists
|
||||
* @package app\adminapi\lists\decorate
|
||||
*/
|
||||
class MenuLists extends BaseAdminDataLists
|
||||
{
|
||||
/**
|
||||
* @notes 菜单列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/2/14 11:29 上午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new Menu())->field('id,name,image,link_type,link_address,sort,status')
|
||||
->order(['sort'=>'asc','id'=>'desc'])
|
||||
->append(['link_address_desc','status_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$list) {
|
||||
$list['link_address_desc'] = MenuEnum::getLinkDesc($list['link_type']).':'.$list['link_address_desc'];
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 菜单总数
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/14 11:29 上午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new Menu())->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\decorate;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\decorate\Navigation;
|
||||
|
||||
/**
|
||||
* 底部导航列表
|
||||
* Class NavigationLists
|
||||
* @package app\adminapi\lists\decorate
|
||||
*/
|
||||
class NavigationLists extends BaseAdminDataLists
|
||||
{
|
||||
/**
|
||||
* @notes 底部导航列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/2/14 10:12 上午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return (new Navigation())->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 底部导航总数
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/14 10:13 上午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new Navigation())->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\dept;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\dept\Jobs;
|
||||
|
||||
/**
|
||||
* 岗位列表
|
||||
* Class JobsLists
|
||||
* @package app\adminapi\lists\dept
|
||||
*/
|
||||
class JobsLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 9:46
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name'],
|
||||
'=' => ['code', 'status']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取管理列表
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:11
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = Jobs::where($this->searchWhere)
|
||||
->append(['status_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/5/26 9:48
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Jobs::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出文件名
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '岗位列表';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'code' => '岗位编码',
|
||||
'name' => '岗位名称',
|
||||
'remark' => '备注',
|
||||
'status_desc' => '状态',
|
||||
'create_time' => '添加时间',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\device;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\device\UserDevice;
|
||||
|
||||
class DeviceLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['platform', 'user_id'],
|
||||
'%like%' => ['device_id', 'model', 'brand', 'app_version', 'ip'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
return UserDevice::where($this->searchWhere)
|
||||
->append(['platform_text'])
|
||||
->order(['last_at' => 'desc', 'id' => 'desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return UserDevice::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\file;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\file\FileCate;
|
||||
|
||||
/**
|
||||
* 文件分类列表
|
||||
* Class FileCateLists
|
||||
* @package app\adminapi\lists\file
|
||||
*/
|
||||
class FileCateLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 文件分类搜素条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:24
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['type']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取文件分类列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:24
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new FileCate())->field(['id,pid,type,name'])
|
||||
->where($this->searchWhere)
|
||||
->order('id desc')
|
||||
->select()->toArray();
|
||||
|
||||
return linear_to_tree($lists, 'children');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取文件分类数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:24
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new FileCate())->where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\file;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\adminapi\logic\FileLogic;
|
||||
use app\common\enum\FileEnum;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\file\File;
|
||||
use app\common\model\file\FileCate;
|
||||
use app\common\service\FileService;
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
* Class FileLists
|
||||
* @package app\adminapi\lists\file
|
||||
*/
|
||||
class FileLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 文件搜索条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:27
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['type', 'source'],
|
||||
'%like%' => ['name']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 额外查询处理
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2024/2/7 10:26
|
||||
*/
|
||||
public function queryWhere(): array
|
||||
{
|
||||
$where = [];
|
||||
|
||||
if (!empty($this->params['cid'])) {
|
||||
$cateChild = FileLogic::getCateIds($this->params['cid']);
|
||||
array_push($cateChild, $this->params['cid']);
|
||||
$where[] = ['cid', 'in', $cateChild];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取文件列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:27
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new File())->field(['id,cid,type,name,uri,create_time'])
|
||||
->order('id', 'desc')
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
// ->where('source', FileEnum::SOURCE_ADMIN)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['url'] = FileService::getFileUrl($item['uri']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取文件数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:29
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new File())->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
// ->where('source', FileEnum::SOURCE_ADMIN)
|
||||
->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\user\AccountLogEnum;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use think\facade\Db;
|
||||
use app\common\service\FileService;
|
||||
|
||||
|
||||
/**
|
||||
* 账记流水列表
|
||||
* Class AccountLogLists
|
||||
* @package app\adminapi\lists\finance
|
||||
*/
|
||||
class AccountLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:26
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['al.change_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:26
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 按变动对象筛选
|
||||
if (!empty($this->params['change_object'])) {
|
||||
$where[] = ['al.change_object', '=', $this->params['change_object']];
|
||||
}
|
||||
// 用户余额
|
||||
if (isset($this->params['type']) && $this->params['type'] == 'um') {
|
||||
$where[] = ['change_type', 'in', AccountLogEnum::getUserMoneyChangeType()];
|
||||
}
|
||||
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.nickname|u.mobile|u.account', 'like', '%' . $this->params['user_info'] . '%'];
|
||||
}
|
||||
|
||||
if (!empty($this->params['start_time'])) {
|
||||
$where[] = ['al.create_time', '>=', strtotime($this->params['start_time'])];
|
||||
}
|
||||
|
||||
if (!empty($this->params['end_time'])) {
|
||||
$where[] = ['al.create_time', '<=', strtotime($this->params['end_time'])];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:31
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$field = 'u.nickname,u.account,u.sn,u.avatar,u.mobile,al.action,al.change_object,al.change_amount,al.left_amount,al.change_type,al.source_sn,al.remark,al.create_time';
|
||||
$lists = UserAccountLog::alias('al')
|
||||
->join('user u', 'u.id = al.user_id')
|
||||
->field($field)
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->order('al.id', 'desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// 变动对象字典
|
||||
$objectMap = Db::name('dict_data')
|
||||
->where('type_value', 'account_change_object')
|
||||
->where('status', 1)
|
||||
->column('name', 'value');
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
$item['change_type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']);
|
||||
$item['change_object_desc'] = $objectMap[(string) $item['change_object']] ?? '-';
|
||||
$symbol = $item['action'] == AccountLogEnum::INC ? '+' : '-';
|
||||
$item['change_amount'] = $symbol . $item['change_amount'];
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:36
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserAccountLog::alias('al')
|
||||
->join('user u', 'u.id = al.user_id')
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\refund\RefundLog;
|
||||
|
||||
|
||||
/**
|
||||
* 退款日志列表
|
||||
* Class RefundLogLists
|
||||
* @package app\adminapi\lists\product
|
||||
*/
|
||||
class RefundLogLists extends BaseAdminDataLists
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 查询条件
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:55
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where[] = ['record_id', '=', $this->params['record_id'] ?? 0];
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:56
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new RefundLog())
|
||||
->order(['id' => 'desc'])
|
||||
->where($this->queryWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->hidden(['refund_msg'])
|
||||
->append(['handler', 'refund_status_text'])
|
||||
->select()
|
||||
->toArray();
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:56
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new RefundLog())
|
||||
->where($this->queryWhere())
|
||||
->count();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\RefundEnum;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\refund\RefundRecord;
|
||||
use app\common\service\FileService;
|
||||
|
||||
|
||||
/**
|
||||
* 退款记录列表
|
||||
* Class RefundRecordLists
|
||||
* @package app\adminapi\lists\product
|
||||
*/
|
||||
class RefundRecordLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExtendInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 查询条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['r.sn', 'r.order_sn', 'r.refund_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 查询条件
|
||||
* @param bool $flag
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function queryWhere($flag = true)
|
||||
{
|
||||
$where = [];
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.nickname|u.mobile|u.account', 'like', '%' . $this->params['user_info'] . '%'];
|
||||
}
|
||||
if (!empty($this->params['start_time'])) {
|
||||
$where[] = ['r.create_time', '>=', strtotime($this->params['start_time'])];
|
||||
}
|
||||
if (!empty($this->params['end_time'])) {
|
||||
$where[] = ['r.create_time', '<=', strtotime($this->params['end_time'])];
|
||||
}
|
||||
|
||||
if ($flag == true) {
|
||||
if (isset($this->params['refund_status']) && $this->params['refund_status'] != '') {
|
||||
$where[] = ['r.refund_status', '=', $this->params['refund_status']];
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new RefundRecord())->alias('r')
|
||||
->field('r.*,u.nickname,u.avatar')
|
||||
->join('user u', 'u.id = r.user_id')
|
||||
->order(['r.id' => 'desc'])
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->append(['refund_type_text', 'refund_status_text', 'refund_way_text'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new RefundRecord())->alias('r')
|
||||
->join('user u', 'u.id = r.user_id')
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 额外参数
|
||||
* @return mixed|null
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function extend()
|
||||
{
|
||||
$count = (new RefundRecord())->alias('r')
|
||||
->join('user u', 'u.id = r.user_id')
|
||||
->field([
|
||||
'count(r.id) as total',
|
||||
'count(if(r.refund_status='.RefundEnum::REFUND_ING.', true, null)) as ing',
|
||||
'count(if(r.refund_status='.RefundEnum::REFUND_SUCCESS.', true, null)) as success',
|
||||
'count(if(r.refund_status='.RefundEnum::REFUND_ERROR.', true, null)) as error',
|
||||
])
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere(false))
|
||||
->select()->toArray();
|
||||
|
||||
return array_shift($count);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\lottery;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\lottery\LotteryGame;
|
||||
use app\common\model\lottery\LotteryGameCategory;
|
||||
|
||||
class LotteryCategoryLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name'],
|
||||
'=' => ['category', 'status', 'is_show'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = LotteryGame::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('sort', 'asc')
|
||||
->order('id', 'asc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$categories = LotteryGameCategory::column('label', 'value');
|
||||
foreach ($lists as &$item) {
|
||||
$item['category_name'] = $categories[$item['category']] ?? '-';
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return LotteryGame::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\lottery;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\lottery\LotteryDraw;
|
||||
use app\common\model\lottery\LotteryCategory;
|
||||
|
||||
class LotteryDrawLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['category_id', 'status'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = LotteryDraw::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('draw_date', 'desc')
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$catIds = array_unique(array_column($lists, 'category_id'));
|
||||
$cats = LotteryCategory::whereIn('id', $catIds)->column('name', 'id');
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['category_name'] = $cats[$item['category_id']] ?? '-';
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return LotteryDraw::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\lottery;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\lottery\LotteryGameCategory;
|
||||
|
||||
class LotteryRegionLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['label'],
|
||||
'=' => ['is_show'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
return LotteryGameCategory::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('sort', 'asc')
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return LotteryGameCategory::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\match;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\league\League;
|
||||
|
||||
class LeagueLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['label'],
|
||||
'=' => ['type', 'is_show'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = League::where($this->searchWhere)
|
||||
->whereIn('type', ['sport', 'league'])
|
||||
->order('sort', 'desc')
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// 按 type 分组
|
||||
$sports = [];
|
||||
$leagues = [];
|
||||
foreach ($lists as $item) {
|
||||
if ($item['type'] === 'sport') {
|
||||
$sports[] = $item;
|
||||
} else {
|
||||
$leagues[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
// 按 sport_type 将联赛挂到对应体育类型下
|
||||
$leagueMap = [];
|
||||
foreach ($leagues as $lg) {
|
||||
$st = $lg['sport_type'];
|
||||
if (!isset($leagueMap[$st])) {
|
||||
$leagueMap[$st] = [];
|
||||
}
|
||||
$leagueMap[$st][] = $lg;
|
||||
}
|
||||
|
||||
// 构建树形:sport 为父节点,league 为子节点
|
||||
$tree = [];
|
||||
foreach ($sports as $sport) {
|
||||
$st = $sport['sport_type'];
|
||||
$children = $leagueMap[$st] ?? [];
|
||||
$tree[] = [
|
||||
'id' => $sport['id'],
|
||||
'label' => $sport['label'],
|
||||
'type' => 'sport',
|
||||
'sport_type' => $st,
|
||||
'icon' => $sport['icon'] ?? '',
|
||||
'sort' => $sport['sort'],
|
||||
'is_show' => $sport['is_show'],
|
||||
'is_group' => true,
|
||||
'children' => $children,
|
||||
];
|
||||
}
|
||||
|
||||
// 未归属任何 sport 的联赛(孤儿数据)
|
||||
$assignedIds = [];
|
||||
foreach ($leagueMap as $group) {
|
||||
foreach ($group as $lg) {
|
||||
$assignedIds[] = $lg['id'];
|
||||
}
|
||||
}
|
||||
$orphans = [];
|
||||
foreach ($leagues as $lg) {
|
||||
if (!in_array($lg['id'], $assignedIds)) {
|
||||
$orphans[] = $lg;
|
||||
}
|
||||
}
|
||||
if (!empty($orphans)) {
|
||||
$tree[] = [
|
||||
'id' => 'type_orphan',
|
||||
'label' => '未分类',
|
||||
'type' => 'league',
|
||||
'sport_type' => -1,
|
||||
'icon' => '',
|
||||
'sort' => '',
|
||||
'is_show' => '',
|
||||
'is_group' => true,
|
||||
'children' => $orphans,
|
||||
];
|
||||
}
|
||||
|
||||
return $tree;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return League::where($this->searchWhere)->whereIn('type', ['sport', 'league'])->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\match;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\match\MatchEvent;
|
||||
|
||||
class MatchLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['sport_type', 'status', 'is_hot', 'is_show'],
|
||||
'%like%' => ['home_team', 'away_team', 'league_name'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = MatchEvent::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('match_time', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['match_time_str'] = date('Y-m-d H:i', $item['match_time']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return MatchEvent::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\notice;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\notice\NoticeSetting;
|
||||
|
||||
/**
|
||||
* 通知设置
|
||||
* Class NoticeSettingLists
|
||||
* @package app\adminapi\lists\notice
|
||||
*/
|
||||
class NoticeSettingLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return \string[][]
|
||||
* @author ljj
|
||||
* @date 2022/2/17 2:21 下午
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['recipient', 'type']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 通知设置列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/2/16 3:18 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new NoticeSetting())->field('id,scene_name,sms_notice,type')
|
||||
->append(['sms_status_desc','type_desc'])
|
||||
->where($this->searchWhere)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 通知设置数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/2/16 3:18 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new NoticeSetting())->where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\points;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\points\PointsProduct;
|
||||
|
||||
class PointsProductLists extends BaseAdminDataLists
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
return PointsProduct::where($this->searchWhere)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return PointsProduct::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\popup;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\popup\PagePopup;
|
||||
|
||||
class PopupLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name', 'page_path', 'title'],
|
||||
'=' => ['status', 'popup_type'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
return PagePopup::where($this->searchWhere)
|
||||
->field([
|
||||
'id',
|
||||
'name',
|
||||
'page_path',
|
||||
'popup_type',
|
||||
'image',
|
||||
'title',
|
||||
'link_type',
|
||||
'link_url',
|
||||
'frequency',
|
||||
'auto_close_seconds',
|
||||
'is_closable',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'target_platform',
|
||||
'sort',
|
||||
'status',
|
||||
'show_count',
|
||||
'click_count',
|
||||
'close_count',
|
||||
'create_time',
|
||||
'update_time'
|
||||
])
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return PagePopup::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\popup;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\popup\PagePopupLog;
|
||||
|
||||
class PopupLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['popup_id', 'action', 'platform', 'user_id'],
|
||||
'%like%' => ['device_id', 'page_path'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
return PagePopupLog::where($this->searchWhere)
|
||||
->append(['action_text'])
|
||||
->order(['id' => 'desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return PagePopupLog::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\recharge;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\recharge\RechargeOrder;
|
||||
use app\common\service\FileService;
|
||||
|
||||
/**
|
||||
* 充值记录列表
|
||||
* Class RecharLists
|
||||
* @package app\adminapi\lists
|
||||
*/
|
||||
class RechargeLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:07
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'sn' => '充值单号',
|
||||
'nickname' => '用户昵称',
|
||||
'order_amount' => '充值金额',
|
||||
'pay_way_text' => '支付方式',
|
||||
'pay_status_text' => '支付状态',
|
||||
'pay_time' => '支付时间',
|
||||
'create_time' => '下单时间',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出表名
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:07
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '充值记录';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['ro.sn', 'ro.pay_way', 'ro.pay_status'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:08
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 用户编号
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.nickname|u.mobile|u.account', 'like', '%' . $this->params['user_info'] . '%'];
|
||||
}
|
||||
|
||||
// 下单时间
|
||||
if (!empty($this->params['start_time']) && !empty($this->params['end_time'])) {
|
||||
$time = [strtotime($this->params['start_time']), strtotime($this->params['end_time'])];
|
||||
$where[] = ['ro.create_time', 'between', $time];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:13
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$field = 'ro.id,ro.sn,ro.order_amount,ro.pay_way,ro.pay_time,ro.pay_status,ro.create_time,ro.refund_status';
|
||||
$field .= ',u.avatar,u.nickname,u.account';
|
||||
$lists = RechargeOrder::alias('ro')
|
||||
->join('user u', 'u.id = ro.user_id')
|
||||
->field($field)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->order('ro.id', 'desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->append(['pay_status_text', 'pay_way_text'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
$item['pay_time'] = empty($item['pay_time']) ? '' : date('Y-m-d H:i:s', $item['pay_time']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:13
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return RechargeOrder::alias('ro')
|
||||
->join('user u', 'u.id = ro.user_id')
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\setting;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\SmsLog;
|
||||
|
||||
class SmsUploadLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['phone', 'body'],
|
||||
'=' => ['status', 'type'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = SmsLog::field('id,phone,body,sms_time,type,status,device_id,batch_id,create_time')
|
||||
->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['record_type_desc'] = $this->getRecordTypeDesc((int)$item['type']);
|
||||
$item['type_desc'] = $this->getActionTypeDesc((int)$item['type']);
|
||||
$item['status_desc'] = $this->getStatusDesc((int)$item['status']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return SmsLog::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
private function getRecordTypeDesc(int $type): string
|
||||
{
|
||||
return $type >= 10 ? '来电' : '短信';
|
||||
}
|
||||
|
||||
private function getActionTypeDesc(int $type): string
|
||||
{
|
||||
return match ($type) {
|
||||
1 => '接收',
|
||||
2 => '发送',
|
||||
11 => '来电已接',
|
||||
13 => '来电未接',
|
||||
15 => '来电拒接',
|
||||
default => '未知',
|
||||
};
|
||||
}
|
||||
|
||||
private function getStatusDesc(int $status): string
|
||||
{
|
||||
return match ($status) {
|
||||
0 => '待验证',
|
||||
1 => '已使用',
|
||||
2 => '不适用',
|
||||
default => '未知',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\setting\dict;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\dict\DictData;
|
||||
|
||||
|
||||
/**
|
||||
* 字典数据列表
|
||||
* Class DictDataLists
|
||||
* @package app\adminapi\lists\dict
|
||||
*/
|
||||
class DictDataLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:29
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name', 'type_value'],
|
||||
'=' => ['status', 'type_id']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:35
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return DictData::where($this->searchWhere)
|
||||
->append(['status_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:35
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return DictData::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\setting\dict;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\dict\DictType;
|
||||
|
||||
|
||||
/**
|
||||
* 字典类型列表
|
||||
* Class DictTypeLists
|
||||
* @package app\adminapi\lists\dictionary
|
||||
*/
|
||||
class DictTypeLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 15:53
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name', 'type'],
|
||||
'=' => ['status']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 15:54
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return DictType::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->append(['status_desc'])
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 15:54
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return DictType::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\setting\pay;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\pay\PayConfig;
|
||||
|
||||
/**
|
||||
* 支付配置列表
|
||||
* Class PayConfigLists
|
||||
* @package app\adminapi\lists\setting\pay
|
||||
*/
|
||||
class PayConfigLists extends BaseAdminDataLists
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2023/2/23 16:15
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = PayConfig::field('id,name,pay_way,icon,sort')
|
||||
->append(['pay_way_name'])
|
||||
->order('sort','desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2023/2/23 16:15
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return PayConfig::count();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\setting\system;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\OperationLog;
|
||||
|
||||
/**
|
||||
* 日志列表
|
||||
* Class LogLists
|
||||
* @package app\adminapi\lists\setting\system
|
||||
*/
|
||||
class LogLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author ljj
|
||||
* @date 2021/8/3 4:21 下午
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['admin_name','url','ip','type'],
|
||||
'between_time' => 'create_time',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 查看系统日志列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2021/8/3 4:21 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = OperationLog::field('id,action,admin_name,admin_id,url,type,params,ip,create_time')
|
||||
->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order('id','desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 查看系统日志总数
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2021/8/3 4:23 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return OperationLog::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置导出字段
|
||||
* @return string[]
|
||||
* @author ljj
|
||||
* @date 2021/8/3 4:48 下午
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
// '数据库字段名(支持别名) => 'Excel表字段名'
|
||||
'id' => '记录ID',
|
||||
'action' => '操作',
|
||||
'admin_name' => '管理员',
|
||||
'admin_id' => '管理员ID',
|
||||
'url' => '访问链接',
|
||||
'type' => '访问方式',
|
||||
'params' => '访问参数',
|
||||
'ip' => '来源IP',
|
||||
'create_time' => '日志时间',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置默认表名
|
||||
* @return string
|
||||
* @author ljj
|
||||
* @date 2021/8/3 4:48 下午
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '系统日志';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\shortlink;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\ShortLink;
|
||||
use app\common\model\user\User;
|
||||
use think\facade\Db;
|
||||
|
||||
class ShortLinkLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['user_id'],
|
||||
'%like%' => ['code'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$where = $this->searchWhere;
|
||||
$linkPageType = $this->request->get('link_page_type', '');
|
||||
if ($linkPageType !== '') {
|
||||
$where[] = ['page_type', '=', $linkPageType];
|
||||
}
|
||||
|
||||
$lists = ShortLink::where($where)
|
||||
->order('id', 'desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$userIds = array_unique(array_column($lists, 'user_id'));
|
||||
$users = User::whereIn('id', $userIds)->column('nickname,avatar', 'id');
|
||||
|
||||
// 页面类型字典映射
|
||||
$pageTypeMap = Db::name('dict_data')
|
||||
->where('type_value', 'short_link_page_type')
|
||||
->where('status', 1)
|
||||
->column('name', 'value');
|
||||
|
||||
// 按 page_type 分组收集 page_id,批量查标题
|
||||
$grouped = [];
|
||||
foreach ($lists as $item) {
|
||||
$grouped[$item['page_type']][] = $item['page_id'];
|
||||
}
|
||||
$titleMap = [];
|
||||
foreach ($grouped as $type => $ids) {
|
||||
$ids = array_unique(array_filter($ids));
|
||||
if (empty($ids))
|
||||
continue;
|
||||
switch ($type) {
|
||||
case 'news':
|
||||
$titleMap[$type] = Db::name('article')->whereIn('id', $ids)->column('title', 'id');
|
||||
break;
|
||||
case 'match':
|
||||
$rows = Db::name('match')->whereIn('id', $ids)->column('home_team,away_team', 'id');
|
||||
$titleMap[$type] = array_map(fn($m) => $m['home_team'] . ' vs ' . $m['away_team'], $rows);
|
||||
break;
|
||||
case 'post':
|
||||
case 'community':
|
||||
$rows = Db::name('community_post')->whereIn('id', $ids)->column('content', 'id');
|
||||
$titleMap[$type] = array_map(fn($c) => mb_substr(strip_tags($c), 0, 20), $rows);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['nickname'] = $users[$item['user_id']]['nickname'] ?? '游客';
|
||||
$item['avatar'] = $users[$item['user_id']]['avatar'] ?? '';
|
||||
$item['short_url'] = request()->domain() . '/s/' . $item['code'];
|
||||
$item['page_type_name'] = $pageTypeMap[$item['page_type']] ?? $item['page_type'];
|
||||
$item['page_title'] = $titleMap[$item['page_type']][$item['page_id']] ?? '-';
|
||||
if (!empty($item['qrcode'])) {
|
||||
$absPath = public_path() . $item['qrcode'];
|
||||
$ver = is_file($absPath) ? filemtime($absPath) : time();
|
||||
$item['qrcode_url'] = \app\common\service\FileService::getFileUrl($item['qrcode']) . '?v=' . $ver;
|
||||
} else {
|
||||
$item['qrcode_url'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
$where = $this->searchWhere;
|
||||
$linkPageType = $this->request->get('link_page_type', '');
|
||||
if ($linkPageType !== '') {
|
||||
$where[] = ['page_type', '=', $linkPageType];
|
||||
}
|
||||
return ShortLink::where($where)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\shortlink;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\ShortLinkLog;
|
||||
|
||||
class ShortLinkLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['short_link_id', 'code', 'platform'],
|
||||
'%like%' => ['ip'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = ShortLinkLog::where($this->searchWhere)
|
||||
->order('id', 'desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// create_time 已由 ThinkPHP auto_timestamp + datetime_format 自动格式化
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return ShortLinkLog::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\tools;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 数据表列表
|
||||
* Class GeneratorLists
|
||||
* @package app\adminapi\lists\tools
|
||||
*/
|
||||
class DataTableLists extends BaseAdminDataLists
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 查询结果
|
||||
* @return mixed
|
||||
* @author 段誉
|
||||
* @date 2022/6/13 18:54
|
||||
*/
|
||||
public function queryResult()
|
||||
{
|
||||
$sql = 'SHOW TABLE STATUS WHERE 1=1 ';
|
||||
if (!empty($this->params['name'])) {
|
||||
$sql .= "AND name LIKE '%" . $this->params['name'] . "%'";
|
||||
}
|
||||
if (!empty($this->params['comment'])) {
|
||||
$sql .= "AND comment LIKE '%" . $this->params['comment'] . "%'";
|
||||
}
|
||||
return Db::query($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 处理列表
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2022/6/13 18:54
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = array_map("array_change_key_case", $this->queryResult());
|
||||
$offset = max(0, ($this->pageNo - 1) * $this->pageSize);
|
||||
$lists = array_slice($lists, $offset, $this->pageSize, true);
|
||||
return array_values($lists);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/6/13 18:54
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return count($this->queryResult());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\tools;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\tools\GenerateTable;
|
||||
|
||||
|
||||
/**
|
||||
* 代码生成所选数据表列表
|
||||
* Class GenerateTableLists
|
||||
* @package app\adminapi\lists\tools
|
||||
*/
|
||||
class GenerateTableLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2022/6/14 10:55
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['table_name', 'table_comment']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 查询列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/6/14 10:55
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return GenerateTable::where($this->searchWhere)
|
||||
->order(['id' => 'desc'])
|
||||
->append(['template_type_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/6/14 10:55
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return GenerateTable::count();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\adminapi\lists\user;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\user\UserTerminalEnum;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\user\User;
|
||||
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
* Class UserLists
|
||||
* @package app\adminapi\lists\user
|
||||
*/
|
||||
class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2022/9/22 15:50
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end'];
|
||||
return array_intersect(array_keys($this->params), $allowSearch);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/9/22 15:50
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$field = "id,sn,nickname,sex,avatar,account,mobile,channel,user_money,user_points,create_time";
|
||||
$lists = User::withSearch($this->setSearch(), $this->params)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->field($field)
|
||||
->order('id desc')
|
||||
->select()->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/9/22 15:51
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return User::withSearch($this->setSearch(), $this->params)->count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出文件名
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '用户列表';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'sn' => '用户编号',
|
||||
'nickname' => '用户昵称',
|
||||
'account' => '账号',
|
||||
'mobile' => '手机号码',
|
||||
'channel' => '注册来源',
|
||||
'create_time' => '注册时间',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\lists\vip;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\vip\VipLevel;
|
||||
|
||||
class VipLevelLists extends BaseAdminDataLists
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name'],
|
||||
];
|
||||
}
|
||||
|
||||
public function lists(): array
|
||||
{
|
||||
return VipLevel::where($this->searchWhere)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return VipLevel::where($this->searchWhere)->count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user