2.2.5
This commit is contained in:
parent
53303f2650
commit
2047a80ceb
@ -213,17 +213,15 @@ abstract class BaseController
|
|||||||
return $htpw;
|
return $htpw;
|
||||||
}
|
}
|
||||||
|
|
||||||
//得到当前系统安装前台域名
|
protected function getDomain()
|
||||||
protected function getIndexUrl()
|
|
||||||
{
|
{
|
||||||
$sys = $this->getSystem();
|
return $this->getHttpUrl($this->getSystem()['domain']);
|
||||||
$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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行时间计算
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
protected function getRunTime()
|
protected function getRunTime()
|
||||||
{
|
{
|
||||||
//运行时间
|
//运行时间
|
||||||
@ -242,78 +240,28 @@ abstract class BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文章链接地址
|
* 非admin应用的文章url路由地址
|
||||||
* @param int $aid 文章id
|
* @param int $aid
|
||||||
* @param string $ename 所属分类ename
|
* @param $ename
|
||||||
* @param string $appname 所属应用名
|
|
||||||
* @return string
|
* @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>/'){
|
if(config('taoler.url_rewrite.article_as') == '<ename>/'){
|
||||||
// 分类可变路由
|
$articleUrl = (string) url('article_detail', ['id' => (int) $aid, 'ename'=> $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');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断index应用是否绑定域名
|
// // 判断应用是否绑定域名
|
||||||
$bind_index = array_search($appname, config('app.domain_bind'));
|
// $app_bind = array_search($appName, config('app.domain_bind'));
|
||||||
// 判断index应用是否域名映射
|
// // 判断应用是否域名映射
|
||||||
$map_index = array_search($appname, config('app.app_map'));
|
// $app_map = array_search($appName, config('app.app_map'));
|
||||||
// article 所属应用名
|
|
||||||
$index = $map_index ?: $appname; // index应用名
|
|
||||||
|
|
||||||
// 判断是否开启绑定
|
//a.appName不是admin
|
||||||
//$domain_bind = array_key_exists('domain_bind',config('app'));
|
return $domain . $articleUrl;
|
||||||
|
|
||||||
// 判断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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -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 = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_DIRNAME);
|
||||||
$dirname = date('Ymd',time());
|
$dirname = date('Ymd',time());
|
||||||
//路径
|
//路径
|
||||||
$path = 'storage/' . $this->uid . '/article_pic/' . $dirname . '/';
|
$path = 'storage/download/article_pic/' . $dirname . '/';
|
||||||
//绝对文件夹
|
//绝对文件夹
|
||||||
$fileDir = public_path() . $path;
|
$fileDir = public_path() . $path;
|
||||||
//文件绝对路径
|
//文件绝对路径
|
||||||
@ -602,4 +523,42 @@ abstract class BaseController
|
|||||||
return $content;
|
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
|
<?php
|
||||||
/**
|
/*
|
||||||
* @Program: TaoLer 2023/3/14
|
* @Program: TaoLer 2023/3/14
|
||||||
* @FilePath: app\admin\controller\content\Cate.php
|
* @FilePath: app\admin\controller\content\Cate.php
|
||||||
* @Description: Cate
|
* @Description: Cate 分类菜单
|
||||||
* @LastEditTime: 2023-03-14 15:40:53
|
* @LastEditTime: 2023-03-14 15:40:53
|
||||||
* @Author: Taoker <317927823@qq.com>
|
* @Author: Taoker <317927823@qq.com>
|
||||||
* @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
|
* @Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
|
||||||
@ -11,59 +11,42 @@
|
|||||||
namespace app\admin\controller\content;
|
namespace app\admin\controller\content;
|
||||||
|
|
||||||
use app\common\controller\AdminController;
|
use app\common\controller\AdminController;
|
||||||
|
use think\App;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\facade\Cache;
|
|
||||||
use taoler\com\Files;
|
use taoler\com\Files;
|
||||||
use app\common\lib\Msgres;
|
use app\common\lib\Msgres;
|
||||||
use app\common\model\Article;
|
|
||||||
use app\common\model\Cate as CateModel;
|
use app\common\model\Cate as CateModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Cate extends AdminController
|
class Cate extends AdminController
|
||||||
{
|
{
|
||||||
|
protected $model;
|
||||||
|
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
parent::__construct($app);
|
||||||
|
$this->model = new CateModel();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 浏览
|
* 浏览
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
//详情模板
|
|
||||||
$sys = $this->getSystem();
|
|
||||||
$template = Files::getDirName('../view/'.$sys['template'].'/index/article/');
|
|
||||||
View::assign(['template'=>$template]);
|
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
//帖子分类
|
//帖子分类
|
||||||
public function list()
|
public function list()
|
||||||
{
|
{
|
||||||
$cate = new CateModel();
|
return $this->model->getList();
|
||||||
if(Request::isAjax()){
|
|
||||||
return $cate->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()
|
public function addEdit()
|
||||||
{
|
{
|
||||||
$addOrEdit = !is_null(input('id'));//true是编辑false新增
|
$addOrEdit = !is_null(input('id'));//true是编辑false新增
|
||||||
@ -72,132 +55,55 @@ class Cate extends AdminController
|
|||||||
$data = Request::param();
|
$data = Request::param();
|
||||||
if(isset($data['id']) && $data['pid'] == $data['id']) return json(['code'=>-1,'msg'=> $msg.'不能作为自己的子类']);
|
if(isset($data['id']) && $data['pid'] == $data['id']) return json(['code'=>-1,'msg'=> $msg.'不能作为自己的子类']);
|
||||||
$list = Db::name('cate')->cache('catename')->save($data);
|
$list = Db::name('cate')->cache('catename')->save($data);
|
||||||
|
|
||||||
if($list){
|
if($list){
|
||||||
return json(['code'=>0,'msg'=> $msg.'分类成功']);
|
return json(['code'=>0,'msg'=> $msg.'成功']);
|
||||||
}else{
|
|
||||||
return json(['code'=>-1,'msg'=> $msg.'分类失败']);
|
|
||||||
}
|
}
|
||||||
|
return json(['code'=>-1,'msg'=> $msg.'失败']);
|
||||||
}
|
}
|
||||||
//详情模板
|
//详情模板
|
||||||
$sys = $this->getSystem();
|
$template = $this->getIndexTpl();
|
||||||
$template = Files::getDirName('../view/'.$sys['template'].'/index/article/');
|
|
||||||
// 如果是新增,pid=0,detpl默认第一个子模块,如果是编辑,查询出cate
|
// 如果是新增,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'];
|
$cate = $addOrEdit ? $this->model->getCateInfoById((int) input('id')) : '';
|
||||||
// app下前台带模板的应用
|
$view = $addOrEdit ? 'edit' : 'add';
|
||||||
$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([
|
||||||
public function add()
|
'template' => $template,
|
||||||
{
|
'cate' => $cate
|
||||||
$addOrEdit = !is_null(input('id'));//true是编辑false新增
|
]);
|
||||||
|
return View::fetch($view);
|
||||||
if(Request::isAjax()) {
|
|
||||||
$data = Request::param();
|
|
||||||
if(isset($data['id']) && $data['pid'] == $data['id']) return json(['code'=>-1,'msg'=> '不能作为自己的子类']);
|
|
||||||
$list = Db::name('cate')->cache('catename')->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 = ['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 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除帖子分类
|
//删除帖子分类
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
if(Request::isAjax()){
|
$result = $this->model->del(input('id'));
|
||||||
$id = Request::param('id');
|
|
||||||
$cate = new CateModel;
|
|
||||||
$result = $cate->del($id);
|
|
||||||
if($result == 1){
|
if($result == 1){
|
||||||
return json(['code'=>0,'msg'=>'删除分类成功']);
|
return json(['code'=>0,'msg'=>'删除分类成功']);
|
||||||
}else{
|
|
||||||
return json(['code'=>-1,'msg'=>$result]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return json(['code'=>-1,'msg' => $result]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 动态审核
|
||||||
//帖子分类开启热点
|
public function check()
|
||||||
//评论审核
|
|
||||||
public function hot()
|
|
||||||
{
|
{
|
||||||
$data = Request::only(['id','is_hot']);
|
$param = Request::only(['id','name','value']);
|
||||||
$cate = Db::name('cate')->save($data);
|
$data = ['id'=>$param['id'],$param['name']=>$param['value']];
|
||||||
if($cate){
|
//获取状态
|
||||||
if($data['is_hot'] == 1){
|
$res = Db::name('cate')->save($data);
|
||||||
return json(['code'=>0,'msg'=>'设置热点成功','icon'=>6]);
|
if($res){
|
||||||
} else {
|
return json(['code'=>0,'msg'=>'设置成功','icon'=>6]);
|
||||||
return json(['code'=>0,'msg'=>'取消热点显示','icon'=>5]);
|
|
||||||
}
|
}
|
||||||
}else{
|
return json(['code'=>-1,'msg'=>'设置失败']);
|
||||||
$res = ['code'=>-1,'msg'=>'热点设置失败'];
|
|
||||||
}
|
|
||||||
return json($res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//array_filter过滤函数
|
/**
|
||||||
public function filtr($arr){
|
* index/view/article下模板文件
|
||||||
if($arr === '' || $arr === null){
|
* @return array
|
||||||
return false;
|
*/
|
||||||
}
|
protected function getIndexTpl() :array
|
||||||
return true;
|
{
|
||||||
|
$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\controller\AdminController;
|
||||||
use app\common\model\Article;
|
use app\common\model\Article;
|
||||||
|
use think\App;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@ -23,6 +24,14 @@ use think\response\Json;
|
|||||||
|
|
||||||
class Forum extends AdminController
|
class Forum extends AdminController
|
||||||
{
|
{
|
||||||
|
protected $model;
|
||||||
|
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
parent::__construct($app);
|
||||||
|
$this->model = new Article();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 浏览
|
* 浏览
|
||||||
* @return string
|
* @return string
|
||||||
@ -32,86 +41,30 @@ class Forum extends AdminController
|
|||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
//帖子列表
|
|
||||||
public function list()
|
public function list()
|
||||||
{
|
{
|
||||||
if(Request::isAjax()){
|
$list = $this->model->getList(input('limit'),input('page'));
|
||||||
$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']);
|
|
||||||
|
|
||||||
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 = [];
|
$res = [];
|
||||||
$count = $forumList->total();
|
if($list['total']){
|
||||||
if($count){
|
foreach($list['data'] as $v) {
|
||||||
$res['code'] = 0;
|
$res['data'][] = [
|
||||||
$res['msg'] = '';
|
'id' => $v['id'],
|
||||||
$res['count'] = $count;
|
'poster' => $v['user']['name'],
|
||||||
foreach($forumList as $k=>$v){
|
'avatar' => $v['user']['user_img'],
|
||||||
$url = $this->getRouteUrl($v['aid'],$v['ename'],$v['appname']);
|
'title' => htmlspecialchars($v['title']),
|
||||||
$res['data'][]= [
|
'url' => $this->getArticleUrl($v['id'], 'index', $v['cate']['ename']),
|
||||||
'id'=>$v['aid'],
|
|
||||||
'poster'=>$v['name'],
|
|
||||||
'avatar'=>$v['user_img'],
|
|
||||||
'title'=>htmlspecialchars($v['title']),
|
|
||||||
'url' => $url,
|
|
||||||
'content' => strip_tags($v['content']),
|
'content' => strip_tags($v['content']),
|
||||||
'posttime'=>date("Y-m-d",$v['update_time']),
|
'posttime' => $v['update_time'],
|
||||||
'top'=>$v['is_top'],
|
'top' => $v['is_top'],
|
||||||
'hot'=>$v['is_hot'],
|
'hot' => $v['is_hot'],
|
||||||
'reply'=>$v['is_reply'],
|
'reply' => $v['is_reply'],
|
||||||
'check'=>$v['status']
|
'check' => $v['status']
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
return json(['code' =>0, 'msg' => 'ok', 'count' => $list['total'], 'data' => $res['data']]);
|
||||||
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
|
|
||||||
}
|
|
||||||
return json($res);
|
|
||||||
}
|
}
|
||||||
|
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'])))));
|
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace(',',',',$data['keywords'])))));
|
||||||
|
|
||||||
// 获取分类ename,appname
|
// 获取分类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 = $this->model->add($data);
|
||||||
$result = $article->add($data);
|
|
||||||
if ($result['code'] == 1) {
|
if ($result['code'] == 1) {
|
||||||
// 获取到的最新ID
|
// 获取到的最新ID
|
||||||
$aid = $result['data']['id'];
|
$aid = $result['data']['id'];
|
||||||
@ -162,9 +114,9 @@ class Forum extends AdminController
|
|||||||
// 清除文章tag缓存
|
// 清除文章tag缓存
|
||||||
Cache::tag('tagArtDetail')->clear();
|
Cache::tag('tagArtDetail')->clear();
|
||||||
|
|
||||||
$link = $this->getRouteUrl((int)$aid, $cateName['ename'],$cateName['appname']);
|
$link = $this->getArticleUrl((int)$aid, 'index', $cateName['ename']);
|
||||||
// 推送给百度收录接口
|
|
||||||
$this->baiduPushUrl($link);
|
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
||||||
|
|
||||||
$url = $result['data']['status'] ? $link : (string)url('index/');
|
$url = $result['data']['status'] ? $link : (string)url('index/');
|
||||||
$res = Msgres::success($result['msg'], $url);
|
$res = Msgres::success($result['msg'], $url);
|
||||||
@ -202,9 +154,7 @@ class Forum extends AdminController
|
|||||||
$validate = new \app\common\validate\Article();
|
$validate = new \app\common\validate\Article();
|
||||||
$res = $validate->scene('Artadd')->check($data);
|
$res = $validate->scene('Artadd')->check($data);
|
||||||
|
|
||||||
if(true !== $res){
|
if(!$res) return Msgres::error($validate->getError());
|
||||||
return Msgres::error($validate->getError());
|
|
||||||
} else {
|
|
||||||
//获取内容图片音视频标识
|
//获取内容图片音视频标识
|
||||||
$iva= $this->hasIva($data['content']);
|
$iva= $this->hasIva($data['content']);
|
||||||
$data = array_merge($data,$iva);
|
$data = array_merge($data,$iva);
|
||||||
@ -241,14 +191,10 @@ class Forum extends AdminController
|
|||||||
//删除原有缓存显示编辑后内容
|
//删除原有缓存显示编辑后内容
|
||||||
Cache::delete('article_'.$id);
|
Cache::delete('article_'.$id);
|
||||||
$link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
|
$link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
|
||||||
// 推送给百度收录接口
|
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
||||||
$this->baiduPushUrl($link);
|
return Msgres::success('edit_success',$link);
|
||||||
$editRes = Msgres::success('edit_success',$link);
|
|
||||||
} else {
|
|
||||||
$editRes = Msgres::error($result);
|
|
||||||
}
|
|
||||||
return $editRes;
|
|
||||||
}
|
}
|
||||||
|
return Msgres::error($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
View::assign(['article'=>$article]);
|
View::assign(['article'=>$article]);
|
||||||
|
@ -37,6 +37,7 @@ class User extends AdminController
|
|||||||
if(Request::isAjax()){
|
if(Request::isAjax()){
|
||||||
$datas = Request::only(['id','name','email','sex','status']);
|
$datas = Request::only(['id','name','email','sex','status']);
|
||||||
$map = array_filter($datas,[$this,'filtrArr']);
|
$map = array_filter($datas,[$this,'filtrArr']);
|
||||||
|
halt($map);
|
||||||
$user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->paginate([
|
$user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->paginate([
|
||||||
'list_rows' => input('limit'),
|
'list_rows' => input('limit'),
|
||||||
'page' => input('page')
|
'page' => input('page')
|
||||||
@ -98,7 +99,7 @@ class User extends AdminController
|
|||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
if(Request::isAjax()){
|
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']);
|
$user = Db::name('user')->field('create_time')->find($data['id']);
|
||||||
$salt = substr(md5($user['create_time']),-6);
|
$salt = substr(md5($user['create_time']),-6);
|
||||||
// 密码
|
// 密码
|
||||||
|
@ -16,14 +16,6 @@
|
|||||||
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
|
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
|
||||||
</div>
|
</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">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">分类名</label>
|
<label class="layui-form-label">分类名</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
@ -41,7 +33,7 @@
|
|||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<select name="detpl" id="tpl" lay-verify="required">
|
<select name="detpl" id="tpl" lay-verify="required">
|
||||||
{volist name="template" id="vo"}
|
{volist name="template" id="vo"}
|
||||||
<option value="{$vo}" {if($vo == $cate.detpl)} selected {/if} >{$vo}</option>
|
<option value="{$vo}" >{$vo}</option>
|
||||||
{/volist}
|
{/volist}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -77,7 +69,9 @@
|
|||||||
,form = layui.form ;
|
,form = layui.form ;
|
||||||
var iconPicker = layui.iconPicker;
|
var iconPicker = layui.iconPicker;
|
||||||
var xmSelect = layui.xmSelect;
|
var xmSelect = layui.xmSelect;
|
||||||
var initPid = "{$cate.pid}";
|
var initPid = 0;
|
||||||
|
|
||||||
|
let ADD_EDIT = "{:url('content.cate/addEdit')}";
|
||||||
|
|
||||||
//初始化图标选择
|
//初始化图标选择
|
||||||
iconPicker.render({
|
iconPicker.render({
|
||||||
@ -93,7 +87,7 @@
|
|||||||
|
|
||||||
form.on('submit(cate-save)', function(data) {
|
form.on('submit(cate-save)', function(data) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{:url('content.cate/add')}",
|
url: ADD_EDIT,
|
||||||
data: JSON.stringify(data.field),
|
data: JSON.stringify(data.field),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
@ -119,22 +113,6 @@
|
|||||||
return false;
|
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 (){
|
(function (){
|
||||||
//分类菜单结构
|
//分类菜单结构
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -16,27 +16,25 @@
|
|||||||
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
|
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
|
||||||
</div>
|
</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">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">分类名</label>
|
<label class="layui-form-label">分类名</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" name="catename" lay-verify="required" value="{$cate.catename}" placeholder="分类名*" autocomplete="off" class="layui-input">
|
<input type="text" name="catename" lay-verify="required" value="{$cate.catename}" placeholder="分类名*" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">EN别名</label>
|
<label class="layui-form-label">EN别名</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" name="ename" lay-verify="required" value="{$cate.ename}" placeholder="英文名*" autocomplete="off" class="layui-input">
|
<input type="text" name="ename" lay-verify="required" value="{$cate.ename}" placeholder="英文名*" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">图标</label>
|
<label class="layui-form-label">图标</label>
|
||||||
<div class="layui-input-block">
|
<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">
|
<input type="text" name="icon" placeholder="图标*" value="{$cate.icon}" id="iconPicker" lay-filter="iconPicker" style="display:none;" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">详情页模板</label>
|
<label class="layui-form-label">详情页模板</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<select name="detpl" id="tpl" lay-verify="required">
|
<select name="detpl" id="tpl" lay-verify="required">
|
||||||
@ -45,10 +43,14 @@
|
|||||||
{/volist}
|
{/volist}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">描述</label>
|
<label class="layui-form-label">描述</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" name="desc" lay-verify="required" value="{$cate.desc}" placeholder="描述*" autocomplete="off" class="layui-input">
|
<input type="text" name="desc" lay-verify="required" value="{$cate.desc}" placeholder="描述*" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">排序</label>
|
<label class="layui-form-label">排序</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" name="sort" lay-verify="number|required" value="{$cate.sort}" placeholder="请填数字" autocomplete="off" class="layui-input">
|
<input type="text" name="sort" lay-verify="number|required" value="{$cate.sort}" placeholder="请填数字" autocomplete="off" class="layui-input">
|
||||||
@ -82,6 +84,8 @@
|
|||||||
var xmSelect = layui.xmSelect;
|
var xmSelect = layui.xmSelect;
|
||||||
var initPid = "{$cate.pid}";
|
var initPid = "{$cate.pid}";
|
||||||
|
|
||||||
|
let ADD_EDIT = "{:url('content.cate/addEdit')}";
|
||||||
|
|
||||||
//初始化图标选择
|
//初始化图标选择
|
||||||
iconPicker.render({
|
iconPicker.render({
|
||||||
elem: '#iconPicker',
|
elem: '#iconPicker',
|
||||||
@ -96,7 +100,7 @@
|
|||||||
|
|
||||||
form.on('submit(cate-save)', function(data) {
|
form.on('submit(cate-save)', function(data) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{:url('content.cate/edit')}",
|
url: ADD_EDIT,
|
||||||
data: JSON.stringify(data.field),
|
data: JSON.stringify(data.field),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
@ -122,23 +126,6 @@
|
|||||||
return false;
|
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 (){
|
(function (){
|
||||||
//分类菜单结构
|
//分类菜单结构
|
||||||
$.ajax({
|
$.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>
|
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" id="cate-enable">
|
<script type="text/html" id="cate-hot">
|
||||||
<input type="checkbox" name="is_hot" value="{{d.id}}" lay-skin="primary" lay-filter="cate-enable" {{ d.is_hot == 1 ? 'checked' : '' }} />
|
<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>
|
||||||
|
|
||||||
<script type="text/html" id="icon">
|
<script type="text/html" id="icon">
|
||||||
@ -49,7 +52,7 @@
|
|||||||
<script>
|
<script>
|
||||||
const CATE = "{:url('content.cate/list')}";
|
const CATE = "{:url('content.cate/list')}";
|
||||||
const DELETE = "{:url('content.cate/delete')}";
|
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 () {
|
layui.use(['table','form','jquery','treetable'],function () {
|
||||||
let $ = layui.jquery;
|
let $ = layui.jquery;
|
||||||
@ -57,19 +60,16 @@
|
|||||||
let form = layui.form;
|
let form = layui.form;
|
||||||
let treetable = layui.treetable;
|
let treetable = layui.treetable;
|
||||||
|
|
||||||
|
|
||||||
let MODULE_PATH = "operate/";
|
|
||||||
|
|
||||||
let cols = [
|
let cols = [
|
||||||
[
|
[
|
||||||
{type: 'checkbox'}
|
{type: 'checkbox'}
|
||||||
,{field: 'catename', title: '分类名', width: 150}
|
,{field: 'catename', title: '分类名', width: 150}
|
||||||
,{field: 'appname', title: '所属应用', width: 90}
|
|
||||||
,{field: 'ename', title: 'EN别名', width: 100}
|
,{field: 'ename', title: 'EN别名', width: 100}
|
||||||
,{field: 'detpl',title: '模板', align: 'center',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: '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: 'desc', title: '描述', minWidth: 200}
|
||||||
|
,{field: 'status', title: '状态', width: 80,templet:'#cate-check'}
|
||||||
,{field: 'id', title: 'ID',width: 60}
|
,{field: 'id', title: 'ID',width: 60}
|
||||||
,{field: 'sort', title: '排序', width: 80, sort: true}
|
,{field: 'sort', title: '排序', width: 80, sort: true}
|
||||||
,{title: '操作', width: 120, align: 'center', toolbar: '#cate-bar'}
|
,{title: '操作', width: 120, align: 'center', toolbar: '#cate-bar'}
|
||||||
@ -83,7 +83,7 @@
|
|||||||
treeIdName: 'id',
|
treeIdName: 'id',
|
||||||
treePidName: 'pid',
|
treePidName: 'pid',
|
||||||
skin:'line',
|
skin:'line',
|
||||||
treeDefaultClose: true,
|
treeDefaultClose: false,
|
||||||
toolbar:'#cate-toolbar',
|
toolbar:'#cate-toolbar',
|
||||||
elem: '#cate-table',
|
elem: '#cate-table',
|
||||||
url: CATE,
|
url: CATE,
|
||||||
@ -117,34 +117,28 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
form.on('checkbox(cate-enable)', function(obj) {
|
form.on('checkbox(cate-hot)', function(obj){
|
||||||
layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis);
|
layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis);
|
||||||
var status = obj.elem.checked ? 1 : 0;
|
var status = obj.elem.checked ? 1 : 0;
|
||||||
//执行用户审核
|
$.post(CHECK,{id:this.value, name:this.name, value: status},function(res){
|
||||||
$.ajax({
|
|
||||||
type:'post',
|
|
||||||
url: ENABLE,
|
|
||||||
data:{"id":this.value,"is_hot":status},
|
|
||||||
dataType:'json',
|
|
||||||
success:function(res){
|
|
||||||
if(res.code === 0){
|
if(res.code === 0){
|
||||||
layer.msg(res.msg,{
|
layer.msg(res.msg,{icon:res.icon,time:2000})
|
||||||
icon:res.icon,
|
|
||||||
time:2000
|
|
||||||
}
|
|
||||||
//,function(){location.reload();}
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
layer.open({
|
layer.open({title:'审核失败',content:res.msg,icon:5,adim:6})
|
||||||
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})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
window.add = function(){
|
window.add = function(){
|
||||||
@ -153,7 +147,7 @@
|
|||||||
title: '新增',
|
title: '新增',
|
||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['450px', '500px'],
|
area: ['450px', '500px'],
|
||||||
content: 'add.html'
|
content: 'addEdit.html'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +157,7 @@
|
|||||||
title: '修改',
|
title: '修改',
|
||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['450px', '500px'],
|
area: ['450px', '500px'],
|
||||||
content: 'edit.html?id=' + obj.data.id
|
content: 'addEdit.html?id=' + obj.data.id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.remove = function(obj){
|
window.remove = function(obj){
|
||||||
|
@ -199,7 +199,7 @@
|
|||||||
form.on('switch(artStatus)', function(obj){
|
form.on('switch(artStatus)', function(obj){
|
||||||
//layer.tips(obj.value + ' ' + obj.elem.name + ':'+ obj.elem.checked, obj.othis);
|
//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){
|
$.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})
|
layer.msg(res.msg,{icon:res.icon,time:2000})
|
||||||
} else {
|
} else {
|
||||||
layer.open({title:'审核失败',content:res.msg,icon:5,adim:6})
|
layer.open({title:'审核失败',content:res.msg,icon:5,adim:6})
|
||||||
|
@ -27,6 +27,8 @@ class AdminController extends \app\BaseController
|
|||||||
|
|
||||||
protected $aid = '';
|
protected $aid = '';
|
||||||
|
|
||||||
|
protected $appName = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化菜单
|
* 初始化菜单
|
||||||
*/
|
*/
|
||||||
@ -35,7 +37,10 @@ class AdminController extends \app\BaseController
|
|||||||
//权限auth检查
|
//权限auth检查
|
||||||
$this->aid = Session::get('admin_id');
|
$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;
|
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(),
|
'subcatelist' => $this->showSubnav(),
|
||||||
//当前登录用户
|
//当前登录用户
|
||||||
'user' => $this->showUser($this->uid),
|
'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();
|
$appname = app('http')->getName();
|
||||||
//1.查询分类表获取所有分类
|
//1.查询分类表获取所有分类
|
||||||
// $cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0, 'appname' => $appname])->cache('catename' . $appname,3600)->select()->toArray();
|
|
||||||
$cate = new Cate();
|
$cate = new Cate();
|
||||||
$cateList = $cate->menu();
|
$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
|
// 显示子导航subnav
|
||||||
@ -172,17 +170,4 @@ class BaseController extends BaseCtrl
|
|||||||
return $sysInfo;
|
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,17 +109,16 @@ class Article extends Model
|
|||||||
*/
|
*/
|
||||||
public function getArtTop(int $num)
|
public function getArtTop(int $num)
|
||||||
{
|
{
|
||||||
$artTop = Cache::get('arttop');
|
|
||||||
// 区分应用分类
|
return Cache::remember('topArticle', function() use($num){
|
||||||
$appCateIdArr = Cate::where(['appname' => app('http')->getName()])->column('id');
|
return $this::field('id,title,title_color,cate_id,user_id,create_time,is_top,pv,upzip,has_img,has_video,has_audio')
|
||||||
if (!$artTop) {
|
->where([['is_top', '=', 1], ['status', '=', 1]])
|
||||||
$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([
|
->with([
|
||||||
'cate' => function ($query) {
|
'cate' => function ($query) {
|
||||||
$query->where('delete_time', 0)->field('id,catename,ename');
|
$query->where('delete_time', 0)->field('id,catename,ename');
|
||||||
},
|
},
|
||||||
'user' => function ($query) {
|
'user' => function ($query) {
|
||||||
$query->field('id,name,nickname,user_img,area_id,vip');
|
$query->field('id,name,nickname,user_img');
|
||||||
}
|
}
|
||||||
])->withCount(['comments'])
|
])->withCount(['comments'])
|
||||||
->order('create_time', 'desc')
|
->order('create_time', 'desc')
|
||||||
@ -127,10 +126,7 @@ class Article extends Model
|
|||||||
->append(['url'])
|
->append(['url'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
},60);
|
||||||
Cache::tag('tagArtDetail')->set('arttop', $artTop, 60);
|
|
||||||
}
|
|
||||||
return $artTop;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,29 +139,24 @@ class Article extends Model
|
|||||||
*/
|
*/
|
||||||
public function getArtList(int $num)
|
public function getArtList(int $num)
|
||||||
{
|
{
|
||||||
$artList = Cache::get('artlist');
|
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')
|
||||||
$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')
|
|
||||||
->with([
|
->with([
|
||||||
'cate' => function($query){
|
'cate' => function($query){
|
||||||
$query->where('delete_time',0)->field('id,catename,ename,detpl');
|
$query->where('delete_time',0)->field('id,catename,ename,detpl');
|
||||||
},
|
},
|
||||||
'user' => function($query){
|
'user' => function($query){
|
||||||
$query->field('id,name,nickname,user_img,area_id,vip');
|
$query->field('id,name,nickname,user_img');
|
||||||
} ])
|
} ])
|
||||||
->withCount(['comments'])
|
->withCount(['comments'])
|
||||||
->where([['status', '=', 1], ['is_top', '=', 0],['cate_id', 'in', $appCateIdArr]])
|
->where('status', '=', 1)
|
||||||
->order('create_time','desc')
|
->order('create_time','desc')
|
||||||
->limit($num)
|
->limit($num)
|
||||||
->append(['url'])
|
->append(['url'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
},30);
|
||||||
|
|
||||||
Cache::tag('tagArt')->set('artlist',$artList,60);
|
|
||||||
}
|
|
||||||
return $artList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -197,17 +188,14 @@ class Article extends Model
|
|||||||
/**
|
/**
|
||||||
* 获取详情
|
* 获取详情
|
||||||
* @param int $id 文章id
|
* @param int $id 文章id
|
||||||
* @return array|mixed|Model|null
|
* @return mixed
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \Throwable
|
||||||
* @throws \think\db\exception\DbException
|
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
|
||||||
*/
|
*/
|
||||||
public function getArtDetail(int $id)
|
public function getArtDetail(int $id)
|
||||||
{
|
{
|
||||||
$article = Cache::get('article_'.$id);
|
return Cache::remember('article_'.$id, function() use($id){
|
||||||
if(!$article){
|
|
||||||
//查询文章
|
//查询文章
|
||||||
$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])
|
->where(['status'=>1])
|
||||||
->with([
|
->with([
|
||||||
'cate' => function($query){
|
'cate' => function($query){
|
||||||
@ -220,42 +208,27 @@ class Article extends Model
|
|||||||
->withCount(['comments'])
|
->withCount(['comments'])
|
||||||
->append(['url'])
|
->append(['url'])
|
||||||
->find($id);
|
->find($id);
|
||||||
if (!is_null($article)) {
|
|
||||||
Cache::tag('tagArtDetail')->set('article_'.$id, $article->toArray(), 3600);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}, 600);
|
||||||
return $article;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取分类列表
|
* 分类数据
|
||||||
* @param string $ename 分类英文名
|
* @param string $ename
|
||||||
* @param string $type all\top\hot\jie 分类类型
|
* @param string $type all\top\hot\jie 分类类型
|
||||||
* @param int $page 页面
|
* @param int $page
|
||||||
* @return mixed|\think\Paginator
|
* @return mixed
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \Throwable
|
||||||
*/
|
*/
|
||||||
public function getCateList(string $ename, string $type, int $page = 1)
|
public function getCateList(string $ename, string $type, int $page = 1)
|
||||||
{
|
{
|
||||||
$where = [];
|
$where = [];
|
||||||
// 区分应用分类
|
|
||||||
$appCateIdArr = Cate::where(['appname' => app('http')->getName()])->column('id');
|
|
||||||
$cateId = Cate::where('ename',$ename)->value('id');
|
$cateId = Cate::where('ename',$ename)->value('id');
|
||||||
if($cateId){
|
if($cateId){
|
||||||
$where[] = ['cate_id' ,'=', $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) {
|
switch ($type) {
|
||||||
//查询文章,15个分1页
|
//查询文章,15个分1页
|
||||||
case 'jie':
|
case 'jie':
|
||||||
@ -270,18 +243,19 @@ class Article extends Model
|
|||||||
case 'wait':
|
case 'wait':
|
||||||
$where[] = ['jie','=', 0];
|
$where[] = ['jie','=', 0];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
$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')
|
$where[] = ['status', '=', 1];
|
||||||
|
|
||||||
|
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([
|
->with([
|
||||||
'cate' => function($query) {
|
'cate' => function($query) {
|
||||||
$query->where('delete_time',0)->field('id,catename,ename,appname');
|
$query->field('id,catename,ename');
|
||||||
},
|
},
|
||||||
'user' => function($query){
|
'user' => function($query){
|
||||||
$query->field('id,name,nickname,user_img,area_id,vip');
|
$query->field('id,name,nickname,user_img,vip');
|
||||||
}
|
}
|
||||||
])->withCount(['comments'])
|
])->withCount(['comments'])
|
||||||
->where('status',1)
|
|
||||||
->where($where)
|
->where($where)
|
||||||
->limit(15)
|
->limit(15)
|
||||||
->order(['create_time'=>'desc'])
|
->order(['create_time'=>'desc'])
|
||||||
@ -289,10 +263,7 @@ class Article extends Model
|
|||||||
'list_rows' => 15,
|
'list_rows' => 15,
|
||||||
'page' => $page
|
'page' => $page
|
||||||
])->append(['url'])->toArray();
|
])->append(['url'])->toArray();
|
||||||
|
}, 600);
|
||||||
Cache::tag('tagArtDetail')->set('arts'.$ename.$type.$page,$artList,600);
|
|
||||||
}
|
|
||||||
return $artList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户发帖列表
|
// 获取用户发帖列表
|
||||||
@ -409,15 +380,30 @@ class Article extends Model
|
|||||||
return ['previous' => $previous, 'next' => $next];
|
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
|
// 获取url
|
||||||
public function getUrlAttr($value,$data)
|
public function getUrlAttr($value,$data)
|
||||||
{
|
{
|
||||||
if(config('taoler.url_rewrite.article_as') == '<ename>/') {
|
if(config('taoler.url_rewrite.article_as') == '<ename>/') {
|
||||||
$cate = Cate::field('id,ename')->find($data['cate_id']);
|
//$cate = Cate::field('id,ename')->find($data['cate_id']);
|
||||||
return (string) url('article_detail',['id' => $data['id'],'ename' => $cate->ename]);
|
return (string) url('article_detail',['id' => $data['id'],'ename' => $this->cate->ename]);
|
||||||
} else {
|
|
||||||
return (string) url('article_detail',['id' => $data['id']]);
|
|
||||||
}
|
}
|
||||||
|
return (string) url('article_detail',['id' => $data['id']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,10 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
namespace app\common\model;
|
namespace app\common\model;
|
||||||
|
|
||||||
use think\db\exception\DataNotFoundException;
|
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
|
||||||
use think\facade\Lang;
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use think\model\concern\SoftDelete;
|
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();
|
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)
|
public function getSubCate(string $ename)
|
||||||
{
|
{
|
||||||
return $this->field('ename,catename')->where('pid', $this::where('ename', $ename)->value('id'))->select();
|
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)
|
public function del($id)
|
||||||
{
|
{
|
||||||
$cates = $this->field('id,pid')->with('article')->find($id);
|
$cates = $this->field('id,pid')->with('article')->find($id);
|
||||||
$sonCate = $this->field('id,pid')->where('pid',$cates['id'])->find();
|
$sonCate = $this->field('id,pid')->where('pid',$cates['id'])->find();
|
||||||
if(empty($sonCate)) {
|
if(empty($sonCate)) {
|
||||||
$res = $cates->together(['article'])->delete();
|
$res = $cates->together(['article'])->delete();
|
||||||
if($res){
|
return $res ? 1 : '删除失败';
|
||||||
return 1;
|
|
||||||
}else{
|
|
||||||
return '删除分类失败';
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return '存在子分类,无法删除';
|
return '存在子分类,无法删除';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 分类表
|
// 分类表
|
||||||
public function getList()
|
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)) {
|
if(count($data)) {
|
||||||
// 排序
|
// 排序
|
||||||
$cmf_arr = array_column($data, 'sort');
|
$cmf_arr = array_column($data, 'sort');
|
||||||
array_multisort($cmf_arr, SORT_ASC, $data);
|
array_multisort($cmf_arr, SORT_ASC, $data);
|
||||||
return json(['code'=>0,'msg'=>'ok', 'count' => count($data),'data'=>$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不能点击
|
// 如果菜单下无内容,URl不能点击
|
||||||
@ -80,12 +83,11 @@ class Cate extends Model
|
|||||||
{
|
{
|
||||||
$appname = app('http')->getName();
|
$appname = app('http')->getName();
|
||||||
try {
|
try {
|
||||||
$cateList = $this->where(['status' => 1, 'appname' => $appname])
|
return $this->where(['status' => 1, 'appname' => $appname])
|
||||||
->cache('catename' . $appname, 3600)
|
->cache('catename' . $appname, 3600)
|
||||||
->append(['url'])
|
->append(['url'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
return $cateList;
|
|
||||||
} catch (DbException $e) {
|
} catch (DbException $e) {
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
@ -96,7 +98,7 @@ class Cate extends Model
|
|||||||
public function getUrlAttr($value,$data)
|
public function getUrlAttr($value,$data)
|
||||||
{
|
{
|
||||||
// 栏目下存在帖子,则返回正常url,否则为死链
|
// 栏目下存在帖子,则返回正常url,否则为死链
|
||||||
$articleArr = Article::where('cate_id',$data['id'])->column('id');
|
$articleArr = Article::field('id')->where('cate_id', $data['id'])->find();
|
||||||
if(empty($articleArr)) {
|
if(empty($articleArr)) {
|
||||||
return 'javascript:void(0);';
|
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> 新的帖子,请尽快处理。']);
|
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']);
|
$link = $this->getRouteUrl((int)$aid, $cateName['ename']);
|
||||||
// 推送给百度收录接口
|
|
||||||
$this->baiduPushUrl($link);
|
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
||||||
|
|
||||||
$url = $result['data']['status'] ? $link : (string)url('index/');
|
$url = $result['data']['status'] ? $link : (string)url('index/');
|
||||||
$res = Msgres::success($result['msg'], $url);
|
return Msgres::success($result['msg'], $url);
|
||||||
} else {
|
|
||||||
$res = Msgres::error('add_error');
|
|
||||||
}
|
}
|
||||||
return $res;
|
return Msgres::error('add_error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -394,14 +392,12 @@ class Article extends BaseController
|
|||||||
|
|
||||||
//删除原有缓存显示编辑后内容
|
//删除原有缓存显示编辑后内容
|
||||||
Cache::delete('article_'.$id);
|
Cache::delete('article_'.$id);
|
||||||
$link = $this->getRouteUrl((int) $id, $article->cate->ename, $article->cate->appname);
|
$link = $this->getRouteUrl((int) $id, $article->cate->ename);
|
||||||
// 推送给百度收录接口
|
|
||||||
$this->baiduPushUrl($link);
|
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
||||||
$editRes = Msgres::success('edit_success',$link);
|
return Msgres::success('edit_success',$link);
|
||||||
} else {
|
|
||||||
$editRes = Msgres::error($result);
|
|
||||||
}
|
}
|
||||||
return $editRes;
|
return Msgres::error($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,11 +423,9 @@ class Article extends BaseController
|
|||||||
$article = ArticleModel::find(input('id'));
|
$article = ArticleModel::find(input('id'));
|
||||||
$result = $article->together(['comments'])->delete();
|
$result = $article->together(['comments'])->delete();
|
||||||
if($result) {
|
if($result) {
|
||||||
$res = Msgres::success('delete_success');
|
return Msgres::success('delete_success');
|
||||||
} else {
|
|
||||||
$res = Msgres::error('delete_error');
|
|
||||||
}
|
}
|
||||||
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('tag','tag/getAllTag')->name('get_all_tag');
|
||||||
Route::get('arttag','tag/getArticleTag')->name('get_art_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($detail_as . ':id$', 'article/detail')->name('article_detail');
|
||||||
Route::get($cate_as . '<ename>$','article/cate')->name('cate');
|
Route::get($cate_as . '<ename>$','article/cate')->name('cate');
|
||||||
|
@ -13,6 +13,8 @@ layui.define('fly', function(exports){
|
|||||||
var form = layui.form;
|
var form = layui.form;
|
||||||
var fly = layui.fly;
|
var fly = layui.fly;
|
||||||
|
|
||||||
|
var uid = layui.cache.user.uid;
|
||||||
|
|
||||||
var gather = {}, dom = {
|
var gather = {}, dom = {
|
||||||
jieda: $('#jieda')
|
jieda: $('#jieda')
|
||||||
,content: $('#L_content')
|
,content: $('#L_content')
|
||||||
@ -82,7 +84,7 @@ layui.define('fly', function(exports){
|
|||||||
data:{id: div.data('id')},
|
data:{id: div.data('id')},
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
success:function(data){
|
success:function(data){
|
||||||
if(data.code == 0){
|
if(data.code === 0){
|
||||||
layer.msg(data.msg,{
|
layer.msg(data.msg,{
|
||||||
icon:6,
|
icon:6,
|
||||||
time:2000
|
time:2000
|
||||||
@ -163,16 +165,26 @@ layui.define('fly', function(exports){
|
|||||||
othis[ok ? 'removeClass' : 'addClass']('zanok');
|
othis[ok ? 'removeClass' : 'addClass']('zanok');
|
||||||
othis.find('em').html(ok ? (--zans) : (++zans));
|
othis.find('em').html(ok ? (--zans) : (++zans));
|
||||||
} else {
|
} else {
|
||||||
layer.msg(res.msg);
|
layer.msg(res.msg, {icon: 6});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
,reply: function(li){ //回复
|
,reply: function(li){ //回复
|
||||||
|
//判断登陆
|
||||||
|
if(uid == -1){
|
||||||
|
layer.msg('请登录再回复', {icon: 6})
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var val = dom.content.val();
|
var val = dom.content.val();
|
||||||
var aite = '@'+ li.find('.fly-detail-user cite').text().replace(/\s/g, '');
|
var aite = '@'+ li.find('.fly-detail-user cite').text().replace(/\s/g, '');
|
||||||
dom.content.focus()
|
dom.content.focus()
|
||||||
if(val.indexOf(aite) !== -1) return;
|
if(val.indexOf(aite) !== -1) return;
|
||||||
|
// 切换编辑器 回复@赋值
|
||||||
|
if(taonystatus == 0) {
|
||||||
dom.content.val(aite +' ' + val);
|
dom.content.val(aite +' ' + val);
|
||||||
|
} else { //编辑器插件赋值
|
||||||
|
tinymce.activeEditor.setContent(aite + ' .' + val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
,accept: function(li){ //采纳
|
,accept: function(li){ //采纳
|
||||||
var othis = $(this);
|
var othis = $(this);
|
||||||
@ -204,9 +216,14 @@ layui.define('fly', function(exports){
|
|||||||
,title: '编辑回帖'
|
,title: '编辑回帖'
|
||||||
,area: ['738px', '310px']
|
,area: ['738px', '310px']
|
||||||
,success: function(layero){
|
,success: function(layero){
|
||||||
|
|
||||||
|
if(taonystatus == 0) {
|
||||||
fly.layEditor({
|
fly.layEditor({
|
||||||
elem: layero.find('textarea')
|
elem: layero.find('textarea')
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// 编辑器
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, function(value, index){
|
}, function(value, index){
|
||||||
fly.json(commentUpdateDa, {
|
fly.json(commentUpdateDa, {
|
||||||
|
@ -149,6 +149,7 @@
|
|||||||
{:hook('taonyeditor')}
|
{:hook('taonyeditor')}
|
||||||
<script src="/static/xm-select.js"></script>
|
<script src="/static/xm-select.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||||
layui.use(["fly"], function () {
|
layui.use(["fly"], function () {
|
||||||
var $ = layui.jquery,
|
var $ = layui.jquery,
|
||||||
fly = layui.fly,
|
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(){
|
$('.layui-textarea').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.attr(fly.content(html));
|
othis.attr(fly.content(html));
|
||||||
@ -321,6 +322,7 @@
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
|
|
||||||
notify.success(data.msg, function () {
|
notify.success(data.msg, function () {
|
||||||
location.href = data.url;
|
location.href = data.url;
|
||||||
});
|
});
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
<div class="jieda-reply">
|
<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 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">
|
<div class="jieda-admin">
|
||||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
||||||
@ -101,7 +101,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin: 5px 0px;">
|
<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>{$vo.user.sign|raw}</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -203,6 +203,7 @@
|
|||||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||||
langCollection = "{:lang('collection')}",
|
langCollection = "{:lang('collection')}",
|
||||||
langCancelCollection = "{:lang('cancel collection')}";
|
langCancelCollection = "{:lang('cancel collection')}";
|
||||||
|
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||||
|
|
||||||
layui.use(["fly", "face", "colorpicker", "laypage"], function () {
|
layui.use(["fly", "face", "colorpicker", "laypage"], function () {
|
||||||
var $ = layui.jquery,
|
var $ = layui.jquery,
|
||||||
@ -214,10 +215,9 @@
|
|||||||
laypage = layui.laypage;
|
laypage = layui.laypage;
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
var taonystatus = "{:hook('taonystatus')}";
|
|
||||||
// 编辑器插件启用状态
|
// 编辑器插件禁用状态,用原方式解析网页
|
||||||
var isShow = taonystatus ? false : true;
|
if(taonystatus == 0) {
|
||||||
if(isShow) {
|
|
||||||
$('.detail-body').each(function(){
|
$('.detail-body').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.html(fly.content(html));
|
othis.html(fly.content(html));
|
||||||
@ -282,7 +282,7 @@
|
|||||||
form.on("submit(user-comment)", function (data) {
|
form.on("submit(user-comment)", function (data) {
|
||||||
var index = layer.load(1);
|
var index = layer.load(1);
|
||||||
var filed = data.field;
|
var filed = data.field;
|
||||||
if (uid == -1) {
|
if (uid === -1) {
|
||||||
layer.msg("请先登陆", { icon: 5, time: 2000 }, function () {
|
layer.msg("请先登陆", { icon: 5, time: 2000 }, function () {
|
||||||
location.href = "{:url('login/index')}";
|
location.href = "{:url('login/index')}";
|
||||||
});
|
});
|
||||||
|
@ -303,6 +303,7 @@ var collectionFind = "{:url('Collection/find')}",
|
|||||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||||
langCollection = "{:lang('collection')}",
|
langCollection = "{:lang('collection')}",
|
||||||
langCancelCollection = "{:lang('cancel collection')}";
|
langCancelCollection = "{:lang('cancel collection')}";
|
||||||
|
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||||
|
|
||||||
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
||||||
var $ = layui.jquery
|
var $ = layui.jquery
|
||||||
@ -315,10 +316,9 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
|||||||
var id = "{$article.id}";
|
var id = "{$article.id}";
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
var taonystatus = "{:hook('taonystatus')}";
|
|
||||||
// 编辑器插件启用状态
|
// 编辑器插件启用状态
|
||||||
var isShow = taonystatus ? false : true;
|
if(taonystatus == 0) {
|
||||||
if(isShow) {
|
|
||||||
$('.detail-body').each(function(){
|
$('.detail-body').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.html(fly.content(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','');
|
$("#comment-edit").attr('type','');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,9 +30,6 @@
|
|||||||
<div class="fly-list-info">
|
<div class="fly-list-info">
|
||||||
{if config('taoler.config.cate_show') == 1}
|
{if config('taoler.config.cate_show') == 1}
|
||||||
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
|
<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}
|
{/if}
|
||||||
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
|
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
|
||||||
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
</a>
|
</a>
|
||||||
<div class="fly-detail-user">
|
<div class="fly-detail-user">
|
||||||
<a href="{$Request.domain}{:url('user/home',['id'=>$article.user.id])}" class="fly-link">
|
<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>
|
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
||||||
</a>
|
</a>
|
||||||
<span class="layui-btn layui-btn-xs guanzhu" >关注</span>
|
<span class="layui-btn layui-btn-xs guanzhu" >关注</span>
|
||||||
@ -94,7 +93,6 @@
|
|||||||
</a>
|
</a>
|
||||||
<div class="fly-detail-user">
|
<div class="fly-detail-user">
|
||||||
<a href="{:url('user/home',['id'=>$vo.user.id])}" class="fly-link">
|
<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>
|
<cite>{$vo.user.nickname ?: $vo.user.name}</cite>
|
||||||
</a>
|
</a>
|
||||||
{if condition="$article.user.id eq $vo.user.id"}<span>({:lang('poster')})</span>{/if}
|
{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>
|
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
|
||||||
{/if}
|
{/if}
|
||||||
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
|
<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>
|
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||||
<i>{$art.create_time|date='Y-m-d'}</i>
|
<i>{$art.create_time|date='Y-m-d'}</i>
|
||||||
</a>
|
</a>
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||||
langCollection = "{:lang('collection')}",
|
langCollection = "{:lang('collection')}",
|
||||||
langCancelCollection = "{:lang('cancel collection')}";
|
langCancelCollection = "{:lang('cancel collection')}";
|
||||||
|
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||||
|
|
||||||
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
||||||
var $ = layui.jquery
|
var $ = layui.jquery
|
||||||
@ -91,10 +92,9 @@
|
|||||||
,laypage = layui.laypage;
|
,laypage = layui.laypage;
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
var taonystatus = "{:hook('taonystatus')}";
|
|
||||||
// 编辑器插件启用状态
|
// 编辑器插件启用状态
|
||||||
var isShow = taonystatus ? false : true;
|
if(taonystatus == 0) {
|
||||||
if(isShow) {
|
|
||||||
$('.detail-body').each(function(){
|
$('.detail-body').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.html(fly.content(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>
|
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
|
||||||
{/if}
|
{/if}
|
||||||
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
|
<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>
|
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||||
<i>{$art.create_time|date='Y-m-d'}</i>
|
<i>{$art.create_time|date='Y-m-d'}</i>
|
||||||
</a>
|
</a>
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
</a>
|
</a>
|
||||||
<div class="fly-detail-user">
|
<div class="fly-detail-user">
|
||||||
<a href="{$Request.domain}{:url('user/home',['id'=>$article.user.id])}" class="fly-link">
|
<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>
|
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
||||||
</a>
|
</a>
|
||||||
<span class="layui-btn layui-btn-xs guanzhu" >关注</span>
|
<span class="layui-btn layui-btn-xs guanzhu" >关注</span>
|
||||||
@ -97,7 +96,6 @@
|
|||||||
</a>
|
</a>
|
||||||
<div class="fly-detail-user">
|
<div class="fly-detail-user">
|
||||||
<a href="{$Request.domain}{:url('user/home',['id'=>$vo.user.id])}" class="fly-link">
|
<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>
|
<cite>{$vo.user.nickname ?: $vo.user.name}</cite>
|
||||||
</a>
|
</a>
|
||||||
{if condition="$article.user.id eq $vo.user.id"}<span>({:lang('poster')})</span>{/if}
|
{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')}",
|
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||||
langCollection = "{:lang('collection')}",
|
langCollection = "{:lang('collection')}",
|
||||||
langCancelCollection = "{:lang('cancel collection')}";
|
langCancelCollection = "{:lang('cancel collection')}";
|
||||||
|
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||||
|
|
||||||
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
||||||
var $ = layui.jquery
|
var $ = layui.jquery
|
||||||
@ -235,8 +234,7 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){
|
|||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
var taonystatus = "{:hook('taonystatus')}";
|
var taonystatus = "{:hook('taonystatus')}";
|
||||||
// 编辑器插件启用状态
|
// 编辑器插件启用状态
|
||||||
var isShow = taonystatus ? false : true;
|
if(taonystatus == 0) {
|
||||||
if(isShow) {
|
|
||||||
$('.detail-body').each(function(){
|
$('.detail-body').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.html(fly.content(html));
|
othis.html(fly.content(html));
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
<script src="/static/notify.js"></script>
|
<script src="/static/notify.js"></script>
|
||||||
<!-- 样式 -->
|
<!-- 样式 -->
|
||||||
<link rel="canonical" href="{$Request.domain}{$Request.url}">
|
<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/res/css/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/layui/css/layui.css">
|
||||||
<link rel="stylesheet" href="{$Request.domain}/static/res/css/global.css" charset="utf-8">
|
<link rel="stylesheet" href="{$Request.domain}/static/res/css/global.css">
|
||||||
{block name="link"}{/block}
|
{block name="link"}{/block}
|
||||||
<!-- 5+ 引擎环境下自动隐藏无关元素,适配App -->
|
<!-- 5+ 引擎环境下自动隐藏无关元素,适配App -->
|
||||||
<style>
|
<style>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{//导航nav}
|
{//导航nav}
|
||||||
{volist name="cateList" id="cate"}
|
{volist name="cateList" id="cate"}
|
||||||
<li class="layui-nav-item {if($cate.ename eq $Request.param.ename)} layui-this {/if}" >
|
<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"}
|
{notempty name="cate.children"}
|
||||||
<dl class="layui-nav-child"> <!-- 二级菜单 -->
|
<dl class="layui-nav-child"> <!-- 二级菜单 -->
|
||||||
{volist name="cate.children" id="vo2"}
|
{volist name="cate.children" id="vo2"}
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
{if config('taoler.config.cate_show') == 1}
|
{if config('taoler.config.cate_show') == 1}
|
||||||
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
|
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}</a>
|
||||||
{/if}
|
{/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>
|
<a href="{$Request.domain}{:url('user/home',['id'=>$art.user.id])}" link>
|
||||||
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
<cite>{$art.user.nickname ?: $art.user.name}</cite>
|
||||||
</a>
|
</a>
|
||||||
|
@ -2,22 +2,13 @@
|
|||||||
<a href="{$Request.domain}{:url('user/home',['id'=>$top.user_id])}" class="fly-avatar">
|
<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}">
|
<img src="{$Request.domain}{$top.user.user_img}" alt="{$top.user.name}">
|
||||||
</a>
|
</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">
|
<div class="fly-list-info">
|
||||||
{if config('taoler.config.cate_show') == 1}
|
{if config('taoler.config.cate_show') == 1}
|
||||||
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $top.cate.ename : $top.cate.catename}</a>
|
<a class="layui-badge">{:cookie('think_lang') == 'en-us' ? $top.cate.ename : $top.cate.catename}</a>
|
||||||
{/if}
|
{/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>
|
<a href="{$Request.domain}{:url('user/home',['id'=>$top.user_id])}" link>
|
||||||
<cite>{$top.user.nickname ?: $top.user.name}</cite>
|
<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>
|
</a>
|
||||||
<i>{$top.create_time|date='Y-m-d'}</i>
|
<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>'}
|
{$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.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>'}
|
{$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>
|
<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>
|
<span class="fly-list-nums"><i class="iconfont icon-pinglun1" title="回答"></i> {$top.comments_count}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="fly-list-badge">
|
<div class="fly-list-badge">
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<meta name="keywords" content="TaoLer社区">
|
<meta name="keywords" content="TaoLer社区">
|
||||||
<meta name="description" content="TaoLer社区是模块化前端UI框架社区,致力于为web开发提供强劲动力">
|
<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/layui/css/layui.css">
|
||||||
<link rel="stylesheet" href="{$Request.domain}/static/res/css/global.css">
|
<link rel="stylesheet" href="{$Request.domain}/static/res/css/global.css">
|
||||||
{block name="css"}{/block}
|
{block name="css"}{/block}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user