mirror of https://github.com/1099438829/apeblog
This commit is contained in:
parent
dea2db3a18
commit
9c53d73287
|
|
@ -5,9 +5,9 @@ namespace app\admin\controller;
|
|||
use app\common\model\Admin as aModel;
|
||||
use app\common\model\AdminRole as rModel;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\services\FormBuilderService as Form;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use think\facade\Route as Url;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ namespace app\admin\controller;
|
|||
use app\common\model\AdminAuth as aModel;
|
||||
use app\Request;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\services\FormBuilderService as Form;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use think\facade\Route as Url;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace app\admin\controller;
|
|||
|
||||
use app\common\model\AdminLog as lModel;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
||||
/**
|
||||
* 日志
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use app\common\model\AdminNotify as nModel;
|
||||
/**
|
||||
* 消息提醒
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ use app\common\model\AdminRole as rModel;
|
|||
use app\common\model\AdminAuth as aModel;
|
||||
use app\Request;
|
||||
use FormBuilder\Exception\FormBuilderException;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\services\FormBuilderService as Form;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
|
||||
class AdminRole extends AuthController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use app\common\model\Document as aModel;
|
|||
use app\common\model\DocumentCategory as cModel;
|
||||
use app\common\model\DocumentArticle;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use think\Exception;
|
||||
use think\facade\Log;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace app\admin\controller;
|
|||
use app\common\model\DocumentCategory as aModel;
|
||||
use app\common\model\DocumentCategoryContent;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
||||
/**
|
||||
* Class Article
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ namespace app\admin\controller;
|
|||
|
||||
|
||||
use app\common\model\Attachment;
|
||||
use app\admin\services\storage\QcloudCoService;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\storage\QcloudCoService;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Filesystem;
|
||||
use think\Request;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
namespace app\admin\controller;
|
||||
|
||||
use app\common\model\FriendLink as aModel;
|
||||
use app\admin\services\FormBuilderService as Form;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use think\facade\Route as Url;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ namespace app\admin\controller;
|
|||
use app\common\model\Attachment;
|
||||
use app\common\model\AttachmentCategory;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\services\FormBuilderService as Form;
|
||||
use app\admin\services\storage\QcloudCoService;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use app\admin\service\storage\QcloudCoService;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use app\common\utils\Json;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace app\admin\controller;
|
|||
use app\common\model\AdminAuth;
|
||||
use app\common\model\AdminNotify;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
||||
class Index extends AuthController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace app\admin\controller;
|
|||
|
||||
use app\common\model\InvitationCode as aModel;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
||||
/**
|
||||
* Class Invitation
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace app\admin\controller;
|
|||
|
||||
use app\common\model\Admin;
|
||||
use app\common\model\Admin as adminModel;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
||||
class Login extends AuthController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace app\admin\controller;
|
|||
|
||||
use app\admin\model\MessageForm as aModel;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
||||
/**
|
||||
* Class Message
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
namespace app\admin\controller;
|
||||
|
||||
use app\common\model\Slides as aModel;
|
||||
use app\admin\services\FormBuilderService as Form;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use think\facade\Route as Url;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ use app\common\model\SystemConfig as cModel;
|
|||
use app\common\model\SystemConfigTab as tModel;
|
||||
use app\Request;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\services\FormBuilderService as Form;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
||||
/**
|
||||
* 系统配置
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ namespace app\admin\controller;
|
|||
|
||||
use app\Request;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\services\FormBuilderService as Form;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use app\common\model\SystemConfigTab as tModel;
|
||||
use app\common\model\SystemConfig as cModel;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace app\admin\controller;
|
||||
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
||||
/**
|
||||
* Trait TemplateTrait
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace app\admin\controller;
|
|||
|
||||
use app\common\model\SystemConfig as cModel;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
|
||||
/**
|
||||
* Class Theme
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ namespace app\admin\controller;
|
|||
|
||||
use app\common\model\User as aModel;
|
||||
use app\Request;
|
||||
use app\admin\services\UtilService as Util;
|
||||
use app\admin\service\UtilService as Util;
|
||||
use FormBuilder\Factory\Elm;
|
||||
use app\admin\services\FormBuilderService as Form;
|
||||
use app\admin\service\FormBuilderService as Form;
|
||||
use think\facade\Route as Url;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\admin\services;
|
||||
namespace app\admin\service;
|
||||
|
||||
use FormBuilder\Form\IviewForm;
|
||||
|
||||
/**
|
||||
* 表单构建
|
||||
* Class FormBuilderService
|
||||
* @package app\admin\services
|
||||
* @package app\admin\service
|
||||
*/
|
||||
class FormBuilderService
|
||||
{
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\admin\services;
|
||||
namespace app\admin\service;
|
||||
|
||||
/**
|
||||
* UTIL
|
||||
* Class UtilService
|
||||
* @package app\admin\services
|
||||
* @package app\admin\service
|
||||
*/
|
||||
class UtilService
|
||||
{
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\common\utils;
|
||||
namespace app\common\service;
|
||||
|
||||
/**
|
||||
* Class Curl
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\common\utils;
|
||||
namespace app\common\service;
|
||||
|
||||
use Firebase\JWT\JWT as jt;
|
||||
/**
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\common\utils;
|
||||
namespace app\common\service;
|
||||
|
||||
/**
|
||||
* 宝塔邮件发送
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\common\utils;
|
||||
namespace app\common\service;
|
||||
|
||||
use think\facade\Session as systemSession;
|
||||
|
||||
|
|
@ -13,9 +13,9 @@ function cn_substr($str,$len){
|
|||
/**
|
||||
* 时间戳格式化
|
||||
*/
|
||||
function MyDate($ft,$data){
|
||||
return date($ft,$data);
|
||||
}
|
||||
//function date_format($ft,$data){
|
||||
// return date($ft,$data);
|
||||
//}
|
||||
/**
|
||||
* 过滤html标签
|
||||
*/
|
||||
|
|
@ -28,7 +28,7 @@ function html2text($str){
|
|||
* $strip=true过滤html
|
||||
*/
|
||||
function get_type_content($id,$strip=false){
|
||||
$dc=Db::name('document_category_content')->find($id);
|
||||
$dc=\app\common\model\DocumentCategoryContent::find($id);
|
||||
if(!$dc){
|
||||
return '';
|
||||
}
|
||||
|
|
@ -42,19 +42,19 @@ function get_type_content($id,$strip=false){
|
|||
*/
|
||||
function get_document_category_list(){
|
||||
//缓存文章菜单
|
||||
$docuemtCategory=cache('DATA_DOCUMENT_CATEGORY_LIST');
|
||||
if($docuemtCategory===null){
|
||||
$docuemtCategoryList= \app\common\model\DocumentCategory::where('status',1)->order('sort asc')->select()->toArray();
|
||||
$documentCategory=cache('DATA_DOCUMENT_CATEGORY_LIST');
|
||||
if($documentCategory===null){
|
||||
$documentCategoryList= \app\common\model\DocumentCategory::where('status',1)->order('sort asc')->select()->toArray();
|
||||
//转换,让id作为数组的键
|
||||
$docuemtCategory=[];
|
||||
foreach ($docuemtCategoryList as $key=>$item){
|
||||
$documentCategory=[];
|
||||
foreach ($documentCategoryList as $key=>$item){
|
||||
//根据栏目类型,生成栏目url
|
||||
$item['url']=curl($item);
|
||||
$docuemtCategory[$item['id']]=$item;
|
||||
$documentCategory[$item['id']]=$item;
|
||||
}
|
||||
cache('DATA_DOCUMENT_CATEGORY_LIST',$docuemtCategory);
|
||||
cache('DATA_DOCUMENT_CATEGORY_LIST',$documentCategory);
|
||||
}
|
||||
return $docuemtCategory;
|
||||
return $documentCategory;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -66,15 +66,15 @@ function get_document_category($x,$field=false){
|
|||
throw new Exception('请指定要获取的栏目分类id!');
|
||||
}
|
||||
//获取缓存的文章菜单
|
||||
$docuemtCategoryList=get_document_category_list();
|
||||
if(!isset($docuemtCategoryList[$x])){
|
||||
$documentCategoryList=get_document_category_list();
|
||||
if(!isset($documentCategoryList[$x])){
|
||||
return false;
|
||||
}
|
||||
if($field){
|
||||
return $docuemtCategoryList[$x][$field];
|
||||
return $documentCategoryList[$x][$field];
|
||||
}
|
||||
else{
|
||||
return $docuemtCategoryList[$x];
|
||||
return $documentCategoryList[$x];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,22 +86,22 @@ function get_document_category_by_name($name,$field=false){
|
|||
throw new Exception('请指定要获取的栏目分类标识!');
|
||||
}
|
||||
//获取缓存的文章菜单
|
||||
$docuemtCategoryList=get_document_category_list();
|
||||
$docuemtCategory=false;
|
||||
foreach ($docuemtCategoryList as $item){
|
||||
$documentCategoryList=get_document_category_list();
|
||||
$documentCategory=false;
|
||||
foreach ($documentCategoryList as $item){
|
||||
if($item['name']==$name){
|
||||
$docuemtCategory=$item;
|
||||
$documentCategory=$item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$docuemtCategory){
|
||||
if(!$documentCategory){
|
||||
return false;
|
||||
}
|
||||
if($field){
|
||||
return $docuemtCategory[$field];
|
||||
return $documentCategory[$field];
|
||||
}
|
||||
else{
|
||||
return $docuemtCategory;
|
||||
return $documentCategory;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ function tpl_get_channel($type,$typeid,$row=100,$where='',$orderby='',$display=1
|
|||
if(!$dc){
|
||||
throw new Exception('分类不存在或已删除!');
|
||||
}
|
||||
$tempArr=Db::name('document_category')->where('id','in',$dc['child'])->where('status',1)->limit($row);
|
||||
$tempArr=\app\common\model\DocumentCategory::where('id','in',$dc['child'])->where('status',1)->limit($row);
|
||||
if($display){
|
||||
$tempArr=$tempArr->where('display',1);
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ function tpl_get_channel($type,$typeid,$row=100,$where='',$orderby='',$display=1
|
|||
$dc=get_document_category($typeid);
|
||||
if($dc['pid']!=0){
|
||||
//获取根分类,此操作读取数据库,非缓存!
|
||||
$dc=Db::name('document_category')-where('pid',0)->where('status',1)
|
||||
$dc=\app\common\model\DocumentCategory::where('pid',0)->where('status',1)
|
||||
-> where("CONCAT(',',child,',') like '%,$typeid,%'")->limit($row);
|
||||
if($display){
|
||||
$dc=$dc->where('display',1);
|
||||
|
|
@ -190,7 +190,7 @@ function tpl_get_channel($type,$typeid,$row=100,$where='',$orderby='',$display=1
|
|||
break;
|
||||
case 'where':
|
||||
//根据自定义条件获取分类(where语句),此操作读取数据库,非缓存!
|
||||
$tempArr=Db::name('document_category')->where('status',1)-> where($where)->order($orderby)->limit($row);
|
||||
$tempArr=\app\common\model\DocumentCategory::where('status',1)-> where($where)->order($orderby)->limit($row);
|
||||
if($display){
|
||||
$tempArr=$tempArr->where('display',1);
|
||||
}
|
||||
|
|
@ -204,7 +204,7 @@ function tpl_get_channel($type,$typeid,$row=100,$where='',$orderby='',$display=1
|
|||
break;
|
||||
case 'ids':
|
||||
//根据多个栏目id,逗号隔开的那种,获得栏目列表
|
||||
$tempArr=Db::name('document_category')->where('status',1)-> where('id','in',$typeid)->order($orderby)->limit($row);
|
||||
$tempArr=\app\common\model\DocumentCategory::where('status',1)-> where('id','in',$typeid)->order($orderby)->limit($row);
|
||||
if($display){
|
||||
$tempArr=$tempArr->where('display',1);
|
||||
}
|
||||
|
|
@ -228,10 +228,10 @@ function tpl_get_channel($type,$typeid,$row=100,$where='',$orderby='',$display=1
|
|||
* $row=获取多少数目
|
||||
*/
|
||||
function get_document_category_by_parent($pid,$row,$display=1){
|
||||
$docmentCategoryList=get_document_category_list();
|
||||
$documentCategoryList=get_document_category_list();
|
||||
$x=1;
|
||||
$tempArr=array();
|
||||
foreach ($docmentCategoryList as $item){
|
||||
foreach ($documentCategoryList as $item){
|
||||
if($x>$row){
|
||||
break;
|
||||
}
|
||||
|
|
@ -254,7 +254,7 @@ function tpl_get_prenext($get,$cid=false,$none){
|
|||
$get='next';
|
||||
}
|
||||
|
||||
$document=Db::name('document')->where('display',1)->where('status',1);
|
||||
$document=\app\common\model\Document::where('display',1)->where('status',1);
|
||||
$document=$get=='pre'?$document->where("id",'<',$id):$document->where("id",'>',$id);
|
||||
|
||||
//如果表明在同一分类下查询
|
||||
|
|
@ -403,14 +403,13 @@ function aurl($item){
|
|||
* 模板-根据指定的文章id获取文章内容
|
||||
*/
|
||||
function tpl_get_article($id,$table){
|
||||
$docmentModel=Db::name('document')
|
||||
->alias('a')
|
||||
$documentModel=\app\common\model\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'")
|
||||
->field('a.*,b.title as category_title,c.*');
|
||||
|
||||
$doc=$docmentModel->find();
|
||||
$doc=$documentModel->find();
|
||||
|
||||
if(!$doc){
|
||||
return false;
|
||||
|
|
@ -433,8 +432,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=Db::name('document')
|
||||
->alias('a')
|
||||
$documentListModel=\app\common\model\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)
|
||||
|
|
@ -504,7 +502,7 @@ function tpl_get_product_list($cid,$row,$orderby,$table='article',$type='son',$w
|
|||
function tpl_get_friend_link($type,$row){
|
||||
$flinkList=cache('DATA_FRIEND_LINK');
|
||||
if($flinkList===null){
|
||||
$flinkList=Db::name('friend_link')->where('status',1)->order('sort asc')->limit($row)->select();
|
||||
$flinkList= \app\common\model\FriendLink::where('status',1)->order('sort asc')->limit($row)->select();
|
||||
cache('DATA_FRIEND_LINK',$flinkList);
|
||||
}
|
||||
if($type===0){
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
|
||||
namespace app\index\controller;
|
||||
use app\common\model\Document;
|
||||
use think\facade\Db;
|
||||
use app\common\model\DocumentCategory;
|
||||
use app\common\model\DocumentCategoryContent;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
|
|
@ -19,8 +20,7 @@ use think\facade\Log;
|
|||
*/
|
||||
class Article extends Base
|
||||
{
|
||||
public function lists()
|
||||
{
|
||||
public function lists(){
|
||||
$dc=false;
|
||||
//栏目分类id
|
||||
$id=input('id/d');
|
||||
|
|
@ -40,11 +40,12 @@ class Article extends Base
|
|||
}
|
||||
//赋值分类id,可能是通过栏目分类id获取的栏目分类数据
|
||||
$id=$dc['id'];
|
||||
|
||||
$documentCategoryModel=new DocumentCategory();
|
||||
//栏目存在 增加访问量
|
||||
Db::name('document_category')->where('id',$id)->inc('view')->update();
|
||||
$documentCategoryModel->where('id',$id)->inc('view')->update();
|
||||
|
||||
//判断后台统计配置是否开启 1 开启
|
||||
if($this->systemConfig["web_statistics"] ==1){
|
||||
if(web_config("web_statistics") ==1){
|
||||
//统计url
|
||||
$this->urlrecord($dc['title']);
|
||||
}
|
||||
|
|
@ -62,13 +63,14 @@ class Article extends Base
|
|||
$this->error('请在栏目分类中,指定当前栏目的单篇模板!');
|
||||
}
|
||||
//如果是单篇栏目,加载内容
|
||||
$dcContent= Db::name('document_category_content')->find($id);
|
||||
$contentModel=new DocumentCategoryContent();
|
||||
$dcContent= $contentModel->find($id);
|
||||
$dc['content']=$dcContent['content'];
|
||||
}
|
||||
if(!is_file(TPL.$listTmp)){
|
||||
if(!is_file(config('view.view_path').'article/'.$listTmp)){
|
||||
$this->error('模板文件不存在!');
|
||||
}
|
||||
trace('列表页模板路径:'.TPL.$listTmp,'debug');
|
||||
trace('列表页模板路径:'.config('view.view_path').'article/'.$listTmp,'debug');
|
||||
//文章兼容字段
|
||||
$dc['category_id']=$dc['id'];
|
||||
//判断seo标题是否存在
|
||||
|
|
@ -93,7 +95,8 @@ class Article extends Base
|
|||
$this->error('参数错误!');
|
||||
}
|
||||
//获取该文章
|
||||
$article = (new Document())->where('status',1)->where('id',$id)->find();
|
||||
$documentModel=new Document();
|
||||
$article=$documentModel->where('status',1)->where('id',$id)->find();
|
||||
if(!$article){
|
||||
$this->error('文章不存在或已删除!');
|
||||
}
|
||||
|
|
@ -106,17 +109,18 @@ class Article extends Base
|
|||
//获取该文章内容
|
||||
//根据文章类型,加载不同的内容。
|
||||
$articleType= $article['type']?$article['type']:'article';
|
||||
$articleExt= Db::name('document_'.$articleType)->where('id',$id)->find();
|
||||
$articleExt = $documentModel::name('document_'.$articleType)->where('id',$id)->find();
|
||||
if(!$articleExt){
|
||||
$this->error('文章不存在或已删除!');
|
||||
}
|
||||
$articleExt = $articleExt->toArray();
|
||||
$article=array_merge($article,$articleExt);
|
||||
//添加当前页面的位置信息
|
||||
$article['position']=tpl_get_position($dc);
|
||||
//更新浏览次数
|
||||
(new Document())->where('id', $article['id'])->inc('view')->update();
|
||||
$documentModel->where('id', $article['id'])->inc('view')->update();
|
||||
//读取详情页模板
|
||||
$detailTmp=$dc['template'];
|
||||
$detailTmp=$dc['template_detail'];
|
||||
if(!$detailTmp){
|
||||
$this->error('请在栏目分类中,指定当前栏目的详情模板!');
|
||||
}
|
||||
|
|
@ -130,11 +134,11 @@ 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('CURR_CATEGORY_PATENT_ID',$dc['parent_id']?$dc['parent_id'].','.$article['category_id']:$article['category_id']);
|
||||
//设置文章的url
|
||||
$article['link_str']=aurl($article);
|
||||
//判断后台统计配置是否开启 1 开启
|
||||
if(system_config("web_statistics") ==1){
|
||||
if(web_config("web_statistics") ==1){
|
||||
//统计url
|
||||
$this->urlrecord($article['title']);
|
||||
}
|
||||
|
|
@ -160,9 +164,11 @@ class Article extends Base
|
|||
$this->assign('cid',false);
|
||||
//读取模板配置,获得模板后缀名
|
||||
$view_suffix=config('view.view_suffix');
|
||||
Log::info('详情页模板路径:'.TPL.'content_'.$zzField['tpl'].'.'.$view_suffix);
|
||||
Log::info('详情页模板路径:'.config('view.view_path').'article/'.'content_'.$zzField['tpl'].'.'.$view_suffix);
|
||||
cache('curr_category_patent_id',false);
|
||||
return $this->fetch(TPL.'content_'.$zzField['tpl'].'.'.$view_suffix);
|
||||
$detailTmp = substr($detailTmp,0,strpos($detailTmp,'.'));
|
||||
return $this->fetch('article/'.$detailTmp);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
//文章标签页面
|
||||
|
|
@ -178,8 +184,8 @@ class Article extends Base
|
|||
$zzField['id']='0';
|
||||
$zzField['title'] = $tag;
|
||||
$zzField['meta_title'] = $tag;
|
||||
$zzField['keywords'] = $this->systemConfig['keywords'];
|
||||
$zzField['description'] = $this->systemConfig['description'];
|
||||
$zzField['keywords'] =web_config('keywords');
|
||||
$zzField['description'] =web_config('description');
|
||||
$zzField['position'] ='<a href="/">首页</a> > <a>'.$tag.'</a>';
|
||||
$this->assign('zzField',$zzField);
|
||||
$this->assign('tag',$tag);
|
||||
|
|
@ -205,8 +211,8 @@ class Article extends Base
|
|||
$zzField['id'] = '0';
|
||||
$zzField['title'] = '搜索';
|
||||
$zzField['meta_title'] = '搜索';
|
||||
$zzField['keywords'] = $this->systemConfig['keywords'];
|
||||
$zzField['description'] = $this->systemConfig['description'];
|
||||
$zzField['keywords'] = web_config('keywords');
|
||||
$zzField['description'] = web_config('description');
|
||||
$zzField['position'] = '<a href="/">首页</a> > <a>搜索</a>';
|
||||
$this->assign('zzField',$zzField);
|
||||
$this->assign('kw',$kw);
|
||||
|
|
|
|||
|
|
@ -16,19 +16,19 @@ class Base extends BaseController
|
|||
protected function initialize(){
|
||||
parent::initialize();
|
||||
//判断是否关闭站点。
|
||||
if(!system_config('web_close')){
|
||||
if(!web_config('web_close')){
|
||||
$this->error('网站暂时关闭!','','stop');
|
||||
}
|
||||
//判断后台统计配置是否开启 1 开启
|
||||
if (system_config("web_statistics") == 1) {
|
||||
if (web_config("web_statistics") == 1) {
|
||||
//pv表 zz_pv_log 栏目存在 点击进入页面后
|
||||
$pvLogModel=new PvLog();
|
||||
$pvLogModel->set_view();
|
||||
}
|
||||
//判断是否开启了伪静态
|
||||
if (system_config('web_rewrite')=='0') {
|
||||
if (web_config('web_rewrite')=='0') {
|
||||
$this->request->setRoot('/?s=');
|
||||
} elseif(system_config('web_rewrite')=='1') {
|
||||
} elseif(web_config('web_rewrite')=='1') {
|
||||
$this->request->setRoot('/');
|
||||
} else {
|
||||
$this->request->setRoot('/index.php');
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Index extends Base
|
|||
public function index()
|
||||
{
|
||||
//判断后台统计配置是否开启 1 开启
|
||||
if(system_config("web_statistics") ==1){
|
||||
if(web_config("web_statistics") ==1){
|
||||
//统计url
|
||||
$this->urlrecord('网站首页');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,17 +20,19 @@ class Messageform extends Base
|
|||
public function addMessageform(){
|
||||
if(request()->isPost()){
|
||||
$data=$_POST;
|
||||
//验证
|
||||
$messageformValidate=new MessageformValidate();
|
||||
if (!$messageformValidate->check($data)) {
|
||||
$this->error($messageformValidate->getError());
|
||||
}
|
||||
$msgData['name']=isset($data['name'])?$data['name']:'';
|
||||
$msgData['tel']=isset($data['tel'])?$data['tel']:'';
|
||||
$msgData['email']=isset($data['email'])?$data['email']:'';
|
||||
$msgData['content']=$data['content'];
|
||||
$msgData['create_time']=time();
|
||||
$re=Db::name('message_form')->save($msgData);
|
||||
$model=new MessageFormModel();
|
||||
$postData=$this->request->param();
|
||||
//验证器
|
||||
$messageFormValidate=new MessageFormValidate();
|
||||
if (!$messageFormValidate->check($postData)) {
|
||||
$this->error($messageFormValidate->getError());
|
||||
}
|
||||
$msgData['name']=isset($postData['name'])?$postData['name']:'';
|
||||
$msgData['tel']=isset($postData['tel'])?$postData['tel']:'';
|
||||
$msgData['email']=isset($postData['email'])?$postData['email']:'';
|
||||
$msgData['content']=$postData['content'];
|
||||
$msgData['create_time']=time();
|
||||
$re=$model->add($msgData);
|
||||
if($re){
|
||||
$this->success('留言成功');
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue