2.2.5
This commit is contained in:
parent
53303f2650
commit
2047a80ceb
@ -212,18 +212,16 @@ abstract class BaseController
|
||||
$htpw = Request::scheme().'://'. $www;
|
||||
return $htpw;
|
||||
}
|
||||
|
||||
//得到当前系统安装前台域名
|
||||
protected function getIndexUrl()
|
||||
{
|
||||
$sys = $this->getSystem();
|
||||
$domain = $this->getHttpUrl($sys['domain']);
|
||||
$syscy = $sys['clevel'] ? Lang::get('Authorized') : Lang::get('Free version');
|
||||
$runTime = $this->getRunTime();
|
||||
View::assign(['domain'=>$domain,'insurl'=>$sys['domain'],'syscy'=>$syscy,'clevel'=>$sys['clevel'],'runTime'=>$runTime]);
|
||||
return $domain;
|
||||
}
|
||||
|
||||
protected function getDomain()
|
||||
{
|
||||
return $this->getHttpUrl($this->getSystem()['domain']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行时间计算
|
||||
* @return string
|
||||
*/
|
||||
protected function getRunTime()
|
||||
{
|
||||
//运行时间
|
||||
@ -242,78 +240,28 @@ abstract class BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章链接地址
|
||||
* @param int $aid 文章id
|
||||
* @param string $ename 所属分类ename
|
||||
* @param string $appname 所属应用名
|
||||
* 非admin应用的文章url路由地址
|
||||
* @param int $aid
|
||||
* @param $ename
|
||||
* @return string
|
||||
*/
|
||||
protected function getRouteUrl(int $aid, string $ename = '', string $appname = '') : string
|
||||
protected function getRouteUrl(int $aid, $ename = '')
|
||||
{
|
||||
$indexUrl = $this->getIndexUrl();
|
||||
$domain = $this->getDomain();
|
||||
$appName = app('http')->getName();
|
||||
$articleUrl = (string) url('article_detail', ['id' => $aid]);
|
||||
// 详情动态路由,$aid, $ename
|
||||
if(config('taoler.url_rewrite.article_as') == '<ename>/'){
|
||||
// 分类可变路由
|
||||
$artUrl = (string) url('article_detail', ['id' => (int) $aid, 'ename'=> $ename]);
|
||||
//$artUrl = (string) Route::buildUrl('article_detail', ['id' => $aid, 'ename'=> $ename]);
|
||||
} else {
|
||||
$artUrl = (string) url('article_detail', ['id' => $aid]);
|
||||
}
|
||||
//halt($indexUrl,$artUrl);
|
||||
//多应用时,文章所属应用 2022.11.17
|
||||
$app = app('http')->getName();
|
||||
if(empty($appname)) {
|
||||
// 获取article所属应用的应用名
|
||||
$cid = Db::name('article')->where('id',$aid)->value('cate_id');
|
||||
$appname = Db::name('cate')->where('id',$cid)->value('appname');
|
||||
$articleUrl = (string) url('article_detail', ['id' => (int) $aid, 'ename'=> $ename]);
|
||||
}
|
||||
|
||||
// 判断index应用是否绑定域名
|
||||
$bind_index = array_search($appname, config('app.domain_bind'));
|
||||
// 判断index应用是否域名映射
|
||||
$map_index = array_search($appname, config('app.app_map'));
|
||||
// article 所属应用名
|
||||
$index = $map_index ?: $appname; // index应用名
|
||||
// // 判断应用是否绑定域名
|
||||
// $app_bind = array_search($appName, config('app.domain_bind'));
|
||||
// // 判断应用是否域名映射
|
||||
// $app_map = array_search($appName, config('app.app_map'));
|
||||
|
||||
// 判断是否开启绑定
|
||||
//$domain_bind = array_key_exists('domain_bind',config('app'));
|
||||
|
||||
// 判断index应用是否绑定域名
|
||||
//$bind_index = array_search('index',config('app.domain_bind'));
|
||||
// 判断admin应用是否绑定域名
|
||||
$bind_admin = array_search('admin',config('app.domain_bind'));
|
||||
|
||||
// 判断index应用是否域名映射
|
||||
//$map_index = array_search('index',config('app.app_map'));
|
||||
// 判断admin应用是否域名映射
|
||||
$map_admin = array_search('admin',config('app.app_map'));
|
||||
|
||||
// $index = $map_index ?: 'index'; // index应用名
|
||||
$admin = $map_admin ?: 'admin'; // admin应用名
|
||||
|
||||
if($bind_index) {
|
||||
// echo 111;
|
||||
// index或home前端(非admin应用)域名进行了绑定
|
||||
// $url = $indexUrl . str_replace($admin . '/','',$artUrl);
|
||||
$url = $indexUrl . $artUrl;
|
||||
} else {
|
||||
if($bind_admin) {
|
||||
// echo 222;
|
||||
// admin绑定域名
|
||||
$url = $indexUrl .'/' . $index . $artUrl;
|
||||
} elseif ($app == 'admin' && isset($map_admin)) {
|
||||
// echo 333;
|
||||
// var_dump($admin, $appname, $artUrl);
|
||||
// admin进行了映射
|
||||
$url = $indexUrl . str_replace($admin, $index, $artUrl);
|
||||
} else {
|
||||
// echo 444;
|
||||
// admin未绑定域名
|
||||
$url = $indexUrl . str_replace($app, $index, $artUrl);
|
||||
}
|
||||
|
||||
}
|
||||
//halt($url);
|
||||
return $url;
|
||||
//a.appName不是admin
|
||||
return $domain . $articleUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -459,33 +407,6 @@ abstract class BaseController
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* baidu push api
|
||||
*
|
||||
* @param string $link
|
||||
* @return void
|
||||
*/
|
||||
protected function baiduPushUrl(string $link)
|
||||
{
|
||||
// baidu 接口
|
||||
$api = config('taoler.baidu.push_api');
|
||||
if(!empty($api)) {
|
||||
$url[] = $link;
|
||||
$ch = curl_init();
|
||||
$options = array(
|
||||
CURLOPT_URL => $api,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POSTFIELDS => implode("\n", $url),
|
||||
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
|
||||
);
|
||||
curl_setopt_array($ch, $options);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传接口
|
||||
*
|
||||
@ -553,7 +474,7 @@ abstract class BaseController
|
||||
//$dirname = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_DIRNAME);
|
||||
$dirname = date('Ymd',time());
|
||||
//路径
|
||||
$path = 'storage/' . $this->uid . '/article_pic/' . $dirname . '/';
|
||||
$path = 'storage/download/article_pic/' . $dirname . '/';
|
||||
//绝对文件夹
|
||||
$fileDir = public_path() . $path;
|
||||
//文件绝对路径
|
||||
@ -602,4 +523,42 @@ abstract class BaseController
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* array_filter过滤返回函数
|
||||
* @param $arr
|
||||
* @return bool
|
||||
*/
|
||||
protected function filter($arr) :bool
|
||||
{
|
||||
if($arr === '' || $arr === null){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤为空null等筛选参数
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public function getParamFilter(array $array) :array
|
||||
{
|
||||
return array_filter($array, "filter");
|
||||
}
|
||||
|
||||
/**
|
||||
* 数组根据sort字段数值进行排序
|
||||
* @param array $array 数组
|
||||
* @param string $sort 排序字段
|
||||
* @return array 返回数组
|
||||
*/
|
||||
public function getArrSort(array $array, string $sort = 'sort') :array
|
||||
{
|
||||
// 排序
|
||||
$cmf_arr = array_column($array, 'sort');
|
||||
array_multisort($cmf_arr, SORT_ASC, $array);
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
/*
|
||||
* @Program: TaoLer 2023/3/14
|
||||
* @FilePath: app\admin\controller\content\Cate.php
|
||||
* @Description: Cate
|
||||
* @Description: Cate 分类菜单
|
||||
* @LastEditTime: 2023-03-14 15:40:53
|
||||
* @Author: Taoker <317927823@qq.com>
|
||||
* @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
|
||||
@ -11,194 +11,100 @@
|
||||
namespace app\admin\controller\content;
|
||||
|
||||
use app\common\controller\AdminController;
|
||||
use think\App;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use think\facade\Db;
|
||||
use think\facade\Cache;
|
||||
use taoler\com\Files;
|
||||
use app\common\lib\Msgres;
|
||||
use app\common\model\Article;
|
||||
use app\common\model\Cate as CateModel;
|
||||
|
||||
|
||||
|
||||
class Cate extends AdminController
|
||||
{
|
||||
protected $model;
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new CateModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览
|
||||
* @return string
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//详情模板
|
||||
$sys = $this->getSystem();
|
||||
$template = Files::getDirName('../view/'.$sys['template'].'/index/article/');
|
||||
View::assign(['template'=>$template]);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//帖子分类
|
||||
public function list()
|
||||
{
|
||||
$cate = new CateModel();
|
||||
if(Request::isAjax()){
|
||||
return $cate->getList();
|
||||
}
|
||||
|
||||
return $this->model->getList();
|
||||
}
|
||||
|
||||
// 应用下article/view模板
|
||||
public function getAppNameView()
|
||||
{
|
||||
$appName = input('appname') ?: 'index';
|
||||
$sys = $this->getSystem();
|
||||
if(is_dir(root_path() . 'app' . DS . $appName . DS . 'view' . DS)){
|
||||
$viewPath = root_path() . 'app' . DS . $appName . DS . 'view' . DS . 'article' . DS;
|
||||
} elseif(is_dir(root_path() . 'view' . DS . $sys['template'] . DS)) {
|
||||
$viewPath = root_path() . 'view' . DS . $sys['template'] . DS . 'index' . DS . 'article' . DS;
|
||||
} else {
|
||||
$viewPath = '';
|
||||
}
|
||||
$template = Files::getDirName($viewPath);
|
||||
return json(['data' => $template]);
|
||||
}
|
||||
|
||||
//添加和编辑帖子分类
|
||||
public function addEdit()
|
||||
{
|
||||
$addOrEdit = !is_null(input('id'));//true是编辑false新增
|
||||
$msg = $addOrEdit ? lang('edit') : lang('add');
|
||||
if(Request::isAjax()) {
|
||||
$data = Request::param();
|
||||
if(isset($data['id']) && $data['pid'] == $data['id']) return json(['code'=>-1,'msg'=> $msg.'不能作为自己的子类']);
|
||||
$list = Db::name('cate')->cache('catename')->save($data);
|
||||
|
||||
if($list){
|
||||
return json(['code'=>0,'msg'=> $msg.'分类成功']);
|
||||
}else{
|
||||
return json(['code'=>-1,'msg'=> $msg.'分类失败']);
|
||||
}
|
||||
}
|
||||
//详情模板
|
||||
$sys = $this->getSystem();
|
||||
$template = Files::getDirName('../view/'.$sys['template'].'/index/article/');
|
||||
// 如果是新增,pid=0,detpl默认第一个子模块,如果是编辑,查询出cate
|
||||
$cate = $addOrEdit ? Db::name('cate')->field('detpl,pid,appname')->where(['delete_time' =>0])->find((int) input('id')) : ['pid'=>0,'detpl'=>$template[0],'appname'=>'index'];
|
||||
// app下前台带模板的应用
|
||||
$appArr = [];
|
||||
if(is_dir(root_path() . 'app' . DS . 'home')) {
|
||||
$appArr = ['index','home'];
|
||||
} else {
|
||||
$appArr = ['index'];
|
||||
}
|
||||
View::assign(['template'=>$template,'cate'=>$cate, 'appname' => $appArr]);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//添加分类
|
||||
public function add()
|
||||
//添加和编辑帖子分类 废弃
|
||||
public function addEdit()
|
||||
{
|
||||
$addOrEdit = !is_null(input('id'));//true是编辑false新增
|
||||
|
||||
$msg = $addOrEdit ? lang('edit') : lang('add');
|
||||
if(Request::isAjax()) {
|
||||
$data = Request::param();
|
||||
if(isset($data['id']) && $data['pid'] == $data['id']) return json(['code'=>-1,'msg'=> '不能作为自己的子类']);
|
||||
if(isset($data['id']) && $data['pid'] == $data['id']) return json(['code'=>-1,'msg'=> $msg.'不能作为自己的子类']);
|
||||
$list = Db::name('cate')->cache('catename')->save($data);
|
||||
|
||||
if($list){
|
||||
return json(['code'=>0,'msg'=> '添加成功']);
|
||||
}else{
|
||||
return json(['code'=>-1,'msg'=> '添加失败']);
|
||||
return json(['code'=>0,'msg'=> $msg.'成功']);
|
||||
}
|
||||
return json(['code'=>-1,'msg'=> $msg.'失败']);
|
||||
}
|
||||
//详情模板
|
||||
$sys = $this->getSystem();
|
||||
$template = Files::getDirName('../view/'.$sys['template'].'/index/article/');
|
||||
$template = $this->getIndexTpl();
|
||||
// 如果是新增,pid=0,detpl默认第一个子模块,如果是编辑,查询出cate
|
||||
$cate = ['pid'=>0,'detpl'=>$template[0],'appname'=>'index'];
|
||||
// app下前台带模板的应用
|
||||
$appArr = [];
|
||||
if(is_dir(root_path() . 'app' . DS . 'home')) {
|
||||
$appArr = ['index','home'];
|
||||
} else {
|
||||
$appArr = ['index'];
|
||||
}
|
||||
View::assign(['template'=>$template,'cate'=>$cate, 'appname' => $appArr]);
|
||||
return View::fetch();
|
||||
}
|
||||
$cate = $addOrEdit ? $this->model->getCateInfoById((int) input('id')) : '';
|
||||
$view = $addOrEdit ? 'edit' : 'add';
|
||||
|
||||
//编辑分类
|
||||
public function edit()
|
||||
{
|
||||
if(Request::isAjax()) {
|
||||
$data = Request::param();
|
||||
|
||||
if(isset($data['id']) && $data['pid'] == $data['id']) return json(['code'=>-1,'msg'=> '不能作为自己的子类']);
|
||||
$list = Db::name('cate')->where('id', input('id'))->save($data);
|
||||
|
||||
if($list){
|
||||
return json(['code'=>0,'msg'=> '编辑成功']);
|
||||
}else{
|
||||
return json(['code'=>-1,'msg'=> '编辑失败']);
|
||||
}
|
||||
}
|
||||
//详情模板
|
||||
$sys = $this->getSystem();
|
||||
$template = Files::getDirName('../view/'.$sys['template'].'/index/article/');
|
||||
// 如果是新增,pid=0,detpl默认第一个子模块,如果是编辑,查询出cate
|
||||
$cate = Db::name('cate')->field('id,catename,ename,detpl,pid,appname,icon,sort,desc')->where(['delete_time' =>0])->find((int) input('id'));
|
||||
// app下前台带模板的应用
|
||||
$appArr = [];
|
||||
if(is_dir(root_path() . 'app' . DS . 'home')) {
|
||||
$appArr = ['index','home'];
|
||||
} else {
|
||||
$appArr = ['index'];
|
||||
}
|
||||
View::assign(['template'=>$template,'cate'=>$cate, 'appname' => $appArr]);
|
||||
return View::fetch();
|
||||
View::assign([
|
||||
'template' => $template,
|
||||
'cate' => $cate
|
||||
]);
|
||||
return View::fetch($view);
|
||||
}
|
||||
|
||||
//删除帖子分类
|
||||
public function delete()
|
||||
{
|
||||
if(Request::isAjax()){
|
||||
$id = Request::param('id');
|
||||
$cate = new CateModel;
|
||||
$result = $cate->del($id);
|
||||
if($result == 1){
|
||||
return json(['code'=>0,'msg'=>'删除分类成功']);
|
||||
}else{
|
||||
return json(['code'=>-1,'msg'=>$result]);
|
||||
}
|
||||
}
|
||||
$result = $this->model->del(input('id'));
|
||||
if($result == 1){
|
||||
return json(['code'=>0,'msg'=>'删除分类成功']);
|
||||
}
|
||||
return json(['code'=>-1,'msg' => $result]);
|
||||
}
|
||||
|
||||
|
||||
//帖子分类开启热点
|
||||
//评论审核
|
||||
public function hot()
|
||||
// 动态审核
|
||||
public function check()
|
||||
{
|
||||
$data = Request::only(['id','is_hot']);
|
||||
$cate = Db::name('cate')->save($data);
|
||||
if($cate){
|
||||
if($data['is_hot'] == 1){
|
||||
return json(['code'=>0,'msg'=>'设置热点成功','icon'=>6]);
|
||||
} else {
|
||||
return json(['code'=>0,'msg'=>'取消热点显示','icon'=>5]);
|
||||
}
|
||||
}else{
|
||||
$res = ['code'=>-1,'msg'=>'热点设置失败'];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
|
||||
//array_filter过滤函数
|
||||
public function filtr($arr){
|
||||
if($arr === '' || $arr === null){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
$param = Request::only(['id','name','value']);
|
||||
$data = ['id'=>$param['id'],$param['name']=>$param['value']];
|
||||
//获取状态
|
||||
$res = Db::name('cate')->save($data);
|
||||
if($res){
|
||||
return json(['code'=>0,'msg'=>'设置成功','icon'=>6]);
|
||||
}
|
||||
return json(['code'=>-1,'msg'=>'设置失败']);
|
||||
}
|
||||
|
||||
/**
|
||||
* index/view/article下模板文件
|
||||
* @return array
|
||||
*/
|
||||
protected function getIndexTpl() :array
|
||||
{
|
||||
$sys = $this->getSystem();
|
||||
return Files::getDirName('../view/'.$sys['template'].'/index/article/');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ namespace app\admin\controller\content;
|
||||
|
||||
use app\common\controller\AdminController;
|
||||
use app\common\model\Article;
|
||||
use think\App;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use think\facade\Db;
|
||||
@ -23,6 +24,14 @@ use think\response\Json;
|
||||
|
||||
class Forum extends AdminController
|
||||
{
|
||||
protected $model;
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->model = new Article();
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览
|
||||
* @return string
|
||||
@ -32,87 +41,31 @@ class Forum extends AdminController
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//帖子列表
|
||||
public function list()
|
||||
{
|
||||
if(Request::isAjax()){
|
||||
$data = Request::only(['id','name','title','sec']);
|
||||
$where =array();
|
||||
if (!empty($data['sec'])) {
|
||||
switch ($data['sec']) {
|
||||
case '1':
|
||||
$data['a.status'] = 1;
|
||||
break;
|
||||
case '2':
|
||||
$data['is_top'] = 1;
|
||||
break;
|
||||
case '3':
|
||||
$data['is_hot'] = 1;
|
||||
break;
|
||||
case '4':
|
||||
$data['is_reply'] = 0;
|
||||
break;
|
||||
case '5':
|
||||
$data['a.status'] = -1;
|
||||
break;
|
||||
case '6':
|
||||
$data['a.status'] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($data['sec']);
|
||||
unset($data['status']);
|
||||
public function list()
|
||||
{
|
||||
$list = $this->model->getList(input('limit'),input('page'));
|
||||
$res = [];
|
||||
if($list['total']){
|
||||
foreach($list['data'] as $v) {
|
||||
$res['data'][] = [
|
||||
'id' => $v['id'],
|
||||
'poster' => $v['user']['name'],
|
||||
'avatar' => $v['user']['user_img'],
|
||||
'title' => htmlspecialchars($v['title']),
|
||||
'url' => $this->getArticleUrl($v['id'], 'index', $v['cate']['ename']),
|
||||
'content' => strip_tags($v['content']),
|
||||
'posttime' => $v['update_time'],
|
||||
'top' => $v['is_top'],
|
||||
'hot' => $v['is_hot'],
|
||||
'reply' => $v['is_reply'],
|
||||
'check' => $v['status']
|
||||
];
|
||||
|
||||
if(!empty($data['id'])){
|
||||
$data['a.id'] = $data['id'];
|
||||
unset($data['id']);
|
||||
}
|
||||
|
||||
if(!empty($data['title'])){
|
||||
$where[] = ['title', 'like', '%'.$data['title'].'%'];
|
||||
unset($data['title']);
|
||||
}
|
||||
|
||||
$map = array_filter($data,[$this,"filtr"]);
|
||||
|
||||
$forumList = Db::name('article')
|
||||
->alias('a')
|
||||
->join('user u','a.user_id = u.id')
|
||||
->join('cate c','a.cate_id = c.id')
|
||||
->field('a.id as aid,ename,appname,name,user_img,title,content,a.update_time as update_time,is_top,a.is_hot as is_hot,is_reply,a.status as status')
|
||||
->where('a.delete_time',0)
|
||||
->where($map)
|
||||
->where($where)
|
||||
->order('a.create_time', 'desc')
|
||||
->paginate(15);
|
||||
$res = [];
|
||||
$count = $forumList->total();
|
||||
if($count){
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = '';
|
||||
$res['count'] = $count;
|
||||
foreach($forumList as $k=>$v){
|
||||
$url = $this->getRouteUrl($v['aid'],$v['ename'],$v['appname']);
|
||||
$res['data'][]= [
|
||||
'id'=>$v['aid'],
|
||||
'poster'=>$v['name'],
|
||||
'avatar'=>$v['user_img'],
|
||||
'title'=>htmlspecialchars($v['title']),
|
||||
'url' => $url,
|
||||
'content' => strip_tags($v['content']),
|
||||
'posttime'=>date("Y-m-d",$v['update_time']),
|
||||
'top'=>$v['is_top'],
|
||||
'hot'=>$v['is_hot'],
|
||||
'reply'=>$v['is_reply'],
|
||||
'check'=>$v['status']
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
}
|
||||
}
|
||||
return json(['code' =>0, 'msg' => 'ok', 'count' => $list['total'], 'data' => $res['data']]);
|
||||
}
|
||||
return json(['code' =>-1, 'msg' => 'no data']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加帖子文章
|
||||
@ -142,10 +95,9 @@ class Forum extends AdminController
|
||||
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace(',',',',$data['keywords'])))));
|
||||
|
||||
// 获取分类ename,appname
|
||||
$cateName = Db::name('cate')->field('ename,appname')->find($data['cate_id']);
|
||||
$cateName = $this->model->field('ename,appname')->find($data['cate_id']);
|
||||
|
||||
$article = new Article();
|
||||
$result = $article->add($data);
|
||||
$result = $this->model->add($data);
|
||||
if ($result['code'] == 1) {
|
||||
// 获取到的最新ID
|
||||
$aid = $result['data']['id'];
|
||||
@ -162,9 +114,9 @@ class Forum extends AdminController
|
||||
// 清除文章tag缓存
|
||||
Cache::tag('tagArtDetail')->clear();
|
||||
|
||||
$link = $this->getRouteUrl((int)$aid, $cateName['ename'],$cateName['appname']);
|
||||
// 推送给百度收录接口
|
||||
$this->baiduPushUrl($link);
|
||||
$link = $this->getArticleUrl((int)$aid, 'index', $cateName['ename']);
|
||||
|
||||
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
||||
|
||||
$url = $result['data']['status'] ? $link : (string)url('index/');
|
||||
$res = Msgres::success($result['msg'], $url);
|
||||
@ -202,53 +154,47 @@ class Forum extends AdminController
|
||||
$validate = new \app\common\validate\Article();
|
||||
$res = $validate->scene('Artadd')->check($data);
|
||||
|
||||
if(true !== $res){
|
||||
return Msgres::error($validate->getError());
|
||||
} else {
|
||||
//获取内容图片音视频标识
|
||||
$iva= $this->hasIva($data['content']);
|
||||
$data = array_merge($data,$iva);
|
||||
if(!$res) return Msgres::error($validate->getError());
|
||||
//获取内容图片音视频标识
|
||||
$iva= $this->hasIva($data['content']);
|
||||
$data = array_merge($data,$iva);
|
||||
|
||||
// 处理内容
|
||||
$data['content'] = $this->downUrlPicsReaplace($data['content']);
|
||||
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
|
||||
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace(',',',',$data['keywords'])))));
|
||||
// 处理内容
|
||||
$data['content'] = $this->downUrlPicsReaplace($data['content']);
|
||||
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
|
||||
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace(',',',',$data['keywords'])))));
|
||||
|
||||
$result = $article->edit($data);
|
||||
if($result == 1) {
|
||||
//处理标签
|
||||
$artTags = Db::name('taglist')->where('article_id',$id)->column('tag_id','id');
|
||||
if(isset($tagId)) {
|
||||
$tagIdArr = explode(',',$tagId);
|
||||
foreach($artTags as $aid => $tid) {
|
||||
if(!in_array($tid,$tagIdArr)){
|
||||
//删除被取消的tag
|
||||
Db::name('taglist')->delete($aid);
|
||||
}
|
||||
$result = $article->edit($data);
|
||||
if($result == 1) {
|
||||
//处理标签
|
||||
$artTags = Db::name('taglist')->where('article_id',$id)->column('tag_id','id');
|
||||
if(isset($tagId)) {
|
||||
$tagIdArr = explode(',',$tagId);
|
||||
foreach($artTags as $aid => $tid) {
|
||||
if(!in_array($tid,$tagIdArr)){
|
||||
//删除被取消的tag
|
||||
Db::name('taglist')->delete($aid);
|
||||
}
|
||||
//查询保留的标签
|
||||
$artTags = Db::name('taglist')->where('article_id',$id)->column('tag_id');
|
||||
$tagArr = [];
|
||||
foreach($tagIdArr as $tid) {
|
||||
if(!in_array($tid, $artTags)){
|
||||
//新标签
|
||||
$tagArr[] = ['article_id'=>$data['id'],'tag_id'=>$tid,'create_time'=>time()];
|
||||
}
|
||||
}
|
||||
//更新新标签
|
||||
Db::name('taglist')->insertAll($tagArr);
|
||||
}
|
||||
//删除原有缓存显示编辑后内容
|
||||
Cache::delete('article_'.$id);
|
||||
$link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
|
||||
// 推送给百度收录接口
|
||||
$this->baiduPushUrl($link);
|
||||
$editRes = Msgres::success('edit_success',$link);
|
||||
} else {
|
||||
$editRes = Msgres::error($result);
|
||||
//查询保留的标签
|
||||
$artTags = Db::name('taglist')->where('article_id',$id)->column('tag_id');
|
||||
$tagArr = [];
|
||||
foreach($tagIdArr as $tid) {
|
||||
if(!in_array($tid, $artTags)){
|
||||
//新标签
|
||||
$tagArr[] = ['article_id'=>$data['id'],'tag_id'=>$tid,'create_time'=>time()];
|
||||
}
|
||||
}
|
||||
//更新新标签
|
||||
Db::name('taglist')->insertAll($tagArr);
|
||||
}
|
||||
return $editRes;
|
||||
//删除原有缓存显示编辑后内容
|
||||
Cache::delete('article_'.$id);
|
||||
$link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
|
||||
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
||||
return Msgres::success('edit_success',$link);
|
||||
}
|
||||
return Msgres::error($result);
|
||||
}
|
||||
|
||||
View::assign(['article'=>$article]);
|
||||
|
@ -37,6 +37,7 @@ class User extends AdminController
|
||||
if(Request::isAjax()){
|
||||
$datas = Request::only(['id','name','email','sex','status']);
|
||||
$map = array_filter($datas,[$this,'filtrArr']);
|
||||
halt($map);
|
||||
$user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->paginate([
|
||||
'list_rows' => input('limit'),
|
||||
'page' => input('page')
|
||||
@ -98,7 +99,7 @@ class User extends AdminController
|
||||
public function edit()
|
||||
{
|
||||
if(Request::isAjax()){
|
||||
$data = Request::only(['name','email','user_img','password','phone','sex']);
|
||||
$data = Request::only(['id','name','email','user_img','password','phone','sex']);
|
||||
$user = Db::name('user')->field('create_time')->find($data['id']);
|
||||
$salt = substr(md5($user['create_time']),-6);
|
||||
// 密码
|
||||
|
@ -16,14 +16,6 @@
|
||||
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
|
||||
</div>
|
||||
</div>
|
||||
<label class="layui-form-label">所属应用</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="appname" lay-filter="appname" lay-verify="required">
|
||||
{volist name="appname" id="vo"}
|
||||
<option value="{$vo}" {if($vo == $cate.appname)} selected {/if}>{$vo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类名</label>
|
||||
<div class="layui-input-block">
|
||||
@ -41,7 +33,7 @@
|
||||
<div class="layui-input-block">
|
||||
<select name="detpl" id="tpl" lay-verify="required">
|
||||
{volist name="template" id="vo"}
|
||||
<option value="{$vo}" {if($vo == $cate.detpl)} selected {/if} >{$vo}</option>
|
||||
<option value="{$vo}" >{$vo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
@ -77,7 +69,9 @@
|
||||
,form = layui.form ;
|
||||
var iconPicker = layui.iconPicker;
|
||||
var xmSelect = layui.xmSelect;
|
||||
var initPid = "{$cate.pid}";
|
||||
var initPid = 0;
|
||||
|
||||
let ADD_EDIT = "{:url('content.cate/addEdit')}";
|
||||
|
||||
//初始化图标选择
|
||||
iconPicker.render({
|
||||
@ -93,7 +87,7 @@
|
||||
|
||||
form.on('submit(cate-save)', function(data) {
|
||||
$.ajax({
|
||||
url: "{:url('content.cate/add')}",
|
||||
url: ADD_EDIT,
|
||||
data: JSON.stringify(data.field),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
@ -119,22 +113,6 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
// 根据应用名动态选择应用下模板
|
||||
form.on('select(appname)', function(data){
|
||||
var appName = data.value;
|
||||
$("#tpl").children('option').remove();
|
||||
$.post("{:url('content.cate/getAppNameView')}", {appname:appName},function (res){
|
||||
var str = '<option value="" >请选择</option>';
|
||||
for(var i=0; i < res.data.length; i++ ) {
|
||||
str += '<option value="'+ res.data[i] +'" >' + res.data[i] + '</option>';
|
||||
// $("select[name='detpl']").append('<option value="'+ arr[i] +'" >' + arr[i] + '</option>');
|
||||
}
|
||||
$("#tpl").append(str);
|
||||
// 动态select重新渲染
|
||||
form.render('select');
|
||||
})
|
||||
|
||||
});
|
||||
(function (){
|
||||
//分类菜单结构
|
||||
$.ajax({
|
||||
|
@ -16,27 +16,25 @@
|
||||
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
|
||||
</div>
|
||||
</div>
|
||||
<label class="layui-form-label">所属应用</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="appname" lay-filter="appname" lay-verify="required">
|
||||
{volist name="appname" id="vo"}
|
||||
<option value="{$vo}" {if($vo == $cate.appname)} selected {/if}>{$vo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="catename" lay-verify="required" value="{$cate.catename}" placeholder="分类名*" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">EN别名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="ename" lay-verify="required" value="{$cate.ename}" placeholder="英文名*" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="icon" placeholder="图标*" value="{$cate.icon}" id="iconPicker" lay-filter="iconPicker" style="display:none;" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">详情页模板</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="detpl" id="tpl" lay-verify="required">
|
||||
@ -45,10 +43,14 @@
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">描述</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="desc" lay-verify="required" value="{$cate.desc}" placeholder="描述*" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="sort" lay-verify="number|required" value="{$cate.sort}" placeholder="请填数字" autocomplete="off" class="layui-input">
|
||||
@ -81,6 +83,8 @@
|
||||
var iconPicker = layui.iconPicker;
|
||||
var xmSelect = layui.xmSelect;
|
||||
var initPid = "{$cate.pid}";
|
||||
|
||||
let ADD_EDIT = "{:url('content.cate/addEdit')}";
|
||||
|
||||
//初始化图标选择
|
||||
iconPicker.render({
|
||||
@ -96,7 +100,7 @@
|
||||
|
||||
form.on('submit(cate-save)', function(data) {
|
||||
$.ajax({
|
||||
url: "{:url('content.cate/edit')}",
|
||||
url: ADD_EDIT,
|
||||
data: JSON.stringify(data.field),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
@ -122,23 +126,6 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
// 根据应用名动态选择应用下模板
|
||||
form.on('select(appname)', function(data){
|
||||
var appName = data.value;
|
||||
$("#tpl").children('option').remove();
|
||||
$.post("{:url('content.cate/getAppNameView')}", {appname:appName},function (res){
|
||||
var str = '<option value="" >请选择</option>';
|
||||
for(var i=0; i < res.data.length; i++ ) {
|
||||
str += '<option value="'+ res.data[i] +'" >' + res.data[i] + '</option>';
|
||||
// $("select[name='detpl']").append('<option value="'+ arr[i] +'" >' + arr[i] + '</option>');
|
||||
}
|
||||
$("#tpl").append(str);
|
||||
// 动态select重新渲染
|
||||
form.render('select');
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
(function (){
|
||||
//分类菜单结构
|
||||
$.ajax({
|
||||
|
@ -36,8 +36,11 @@
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="cate-enable">
|
||||
<input type="checkbox" name="is_hot" value="{{d.id}}" lay-skin="primary" lay-filter="cate-enable" {{ d.is_hot == 1 ? 'checked' : '' }} />
|
||||
<script type="text/html" id="cate-hot">
|
||||
<input type="checkbox" name="is_hot" value="{{d.id}}" lay-skin="primary" lay-filter="cate-hot" {{ d.is_hot == 1 ? 'checked' : '' }} />
|
||||
</script>
|
||||
<script type="text/html" id="cate-check">
|
||||
<input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="cate-check" {{ d.status== 1 ? 'checked' : '' }} />
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="icon">
|
||||
@ -49,7 +52,7 @@
|
||||
<script>
|
||||
const CATE = "{:url('content.cate/list')}";
|
||||
const DELETE = "{:url('content.cate/delete')}";
|
||||
const ENABLE = "{:url('content.cate/hot')}";
|
||||
const CHECK = "{:url('content.cate/check')}";
|
||||
|
||||
layui.use(['table','form','jquery','treetable'],function () {
|
||||
let $ = layui.jquery;
|
||||
@ -57,19 +60,16 @@
|
||||
let form = layui.form;
|
||||
let treetable = layui.treetable;
|
||||
|
||||
|
||||
let MODULE_PATH = "operate/";
|
||||
|
||||
let cols = [
|
||||
[
|
||||
{type: 'checkbox'}
|
||||
,{field: 'catename', title: '分类名', width: 150}
|
||||
,{field: 'appname', title: '所属应用', width: 90}
|
||||
,{field: 'ename', title: 'EN别名', width: 100}
|
||||
,{field: 'detpl',title: '模板', align: 'center',width: 100}
|
||||
,{field: 'icon', title: '图标', align: 'center',width: 50, templet: '<p><i class="layui-icon {{d.icon}}"></i></p>'}
|
||||
,{field: 'is_hot', title: '热门', align: 'center',width: 50, templet: '#cate-enable'}
|
||||
,{field: 'is_hot', title: '热门', align: 'center',width: 50, templet: '#cate-hot'}
|
||||
,{field: 'desc', title: '描述', minWidth: 200}
|
||||
,{field: 'status', title: '状态', width: 80,templet:'#cate-check'}
|
||||
,{field: 'id', title: 'ID',width: 60}
|
||||
,{field: 'sort', title: '排序', width: 80, sort: true}
|
||||
,{title: '操作', width: 120, align: 'center', toolbar: '#cate-bar'}
|
||||
@ -83,7 +83,7 @@
|
||||
treeIdName: 'id',
|
||||
treePidName: 'pid',
|
||||
skin:'line',
|
||||
treeDefaultClose: true,
|
||||
treeDefaultClose: false,
|
||||
toolbar:'#cate-toolbar',
|
||||
elem: '#cate-table',
|
||||
url: CATE,
|
||||
@ -117,35 +117,29 @@
|
||||
}
|
||||
});
|
||||
|
||||
form.on('checkbox(cate-enable)', function(obj) {
|
||||
layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis);
|
||||
var status = obj.elem.checked ? 1 : 0;
|
||||
//执行用户审核
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url: ENABLE,
|
||||
data:{"id":this.value,"is_hot":status},
|
||||
dataType:'json',
|
||||
success:function(res){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg,{
|
||||
icon:res.icon,
|
||||
time:2000
|
||||
}
|
||||
//,function(){location.reload();}
|
||||
);
|
||||
} else {
|
||||
layer.open({
|
||||
title:'审核失败',
|
||||
content:res.msg,
|
||||
icon:5,
|
||||
adim:6
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
form.on('checkbox(cate-hot)', function(obj){
|
||||
layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis);
|
||||
var status = obj.elem.checked ? 1 : 0;
|
||||
$.post(CHECK,{id:this.value, name:this.name, value: status},function(res){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg,{icon:res.icon,time:2000})
|
||||
} else {
|
||||
layer.open({title:'审核失败',content:res.msg,icon:5,adim:6})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('switch(cate-check)', function(obj){
|
||||
layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis);
|
||||
var status = obj.elem.checked ? 1 : 0;
|
||||
$.post(CHECK,{id:this.value, name:this.name, value: status},function(res){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg,{icon:res.icon,time:2000})
|
||||
} else {
|
||||
layer.open({title:'审核失败',content:res.msg,icon:5,adim:6})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
window.add = function(){
|
||||
layer.open({
|
||||
@ -153,7 +147,7 @@
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: 'add.html'
|
||||
content: 'addEdit.html'
|
||||
});
|
||||
}
|
||||
|
||||
@ -163,7 +157,7 @@
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: 'edit.html?id=' + obj.data.id
|
||||
content: 'addEdit.html?id=' + obj.data.id
|
||||
});
|
||||
}
|
||||
window.remove = function(obj){
|
||||
|
@ -199,7 +199,7 @@
|
||||
form.on('switch(artStatus)', function(obj){
|
||||
//layer.tips(obj.value + ' ' + obj.elem.name + ':'+ obj.elem.checked, obj.othis);
|
||||
$.post("{:url('content.forum/check')}",{id:obj.value, name:obj.elem.name,value: obj.elem.checked ? 1 : -1},function(res){
|
||||
if(res.code == 0){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg,{icon:res.icon,time:2000})
|
||||
} else {
|
||||
layer.open({title:'审核失败',content:res.msg,icon:5,adim:6})
|
||||
|
@ -27,6 +27,8 @@ class AdminController extends \app\BaseController
|
||||
|
||||
protected $aid = '';
|
||||
|
||||
protected $appName = '';
|
||||
|
||||
/**
|
||||
* 初始化菜单
|
||||
*/
|
||||
@ -35,7 +37,10 @@ class AdminController extends \app\BaseController
|
||||
//权限auth检查
|
||||
$this->aid = Session::get('admin_id');
|
||||
//系统配置
|
||||
$this->getIndexUrl();
|
||||
$sys = $this->getSystem();
|
||||
$syscy = $sys['clevel'] ? Lang::get('Authorized') : Lang::get('Free version');
|
||||
$runTime = $this->getRunTime();
|
||||
View::assign(['domain'=>$this->getDomain(),'insurl'=>$sys['domain'],'syscy'=>$syscy,'clevel'=>$sys['clevel'],'runTime'=>$runTime]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,6 +147,65 @@ class AdminController extends \app\BaseController
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由
|
||||
* @param int $aid
|
||||
* @param string $appName
|
||||
* @param string $ename
|
||||
* @return string|void
|
||||
*/
|
||||
protected function getArticleUrl(int $aid, string $appName = 'index', string $ename = '' )
|
||||
{
|
||||
// admin管理后台 解析非admin应用路由
|
||||
//$appName = app('http')->getName();
|
||||
|
||||
$articleUrl = (string) url('article_detail', ['id' => $aid]);
|
||||
// 详情动态路由,$aid, $ename
|
||||
if(config('taoler.url_rewrite.article_as') == '<ename>/'){
|
||||
$articleUrl = (string) url('article_detail', ['id' => (int) $aid, 'ename'=> $ename]);
|
||||
}
|
||||
|
||||
// 判断应用是否绑定域名
|
||||
$app_bind = array_search($appName, config('app.domain_bind'));
|
||||
// 判断应用是否域名映射
|
||||
$app_map = array_search($appName, config('app.app_map'));
|
||||
|
||||
// 判断admin应用是否绑定域名
|
||||
$bind_admin = array_search('admin',config('app.domain_bind'));
|
||||
// 判断admin应用是否域名映射
|
||||
$map_admin = array_search('admin',config('app.app_map'));
|
||||
|
||||
//1.admin绑定了域名
|
||||
if($bind_admin) {
|
||||
// 1.应用绑定了域名
|
||||
if($app_bind) {
|
||||
return $this->getDomain() . $articleUrl;
|
||||
}
|
||||
// 2.应用进行了映射
|
||||
if($app_map){
|
||||
return $this->getDomain() . '/' . $appName . $articleUrl;
|
||||
}
|
||||
// 3.应用未绑定域名也未进行映射
|
||||
return $this->getDomain() . '/' . $appName . $articleUrl;
|
||||
}
|
||||
|
||||
//2.admin进行了映射
|
||||
if($map_admin) {
|
||||
// 1.应用绑定了域名
|
||||
if($app_bind) {
|
||||
return $this->getDomain() . str_replace($map_admin, '', $articleUrl);;
|
||||
}
|
||||
// 2.应用进行了映射
|
||||
if($app_map){
|
||||
return $this->getDomain() . str_replace($map_admin, $app_map, $articleUrl);
|
||||
}
|
||||
// 3.应用未绑定域名也未进行映射
|
||||
return $this->getDomain() . str_replace($map_admin, $appName, $articleUrl);
|
||||
}
|
||||
//3.admin未绑定域名也未映射
|
||||
return str_replace('admin', $appName, $articleUrl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -46,11 +46,6 @@ class BaseController extends BaseCtrl
|
||||
'subcatelist' => $this->showSubnav(),
|
||||
//当前登录用户
|
||||
'user' => $this->showUser($this->uid),
|
||||
//多站点
|
||||
'stationList' => $this->getStationList(),
|
||||
// 当前站点
|
||||
'city' => input('city') ?: Db::name('station')->where('master',1)->value('city_ename')
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
@ -76,10 +71,13 @@ class BaseController extends BaseCtrl
|
||||
{
|
||||
$appname = app('http')->getName();
|
||||
//1.查询分类表获取所有分类
|
||||
// $cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0, 'appname' => $appname])->cache('catename' . $appname,3600)->select()->toArray();
|
||||
$cate = new Cate();
|
||||
$cateList = $cate->menu();
|
||||
return getTree($cateList);
|
||||
$list = getTree($cateList);
|
||||
// 排序
|
||||
$cmf_arr = array_column($list, 'sort');
|
||||
array_multisort($cmf_arr, SORT_ASC, $list);
|
||||
return $list;
|
||||
}
|
||||
|
||||
// 显示子导航subnav
|
||||
@ -172,17 +170,4 @@ class BaseController extends BaseCtrl
|
||||
return $sysInfo;
|
||||
}
|
||||
|
||||
// 多站点
|
||||
protected function getStationList()
|
||||
{
|
||||
return $stationList = Db::name('station')->select()->toArray();
|
||||
}
|
||||
|
||||
//
|
||||
protected function getCity($cityname)
|
||||
{
|
||||
return Db::name('station')->field('city_name,city_ename')->where('city_ename', $cityname)->find();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -109,28 +109,24 @@ class Article extends Model
|
||||
*/
|
||||
public function getArtTop(int $num)
|
||||
{
|
||||
$artTop = Cache::get('arttop');
|
||||
// 区分应用分类
|
||||
$appCateIdArr = Cate::where(['appname' => app('http')->getName()])->column('id');
|
||||
if (!$artTop) {
|
||||
$artTop = $this::field('id,title,title_color,cate_id,user_id,create_time,is_top,pv,jie,upzip,has_img,has_video,has_audio')->where([['is_top', '=', 1], ['status', '=', 1], ['cate_id', 'in', $appCateIdArr]])
|
||||
->with([
|
||||
'cate' => function ($query) {
|
||||
$query->where('delete_time', 0)->field('id,catename,ename');
|
||||
},
|
||||
'user' => function ($query) {
|
||||
$query->field('id,name,nickname,user_img,area_id,vip');
|
||||
}
|
||||
])->withCount(['comments'])
|
||||
->order('create_time', 'desc')
|
||||
->limit($num)
|
||||
->append(['url'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
Cache::tag('tagArtDetail')->set('arttop', $artTop, 60);
|
||||
}
|
||||
return $artTop;
|
||||
|
||||
return Cache::remember('topArticle', function() use($num){
|
||||
return $this::field('id,title,title_color,cate_id,user_id,create_time,is_top,pv,upzip,has_img,has_video,has_audio')
|
||||
->where([['is_top', '=', 1], ['status', '=', 1]])
|
||||
->with([
|
||||
'cate' => function ($query) {
|
||||
$query->where('delete_time', 0)->field('id,catename,ename');
|
||||
},
|
||||
'user' => function ($query) {
|
||||
$query->field('id,name,nickname,user_img');
|
||||
}
|
||||
])->withCount(['comments'])
|
||||
->order('create_time', 'desc')
|
||||
->limit($num)
|
||||
->append(['url'])
|
||||
->select()
|
||||
->toArray();
|
||||
},60);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,29 +139,24 @@ class Article extends Model
|
||||
*/
|
||||
public function getArtList(int $num)
|
||||
{
|
||||
$artList = Cache::get('artlist');
|
||||
// 区分应用分类
|
||||
$appCateIdArr = Cate::where(['appname' => app('http')->getName()])->column('id');
|
||||
if(!$artList){
|
||||
$artList = $this::field('id,title,title_color,cate_id,user_id,create_time,is_hot,pv,jie,upzip,has_img,has_video,has_audio')
|
||||
return Cache::remember('indexArticle', function() use($num){
|
||||
return $this::field('id,title,title_color,cate_id,user_id,create_time,is_hot,pv,jie,upzip,has_img,has_video,has_audio')
|
||||
->with([
|
||||
'cate' => function($query){
|
||||
$query->where('delete_time',0)->field('id,catename,ename,detpl');
|
||||
},
|
||||
'user' => function($query){
|
||||
$query->field('id,name,nickname,user_img,area_id,vip');
|
||||
$query->field('id,name,nickname,user_img');
|
||||
} ])
|
||||
->withCount(['comments'])
|
||||
->where([['status', '=', 1], ['is_top', '=', 0],['cate_id', 'in', $appCateIdArr]])
|
||||
->where('status', '=', 1)
|
||||
->order('create_time','desc')
|
||||
->limit($num)
|
||||
->append(['url'])
|
||||
->select()
|
||||
->toArray();
|
||||
},30);
|
||||
|
||||
Cache::tag('tagArt')->set('artlist',$artList,60);
|
||||
}
|
||||
return $artList;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,17 +188,14 @@ class Article extends Model
|
||||
/**
|
||||
* 获取详情
|
||||
* @param int $id 文章id
|
||||
* @return array|mixed|Model|null
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @return mixed
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function getArtDetail(int $id)
|
||||
{
|
||||
$article = Cache::get('article_'.$id);
|
||||
if(!$article){
|
||||
return Cache::remember('article_'.$id, function() use($id){
|
||||
//查询文章
|
||||
$article = $this::field('id,title,content,status,cate_id,user_id,goods_detail_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,keywords,description,title_color,create_time,update_time')
|
||||
return $this::field('id,title,content,status,cate_id,user_id,goods_detail_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,keywords,description,title_color,create_time,update_time')
|
||||
->where(['status'=>1])
|
||||
->with([
|
||||
'cate' => function($query){
|
||||
@ -220,68 +208,54 @@ class Article extends Model
|
||||
->withCount(['comments'])
|
||||
->append(['url'])
|
||||
->find($id);
|
||||
if (!is_null($article)) {
|
||||
Cache::tag('tagArtDetail')->set('article_'.$id, $article->toArray(), 3600);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
return $article;
|
||||
}, 600);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分类列表
|
||||
* @param string $ename 分类英文名
|
||||
* 分类数据
|
||||
* @param string $ename
|
||||
* @param string $type all\top\hot\jie 分类类型
|
||||
* @param int $page 页面
|
||||
* @return mixed|\think\Paginator
|
||||
* @throws \think\db\exception\DbException
|
||||
* @param int $page
|
||||
* @return mixed
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function getCateList(string $ename, string $type, int $page = 1)
|
||||
{
|
||||
$where = [];
|
||||
// 区分应用分类
|
||||
$appCateIdArr = Cate::where(['appname' => app('http')->getName()])->column('id');
|
||||
$cateId = Cate::where('ename',$ename)->value('id');
|
||||
if($cateId){
|
||||
$where[] = ['cate_id' ,'=', $cateId];
|
||||
} else {
|
||||
if($ename != 'all'){
|
||||
// 抛出 HTTP 异常
|
||||
throw new \think\exception\HttpException(404, '异常消息');
|
||||
}
|
||||
$where[] = ['cate_id' ,'in',$appCateIdArr];
|
||||
}
|
||||
|
||||
$artList = Cache::get('arts'.$ename.$type.$page);
|
||||
if(!$artList){
|
||||
switch ($type) {
|
||||
//查询文章,15个分1页
|
||||
case 'jie':
|
||||
$where[] = ['jie','=', 1];
|
||||
break;
|
||||
case 'hot':
|
||||
$where[] = ['is_hot','=', 1];
|
||||
break;
|
||||
case 'top':
|
||||
$where[] = ['is_top' ,'=', 1];
|
||||
break;
|
||||
case 'wait':
|
||||
$where[] = ['jie','=', 0];
|
||||
break;
|
||||
switch ($type) {
|
||||
//查询文章,15个分1页
|
||||
case 'jie':
|
||||
$where[] = ['jie','=', 1];
|
||||
break;
|
||||
case 'hot':
|
||||
$where[] = ['is_hot','=', 1];
|
||||
break;
|
||||
case 'top':
|
||||
$where[] = ['is_top' ,'=', 1];
|
||||
break;
|
||||
case 'wait':
|
||||
$where[] = ['jie','=', 0];
|
||||
break;
|
||||
}
|
||||
$where[] = ['status', '=', 1];
|
||||
|
||||
}
|
||||
$artList = $this::field('id,title,content,title_color,cate_id,user_id,create_time,is_top,is_hot,pv,jie,upzip,has_img,has_video,has_audio')
|
||||
return Cache::remember('cate_list_'.$ename.$type.$page, function() use($where,$page){
|
||||
return $this::field('id,cate_id,user_id,title,content,title_color,create_time,is_top,is_hot,pv,jie,upzip,has_img,has_video,has_audio')
|
||||
->with([
|
||||
'cate' => function($query) {
|
||||
$query->where('delete_time',0)->field('id,catename,ename,appname');
|
||||
$query->field('id,catename,ename');
|
||||
},
|
||||
'user' => function($query){
|
||||
$query->field('id,name,nickname,user_img,area_id,vip');
|
||||
$query->field('id,name,nickname,user_img,vip');
|
||||
}
|
||||
])->withCount(['comments'])
|
||||
->where('status',1)
|
||||
->where($where)
|
||||
->limit(15)
|
||||
->order(['create_time'=>'desc'])
|
||||
@ -289,10 +263,7 @@ class Article extends Model
|
||||
'list_rows' => 15,
|
||||
'page' => $page
|
||||
])->append(['url'])->toArray();
|
||||
|
||||
Cache::tag('tagArtDetail')->set('arts'.$ename.$type.$page,$artList,600);
|
||||
}
|
||||
return $artList;
|
||||
}, 600);
|
||||
}
|
||||
|
||||
// 获取用户发帖列表
|
||||
@ -409,15 +380,30 @@ class Article extends Model
|
||||
return ['previous' => $previous, 'next' => $next];
|
||||
}
|
||||
|
||||
// 获取所有帖子内容
|
||||
public function getList($limit,$page)
|
||||
{
|
||||
return $this::field('id,user_id,cate_id,title,content,is_top,is_hot,is_reply,status,update_time')->with([
|
||||
'user' => function($query){
|
||||
$query->field('id,name,user_img');
|
||||
},
|
||||
'cate' => function($query){
|
||||
$query->field('id,ename');
|
||||
}
|
||||
])->paginate([
|
||||
'list_rows' => $limit,
|
||||
'page' => $page
|
||||
])->toArray();
|
||||
}
|
||||
|
||||
// 获取url
|
||||
public function getUrlAttr($value,$data)
|
||||
{
|
||||
if(config('taoler.url_rewrite.article_as') == '<ename>/') {
|
||||
$cate = Cate::field('id,ename')->find($data['cate_id']);
|
||||
return (string) url('article_detail',['id' => $data['id'],'ename' => $cate->ename]);
|
||||
} else {
|
||||
return (string) url('article_detail',['id' => $data['id']]);
|
||||
//$cate = Cate::field('id,ename')->find($data['cate_id']);
|
||||
return (string) url('article_detail',['id' => $data['id'],'ename' => $this->cate->ename]);
|
||||
}
|
||||
return (string) url('article_detail',['id' => $data['id']]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,10 +10,7 @@
|
||||
*/
|
||||
namespace app\common\model;
|
||||
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\facade\Lang;
|
||||
use think\Model;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
@ -37,42 +34,48 @@ class Cate extends Model
|
||||
return $this->field('ename,catename,detpl,desc')->where('ename',$ename)->cache('cate_'.$ename,600)->find();
|
||||
}
|
||||
|
||||
// ID查询类别信息
|
||||
public function getCateInfoById(int $id)
|
||||
{
|
||||
return $this->field('id,catename,ename,detpl,pid,icon,sort,desc')->find($id);
|
||||
}
|
||||
|
||||
// 查询子分类
|
||||
public function getSubCate(string $ename)
|
||||
{
|
||||
return $this->field('ename,catename')->where('pid', $this::where('ename', $ename)->value('id'))->select();
|
||||
}
|
||||
|
||||
// 删除类别
|
||||
/**
|
||||
* 删除分类
|
||||
* @param $id
|
||||
* @return int|string
|
||||
* @throws DbException
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function del($id)
|
||||
{
|
||||
$cates = $this->field('id,pid')->with('article')->find($id);
|
||||
$sonCate = $this->field('id,pid')->where('pid',$cates['id'])->find();
|
||||
if(empty($sonCate)) {
|
||||
$res = $cates->together(['article'])->delete();
|
||||
if($res){
|
||||
return 1;
|
||||
}else{
|
||||
return '删除分类失败';
|
||||
}
|
||||
} else {
|
||||
return '存在子分类,无法删除';
|
||||
return $res ? 1 : '删除失败';
|
||||
}
|
||||
return '存在子分类,无法删除';
|
||||
}
|
||||
|
||||
// 分类表
|
||||
public function getList()
|
||||
{
|
||||
$data = $this->field('id,pid,sort,catename,ename,detpl,icon,appname,is_hot,desc')->where(['status'=>1])->select()->toArray();
|
||||
|
||||
$data = $this->field('id,pid,sort,catename,ename,detpl,icon,status,is_hot,desc')->select()->toArray();
|
||||
if(count($data)) {
|
||||
// 排序
|
||||
$cmf_arr = array_column($data, 'sort');
|
||||
array_multisort($cmf_arr, SORT_ASC, $data);
|
||||
return json(['code'=>0,'msg'=>'ok', 'count' => count($data),'data'=>$data]);
|
||||
} else {
|
||||
return json(['code'=>-1,'msg'=>'no data','data'=>'']);
|
||||
}
|
||||
return json(['code'=>-1,'msg'=>'no data','data'=>'']);
|
||||
}
|
||||
|
||||
// 如果菜单下无内容,URl不能点击
|
||||
@ -80,12 +83,11 @@ class Cate extends Model
|
||||
{
|
||||
$appname = app('http')->getName();
|
||||
try {
|
||||
$cateList = $this->where(['status' => 1, 'appname' => $appname])
|
||||
return $this->where(['status' => 1, 'appname' => $appname])
|
||||
->cache('catename' . $appname, 3600)
|
||||
->append(['url'])
|
||||
->select()
|
||||
->toArray();
|
||||
return $cateList;
|
||||
} catch (DbException $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
@ -96,7 +98,7 @@ class Cate extends Model
|
||||
public function getUrlAttr($value,$data)
|
||||
{
|
||||
// 栏目下存在帖子,则返回正常url,否则为死链
|
||||
$articleArr = Article::where('cate_id',$data['id'])->column('id');
|
||||
$articleArr = Article::field('id')->where('cate_id', $data['id'])->find();
|
||||
if(empty($articleArr)) {
|
||||
return 'javascript:void(0);';
|
||||
}
|
||||
|
@ -292,16 +292,14 @@ class Article extends BaseController
|
||||
// 发提醒邮件
|
||||
if(Config::get('taoler.config.email_notice')) hook('mailtohook',[$this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。']);
|
||||
|
||||
$link = $this->getRouteUrl((int)$aid, $cateName['ename'], $cateName['appname']);
|
||||
// 推送给百度收录接口
|
||||
$this->baiduPushUrl($link);
|
||||
$link = $this->getRouteUrl((int)$aid, $cateName['ename']);
|
||||
|
||||
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
||||
|
||||
$url = $result['data']['status'] ? $link : (string)url('index/');
|
||||
$res = Msgres::success($result['msg'], $url);
|
||||
} else {
|
||||
$res = Msgres::error('add_error');
|
||||
return Msgres::success($result['msg'], $url);
|
||||
}
|
||||
return $res;
|
||||
return Msgres::error('add_error');
|
||||
}
|
||||
|
||||
|
||||
@ -394,14 +392,12 @@ class Article extends BaseController
|
||||
|
||||
//删除原有缓存显示编辑后内容
|
||||
Cache::delete('article_'.$id);
|
||||
$link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
|
||||
// 推送给百度收录接口
|
||||
$this->baiduPushUrl($link);
|
||||
$editRes = Msgres::success('edit_success',$link);
|
||||
} else {
|
||||
$editRes = Msgres::error($result);
|
||||
$link = $this->getRouteUrl((int) $id, $article->cate->ename);
|
||||
|
||||
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
||||
return Msgres::success('edit_success',$link);
|
||||
}
|
||||
return $editRes;
|
||||
return Msgres::error($result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,11 +423,9 @@ class Article extends BaseController
|
||||
$article = ArticleModel::find(input('id'));
|
||||
$result = $article->together(['comments'])->delete();
|
||||
if($result) {
|
||||
$res = Msgres::success('delete_success');
|
||||
} else {
|
||||
$res = Msgres::error('delete_error');
|
||||
return Msgres::success('delete_success');
|
||||
}
|
||||
return $res;
|
||||
return Msgres::error('delete_error');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,7 +65,7 @@ Route::group('art',function () use($detail_as,$cate_as){
|
||||
Route::get('tag','tag/getAllTag')->name('get_all_tag');
|
||||
Route::get('arttag','tag/getArticleTag')->name('get_art_tag');
|
||||
|
||||
Route::group(function () use($detail_as,$cate_as){
|
||||
Route::group(function () use($detail_as, $cate_as){
|
||||
// 动态路径路由会影响下面的路由,所以动态路由放下面
|
||||
Route::get($detail_as . ':id$', 'article/detail')->name('article_detail');
|
||||
Route::get($cate_as . '<ename>$','article/cate')->name('cate');
|
||||
|
@ -12,7 +12,9 @@ layui.define('fly', function(exports){
|
||||
var laytpl = layui.laytpl;
|
||||
var form = layui.form;
|
||||
var fly = layui.fly;
|
||||
|
||||
|
||||
var uid = layui.cache.user.uid;
|
||||
|
||||
var gather = {}, dom = {
|
||||
jieda: $('#jieda')
|
||||
,content: $('#L_content')
|
||||
@ -82,7 +84,7 @@ layui.define('fly', function(exports){
|
||||
data:{id: div.data('id')},
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
if(data.code === 0){
|
||||
layer.msg(data.msg,{
|
||||
icon:6,
|
||||
time:2000
|
||||
@ -163,16 +165,26 @@ layui.define('fly', function(exports){
|
||||
othis[ok ? 'removeClass' : 'addClass']('zanok');
|
||||
othis.find('em').html(ok ? (--zans) : (++zans));
|
||||
} else {
|
||||
layer.msg(res.msg);
|
||||
layer.msg(res.msg, {icon: 6});
|
||||
}
|
||||
});
|
||||
}
|
||||
,reply: function(li){ //回复
|
||||
//判断登陆
|
||||
if(uid == -1){
|
||||
layer.msg('请登录再回复', {icon: 6})
|
||||
return false;
|
||||
}
|
||||
var val = dom.content.val();
|
||||
var aite = '@'+ li.find('.fly-detail-user cite').text().replace(/\s/g, '');
|
||||
dom.content.focus()
|
||||
if(val.indexOf(aite) !== -1) return;
|
||||
dom.content.val(aite +' ' + val);
|
||||
// 切换编辑器 回复@赋值
|
||||
if(taonystatus == 0) {
|
||||
dom.content.val(aite +' ' + val);
|
||||
} else { //编辑器插件赋值
|
||||
tinymce.activeEditor.setContent(aite + ' .' + val);
|
||||
}
|
||||
}
|
||||
,accept: function(li){ //采纳
|
||||
var othis = $(this);
|
||||
@ -204,9 +216,14 @@ layui.define('fly', function(exports){
|
||||
,title: '编辑回帖'
|
||||
,area: ['738px', '310px']
|
||||
,success: function(layero){
|
||||
|
||||
if(taonystatus == 0) {
|
||||
fly.layEditor({
|
||||
elem: layero.find('textarea')
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// 编辑器
|
||||
}
|
||||
}
|
||||
}, function(value, index){
|
||||
fly.json(commentUpdateDa, {
|
||||
|
@ -149,6 +149,7 @@
|
||||
{:hook('taonyeditor')}
|
||||
<script src="/static/xm-select.js"></script>
|
||||
<script>
|
||||
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||
layui.use(["fly"], function () {
|
||||
var $ = layui.jquery,
|
||||
fly = layui.fly,
|
||||
@ -161,10 +162,10 @@
|
||||
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
var taonystatus = "{:hook('taonystatus')}";
|
||||
|
||||
// 编辑器插件启用状态
|
||||
var isShow = taonystatus ? false : true;
|
||||
if(isShow) {
|
||||
|
||||
if(taonystatus == 0) {
|
||||
$('.layui-textarea').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.attr(fly.content(html));
|
||||
@ -321,6 +322,7 @@
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 0) {
|
||||
|
||||
notify.success(data.msg, function () {
|
||||
location.href = data.url;
|
||||
});
|
||||
|
@ -89,7 +89,7 @@
|
||||
|
||||
<div class="jieda-reply">
|
||||
<span class="jieda-zan {if($vo.zan != 0)}zanok{/if}" type="zan"><i class="iconfont icon-zan"></i><em>{$vo.zan}</em>赞</span>
|
||||
<span type="reply"><i class="iconfont icon-svgmoban53"></i>{:lang('reply')}</span>
|
||||
<span type="reply" id="user-reply"><i class="iconfont icon-svgmoban53"></i>{:lang('reply')}</span>
|
||||
{//评论 编辑/删除/采纳/权限}
|
||||
<div class="jieda-admin">
|
||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
||||
@ -101,7 +101,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin: 5px 0px;">
|
||||
<hr width="90%" style="border:1px dotted red;height:1px" />
|
||||
<hr style="border:1px dotted red;height:1px;width:90%" />
|
||||
<div>{$vo.user.sign|raw}</div>
|
||||
</div>
|
||||
</li>
|
||||
@ -203,6 +203,7 @@
|
||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||
langCollection = "{:lang('collection')}",
|
||||
langCancelCollection = "{:lang('cancel collection')}";
|
||||
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||
|
||||
layui.use(["fly", "face", "colorpicker", "laypage"], function () {
|
||||
var $ = layui.jquery,
|
||||
@ -214,10 +215,9 @@
|
||||
laypage = layui.laypage;
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
var taonystatus = "{:hook('taonystatus')}";
|
||||
// 编辑器插件启用状态
|
||||
var isShow = taonystatus ? false : true;
|
||||
if(isShow) {
|
||||
|
||||
// 编辑器插件禁用状态,用原方式解析网页
|
||||
if(taonystatus == 0) {
|
||||
$('.detail-body').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.html(fly.content(html));
|
||||
@ -282,7 +282,7 @@
|
||||
form.on("submit(user-comment)", function (data) {
|
||||
var index = layer.load(1);
|
||||
var filed = data.field;
|
||||
if (uid == -1) {
|
||||
if (uid === -1) {
|
||||
layer.msg("请先登陆", { icon: 5, time: 2000 }, function () {
|
||||
location.href = "{:url('login/index')}";
|
||||
});
|
||||
@ -348,7 +348,7 @@
|
||||
{include file="/public/images-click" /}
|
||||
{:hook('markdownhook')}
|
||||
{include file="/public/qr-read" /}
|
||||
|
||||
|
||||
{volist name="push_js" id="vo"} {$vo.jscode|raw} {/volist}
|
||||
{/block}
|
||||
|
||||
|
@ -303,6 +303,7 @@ var collectionFind = "{:url('Collection/find')}",
|
||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||
langCollection = "{:lang('collection')}",
|
||||
langCancelCollection = "{:lang('cancel collection')}";
|
||||
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||
|
||||
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
||||
var $ = layui.jquery
|
||||
@ -315,10 +316,9 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
||||
var id = "{$article.id}";
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
var taonystatus = "{:hook('taonystatus')}";
|
||||
|
||||
// 编辑器插件启用状态
|
||||
var isShow = taonystatus ? false : true;
|
||||
if(isShow) {
|
||||
if(taonystatus == 0) {
|
||||
$('.detail-body').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.html(fly.content(html));
|
||||
@ -326,7 +326,7 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
||||
}
|
||||
|
||||
//加载评论编辑器
|
||||
if(isShow == false) {
|
||||
if(taonystatus == 1) {
|
||||
$("#comment-edit").attr('type','');
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,6 @@
|
||||
<div class="fly-list-info">
|
||||
{if config('taoler.config.cate_show') == 1}
|
||||
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
|
||||
{/if}
|
||||
{if config('taoler.config.area_show') == 1}
|
||||
<span class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</span>
|
||||
{/if}
|
||||
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
|
||||
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||
|
@ -39,7 +39,6 @@
|
||||
</a>
|
||||
<div class="fly-detail-user">
|
||||
<a href="{$Request.domain}{:url('user/home',['id'=>$article.user.id])}" class="fly-link">
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($article.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
||||
</a>
|
||||
<span class="layui-btn layui-btn-xs guanzhu" >关注</span>
|
||||
@ -94,7 +93,6 @@
|
||||
</a>
|
||||
<div class="fly-detail-user">
|
||||
<a href="{:url('user/home',['id'=>$vo.user.id])}" class="fly-link">
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($vo.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$vo.user.nickname ?: $vo.user.name}</cite>
|
||||
</a>
|
||||
{if condition="$article.user.id eq $vo.user.id"}<span>({:lang('poster')})</span>{/if}
|
||||
|
@ -27,9 +27,6 @@
|
||||
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
|
||||
{/if}
|
||||
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
|
||||
{if config('taoler.config.area_show') == 1}
|
||||
<span class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</span>
|
||||
{/if}
|
||||
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||
<i>{$art.create_time|date='Y-m-d'}</i>
|
||||
</a>
|
||||
|
@ -80,6 +80,7 @@
|
||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||
langCollection = "{:lang('collection')}",
|
||||
langCancelCollection = "{:lang('cancel collection')}";
|
||||
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||
|
||||
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
||||
var $ = layui.jquery
|
||||
@ -91,10 +92,9 @@
|
||||
,laypage = layui.laypage;
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
var taonystatus = "{:hook('taonystatus')}";
|
||||
|
||||
// 编辑器插件启用状态
|
||||
var isShow = taonystatus ? false : true;
|
||||
if(isShow) {
|
||||
if(taonystatus == 0) {
|
||||
$('.detail-body').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.html(fly.content(html));
|
||||
|
@ -32,9 +32,6 @@
|
||||
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
|
||||
{/if}
|
||||
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
|
||||
{if config('taoler.config.area_show') == 1}
|
||||
<span class="layui-badge layui-bg-green " title="来自哪简称">{:getAsing($art.user.area_id) ?: '无'}</span>
|
||||
{/if}
|
||||
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||
<i>{$art.create_time|date='Y-m-d'}</i>
|
||||
</a>
|
||||
|
@ -40,7 +40,6 @@
|
||||
</a>
|
||||
<div class="fly-detail-user">
|
||||
<a href="{$Request.domain}{:url('user/home',['id'=>$article.user.id])}" class="fly-link">
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($article.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
||||
</a>
|
||||
<span class="layui-btn layui-btn-xs guanzhu" >关注</span>
|
||||
@ -97,7 +96,6 @@
|
||||
</a>
|
||||
<div class="fly-detail-user">
|
||||
<a href="{$Request.domain}{:url('user/home',['id'=>$vo.user.id])}" class="fly-link">
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($vo.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$vo.user.nickname ?: $vo.user.name}</cite>
|
||||
</a>
|
||||
{if condition="$article.user.id eq $vo.user.id"}<span>({:lang('poster')})</span>{/if}
|
||||
@ -221,6 +219,7 @@ var collectionFind = "{:url('Collection/find')}",
|
||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||
langCollection = "{:lang('collection')}",
|
||||
langCancelCollection = "{:lang('cancel collection')}";
|
||||
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||
|
||||
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
||||
var $ = layui.jquery
|
||||
@ -235,8 +234,7 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
var taonystatus = "{:hook('taonystatus')}";
|
||||
// 编辑器插件启用状态
|
||||
var isShow = taonystatus ? false : true;
|
||||
if(isShow) {
|
||||
if(taonystatus == 0) {
|
||||
$('.detail-body').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.html(fly.content(html));
|
||||
|
@ -33,9 +33,9 @@
|
||||
<script src="/static/notify.js"></script>
|
||||
<!-- 样式 -->
|
||||
<link rel="canonical" href="{$Request.domain}{$Request.url}">
|
||||
<link rel="stylesheet" href="https://at.alicdn.com/t/font_24081_qs69ykjbea.css" />
|
||||
<link rel="stylesheet" href="{$Request.domain}/static/layui/css/layui.css" charset="utf-8">
|
||||
<link rel="stylesheet" href="{$Request.domain}/static/res/css/global.css" charset="utf-8">
|
||||
<link rel="stylesheet" href="{$Request.domain}/static/res/css/font_24081_qs69ykjbea.css" />
|
||||
<link rel="stylesheet" href="{$Request.domain}/static/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="{$Request.domain}/static/res/css/global.css">
|
||||
{block name="link"}{/block}
|
||||
<!-- 5+ 引擎环境下自动隐藏无关元素,适配App -->
|
||||
<style>
|
||||
|
@ -10,7 +10,7 @@
|
||||
{//导航nav}
|
||||
{volist name="cateList" id="cate"}
|
||||
<li class="layui-nav-item {if($cate.ename eq $Request.param.ename)} layui-this {/if}" >
|
||||
<a href="{$cate.url}">{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</a> {if condition="$cate.is_hot eq 1"} <span class="layui-badge-dot"></span> {/if}
|
||||
<a href="{$cate.url}">{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename} {if condition="$cate.is_hot eq 1"} <span class="layui-badge-dot"></span> {/if}</a>
|
||||
{notempty name="cate.children"}
|
||||
<dl class="layui-nav-child"> <!-- 二级菜单 -->
|
||||
{volist name="cate.children" id="vo2"}
|
||||
|
@ -7,9 +7,6 @@
|
||||
{if config('taoler.config.cate_show') == 1}
|
||||
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
|
||||
{/if}
|
||||
{if config('taoler.config.area_show') == 1}
|
||||
<i class="layui-badge layui-bg-green" title="归属地简称">{:getAsing($art.user.area_id) ?: '无'}</i>
|
||||
{/if}
|
||||
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
|
||||
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||
</a>
|
||||
|
@ -2,22 +2,13 @@
|
||||
<a href="{$Request.domain}{:url('user/home',['id'=>$top.user_id])}" class="fly-avatar">
|
||||
<img src="{$Request.domain}{$top.user.user_img}" alt="{$top.user.name}">
|
||||
</a>
|
||||
<h2><a href="{$Request.domain}{$top.url}" style="color:{$top.title_color};">{$top.title}</a></h2>
|
||||
<h2><a href="{$Request.domain}{$top.url}" style="color:{$top.title_color ?? ''};">{$top.title}</a></h2>
|
||||
<div class="fly-list-info">
|
||||
{if config('taoler.config.cate_show') == 1}
|
||||
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $top.cate.ename : $top.cate.catename}</a>
|
||||
{/if}
|
||||
{if config('taoler.config.area_show') == 1}
|
||||
<i class="layui-badge layui-bg-green" title="归属地简称">{:getAsing($top.user.area_id) ?: '无'}</i>
|
||||
{/if}
|
||||
<a href="{$Request.domain}{:url('user/home',['id'=>$top.user_id])}" link>
|
||||
<cite>{$top.user.nickname ?: $top.user.name}</cite>
|
||||
<!--
|
||||
<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
||||
{if($top.user.vip > 0)}
|
||||
<i class="layui-badge fly-badge-vip">vip{$top.user.vip}</i>
|
||||
{/if}
|
||||
-->
|
||||
</a>
|
||||
<i>{$top.create_time|date='Y-m-d'}</i>
|
||||
{$top.has_img ?= '<span><i class="layui-icon layui-icon-picture" style="color: #5FB878;"></i></span>'}
|
||||
@ -25,9 +16,6 @@
|
||||
{$top.has_audio ?= '<span><i class="layui-icon layui-icon-speaker" style="color: #000000;"></i></span>'}
|
||||
{$top.upzip ?= '<span><i class="layui-icon layui-icon-file-b" style="color: #009688;" title="附件"></i></span>'}
|
||||
<span class=" layui-hide-xs" title="浏览"> <i class="iconfont" title="浏览"></i> {$top.pv} </span>
|
||||
{if ($top.jie == 1)}
|
||||
<span class="layui-badge fly-badge-accept layui-hide-xs">{:lang('end')}</span>
|
||||
{/if}
|
||||
<span class="fly-list-nums"><i class="iconfont icon-pinglun1" title="回答"></i> {$top.comments_count}</span>
|
||||
</div>
|
||||
<div class="fly-list-badge">
|
||||
|
@ -15,7 +15,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="keywords" content="TaoLer社区">
|
||||
<meta name="description" content="TaoLer社区是模块化前端UI框架社区,致力于为web开发提供强劲动力">
|
||||
<link rel="stylesheet" href="https://at.alicdn.com/t/font_24081_qs69ykjbea.css" />
|
||||
<link rel="stylesheet" href="{$Request.domain}/static/res/css/font_24081_qs69ykjbea.css" />
|
||||
<link rel="stylesheet" href="{$Request.domain}/static/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="{$Request.domain}/static/res/css/global.css">
|
||||
{block name="css"}{/block}
|
||||
|
Loading…
Reference in New Issue
Block a user