mirror of https://github.com/1099438829/apeblog
修复若干bug
This commit is contained in:
parent
afeb6558ee
commit
415cafb3b5
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\constant\Config;
|
||||
use app\common\model\DocumentCategory as aModel;
|
||||
use app\common\model\DocumentCategoryContent;
|
||||
use app\Request;
|
||||
|
|
@ -87,6 +88,7 @@ class Category extends AuthController
|
|||
$res = DocumentCategoryContent::update(['content'=>$content],['id'=>$id]);
|
||||
}
|
||||
}
|
||||
cache(Config::DATA_DOCUMENT_CATEGORY_LIST,null);
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +102,8 @@ class Category extends AuthController
|
|||
if (!$id) return app("json")->fail("参数有误,Id为空!");
|
||||
$where = Util::postMore([['field',''],['value','']]);
|
||||
if ($where['field'] == '' || $where['value'] =='') return app("json")->fail("参数有误!");
|
||||
return aModel::update([$where['field']=>$where['value']],['id'=>$id]) ? app("json")->success("操作成功") : app("json")->fail("操作失败");
|
||||
cache(Config::DATA_DOCUMENT_CATEGORY_LIST,null);
|
||||
return aModel::update([$where['field']=>$where['value']],['id'=>$id]) ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -176,6 +179,7 @@ class Category extends AuthController
|
|||
$model = new aModel();
|
||||
$model->where('id',$where['id'])->delete();
|
||||
$res = DocumentCategoryContent::where('id',$where['id'])->delete();
|
||||
cache(Config::DATA_DOCUMENT_CATEGORY_LIST,null);
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\constant\Config;
|
||||
use app\common\model\FriendLink as aModel;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use app\Request;
|
||||
|
|
@ -123,6 +124,7 @@ class FriendLink extends AuthController
|
|||
$data['uid'] = $this->adminId;
|
||||
$res = aModel::update($data,['id'=>$id]);
|
||||
}
|
||||
cache(Config::DATA_FRIEND_LINK,null);//清除缓存
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
|
||||
|
|
@ -138,6 +140,7 @@ class FriendLink extends AuthController
|
|||
if (!$id) return app("json")->fail("参数有误,Id为空!");
|
||||
$where = Util::postMore([['field',''],['value','']]);
|
||||
if ($where['field'] == '' || $where['value'] =='') return app("json")->fail("参数有误!");
|
||||
cache(Config::DATA_FRIEND_LINK,null);//清除缓存
|
||||
return aModel::update([$where['field']=>$where['value']],['id'=>$id]) ? app("json")->success("操作成功") : app("json")->fail("操作失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use app\common\constant\Config;
|
||||
use app\common\model\Advert as aModel;
|
||||
use app\Request;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
|
@ -144,6 +145,7 @@ class Poster extends AuthController
|
|||
}else {
|
||||
$res = aModel::update($data,['id'=>$id]);
|
||||
}
|
||||
cache(Config::DATA_ADVERT.'_'.$data['type'],null);//清除缓存
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\constant\Config;
|
||||
use app\common\model\Slides as aModel;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use app\Request;
|
||||
|
|
@ -120,6 +121,7 @@ class Slides extends AuthController
|
|||
}else {
|
||||
$res = aModel::update($data,['id'=>$id]);
|
||||
}
|
||||
cache(Config::DATA_BANNER,null);//清除缓存
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\common\constant\Config;
|
||||
use app\common\model\SystemConfig as cModel;
|
||||
use app\common\model\SystemConfigTab as tModel;
|
||||
use app\Request;
|
||||
|
|
@ -184,7 +185,7 @@ class SystemConfig extends AuthController
|
|||
$res = cModel::update($data,['id'=>$id]);
|
||||
}
|
||||
//修改完需要更新缓存
|
||||
cache('systemConfig',null);//清除缓存
|
||||
cache(Config::DATA_SYSTEM_CONFIG,null);//清除缓存
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +198,7 @@ class SystemConfig extends AuthController
|
|||
{
|
||||
try {
|
||||
foreach ($request->param() as $k => $v) cModel::editValueByFormName($k,$v);
|
||||
cache('systemConfig',null);//清除缓存
|
||||
cache(Config::DATA_SYSTEM_CONFIG,null);//清除缓存
|
||||
return app("json")->success("操作成功");
|
||||
}catch (\Exception $e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class Theme extends AuthController
|
|||
]);
|
||||
if ($data['value'] == "") return app("json")->fail("主题不能为空");
|
||||
$res = cModel::update($data,['form_name'=>'web_template']);
|
||||
cache('systemConfig',null);//清除缓存
|
||||
cache(Config::DATA_SYSTEM_CONFIG,null);//清除缓存
|
||||
return $res ? app("json")->success("操作成功",'code') : app("json")->fail("操作失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
<div class="col-xs-6">推荐</div>
|
||||
<div class="col-xs-6">
|
||||
<label class="lyear-switch switch-solid switch-primary">
|
||||
<input type="checkbox" name="is_recommend" {if $info.is_recommend = 1}checked{/if}>
|
||||
<input type="checkbox" name="is_recommend" {if $info.is_recommend}checked{/if}>
|
||||
<span></span>
|
||||
</label>
|
||||
</div>
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
<div class="col-xs-6">热门</div>
|
||||
<div class="col-xs-6">
|
||||
<label class="lyear-switch switch-solid switch-primary">
|
||||
<input type="checkbox" name="is_hot" {if $info.is_hot = 1}checked{/if}>
|
||||
<input type="checkbox" name="is_hot" {if $info.is_hot}checked{/if}>
|
||||
<span></span>
|
||||
</label>
|
||||
</div>
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
<div class="col-xs-6">顶置</div>
|
||||
<div class="col-xs-6">
|
||||
<label class="lyear-switch switch-solid switch-primary">
|
||||
<input type="checkbox" name="is_top" {if $info.is_top = 1}checked{/if}>
|
||||
<input type="checkbox" name="is_top" {if $info.is_top}checked{/if}>
|
||||
<span></span>
|
||||
</label>
|
||||
</div>
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
<div class="col-xs-6">显示</div>
|
||||
<div class="col-xs-6">
|
||||
<label class="lyear-switch switch-solid switch-primary">
|
||||
<input type="checkbox" name="display" {if $info.is_top = 1}checked{/if}>
|
||||
<input type="checkbox" name="display" {if $info.is_top}checked{/if}>
|
||||
<span></span>
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -77,21 +77,17 @@
|
|||
showColumns: true, // 是否显示所有的列
|
||||
showRefresh: true, // 是否显示刷新按钮
|
||||
columns: [
|
||||
// {
|
||||
// field: 'check',
|
||||
// checkbox: true
|
||||
// },
|
||||
{
|
||||
field: 'title',
|
||||
title: '名称',
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '名称',
|
||||
},
|
||||
{
|
||||
field: 'display',
|
||||
title: '可见性',
|
||||
title: '是否可见',
|
||||
formatter: function (value, row, index) {
|
||||
if (value == 0) {
|
||||
is_checked = '';
|
||||
|
|
@ -141,7 +137,7 @@
|
|||
});
|
||||
},
|
||||
'click .category-edit': function (e, value, row, index) {
|
||||
iframe.createIframe('修改分类','/admin/category/edit?id='+row.id)
|
||||
location.href = '/admin/category/edit?id='+row.id;
|
||||
}
|
||||
},
|
||||
formatter: operateFormatter
|
||||
|
|
@ -184,10 +180,10 @@
|
|||
// 操作按钮
|
||||
function operateFormatter(value, row, index) {
|
||||
return [
|
||||
'<a type="button" class="category-add btn btn-xs btn-default m-r-5" title="编辑" data-toggle="tooltip"><i class="mdi mdi-plus"></i></a>',
|
||||
'<a type="button" class="category-add btn btn-xs btn-default m-r-5" title="添加子分类" data-toggle="tooltip"><i class="mdi mdi-plus"></i></a>',
|
||||
'<a type="button" class="category-edit btn btn-xs btn-default m-r-5" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>',
|
||||
'<a type="button" class="category-delete btn btn-xs btn-default" title="删除" data-toggle="tooltip"><i class="mdi mdi-delete"></i></a>',
|
||||
'<a type="button" class="article-add btn btn-xs btn-default m-r-5" title="添加文章" data-toggle="tooltip"><i class="mdi mdi-pencil-box"></i></a>',
|
||||
'<a type="button" class="category-edit btn btn-xs btn-default m-r-5" title="修改" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>',
|
||||
'<a type="button" class="category-delete btn btn-xs btn-default" title="删除" data-toggle="tooltip"><i class="mdi mdi-delete"></i></a>'
|
||||
].join('');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
use \think\facade\Db;
|
||||
use app\common\model\SystemConfig;
|
||||
use app\common\constant\Config;
|
||||
// 应用公共文件
|
||||
if (!function_exists('system_config_more'))
|
||||
{
|
||||
|
|
@ -13,10 +14,10 @@ if (!function_exists('system_config_more'))
|
|||
*/
|
||||
function system_config_more(array $formNames): array
|
||||
{
|
||||
$systemConfig = cache('systemConfig');
|
||||
$systemConfig = cache(Config::DATA_SYSTEM_CONFIG);
|
||||
if (empty($systemConfig)){
|
||||
$systemConfig = \app\common\model\SystemConfig::getSystemConfigValues();
|
||||
cache('systemConfig',$systemConfig);
|
||||
$systemConfig = SystemConfig::getSystemConfigValues();
|
||||
cache(Config::DATA_SYSTEM_CONFIG,$systemConfig);
|
||||
}
|
||||
$data = [];
|
||||
foreach ($formNames as $v){
|
||||
|
|
@ -73,10 +74,10 @@ if (!function_exists('system_config'))
|
|||
*/
|
||||
function system_config(string $formName): string
|
||||
{
|
||||
$systemConfig = cache('systemConfig');
|
||||
$systemConfig = cache(Config::DATA_SYSTEM_CONFIG);
|
||||
if (empty($systemConfig)){
|
||||
$systemConfig = \app\common\model\SystemConfig::getSystemConfigValues();
|
||||
cache('systemConfig',$systemConfig);
|
||||
$systemConfig = SystemConfig::getSystemConfigValues();
|
||||
cache(Config::DATA_SYSTEM_CONFIG,$systemConfig);
|
||||
}
|
||||
return $systemConfig[$formName]??'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @author 李玉坤
|
||||
* @date 2021-11-11 23:57
|
||||
*/
|
||||
|
||||
namespace app\common\constant;
|
||||
|
||||
|
||||
class Config
|
||||
{
|
||||
|
||||
const DATA_FRIEND_LINK = 'data_friend_link'; //友链
|
||||
const DATA_DOCUMENT_CATEGORY_LIST = 'data_document_category_list'; //文章分类
|
||||
const CURR_CATEGORY_PATENT_ID = 'curr_category_patent_id'; //当前分类腹肌id
|
||||
const DATA_SYSTEM_CONFIG = 'data_system_config'; //系统配置
|
||||
const DATA_BANNER = 'data_banner'; //banner
|
||||
const DATA_ADVERT = 'data_advert'; //广告
|
||||
}
|
||||
|
|
@ -3,6 +3,11 @@
|
|||
// +----------------------------------------------------------------------
|
||||
use think\facade\Db;
|
||||
use think\Exception;
|
||||
use app\common\constant\Config;
|
||||
use app\common\model\DocumentCategoryContent;
|
||||
use app\common\model\DocumentCategory;
|
||||
use app\common\model\Document;
|
||||
use \app\common\model\FriendLink;
|
||||
|
||||
// 应用公共文件
|
||||
/**
|
||||
|
|
@ -13,12 +18,6 @@ function cn_substr($str, $len)
|
|||
return mb_substr($str, 0, $len, 'utf-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间戳格式化
|
||||
*/
|
||||
//function date_format($ft,$data){
|
||||
// return date($ft,$data);
|
||||
//}
|
||||
/**
|
||||
* 过滤html标签
|
||||
*/
|
||||
|
|
@ -34,7 +33,7 @@ function html2text($str)
|
|||
*/
|
||||
function get_type_content($id, $strip = false)
|
||||
{
|
||||
$dc = \app\common\model\DocumentCategoryContent::find($id);
|
||||
$dc = DocumentCategoryContent::find($id);
|
||||
if (!$dc) {
|
||||
return '';
|
||||
}
|
||||
|
|
@ -50,9 +49,9 @@ function get_type_content($id, $strip = false)
|
|||
function get_document_category_list()
|
||||
{
|
||||
//缓存文章菜单
|
||||
$documentCategory = cache('DATA_DOCUMENT_CATEGORY_LIST');
|
||||
$documentCategory = cache(Config::DATA_DOCUMENT_CATEGORY_LIST);
|
||||
if ($documentCategory === null) {
|
||||
$documentCategoryList = \app\common\model\DocumentCategory::where('status', 1)->order('sort asc')->select()->toArray();
|
||||
$documentCategoryList = DocumentCategory::where('status', 1)->order('sort asc')->select()->toArray();
|
||||
//转换,让id作为数组的键
|
||||
$documentCategory = [];
|
||||
foreach ($documentCategoryList as $key => $item) {
|
||||
|
|
@ -60,7 +59,7 @@ function get_document_category_list()
|
|||
$item['url'] = curl($item);
|
||||
$documentCategory[$item['id']] = $item;
|
||||
}
|
||||
cache('DATA_DOCUMENT_CATEGORY_LIST', $documentCategory);
|
||||
cache(Config::DATA_DOCUMENT_CATEGORY_LIST, $documentCategory);
|
||||
}
|
||||
return $documentCategory;
|
||||
}
|
||||
|
|
@ -122,7 +121,7 @@ function tpl_get_channel($type, $typeid, $row = 100, $where = '', $orderby = '',
|
|||
switch ($type) {
|
||||
case "all":
|
||||
//获取顶级分类
|
||||
return get_document_category_all(0, $row, $display);
|
||||
return get_document_category_all($display);
|
||||
break;
|
||||
case 'top':
|
||||
//获取顶级分类
|
||||
|
|
@ -155,7 +154,7 @@ function tpl_get_channel($type, $typeid, $row = 100, $where = '', $orderby = '',
|
|||
if (!$dc) {
|
||||
throw new Exception('分类不存在或已删除!');
|
||||
}
|
||||
$tempArr = \app\common\model\DocumentCategory::where('id', 'in', $dc['child'])->where('status', 1)->limit($row);
|
||||
$tempArr = DocumentCategory::where('id', 'in', $dc['child'])->where('status', 1)->limit($row);
|
||||
if ($display) {
|
||||
$tempArr = $tempArr->where('display', 1);
|
||||
}
|
||||
|
|
@ -185,7 +184,7 @@ function tpl_get_channel($type, $typeid, $row = 100, $where = '', $orderby = '',
|
|||
$dc = get_document_category($typeid);
|
||||
if ($dc['pid'] != 0) {
|
||||
//获取根分类,此操作读取数据库,非缓存!
|
||||
$dc = \app\common\model\DocumentCategory::where('pid', 0)->where('status', 1)
|
||||
$dc = DocumentCategory::where('pid', 0)->where('status', 1)
|
||||
->where("CONCAT(',',child,',') like '%,$typeid,%'")->limit($row);
|
||||
if ($display) {
|
||||
$dc = $dc->where('display', 1);
|
||||
|
|
@ -202,7 +201,7 @@ function tpl_get_channel($type, $typeid, $row = 100, $where = '', $orderby = '',
|
|||
break;
|
||||
case 'where':
|
||||
//根据自定义条件获取分类(where语句),此操作读取数据库,非缓存!
|
||||
$tempArr = \app\common\model\DocumentCategory::where('status', 1)->where($where)->order($orderby)->limit($row);
|
||||
$tempArr = DocumentCategory::where('status', 1)->where($where)->order($orderby)->limit($row);
|
||||
if ($display) {
|
||||
$tempArr = $tempArr->where('display', 1);
|
||||
}
|
||||
|
|
@ -216,7 +215,7 @@ function tpl_get_channel($type, $typeid, $row = 100, $where = '', $orderby = '',
|
|||
break;
|
||||
case 'ids':
|
||||
//根据多个栏目id,逗号隔开的那种,获得栏目列表
|
||||
$tempArr = \app\common\model\DocumentCategory::where('status', 1)->where('id', 'in', $typeid)->order($orderby)->limit($row);
|
||||
$tempArr = DocumentCategory::where('status', 1)->where('id', 'in', $typeid)->order($orderby)->limit($row);
|
||||
if ($display) {
|
||||
$tempArr = $tempArr->where('display', 1);
|
||||
}
|
||||
|
|
@ -288,7 +287,7 @@ function tpl_get_prenext($get, $cid = false, $none)
|
|||
$get = 'next';
|
||||
}
|
||||
|
||||
$document = \app\common\model\Document::where('display', 1)->where('status', 1);
|
||||
$document = Document::where('display', 1)->where('status', 1);
|
||||
$document = $get == 'pre' ? $document->where("id", '<', $id) : $document->where("id", '>', $id);
|
||||
|
||||
//如果表明在同一分类下查询
|
||||
|
|
@ -320,7 +319,7 @@ function tpl_get_prenext($get, $cid = false, $none)
|
|||
function tpl_get_list($orderby, $pagesize, $cid, $type, $table = 'article', $where = false, $display = 1)
|
||||
{
|
||||
|
||||
$documentListModel = (new \app\common\model\Document())
|
||||
$documentListModel = (new Document())
|
||||
->alias('a')
|
||||
->join(config('database.prefix') . 'document_category b', 'a.category_id=b.id', 'LEFT')
|
||||
->join(config('database.prefix') . "document_$table c", 'a.id=c.id', 'LEFT')
|
||||
|
|
@ -439,7 +438,7 @@ function aurl($item)
|
|||
*/
|
||||
function tpl_get_article($id, $table)
|
||||
{
|
||||
$documentModel = \app\common\model\Document::alias('a')
|
||||
$documentModel = Document::alias('a')
|
||||
->join(config('database.prefix') . 'document_category b', 'a.category_id=b.id', 'LEFT')
|
||||
->join(config('database.prefix') . "document_$table c", 'a.id=c.id', 'LEFT')
|
||||
->where('a.status', 1)->where('a.id', $id)->where("a.type='$table'")
|
||||
|
|
@ -469,7 +468,7 @@ function tpl_get_article($id, $table)
|
|||
function tpl_get_article_list($cid, $row, $orderby, $table = 'article', $type = 'son', $where = false, $display = 1, $ids = '')
|
||||
{
|
||||
|
||||
$documentListModel = \app\common\model\Document::alias('a')
|
||||
$documentListModel = Document::alias('a')
|
||||
->join(config('database.prefix') . 'document_category b', 'a.category_id=b.id', 'LEFT')
|
||||
->join(config('database.prefix') . "document_$table c", 'a.id=c.id', 'RIGHT')
|
||||
->where("a.type='$table'")->where('a.status', 1)->where('b.status', 1)
|
||||
|
|
@ -538,10 +537,10 @@ function tpl_get_product_list($cid, $row, $orderby, $table = 'article', $type =
|
|||
*/
|
||||
function tpl_get_friend_link($type, $row)
|
||||
{
|
||||
$flinkList = cache('DATA_FRIEND_LINK');
|
||||
$flinkList = cache(Config::DATA_FRIEND_LINK);
|
||||
if ($flinkList === null) {
|
||||
$flinkList = \app\common\model\FriendLink::where('status', 1)->order('sort asc')->limit($row)->select();
|
||||
cache('DATA_FRIEND_LINK', $flinkList);
|
||||
$flinkList = FriendLink::where('status', 1)->order('sort asc')->limit($row)->select();
|
||||
cache(Config::DATA_FRIEND_LINK, $flinkList);
|
||||
}
|
||||
if ($type === 0) {
|
||||
return $flinkList;
|
||||
|
|
@ -560,10 +559,10 @@ function tpl_get_friend_link($type, $row)
|
|||
*/
|
||||
function tpl_get_banner($type, $row)
|
||||
{
|
||||
$bannerList = cache('DATA_BANNER');
|
||||
$bannerList = cache(Config::DATA_BANNER);
|
||||
if ($bannerList === null) {
|
||||
$bannerList = Db::name('slides')->where('status', 1)->order('sort asc')->limit($row)->select();
|
||||
cache('DATA_BANNER', $bannerList);
|
||||
cache(Config::DATA_BANNER, $bannerList);
|
||||
}
|
||||
if ($type === 0) {
|
||||
return $bannerList;
|
||||
|
|
@ -608,24 +607,20 @@ function tpl_get_advert($type, $row)
|
|||
return $advertListTemp;
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('web_config')) {
|
||||
/**
|
||||
* 获取系统配置值
|
||||
* @param string $formName
|
||||
* @return string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-14 22:41
|
||||
* @date 2021-11-12 0:34
|
||||
*/
|
||||
function web_config(string $formName): string
|
||||
{
|
||||
$webConfig = cache('systemConfig');
|
||||
$webConfig = cache(Config::DATA_SYSTEM_CONFIG);
|
||||
if (empty($webConfig)) {
|
||||
$webConfig = Db::name('system_config')->where("status", 1)->column('value', 'form_name');
|
||||
cache('systemConfig', $webConfig);
|
||||
cache(Config::DATA_SYSTEM_CONFIG, $webConfig);
|
||||
}
|
||||
return $webConfig[$formName] ?? '';
|
||||
}
|
||||
|
|
@ -633,6 +628,10 @@ if (!function_exists('web_config')) {
|
|||
|
||||
/**
|
||||
* 模板-文章标签
|
||||
* @param $tags
|
||||
* @return array|bool
|
||||
* @author 李玉坤
|
||||
* @date 2021-11-12 0:34
|
||||
*/
|
||||
function tpl_get_tags_list($tags)
|
||||
{
|
||||
|
|
@ -756,7 +755,7 @@ function IsActiveNav($curr_cid = false, $cid = false)
|
|||
}
|
||||
|
||||
//判断是否在同一栏目树下。
|
||||
$parent_id = cache('curr_category_patent_id');
|
||||
$parent_id = cache(Config::CURR_CATEGORY_PATENT_ID);
|
||||
|
||||
$parent_id = explode(',', $parent_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use app\common\model\Comment as commentModel;
|
|||
use app\common\model\Tag as TagModel;
|
||||
use app\Request;
|
||||
use think\facade\Log;
|
||||
use app\common\constant\Config;
|
||||
|
||||
/**
|
||||
* 应用入口
|
||||
|
|
@ -89,7 +90,7 @@ class Article extends Base
|
|||
//当前页面所属分类id
|
||||
$this->assign('cid',$id);
|
||||
//缓存当前页面栏目分类树ids
|
||||
cache('curr_category_patent_id',$dc['pid']?$dc['pid'].','.$id:$id);
|
||||
cache(Config::CURR_CATEGORY_PATENT_ID,$dc['pid']?$dc['pid'].','.$id:$id);
|
||||
//去除后缀
|
||||
$listTmp = substr($listTmp,0,strpos($listTmp,'.'));
|
||||
return $this->fetch('category/'.$listTmp);
|
||||
|
|
@ -155,7 +156,7 @@ class Article extends Base
|
|||
//当前页面所属分类id
|
||||
$this->assign('cid',$article['category_id']);
|
||||
//缓存当前页面栏目分类树ids
|
||||
cache('CURR_CATEGORY_PATENT_ID',$dc['pid']?$dc['pid'].','.$article['category_id']:$article['category_id']);
|
||||
cache(Config::CURR_CATEGORY_PATENT_ID,$dc['pid']?$dc['pid'].','.$article['category_id']:$article['category_id']);
|
||||
//设置文章的url
|
||||
$article['link_str']=aurl($article);
|
||||
//判断后台统计配置是否开启 1 开启
|
||||
|
|
@ -227,7 +228,7 @@ class Article extends Base
|
|||
$this->assign('tag',$tag);
|
||||
|
||||
//清除可能存在的栏目分类树id
|
||||
cache('curr_category_patent_id',false);
|
||||
cache(Config::CURR_CATEGORY_PATENT_ID,false);
|
||||
//模板兼容性标签
|
||||
$this->assign('id',false);
|
||||
$this->assign('cid',false);
|
||||
|
|
@ -284,7 +285,7 @@ class Article extends Base
|
|||
$this->assign('apeField',$apeField);
|
||||
$this->assign('kw',$kw);
|
||||
//清除可能存在的栏目分类树id
|
||||
cache('curr_category_patent_id',false);
|
||||
cache(Config::CURR_CATEGORY_PATENT_ID,false);
|
||||
//模板兼容性标签
|
||||
$this->assign('id',false);
|
||||
$this->assign('cid',false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue