no message
This commit is contained in:
@@ -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 [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user