mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-05-23 15:21:36 +08:00
修改文章标签
This commit is contained in:
parent
6f1fa67974
commit
bca067d2b9
@ -55,7 +55,7 @@ class NewsItem extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function _page_filter(array &$data)
|
protected function _page_filter(array &$data)
|
||||||
{
|
{
|
||||||
NewsService::instance()->buildListState($data);
|
NewsService::instance()->buildData($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ class News extends Controller
|
|||||||
$query = $this->_query('DataNewsItem')->like('name,mark')->equal('id,code');
|
$query = $this->_query('DataNewsItem')->like('name,mark')->equal('id,code');
|
||||||
$query->where(['deleted' => 0, 'status' => 1])->withoutField('sort,status,deleted');
|
$query->where(['deleted' => 0, 'status' => 1])->withoutField('sort,status,deleted');
|
||||||
$result = $query->order('sort desc,id desc')->page(true, false, false, 15);
|
$result = $query->order('sort desc,id desc')->page(true, false, false, 15);
|
||||||
NewsService::instance()->buildListState($result['list'], input('uid', 0));
|
NewsService::instance()->buildData($result['list'], input('uid', 0));
|
||||||
$this->success('获取文章内容', $result);
|
$this->success('获取文章内容', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,13 +56,13 @@ class NewsService extends Service
|
|||||||
* @param integer $uid 用户UID
|
* @param integer $uid 用户UID
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function buildListState(array &$list, int $uid = 0): array
|
public function buildData(array &$list, int $uid = 0): array
|
||||||
{
|
{
|
||||||
if (count($list) > 0) {
|
if (count($list) > 0) {
|
||||||
[$code2, $code1, $marks] = [[], [], []];
|
[$code2, $code1] = [[], []];
|
||||||
|
$marks = $this->app->db->name('DataNewsMark')->where(['status' => 1])->column('name');
|
||||||
if ($uid > 0) {
|
if ($uid > 0) {
|
||||||
$map = [['uid', '=', $uid], ['code', 'in', array_unique(array_column($list, 'code'))]];
|
$map = [['uid', '=', $uid], ['code', 'in', array_unique(array_column($list, 'code'))]];
|
||||||
$marks = $this->app->db->name('DataNewsMark')->where(['status' => 1])->column('name');
|
|
||||||
$code1 = $this->app->db->name('DataNewsXCollect')->where($map)->where(['type' => 1])->column('code');
|
$code1 = $this->app->db->name('DataNewsXCollect')->where($map)->where(['type' => 1])->column('code');
|
||||||
$code2 = $this->app->db->name('DataNewsXCollect')->where($map)->where(['type' => 2])->column('code');
|
$code2 = $this->app->db->name('DataNewsXCollect')->where($map)->where(['type' => 2])->column('code');
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="text-left nowrap">{$vo.code|default=''}</td>
|
<td class="text-left nowrap">{$vo.code|default=''}</td>
|
||||||
<td class="text-left nowrap">{$vo.name|default=''}</td>
|
<td class="text-left nowrap">{$vo.name|default=''}</td>
|
||||||
<td class="text-left nowrap">{notempty name='vo.mark'}{foreach $vo.mark as $tag}<span data-tips-text="热搜标签" class="margin-right-5 layui-badge layui-bg-cyan">{$tag}</span>{/foreach}{/notempty}<br></td>
|
<td class="text-left nowrap">{notempty name='vo.mark'}{foreach $vo.mark as $tag}<span class="margin-right-5 layui-badge layui-bg-cyan">{$tag}</span>{/foreach}{/notempty}<br></td>
|
||||||
<td class="text-left nowrap">{if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">已激活</span>{/if}</td>
|
<td class="text-left nowrap">{if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">已激活</span>{/if}</td>
|
||||||
<td class="text-left nowrap">{$vo.create_at|format_datetime}</td>
|
<td class="text-left nowrap">{$vo.create_at|format_datetime}</td>
|
||||||
<td class='text-left nowrap'>
|
<td class='text-left nowrap'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user