mirror of https://github.com/1099438829/apeblog
修复一大把bug
This commit is contained in:
parent
e0d951cc27
commit
dc0fcfd1eb
|
|
@ -6,6 +6,7 @@ use app\admin\extend\FormBuilder as Form;
|
||||||
use app\admin\extend\Util as Util;
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\constant\Data;
|
use app\common\constant\Data;
|
||||||
use app\common\model\Advert as aModel;
|
use app\common\model\Advert as aModel;
|
||||||
|
use app\common\model\AdvertInfo as tModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
|
|
@ -23,40 +24,24 @@ use think\facade\Route as Url;
|
||||||
*/
|
*/
|
||||||
class Advert extends AuthController
|
class Advert extends AuthController
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 广告管理
|
|
||||||
* @return string
|
|
||||||
* @throws Exception
|
|
||||||
* @author 木子的忧伤
|
|
||||||
* @date 2021-02-19 11:53
|
|
||||||
*/
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function navList(Request $request)
|
|
||||||
{
|
|
||||||
return app("json")->layui(Data::ADVERT_NAV_LIST);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章列表
|
* 列表
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return mixed
|
* @return
|
||||||
* @throws DataNotFoundException
|
|
||||||
* @throws DbException
|
|
||||||
* @throws ModelNotFoundException
|
|
||||||
* @author 木子的忧伤
|
|
||||||
* @date 2021-02-15 23:26
|
|
||||||
*/
|
*/
|
||||||
public function lst(Request $request)
|
public function lst(Request $request)
|
||||||
{
|
{
|
||||||
$where = Util::postMore([
|
$where = Util::postMore([
|
||||||
['title', ''],
|
['title', ''],
|
||||||
|
['status', ''],
|
||||||
['start_time', ''],
|
['start_time', ''],
|
||||||
['end_time', ''],
|
['end_time', ''],
|
||||||
['status', ''],
|
|
||||||
['page', 1],
|
['page', 1],
|
||||||
['limit', 20],
|
['limit', 20],
|
||||||
]);
|
]);
|
||||||
|
|
@ -64,7 +49,7 @@ class Advert extends AuthController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加广告
|
* 添加
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return string
|
* @return string
|
||||||
* @throws FormBuilderException
|
* @throws FormBuilderException
|
||||||
|
|
@ -72,47 +57,32 @@ class Advert extends AuthController
|
||||||
public function add(Request $request)
|
public function add(Request $request)
|
||||||
{
|
{
|
||||||
$form = array();
|
$form = array();
|
||||||
$form[] = Elm::input('title', '广告名称')->col(10);
|
$form[] = Elm::input('title', '轮播组名称')->col(10);
|
||||||
$form[] = Elm::input('url', '链接地址')->col(10);
|
$form[] = Elm::input('alias', '标识')->col(10);
|
||||||
$form[] = Elm::frameImage('cover_path', '广告图片', Url::buildUrl('admin/image/index', array('fodder' => 'cover_path', 'limit' => 1)))->icon("ios-image")->width('96%')->height('440px')->col(10);
|
$form[] = Elm::input('description', '描述')->col(20);
|
||||||
$form[] = Elm::input('sort', '排序')->col(10);
|
$form[] = Elm::radio('status', '状态', 1)->options([['label' => '禁用', 'value' => 0], ['label' => '启用', 'value' => 1]])->col(24);
|
||||||
$form[] = Elm::select('position', '位置')->options(function () {
|
|
||||||
$options = [];
|
|
||||||
foreach (Data::ADVERT_NAV_LIST as $k => $v) {
|
|
||||||
$options[] = Elm::option($k, $v);
|
|
||||||
}
|
|
||||||
return $options;
|
|
||||||
})->col(10);
|
|
||||||
$form[] = Elm::radio('status', '状态', 1)->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
|
|
||||||
$form = Form::make_post_form($form, url('save')->build());
|
$form = Form::make_post_form($form, url('save')->build());
|
||||||
$this->assign(compact('form'));
|
$this->assign(compact('form'));
|
||||||
return $this->fetch("public/form-builder");
|
return $this->fetch("public/form-builder");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改banner
|
* 修改
|
||||||
|
* @param Request $request
|
||||||
* @return string
|
* @return string
|
||||||
* @throws FormBuilderException
|
* @throws FormBuilderException
|
||||||
*/
|
*/
|
||||||
public function edit($id = "")
|
public function edit($id = '')
|
||||||
{
|
{
|
||||||
if (!$id) return app("json")->fail("数据id不能为空");
|
if (!$id) return app("json")->fail("项目id不能为空");
|
||||||
$info = aModel::get($id);
|
$info = aModel::get($id);
|
||||||
if (!$info) return app("json")->fail("没有该数据");
|
if (!$info) return app("json")->fail("轮播组不存在");
|
||||||
$form = array();
|
$form = array();
|
||||||
$form[] = Elm::input('title', '广告名称', $info['title'])->col(10);
|
$form[] = Elm::input('title', '轮播组名称', $info['title'])->col(10);
|
||||||
$form[] = Elm::input('url', '链接地址', $info['url'])->col(10);
|
$form[] = Elm::input('alias', '标识', $info['alias'])->col(10);
|
||||||
$form[] = Elm::frameImage('cover_path', '广告图片', Url::buildUrl('admin/image/index', array('fodder' => 'cover_path', 'limit' => 1)), $info['cover_path'])->icon("ios-image")->width('96%')->height('440px')->col(10);
|
$form[] = Elm::input('description', '描述', $info['description'])->col(20);
|
||||||
$form[] = Elm::input('sort', '排序', $info['sort'])->col(10);
|
$form[] = Elm::radio('status', '状态', $info['status'])->options([['label' => '禁用', 'value' => 0], ['label' => '启用', 'value' => 1]])->col(24);
|
||||||
$form[] = Elm::select('position', '位置', $info['position'])->options(function () {
|
$form = Form::make_post_form($form, url('save', ["id" => $id])->build());
|
||||||
$options = [];
|
|
||||||
foreach (Data::ADVERT_NAV_LIST as $k => $v) {
|
|
||||||
$options[] = Elm::option($k, $v);
|
|
||||||
}
|
|
||||||
return $options;
|
|
||||||
})->col(10);
|
|
||||||
$form[] = Elm::radio('status', '状态', $info['status'])->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
|
|
||||||
$form = Form::make_post_form($form, url('save', ['id' => $id])->build());
|
|
||||||
$this->assign(compact('form'));
|
$this->assign(compact('form'));
|
||||||
return $this->fetch("public/form-builder");
|
return $this->fetch("public/form-builder");
|
||||||
}
|
}
|
||||||
|
|
@ -123,13 +93,165 @@ class Advert extends AuthController
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function save($id = "")
|
public function save($id = "")
|
||||||
|
{
|
||||||
|
$data = Util::postMore([
|
||||||
|
['title', ''],
|
||||||
|
['alias', ''],
|
||||||
|
['description', ''],
|
||||||
|
['status', 1]
|
||||||
|
]);
|
||||||
|
if ($data['title'] == "") return app("json")->fail("轮播名称不能为空");
|
||||||
|
if ($data['alias'] == "") return app("json")->fail("标识不能为空");
|
||||||
|
if ($id == "") {
|
||||||
|
//需要验证轮播组标识是否存在
|
||||||
|
$info = aModel::where("alias",$data['alias'])->find($id);
|
||||||
|
if ($info) return app("json")->fail("标识已存在,请修改后重试");
|
||||||
|
$data['create_time'] = time();
|
||||||
|
$res = aModel::insert($data);
|
||||||
|
} else {
|
||||||
|
$data['update_time'] = time();
|
||||||
|
$res = aModel::update($data, ['id' => $id]);
|
||||||
|
}
|
||||||
|
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字段
|
||||||
|
* @param $id
|
||||||
|
* @return mixed
|
||||||
|
* @author 木子的忧伤
|
||||||
|
* @date 2021-02-16 23:12
|
||||||
|
*/
|
||||||
|
public function field($id)
|
||||||
|
{
|
||||||
|
if (!$id) return app("json")->fail("参数有误,Id为空!");
|
||||||
|
$where = Util::postMore([['field', ''], ['value', '']]);
|
||||||
|
if ($where['field'] == '' || $where['value'] == '') return app("json")->fail("参数有误!");
|
||||||
|
return aModel::update([$where['field'] => $where['value']], ['id' => $id]) ? app("json")->success("操作成功") : app("json")->fail("操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重写删除
|
||||||
|
* @param Request $request
|
||||||
|
* @return mixed|void
|
||||||
|
* @throws DataNotFoundException
|
||||||
|
* @throws DbException
|
||||||
|
* @throws ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function del(Request $request)
|
||||||
|
{
|
||||||
|
$ids = $request->param("id", 0);
|
||||||
|
if ($ids == 0) return app("json")->fail("参数有误,Id为空!");
|
||||||
|
if (!is_array($ids)) $ids = array_filter(explode(",", $ids));
|
||||||
|
if (tModel::where("tab_id", "in", $ids)->count() > 0) return app("json")->fail("该配置项下有配置数据,不能删除!");
|
||||||
|
return parent::del($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 广告管理
|
||||||
|
* @return string
|
||||||
|
* @throws Exception
|
||||||
|
* @author 木子的忧伤
|
||||||
|
* @date 2021-02-19 11:53
|
||||||
|
*/
|
||||||
|
public function info()
|
||||||
|
{
|
||||||
|
return $this->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 广告列表
|
||||||
|
* @param Request $request
|
||||||
|
* @return mixed
|
||||||
|
* @throws DataNotFoundException
|
||||||
|
* @throws DbException
|
||||||
|
* @throws ModelNotFoundException
|
||||||
|
* @author 木子的忧伤
|
||||||
|
* @date 2021-02-15 23:26
|
||||||
|
*/
|
||||||
|
public function infoList(Request $request)
|
||||||
|
{
|
||||||
|
$where = Util::postMore([
|
||||||
|
['title', ''],
|
||||||
|
['start_time', ''],
|
||||||
|
['end_time', ''],
|
||||||
|
['status', ''],
|
||||||
|
['page', 1],
|
||||||
|
['limit', 20],
|
||||||
|
]);
|
||||||
|
return app("json")->layui(tModel::systemPage($where));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加广告
|
||||||
|
* @param Request $request
|
||||||
|
* @return string
|
||||||
|
* @throws FormBuilderException
|
||||||
|
*/
|
||||||
|
public function addAdvert(Request $request)
|
||||||
|
{
|
||||||
|
$form = array();
|
||||||
|
$form[] = Elm::input('title', '广告名称')->col(10);
|
||||||
|
$form[] = Elm::input('url', '链接地址')->col(10);
|
||||||
|
$form[] = Elm::frameImage('cover_path', '广告图片', Url::buildUrl('admin/image/index', array('fodder' => 'cover_path', 'limit' => 1)))->icon("ios-image")->width('96%')->height('440px')->col(10);
|
||||||
|
$form[] = Elm::number('sort', '排序')->col(10);
|
||||||
|
$form[] = Elm::select('advert_id', '位置')->options(function () {
|
||||||
|
$options = [];
|
||||||
|
$advertList = aModel::where("status",1)->column("title","id");
|
||||||
|
foreach ($advertList as $k => $v) {
|
||||||
|
$options[] = Elm::option($k, $v);
|
||||||
|
}
|
||||||
|
return $options;
|
||||||
|
})->col(10);
|
||||||
|
$form[] = Elm::radio('status', '状态', 1)->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
|
||||||
|
$form = Form::make_post_form($form, url('saveAdvert')->build());
|
||||||
|
$this->assign(compact('form'));
|
||||||
|
return $this->fetch("public/form-builder");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改banner
|
||||||
|
* @return string
|
||||||
|
* @throws FormBuilderException
|
||||||
|
*/
|
||||||
|
public function editAdvert($id = "")
|
||||||
|
{
|
||||||
|
if (!$id) return app("json")->fail("数据id不能为空");
|
||||||
|
$info = tModel::get($id);
|
||||||
|
if (!$info) return app("json")->fail("没有该数据");
|
||||||
|
$form = array();
|
||||||
|
$form[] = Elm::input('title', '广告名称', $info['title'])->col(10);
|
||||||
|
$form[] = Elm::input('url', '链接地址', $info['url'])->col(10);
|
||||||
|
$form[] = Elm::frameImage('cover_path', '广告图片', Url::buildUrl('admin/image/index', array('fodder' => 'cover_path', 'limit' => 1)), $info['cover_path'])->icon("ios-image")->width('96%')->height('440px')->col(10);
|
||||||
|
$form[] = Elm::number('sort', '排序', $info['sort'])->col(10);
|
||||||
|
$form[] = Elm::select('advert_id', '位置', $info['advert_id'])->options(function () {
|
||||||
|
$options = [];
|
||||||
|
$advertList = aModel::where("status",1)->column("title","id");
|
||||||
|
foreach ($advertList as $k => $v) {
|
||||||
|
$options[] = Elm::option($k, $v);
|
||||||
|
}
|
||||||
|
return $options;
|
||||||
|
})->col(10);
|
||||||
|
$form[] = Elm::radio('status', '状态', $info['status'])->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
|
||||||
|
$form = Form::make_post_form($form, url('saveAdvert', ['id' => $id])->build());
|
||||||
|
$this->assign(compact('form'));
|
||||||
|
return $this->fetch("public/form-builder");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存修改
|
||||||
|
* @param string $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function saveAdvert($id = "")
|
||||||
{
|
{
|
||||||
$data = Util::postMore([
|
$data = Util::postMore([
|
||||||
['id', ''],
|
['id', ''],
|
||||||
['title', ''],
|
['title', ''],
|
||||||
['url', ''],
|
['url', ''],
|
||||||
['cover_path', ''],
|
['cover_path', ''],
|
||||||
['position', 1],
|
['advert_id', 1],
|
||||||
['sort', ''],
|
['sort', ''],
|
||||||
['status', 1],
|
['status', 1],
|
||||||
]);
|
]);
|
||||||
|
|
@ -139,16 +261,11 @@ class Advert extends AuthController
|
||||||
$data['user_id'] = $this->adminId;//默认修改你
|
$data['user_id'] = $this->adminId;//默认修改你
|
||||||
if (filter_var($data['url'], FILTER_VALIDATE_URL) === false) return app("json")->fail("链接地址不合法");
|
if (filter_var($data['url'], FILTER_VALIDATE_URL) === false) return app("json")->fail("链接地址不合法");
|
||||||
if ($id == "") {
|
if ($id == "") {
|
||||||
//判断下用户是否存在
|
$res = tModel::create($data);
|
||||||
$info = aModel::where('url', $data['url'])->find();
|
|
||||||
if ($info) {
|
|
||||||
return app("json")->fail("链接已存在");
|
|
||||||
}
|
|
||||||
$res = aModel::create($data);
|
|
||||||
} else {
|
} else {
|
||||||
$res = aModel::update($data, ['id' => $id]);
|
$res = tModel::update($data, ['id' => $id]);
|
||||||
}
|
}
|
||||||
cache(Data::DATA_ADVERT . '_' . $data['position'], null);//清除缓存
|
cache(Data::DATA_ADVERT . '_' . $data['advert_id'], null);//清除缓存
|
||||||
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败");
|
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ use app\common\model\DocumentCategory as cModel;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
use app\common\constant\Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Article
|
* Class Article
|
||||||
|
|
@ -57,7 +58,7 @@ class Article extends AuthController
|
||||||
['page', 1],
|
['page', 1],
|
||||||
['limit', 20],
|
['limit', 20],
|
||||||
]);
|
]);
|
||||||
$where['type'] = Document::DOCUMENT_TYPE_ARTICLE;
|
$where['type'] = Data::DOCUMENT_TYPE_ARTICLE;
|
||||||
return app("json")->layui(Document::systemPage($where));
|
return app("json")->layui(Document::systemPage($where));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,6 +85,7 @@ class Article extends AuthController
|
||||||
['is_recommend', 0],
|
['is_recommend', 0],
|
||||||
['is_top', 0],
|
['is_top', 0],
|
||||||
['is_hot', 0],
|
['is_hot', 0],
|
||||||
|
['theme', 'detail.html'],
|
||||||
['link_str', ''],
|
['link_str', ''],
|
||||||
['cover_path', ''],
|
['cover_path', ''],
|
||||||
['display', 1],
|
['display', 1],
|
||||||
|
|
@ -97,7 +99,7 @@ class Article extends AuthController
|
||||||
if ($data['category_id'] == "") return app("json")->fail("栏目分类不能为空");
|
if ($data['category_id'] == "") return app("json")->fail("栏目分类不能为空");
|
||||||
if ($data['cover_path'] == "") return app("json")->fail("主图不能为空");
|
if ($data['cover_path'] == "") return app("json")->fail("主图不能为空");
|
||||||
$model = new Document();
|
$model = new Document();
|
||||||
$res = $model->updateInfo($data, Document::DOCUMENT_TYPE_ARTICLE);
|
$res = $model->updateInfo($data, Data::DOCUMENT_TYPE_ARTICLE);
|
||||||
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败,错误原因:" . $model->getError());
|
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败,错误原因:" . $model->getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,7 +157,7 @@ class Article extends AuthController
|
||||||
if ($where['id'] == '') {
|
if ($where['id'] == '') {
|
||||||
$this->error('参数错误');
|
$this->error('参数错误');
|
||||||
}
|
}
|
||||||
$info = (new Document())->getInfo($where["id"], Document::DOCUMENT_TYPE_ARTICLE);
|
$info = (new Document())->getInfo($where["id"], Data::DOCUMENT_TYPE_ARTICLE);
|
||||||
if (empty($info)) {
|
if (empty($info)) {
|
||||||
$this->error('数据不存在');
|
$this->error('数据不存在');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,9 @@ class FriendLink extends AuthController
|
||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
$form = array();
|
$form = array();
|
||||||
$form[] = Elm::input('title', '链接名称')->col(10);
|
$form[] = Elm::input('title', '网站名称')->col(10);
|
||||||
$form[] = Elm::input('url', '链接地址')->col(10);
|
$form[] = Elm::input('url', '网站地址')->col(10);
|
||||||
$form[] = Elm::frameImage('image', '网站图标', Url::buildUrl('admin/image/index', array('fodder' => 'image', 'limit' => 1)))->icon("ios-image")->width('96%')->height('440px')->col(10);
|
$form[] = Elm::frameImage('image', '网站Logo', Url::buildUrl('admin/image/index', array('fodder' => 'image', 'limit' => 1)))->icon("ios-image")->width('96%')->height('440px')->col(10);
|
||||||
$form[] = Elm::input('sort', '排序')->col(10);
|
$form[] = Elm::input('sort', '排序')->col(10);
|
||||||
$form[] = Elm::textarea('description', '描述')->col(10);
|
$form[] = Elm::textarea('description', '描述')->col(10);
|
||||||
$form[] = Elm::radio('status', '状态', 1)->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
|
$form[] = Elm::radio('status', '状态', 1)->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
|
||||||
|
|
@ -86,9 +86,9 @@ class FriendLink extends AuthController
|
||||||
$ainfo = aModel::get($id);
|
$ainfo = aModel::get($id);
|
||||||
if (!$ainfo) return app("json")->fail("没有该数据");
|
if (!$ainfo) return app("json")->fail("没有该数据");
|
||||||
$form = array();
|
$form = array();
|
||||||
$form[] = Elm::input('title', '链接名称', $ainfo['title'])->col(10);
|
$form[] = Elm::input('title', '网站名称', $ainfo['title'])->col(10);
|
||||||
$form[] = Elm::input('url', '链接地址', $ainfo['url'])->col(10);
|
$form[] = Elm::input('url', '网站地址', $ainfo['url'])->col(10);
|
||||||
$form[] = Elm::frameImage('image', '网站图标', Url::buildUrl('admin/image/index', array('fodder' => 'image', 'limit' => 1)), $ainfo['image'])->icon("ios-image")->width('96%')->height('440px')->col(10);
|
$form[] = Elm::frameImage('image', '网站Logo', Url::buildUrl('admin/image/index', array('fodder' => 'image', 'limit' => 1)), $ainfo['image'])->icon("ios-image")->width('96%')->height('440px')->col(10);
|
||||||
$form[] = Elm::input('sort', '排序', $ainfo['sort'])->col(10);
|
$form[] = Elm::input('sort', '排序', $ainfo['sort'])->col(10);
|
||||||
$form[] = Elm::textarea('description', '描述', $ainfo['description'])->col(10);
|
$form[] = Elm::textarea('description', '描述', $ainfo['description'])->col(10);
|
||||||
$form[] = Elm::radio('status', '状态', $ainfo['status'])->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
|
$form[] = Elm::radio('status', '状态', $ainfo['status'])->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
|
||||||
|
|
@ -113,14 +113,14 @@ class FriendLink extends AuthController
|
||||||
['sort', ''],
|
['sort', ''],
|
||||||
['status', 1],
|
['status', 1],
|
||||||
]);
|
]);
|
||||||
if ($data['title'] == "") return app("json")->fail("链接名称不能为空");
|
if ($data['title'] == "") return app("json")->fail("网站名称不能为空");
|
||||||
if ($data['url'] == "") return app("json")->fail("链接地址不能为空");
|
if ($data['url'] == "") return app("json")->fail("网站地址不能为空");
|
||||||
if (is_array($data['image'])) $data['image'] = $data['avatar'][0];
|
if (is_array($data['image'])) $data['image'] = $data['avatar'][0];
|
||||||
if ($id == "") {
|
if ($id == "") {
|
||||||
//判断下用户是否存在
|
//判断下用户是否存在
|
||||||
$info = aModel::where('url', $data['url'])->find();
|
$info = aModel::where('url', $data['url'])->find();
|
||||||
if ($info) {
|
if ($info) {
|
||||||
return app("json")->fail("链接已存在");
|
return app("json")->fail("网站已存在");
|
||||||
}
|
}
|
||||||
$data['uid'] = $this->adminId;
|
$data['uid'] = $this->adminId;
|
||||||
$res = aModel::create($data);
|
$res = aModel::create($data);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ use app\common\model\Document;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
use app\common\constant\Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Page
|
* Class Page
|
||||||
|
|
@ -57,7 +58,7 @@ class Page extends AuthController
|
||||||
['page', 1],
|
['page', 1],
|
||||||
['limit', 20],
|
['limit', 20],
|
||||||
]);
|
]);
|
||||||
$where["type"] = Document::DOCUMENT_TYPE_PAGE;
|
$where["type"] = Data::DOCUMENT_TYPE_PAGE;
|
||||||
return app("json")->layui(Document::systemPage($where));
|
return app("json")->layui(Document::systemPage($where));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,7 +99,7 @@ class Page extends AuthController
|
||||||
if ($data['theme'] == "") return app("json")->fail("文章模板不能为空");
|
if ($data['theme'] == "") return app("json")->fail("文章模板不能为空");
|
||||||
if ($data['cover_path'] == "") return app("json")->fail("主图不能为空");
|
if ($data['cover_path'] == "") return app("json")->fail("主图不能为空");
|
||||||
$model = new Document();
|
$model = new Document();
|
||||||
$res = $model->updateInfo($data, Document::DOCUMENT_TYPE_PAGE);
|
$res = $model->updateInfo($data, Data::DOCUMENT_TYPE_PAGE);
|
||||||
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败,错误原因:" . $model->getError());
|
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败,错误原因:" . $model->getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,7 +132,7 @@ class Page extends AuthController
|
||||||
{
|
{
|
||||||
// 获取页面模板列表
|
// 获取页面模板列表
|
||||||
$this->getThemeList();
|
$this->getThemeList();
|
||||||
$themeList = get_theme_list(Document::DOCUMENT_TYPE_PAGE);
|
$themeList = get_theme_list(Data::DOCUMENT_TYPE_PAGE);
|
||||||
$this->assign("theme_list", $themeList);
|
$this->assign("theme_list", $themeList);
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
@ -151,12 +152,12 @@ class Page extends AuthController
|
||||||
if ($where['id'] == '') {
|
if ($where['id'] == '') {
|
||||||
$this->error('数据不存在');
|
$this->error('数据不存在');
|
||||||
}
|
}
|
||||||
$info = (new Document())->getInfo($where["id"], Document::DOCUMENT_TYPE_PAGE);
|
$info = (new Document())->getInfo($where["id"], Data::DOCUMENT_TYPE_PAGE);
|
||||||
if (empty($info)) {
|
if (empty($info)) {
|
||||||
$this->error('数据不存在');
|
$this->error('数据不存在');
|
||||||
}
|
}
|
||||||
// 获取页面模板列表
|
// 获取页面模板列表
|
||||||
$themeList = get_theme_list(Document::DOCUMENT_TYPE_PAGE);
|
$themeList = get_theme_list(Data::DOCUMENT_TYPE_PAGE);
|
||||||
$this->assign("theme_list", $themeList);
|
$this->assign("theme_list", $themeList);
|
||||||
$this->assign("info", $info);
|
$this->assign("info", $info);
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,10 @@
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="form-inline searchForm" onsubmit="return false;">
|
<form class="form-inline searchForm" onsubmit="return false;">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="title">广告名称</label>
|
<label for="title">轮播组名称</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" id="title" name="title"
|
<input type="text" class="form-control" id="title" name="title" placeholder="请输入广告名称">
|
||||||
placeholder="请输入广告名称">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -99,33 +98,36 @@
|
||||||
title: 'ID'
|
title: 'ID'
|
||||||
}, {
|
}, {
|
||||||
field: 'title',
|
field: 'title',
|
||||||
title: '广告名称'
|
title: '标题'
|
||||||
}, {
|
}, {
|
||||||
field: 'cover_path',
|
field: 'alias',
|
||||||
title: '广告图片',
|
title: '标识',
|
||||||
formatter: function (value) {
|
}, {
|
||||||
let html = '<img src="' + value + '" alt="" width="50px;">';
|
field: 'description',
|
||||||
return html;
|
title: '备注',
|
||||||
|
}, {
|
||||||
|
field: 'status',
|
||||||
|
title: '状态',
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
if (value == 0) {
|
||||||
|
is_checked = '';
|
||||||
|
} else if (value == 1) {
|
||||||
|
is_checked = 'checked="checked"';
|
||||||
}
|
}
|
||||||
}, {
|
var field = "display";
|
||||||
field: 'position',
|
result = '<label class="lyear-switch switch-primary switch-solid lyear-status"><input type="checkbox" ' + is_checked + '><span onClick="updateStatus(' + row.id + ', ' + value + ', \'' + field + '\')"></span></label>';
|
||||||
title: '广告图片',
|
return result;
|
||||||
formatter: function (value) {
|
},
|
||||||
return nav_list[value]
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
field: 'url',
|
|
||||||
title: '链接地址',
|
|
||||||
}, {
|
|
||||||
field: 'create_time',
|
|
||||||
title: '添加时间',
|
|
||||||
}, {
|
}, {
|
||||||
field: 'operate',
|
field: 'operate',
|
||||||
title: '操作',
|
title: '操作',
|
||||||
formatter: operateFormatter,
|
formatter: operateFormatter,
|
||||||
events: {
|
events: {
|
||||||
'click .btn-edit': function (event, value, row, index) {
|
'click .btn-edit': function (event, value, row, index) {
|
||||||
iframe.createIframe('修改广告', '/admin/advert/edit?id=' + row.id)
|
iframe.createIframe('编辑', '/admin/advert/edit?id=' + row.id)
|
||||||
|
},
|
||||||
|
'click .btn-list': function (event, value, row, index) {
|
||||||
|
window.location.href = "/admin/advert/info?id=" + row.id;
|
||||||
},
|
},
|
||||||
'click .btn-del': function (event, value, row, index) {
|
'click .btn-del': function (event, value, row, index) {
|
||||||
$.alert({
|
$.alert({
|
||||||
|
|
@ -172,10 +174,30 @@
|
||||||
function operateFormatter(value, row, index) {
|
function operateFormatter(value, row, index) {
|
||||||
return [
|
return [
|
||||||
'<a type="button" class="btn-edit btn btn-xs btn-default m-r-5" title="修改" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>',
|
'<a type="button" class="btn-edit btn btn-xs btn-default m-r-5" title="修改" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>',
|
||||||
|
'<a type="button" class="btn-list btn btn-xs btn-default m-r-5" title="管理轮播" data-toggle="tooltip"><i class="mdi mdi-file-document"></i></a>',
|
||||||
'<a type="button" class="btn-del btn btn-xs btn-default" title="删除" data-toggle="tooltip"><i class="mdi mdi-delete"></i></a>'
|
'<a type="button" class="btn-del btn btn-xs btn-default" title="删除" data-toggle="tooltip"><i class="mdi mdi-delete"></i></a>'
|
||||||
].join('');
|
].join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateStatus(id, value, field) {
|
||||||
|
var newstate = (value == 1) ? 0 : 1; // 发送参数值跟当前参数值相反
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/admin/article/field?id=" + id,
|
||||||
|
data: {field: field, value: newstate},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.status == 200) {
|
||||||
|
parent.lightyear.notify('修改成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
|
$(".tree-table").bootstrapTable('refresh');
|
||||||
|
} else parent.lightyear.notify('修改失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
parent.lightyear.notify('修改失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function delOne(id) {
|
function delOne(id) {
|
||||||
$.confirm({
|
$.confirm({
|
||||||
title: '重要提醒!',
|
title: '重要提醒!',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,235 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh">
|
||||||
|
<head>
|
||||||
|
<title>轮播管理 - {:system_config('title')}后台管理系统</title>
|
||||||
|
{include file="public/header" /}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid p-t-15">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4>管理轮播</h4>
|
||||||
|
<ul class="card-actions">
|
||||||
|
<li>
|
||||||
|
<button type="button" data-toggle="tooltip" title="" data-original-title="返回" onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="card-header"><h4>搜索</h4></div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form class="form-inline searchForm" onsubmit="return false;">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="title">轮播名称</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" id="title" name="title"
|
||||||
|
placeholder="请输入轮播名称">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="start_time">操作时间</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input class="form-control js-datetimepicker" type="text" id="start_time"
|
||||||
|
name="start_time" autocomplete="off" data-side-by-side="true" data-locale="zh-cn"
|
||||||
|
data-format="YYYY-MM-DD" placeholder="开始时间">
|
||||||
|
<span class="input-group-addon">~</span>
|
||||||
|
<input class="form-control js-datetimepicker" type="text" id="end_time" name="end_time"
|
||||||
|
autocomplete="off" data-side-by-side="true" data-locale="zh-cn"
|
||||||
|
data-format="YYYY-MM-DD" placeholder="结束时间">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-success" style="margin: -10px 0 0 10px;" id="search">搜索
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-toolbar clearfix">
|
||||||
|
<div id="toolbar" class="toolbar-btn-action">
|
||||||
|
<button id="btn_add" type="button" class="btn btn-primary m-r-5"
|
||||||
|
onclick="iframe.createIframe('添加轮播','/admin/advert/addAdvert')">
|
||||||
|
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||||
|
</button>
|
||||||
|
<a class="btn btn-warning" href="#!" onclick="delSelect()"><i class="mdi mdi-window-close"></i>
|
||||||
|
删除</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<table id="tb_departments"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{include file="public/footer"/}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('#tb_departments').bootstrapTable({
|
||||||
|
classes: 'table table-bordered table-hover table-striped',
|
||||||
|
url: '/admin/advert/infoList',
|
||||||
|
method: 'post',
|
||||||
|
dataType: 'json', // 因为本示例中是跨域的调用,所以涉及到ajax都采用jsonp,
|
||||||
|
uniqueId: 'id',
|
||||||
|
idField: 'id', // 每行的唯一标识字段
|
||||||
|
toolbar: '#toolbar', // 工具按钮容器
|
||||||
|
showColumns: false, // 是否显示所有的列
|
||||||
|
showRefresh: false, // 是否显示刷新按钮
|
||||||
|
responseHandler: function (res) {
|
||||||
|
return {
|
||||||
|
"total": res.count,
|
||||||
|
"rows": res.data,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
pagination: true,
|
||||||
|
queryParams: function (params) {
|
||||||
|
let temp = toArrayList($(".searchForm").serializeArray());
|
||||||
|
temp['limit'] = params.limit;
|
||||||
|
temp['page'] = (params.offset / params.limit) + 1;
|
||||||
|
return temp;
|
||||||
|
},
|
||||||
|
sidePagination: "server",
|
||||||
|
pageNumber: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
pageList: [10, 20, 50, 100],
|
||||||
|
columns: [{
|
||||||
|
checkbox: true, // 是否显示复选框
|
||||||
|
}, {
|
||||||
|
field: 'id',
|
||||||
|
title: 'ID'
|
||||||
|
}, {
|
||||||
|
field: 'title',
|
||||||
|
title: '轮播名称'
|
||||||
|
}, {
|
||||||
|
field: 'cover_path',
|
||||||
|
title: '轮播图片',
|
||||||
|
formatter: function (value) {
|
||||||
|
let html = '<img src="' + value + '" alt="" width="50px;">';
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
field: 'url',
|
||||||
|
title: '链接地址',
|
||||||
|
}, {
|
||||||
|
field: 'create_time',
|
||||||
|
title: '添加时间',
|
||||||
|
}, {
|
||||||
|
field: 'operate',
|
||||||
|
title: '操作',
|
||||||
|
formatter: operateFormatter,
|
||||||
|
events: {
|
||||||
|
'click .btn-edit': function (event, value, row, index) {
|
||||||
|
iframe.createIframe('修改轮播', '/admin/advert/editAdvert?id=' + row.id)
|
||||||
|
},
|
||||||
|
'click .btn-del': function (event, value, row, index) {
|
||||||
|
$.alert({
|
||||||
|
title: '系统提示',
|
||||||
|
content: '删除提醒',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'btn-primary',
|
||||||
|
action: function () {
|
||||||
|
$.post(url = "/admin/advert/delAdvert", data = {"id": row.id}, function (res) {
|
||||||
|
if (res.status == 200) {
|
||||||
|
parent.lightyear.notify('删除成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
|
$("#tb_departments").bootstrapTable('refresh');
|
||||||
|
} else parent.lightyear.notify('删除失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '取消'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
onLoadSuccess: function (data) {
|
||||||
|
$("[data-toggle='tooltip']").tooltip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//搜索
|
||||||
|
$("#search").click(function () {
|
||||||
|
let start_time = $('#start_time').val();
|
||||||
|
let end_time = $('#end_time').val();
|
||||||
|
if (start_time && end_time && start_time > end_time) {
|
||||||
|
alert('开始时间不能大于结束时间');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$("#tb_departments").bootstrapTable('refresh', {query: {page: 1}, pageNumber: 1});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 操作按钮
|
||||||
|
function operateFormatter(value, row, index) {
|
||||||
|
return [
|
||||||
|
'<a type="button" class="btn-edit btn btn-xs btn-default m-r-5" title="修改" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>',
|
||||||
|
'<a type="button" class="btn-del btn btn-xs btn-default" title="删除" data-toggle="tooltip"><i class="mdi mdi-delete"></i></a>'
|
||||||
|
].join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
function delOne(id) {
|
||||||
|
$.confirm({
|
||||||
|
title: '重要提醒!',
|
||||||
|
content: '删除后将不可恢复,请谨慎操作!',
|
||||||
|
backgroundDismiss: true,
|
||||||
|
buttons: {
|
||||||
|
ok: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'btn-danger',
|
||||||
|
action: function () {
|
||||||
|
$.post("/admin/advert/delAdvert", data = {id: id}, function (res) {
|
||||||
|
if (res.status == 200 || res.code == 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
|
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
|
location.reload();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '取消',
|
||||||
|
btnClass: 'btn-primary'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function delSelect() {
|
||||||
|
var checkID = "";
|
||||||
|
var selectedItem = $('#tb_departments').bootstrapTable('getSelections');
|
||||||
|
if (selectedItem == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
|
for (var i = 0; i < selectedItem.length; i++) {
|
||||||
|
checkID += selectedItem[i]['id'] + ",";
|
||||||
|
}
|
||||||
|
if (checkID == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
|
$.confirm({
|
||||||
|
title: '重要提醒!',
|
||||||
|
content: '选中项删除后将不可恢复,请谨慎操作!',
|
||||||
|
backgroundDismiss: true,
|
||||||
|
buttons: {
|
||||||
|
ok: {
|
||||||
|
text: '确认',
|
||||||
|
btnClass: 'btn-danger',
|
||||||
|
action: function () {
|
||||||
|
$.post("/admin/advert/delAdvert", data = {id: checkID}, function (res) {
|
||||||
|
if (res.status == 200 || res.code == 200) {
|
||||||
|
lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
|
location.reload();
|
||||||
|
} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel: {
|
||||||
|
text: '取消',
|
||||||
|
btnClass: 'btn-primary'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -13,11 +13,11 @@
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="form-inline searchForm" onsubmit="return false;">
|
<form class="form-inline searchForm" onsubmit="return false;">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="title">链接名称</label>
|
<label for="title">网站名称</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" id="title" name="title"
|
<input type="text" class="form-control" id="title" name="title"
|
||||||
placeholder="请输入链接名称或url">
|
placeholder="请输入网站名称或url">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -102,10 +102,10 @@
|
||||||
title: '序号'
|
title: '序号'
|
||||||
}, {
|
}, {
|
||||||
field: 'title',
|
field: 'title',
|
||||||
title: '链接名称'
|
title: '网站名称'
|
||||||
}, {
|
}, {
|
||||||
field: 'url',
|
field: 'url',
|
||||||
title: '链接地址',
|
title: '网站地址',
|
||||||
}, {
|
}, {
|
||||||
field: 'sort',
|
field: 'sort',
|
||||||
title: '排序',
|
title: '排序',
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,13 @@ class Data
|
||||||
const DATA_ADVERT = 'data_advert'; //广告
|
const DATA_ADVERT = 'data_advert'; //广告
|
||||||
const DATA_ARCHIVE = "data_archive"; //文章归档
|
const DATA_ARCHIVE = "data_archive"; //文章归档
|
||||||
|
|
||||||
//广告位
|
//文档类型
|
||||||
const ADVERT_NAV_LIST = [
|
const DOCUMENT_TYPE_ARTICLE = "article";
|
||||||
1 => '主页banner',
|
const DOCUMENT_TYPE_PAGE = "page";
|
||||||
2 => '主页推荐位置',
|
const DOCUMENT_TYPE_PRODUCT = "product";
|
||||||
3 => '主页右侧广告位',
|
|
||||||
4 => '文章banner',
|
//文档分类
|
||||||
5 => '文章右侧广告位置',
|
const DOCUMENT_CATEGORY = 'category';
|
||||||
];
|
|
||||||
|
|
||||||
//后台用户sessionKey
|
//后台用户sessionKey
|
||||||
const SESSION_KEY_ADMIN_ID = 'admin_id';
|
const SESSION_KEY_ADMIN_ID = 'admin_id';
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class Advert extends BaseModel
|
||||||
public static function systemPage($where): array
|
public static function systemPage($where): array
|
||||||
{
|
{
|
||||||
$model = new self;
|
$model = new self;
|
||||||
if ($where['title'] != '') $model = $model->where("title|url", "like", "%$where[title]%");
|
if ($where['title'] != '') $model = $model->where("title|alias", "like", "%$where[title]%");
|
||||||
if ($where['start_time'] != '') $model = $model->where("create_time", ">", strtotime($where['start_time'] . " 00:00:00"));
|
if ($where['start_time'] != '') $model = $model->where("create_time", ">", strtotime($where['start_time'] . " 00:00:00"));
|
||||||
if ($where['end_time'] != '') $model = $model->where("create_time", "<", strtotime($where['end_time'] . " 23:59:59"));
|
if ($where['end_time'] != '') $model = $model->where("create_time", "<", strtotime($where['end_time'] . " 23:59:59"));
|
||||||
if ($where['status'] != '') $model = $model->where("status", $where['status']);
|
if ($where['status'] != '') $model = $model->where("status", $where['status']);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use think\db\exception\DataNotFoundException;
|
||||||
|
use think\db\exception\DbException;
|
||||||
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AdvertInfo
|
||||||
|
* @package app\common\model
|
||||||
|
* @author 木子的忧伤
|
||||||
|
* @date 2021-07-26 18:38
|
||||||
|
*/
|
||||||
|
class AdvertInfo extends BaseModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
* @param $where
|
||||||
|
* @return array
|
||||||
|
* @throws DataNotFoundException
|
||||||
|
* @throws DbException
|
||||||
|
* @throws ModelNotFoundException
|
||||||
|
* @author 木子的忧伤
|
||||||
|
* @date 2021-02-15 23:24
|
||||||
|
*/
|
||||||
|
public static function systemPage($where): array
|
||||||
|
{
|
||||||
|
$model = new self;
|
||||||
|
if ($where['title'] != '') $model = $model->where("title|url", "like", "%$where[title]%");
|
||||||
|
if ($where['start_time'] != '') $model = $model->where("create_time", ">", strtotime($where['start_time'] . " 00:00:00"));
|
||||||
|
if ($where['end_time'] != '') $model = $model->where("create_time", "<", strtotime($where['end_time'] . " 23:59:59"));
|
||||||
|
if ($where['status'] != '') $model = $model->where("status", $where['status']);
|
||||||
|
$count = self::counts($model);
|
||||||
|
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'], (int)$where['limit']);
|
||||||
|
$data = $model->select()->each(function ($item) {
|
||||||
|
if (!empty($item->pic)) {
|
||||||
|
$item->pic = file_cdn($item->pic);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if ($data) $data = $data->toArray();
|
||||||
|
return compact('data', 'count');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ namespace app\common\model;
|
||||||
use app\common\model\Tag as TagModel;
|
use app\common\model\Tag as TagModel;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
|
use app\common\constant\Data;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\facade\Log;
|
use think\facade\Log;
|
||||||
|
|
@ -19,11 +20,6 @@ use think\Model;
|
||||||
*/
|
*/
|
||||||
class Document extends BaseModel
|
class Document extends BaseModel
|
||||||
{
|
{
|
||||||
//文档类型
|
|
||||||
const DOCUMENT_TYPE_ARTICLE = "article";
|
|
||||||
const DOCUMENT_TYPE_PAGE = "page";
|
|
||||||
const DOCUMENT_TYPE_CATEGORY = "product";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
* @param $where
|
* @param $where
|
||||||
|
|
@ -37,7 +33,7 @@ class Document extends BaseModel
|
||||||
public static function systemPage($where): array
|
public static function systemPage($where): array
|
||||||
{
|
{
|
||||||
$model = new self;
|
$model = new self;
|
||||||
$model = $model->where("type", "=",$where['type']??self::DOCUMENT_TYPE_ARTICLE);
|
$model = $model->where("type", "=",$where['type']??Data::DOCUMENT_TYPE_ARTICLE);
|
||||||
if ($where['title'] != '') $model = $model->where("title", "like", "%$where[title]%");
|
if ($where['title'] != '') $model = $model->where("title", "like", "%$where[title]%");
|
||||||
if ($where['start_time'] != '') $model = $model->where("create_time", ">", strtotime($where['start_time'] . " 00:00:00"));
|
if ($where['start_time'] != '') $model = $model->where("create_time", ">", strtotime($where['start_time'] . " 00:00:00"));
|
||||||
if ($where['end_time'] != '') $model = $model->where("create_time", "<", strtotime($where['end_time'] . " 23:59:59"));
|
if ($where['end_time'] != '') $model = $model->where("create_time", "<", strtotime($where['end_time'] . " 23:59:59"));
|
||||||
|
|
@ -59,14 +55,12 @@ class Document extends BaseModel
|
||||||
* @param string $status
|
* @param string $status
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getInfo($id,$type= self::DOCUMENT_TYPE_ARTICLE,$status = 1): array
|
public function getInfo($id, string $type= Data::DOCUMENT_TYPE_ARTICLE, $status = 1): array
|
||||||
{
|
{
|
||||||
if (empty($id)){
|
if (empty($id)){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$model = self::alias('a')
|
$model = self::alias('a')->field("a.*,p.content");
|
||||||
->field("a.*,p.content")
|
|
||||||
->leftJoin('document_article p','a.id = p.id');
|
|
||||||
if (is_numeric($id)){
|
if (is_numeric($id)){
|
||||||
$model->where("a.id",$id);
|
$model->where("a.id",$id);
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -74,6 +68,17 @@ class Document extends BaseModel
|
||||||
}
|
}
|
||||||
if ($type !=='') $model->where("a.type",$type);
|
if ($type !=='') $model->where("a.type",$type);
|
||||||
if ($status !=='')$model->where("a.status",$status);
|
if ($status !=='')$model->where("a.status",$status);
|
||||||
|
switch ($type){
|
||||||
|
case Data::DOCUMENT_TYPE_ARTICLE:
|
||||||
|
$model->leftJoin('document_article p','a.id = p.id');
|
||||||
|
break;
|
||||||
|
case Data::DOCUMENT_TYPE_PAGE:
|
||||||
|
$model->leftJoin('document_page p','a.id = p.id');
|
||||||
|
break;
|
||||||
|
case Data::DOCUMENT_TYPE_PRODUCT:
|
||||||
|
$model->leftJoin('document_product p','a.id = p.id');
|
||||||
|
break;
|
||||||
|
}
|
||||||
$info = $model->find();
|
$info = $model->find();
|
||||||
if (!$info){
|
if (!$info){
|
||||||
return [];
|
return [];
|
||||||
|
|
@ -89,7 +94,7 @@ class Document extends BaseModel
|
||||||
* @throws DbException
|
* @throws DbException
|
||||||
* @throws ModelNotFoundException
|
* @throws ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public function updateInfo($data, string $type=self::DOCUMENT_TYPE_ARTICLE)
|
public function updateInfo($data, string $type=Data::DOCUMENT_TYPE_ARTICLE)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$content = !empty($data['content'])?$data['content']:'';
|
$content = !empty($data['content'])?$data['content']:'';
|
||||||
|
|
@ -132,7 +137,7 @@ class Document extends BaseModel
|
||||||
Document::where('id', $data['id'])->save($data);
|
Document::where('id', $data['id'])->save($data);
|
||||||
if (!empty($content)) {
|
if (!empty($content)) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::DOCUMENT_TYPE_ARTICLE:
|
case Data::DOCUMENT_TYPE_ARTICLE:
|
||||||
$updateData = [
|
$updateData = [
|
||||||
'id' => $data['id'],
|
'id' => $data['id'],
|
||||||
'content' => $content
|
'content' => $content
|
||||||
|
|
@ -140,7 +145,7 @@ class Document extends BaseModel
|
||||||
$model = new DocumentArticle();
|
$model = new DocumentArticle();
|
||||||
$model->save($updateData);
|
$model->save($updateData);
|
||||||
break;
|
break;
|
||||||
case self::DOCUMENT_TYPE_PAGE:
|
case Data::DOCUMENT_TYPE_PAGE:
|
||||||
$updateData = [
|
$updateData = [
|
||||||
'id' => $data['id'],
|
'id' => $data['id'],
|
||||||
'content' => $content
|
'content' => $content
|
||||||
|
|
@ -148,7 +153,7 @@ class Document extends BaseModel
|
||||||
$model = new DocumentPage();
|
$model = new DocumentPage();
|
||||||
$model->save($updateData);
|
$model->save($updateData);
|
||||||
break;
|
break;
|
||||||
case self::DOCUMENT_TYPE_CATEGORY;
|
case Data::DOCUMENT_TYPE_PRODUCT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//默认暂时不处理
|
//默认暂时不处理
|
||||||
|
|
|
||||||
|
|
@ -33,24 +33,4 @@ class DocumentCategory extends BaseModel
|
||||||
$data = $model->select()->toArray();
|
$data = $model->select()->toArray();
|
||||||
return $data ?: [];
|
return $data ?: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询分类选择类型
|
|
||||||
* @param int $type
|
|
||||||
* @param array $ids
|
|
||||||
* @return array
|
|
||||||
* @throws DataNotFoundException
|
|
||||||
* @throws DbException
|
|
||||||
* @throws ModelNotFoundException
|
|
||||||
*/
|
|
||||||
public static function selectByType(int $type = 0, array $ids = [])
|
|
||||||
{
|
|
||||||
$model = new self;
|
|
||||||
if (!empty($ids)) $model = $model->where("id", "not in", $ids);
|
|
||||||
if ($type != 0) $model = $model->where("type", $type);
|
|
||||||
$model = $model->where("status", 1);
|
|
||||||
$model = $model->field("id,title");
|
|
||||||
$data = $model->select();
|
|
||||||
return $data ? $data->toArray() : [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -34,14 +34,14 @@ class Ape extends TagLib
|
||||||
*/
|
*/
|
||||||
public function tagNav($tag, $content)
|
public function tagNav($tag, $content)
|
||||||
{
|
{
|
||||||
$type = isset($tag['type']) ? $tag['type'] : 'son';
|
$type = $tag['type'] ?? 'son';
|
||||||
$typeId = isset($tag['typeId']) ? $tag['typeId'] : '$cid';
|
$typeId = $tag['typeId'] ?? '$cid';
|
||||||
$row = isset($tag['row']) ? $tag['row'] : 100;
|
$row = $tag['row'] ?? 100;
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$where = isset($tag['where']) ? $tag['where'] : '';
|
$where = $tag['where'] ?? '';
|
||||||
$orderBy = isset($tag['orderBy']) ? $tag['orderBy'] : 'sort asc';
|
$orderBy = $tag['orderBy'] ?? 'sort asc';
|
||||||
|
|
||||||
$display = isset($tag['display']) ? $tag['display'] : 1;
|
$display = $tag['display'] ?? 1;
|
||||||
$display = $display == 1 ? 1 : 0;
|
$display = $display == 1 ? 1 : 0;
|
||||||
//3中传参类型
|
//3中传参类型
|
||||||
//1、栏目id,数字类型
|
//1、栏目id,数字类型
|
||||||
|
|
@ -68,15 +68,13 @@ class Ape extends TagLib
|
||||||
*/
|
*/
|
||||||
public function tagChannel($tag, $content)
|
public function tagChannel($tag, $content)
|
||||||
{
|
{
|
||||||
$type = isset($tag['type']) ? $tag['type'] : 'son';
|
$type = $tag['type'] ?? 'son';
|
||||||
$typeId = isset($tag['typeId']) ? $tag['typeId'] : '$cid';
|
$typeId = $tag['typeId'] ?? '$cid';
|
||||||
$row = isset($tag['row']) ? $tag['row'] : 100;
|
$row = $tag['row'] ?? 100;
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$where = isset($tag['where']) ? $tag['where'] : '';
|
$where = $tag['where'] ?? '';
|
||||||
$orderBy = isset($tag['orderBy']) ? $tag['orderBy'] : 'sort asc';
|
$orderBy = $tag['orderBy'] ?? 'sort asc';
|
||||||
|
$display = $tag['display'] ?? 1;
|
||||||
$display = isset($tag['display']) ? $tag['display'] : 1;
|
|
||||||
$display = $display == 1 ? 1 : 0;
|
|
||||||
//3中传参类型
|
//3中传参类型
|
||||||
//1、栏目id,数字类型
|
//1、栏目id,数字类型
|
||||||
//2、多个栏目id,逗号隔开
|
//2、多个栏目id,逗号隔开
|
||||||
|
|
@ -102,20 +100,20 @@ class Ape extends TagLib
|
||||||
*/
|
*/
|
||||||
public function tagArclist($tag, $content)
|
public function tagArclist($tag, $content)
|
||||||
{
|
{
|
||||||
$typeId = isset($tag['typeId']) ? $tag['typeId'] : '$cid';
|
$typeId = $tag['typeId'] ?? '$cid';
|
||||||
$orderBy = isset($tag['orderBy']) ? $tag['orderBy'] : 'sort asc,create_time desc';
|
$orderBy = $tag['orderBy'] ?? 'sort asc,create_time desc';
|
||||||
$row = isset($tag['row']) ? $tag['row'] : '100';
|
$row = $tag['row'] ?? '100';
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$model = isset($tag['model']) ? $tag['model'] : 'article';
|
$model = $tag['model'] ?? 'article';
|
||||||
$type = isset($tag['type']) ? $tag['type'] : 'find';
|
$type = $tag['type'] ?? 'find';
|
||||||
$where = isset($tag['where']) ? $tag['where'] : '';
|
$where = $tag['where'] ?? '';
|
||||||
$ids = isset($tag['ids']) ? $tag['ids'] : '';
|
$ids = $tag['ids'] ?? '';
|
||||||
//limit参数优先于row
|
//limit参数优先于row
|
||||||
if (isset($tag['limit'])) {
|
if (isset($tag['limit'])) {
|
||||||
$row = $tag['limit'];
|
$row = $tag['limit'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$display = isset($tag['display']) ? $tag['display'] : 1;
|
$display = $tag['display'] ?? 1;
|
||||||
$display = $display == 1 ? 1 : 0;
|
$display = $display == 1 ? 1 : 0;
|
||||||
|
|
||||||
//3中传参类型
|
//3中传参类型
|
||||||
|
|
@ -165,16 +163,16 @@ class Ape extends TagLib
|
||||||
* @param $content
|
* @param $content
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function tagList($tag, $content)
|
public function tagList($tag, $content): string
|
||||||
{
|
{
|
||||||
$orderBy = isset($tag['orderBy']) ? $tag['orderBy'] : 'sort desc,create_time desc';
|
$orderBy = $tag['orderBy'] ?? 'sort desc,create_time desc';
|
||||||
$pageSize = isset($tag['pageSize']) ? $tag['pageSize'] : 15;
|
$pageSize = $tag['pageSize'] ?? 15;
|
||||||
$type = isset($tag['type']) ? $tag['type'] : 'find';
|
$type = $tag['type'] ?? 'find';
|
||||||
$typeId = isset($tag['typeId']) ? $tag['typeId'] : '$cid';
|
$typeId = $tag['typeId'] ?? '$cid';
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$model = isset($tag['model']) ? $tag['model'] : 'article';
|
$model = $tag['model'] ?? 'article';
|
||||||
$where = isset($tag['where']) ? $tag['where'] : '';
|
$where = $tag['where'] ?? '';
|
||||||
$display = isset($tag['display']) ? $tag['display'] : 1;
|
$display = $tag['display'] ?? 1;
|
||||||
$display = $display == 1 ? 1 : 0;
|
$display = $display == 1 ? 1 : 0;
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
$parse .= '$__FUN__ =' . "tpl_get_list(\"$orderBy\",$pageSize,\"$typeId\",\"$type\",\"$model\",\"$where\",$display);";
|
$parse .= '$__FUN__ =' . "tpl_get_list(\"$orderBy\",$pageSize,\"$typeId\",\"$type\",\"$model\",\"$where\",$display);";
|
||||||
|
|
@ -193,10 +191,10 @@ class Ape extends TagLib
|
||||||
*/
|
*/
|
||||||
public function tagPrenext($tag, $content)
|
public function tagPrenext($tag, $content)
|
||||||
{
|
{
|
||||||
$get = isset($tag['get']) ? $tag['get'] : 'pre';
|
$get = $tag['get'] ?? 'pre';
|
||||||
$cid = isset($tag['cid']) ? $tag['cid'] : '$cid';
|
$cid = $tag['cid'] ?? '$cid';
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$none = isset($tag['none']) ? $tag['none'] : '没有了';
|
$none = $tag['none'] ?? '没有了';
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
|
|
||||||
$parse .= '$__LIST__ =[];array_push($__LIST__,' . "tpl_get_prenext(\"$get\",$cid,\"$none\"));";
|
$parse .= '$__LIST__ =[];array_push($__LIST__,' . "tpl_get_prenext(\"$get\",$cid,\"$none\"));";
|
||||||
|
|
@ -215,10 +213,10 @@ class Ape extends TagLib
|
||||||
*/
|
*/
|
||||||
public function tagFlink($tag, $content)
|
public function tagFlink($tag, $content)
|
||||||
{
|
{
|
||||||
$type = isset($tag['type']) ? $tag['type'] : 'text';
|
$type = $tag['type'] ?? 'text';
|
||||||
$type = $type == 'text' ? 0 : 1;
|
$type = $type == 'text' ? 0 : 1;
|
||||||
$row = isset($tag['row']) ? $tag['row'] : 100;
|
$row = $tag['row'] ?? 100;
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
|
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
$parse .= '$__LIST__ =' . "tpl_get_friend_link($type,$row);";
|
$parse .= '$__LIST__ =' . "tpl_get_friend_link($type,$row);";
|
||||||
|
|
@ -239,11 +237,11 @@ class Ape extends TagLib
|
||||||
*/
|
*/
|
||||||
public function tagAdvert($tag, $content)
|
public function tagAdvert($tag, $content)
|
||||||
{
|
{
|
||||||
$type = isset($tag['type']) ? $tag['type'] : 1;
|
$type = $tag['type'] ?? 1;
|
||||||
$row = isset($tag['row']) ? $tag['row'] : 5;
|
$row = $tag['row'] ?? 5;
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
$parse .= '$__LIST__ =' . "tpl_get_advert($type,$row);";
|
$parse .= '$__LIST__ =' . "tpl_get_advert('$type',$row);";
|
||||||
$parse .= ' ?>';
|
$parse .= ' ?>';
|
||||||
$parse .= '{volist name="__LIST__" id="' . $void . '"}';
|
$parse .= '{volist name="__LIST__" id="' . $void . '"}';
|
||||||
$parse .= $content;
|
$parse .= $content;
|
||||||
|
|
@ -262,8 +260,8 @@ class Ape extends TagLib
|
||||||
if (!isset($tag['id'])) {
|
if (!isset($tag['id'])) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$model = isset($tag['model']) ? $tag['model'] : 'article';
|
$model = $tag['model'] ?? 'article';
|
||||||
$id = $tag['id'];
|
$id = $tag['id'];
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
$parse .= '$__LIST__ =[];array_push($__LIST__,' . "tpl_get_article($id,'$model'));";
|
$parse .= '$__LIST__ =[];array_push($__LIST__,' . "tpl_get_article($id,'$model'));";
|
||||||
|
|
@ -286,7 +284,7 @@ class Ape extends TagLib
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$tags = $tag['tags'];
|
$tags = $tag['tags'];
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
|
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
$parse .= '$__LIST__ =' . "tpl_get_tags_list($tags);";
|
$parse .= '$__LIST__ =' . "tpl_get_tags_list($tags);";
|
||||||
|
|
@ -307,11 +305,11 @@ class Ape extends TagLib
|
||||||
*/
|
*/
|
||||||
public function tagComment($tag, $content)
|
public function tagComment($tag, $content)
|
||||||
{
|
{
|
||||||
$pageSize = isset($tag['pageSize']) ? $tag['pageSize'] : 10;
|
$pageSize = $tag['pageSize'] ?? 10;
|
||||||
$type = isset($tag['type']) ? $tag['type'] : 'top';
|
$type = $tag['type'] ?? 'top';
|
||||||
$typeId = isset($tag['typeId']) ? $tag['typeId'] : 0;
|
$typeId = $tag['typeId'] ?? 0;
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$orderBy = isset($tag['orderBy']) ? $tag['orderBy'] : 'id asc';
|
$orderBy = $tag['orderBy'] ?? 'id asc';
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
$parse .= '$__FUN__ =' . "tpl_get_comment_list($typeId,\"$type\",$pageSize,\"$orderBy\");";
|
$parse .= '$__FUN__ =' . "tpl_get_comment_list($typeId,\"$type\",$pageSize,\"$orderBy\");";
|
||||||
if ($type == 'top') {
|
if ($type == 'top') {
|
||||||
|
|
@ -340,9 +338,9 @@ class Ape extends TagLib
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$documentId = $tag['id'];
|
$documentId = $tag['id'];
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$row = isset($tag['row']) ? $tag['row'] : 100;
|
$row = $tag['row'] ?? 100;
|
||||||
$model = isset($tag['model']) ? $tag['model'] : 'article';
|
$model = $tag['model'] ?? 'article';
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
$parse .= '$__LIST__ =' . "tpl_get_relevant_list($documentId,$row,'$model');";
|
$parse .= '$__LIST__ =' . "tpl_get_relevant_list($documentId,$row,'$model');";
|
||||||
$parse .= ' ?>';
|
$parse .= ' ?>';
|
||||||
|
|
@ -364,7 +362,7 @@ class Ape extends TagLib
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$format = $tag['format'] ?: "Y-m";
|
$format = $tag['format'] ?: "Y-m";
|
||||||
$void = isset($tag['void']) ? $tag['void'] : 'field';
|
$void = $tag['void'] ?? 'field';
|
||||||
$parse = '<?php ';
|
$parse = '<?php ';
|
||||||
$parse .= '$__LIST__ =' . "tpl_get_archive_list(\"$tag[type]\",\"$format\");";
|
$parse .= '$__LIST__ =' . "tpl_get_archive_list(\"$tag[type]\",\"$format\");";
|
||||||
$parse .= ' ?>';
|
$parse .= ' ?>';
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ use app\common\model\Comment;
|
||||||
use app\common\model\Document;
|
use app\common\model\Document;
|
||||||
use app\common\model\DocumentCategory;
|
use app\common\model\DocumentCategory;
|
||||||
use app\common\model\DocumentCategoryContent;
|
use app\common\model\DocumentCategoryContent;
|
||||||
|
use app\common\model\Advert;
|
||||||
use app\common\model\FriendLink;
|
use app\common\model\FriendLink;
|
||||||
use app\common\model\Tag;
|
use app\common\model\Tag;
|
||||||
use app\common\model\Nav;
|
use app\common\model\Nav;
|
||||||
|
|
@ -15,7 +16,6 @@ use think\db\exception\DbException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
use think\Exception;
|
use think\Exception;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\facade\Route as Url;
|
|
||||||
|
|
||||||
// 应用公共文件
|
// 应用公共文件
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,23 +37,6 @@ function html2text($str)
|
||||||
return strip_tags($str);
|
return strip_tags($str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取文章分类的内容
|
|
||||||
* $id=文章id
|
|
||||||
* $strip=true过滤html
|
|
||||||
*/
|
|
||||||
function get_type_content($id, $strip = false)
|
|
||||||
{
|
|
||||||
$dc = DocumentCategoryContent::find($id);
|
|
||||||
if (!$dc) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
if ($strip) {
|
|
||||||
return html2text($dc['content']);
|
|
||||||
}
|
|
||||||
return $dc['content'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文章分类
|
* 获取文章分类
|
||||||
*/
|
*/
|
||||||
|
|
@ -322,7 +305,6 @@ function tpl_get_prenext($get, $cid = false, $none)
|
||||||
$document['url'] = 'javascript:void(0)';
|
$document['url'] = 'javascript:void(0)';
|
||||||
$document['title'] = $none;
|
$document['title'] = $none;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $document;
|
return $document;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -333,7 +315,7 @@ function tpl_get_prenext($get, $cid = false, $none)
|
||||||
* @param $cid int 栏目分类id
|
* @param $cid int 栏目分类id
|
||||||
* @param $type string 读取数据的方式(son:'获取栏目下文章以及所有子孙分类文章',self:'获取栏目下文章',search:'获取关键字搜索的文章',where:'根据自定义条件获取文章(where语句)')
|
* @param $type string 读取数据的方式(son:'获取栏目下文章以及所有子孙分类文章',self:'获取栏目下文章',search:'获取关键字搜索的文章',where:'根据自定义条件获取文章(where语句)')
|
||||||
* @param string $table 文章内容扩展表名,默认article
|
* @param string $table 文章内容扩展表名,默认article
|
||||||
* @param bool $where 自定义条件
|
* @param bool|array $where 自定义条件
|
||||||
* @param int $display
|
* @param int $display
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|
@ -341,7 +323,7 @@ function tpl_get_prenext($get, $cid = false, $none)
|
||||||
* @throws DbException
|
* @throws DbException
|
||||||
* @throws ModelNotFoundException
|
* @throws ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
function tpl_get_list($orderBy, $pageSize, $cid, $type, $table = 'article', $where = false, $display = 1)
|
function tpl_get_list($orderBy, int $pageSize, $cid, $type, $table = 'article', $where, int $display = 1)
|
||||||
{
|
{
|
||||||
$documentListModel = (new Document())
|
$documentListModel = (new Document())
|
||||||
->alias('a')
|
->alias('a')
|
||||||
|
|
@ -441,15 +423,7 @@ function get_route_query()
|
||||||
*/
|
*/
|
||||||
function make_category_url($item)
|
function make_category_url($item)
|
||||||
{
|
{
|
||||||
if ((int)$item['type'] == 0) {
|
return url('article/detail', ['id'=>$item['alias']?:$item['id']])->build();
|
||||||
return url('article/lists', ['id'=>$item['id']])->build();
|
|
||||||
// return url('article/lists', ['id'=>$item['alias']?:$item['id']])->build();
|
|
||||||
} elseif ((int)$item['type'] == 1) {
|
|
||||||
return url('article/lists', ['id'=>$item['id']])->build();
|
|
||||||
} elseif ((int)$item['type'] == 2) {
|
|
||||||
return $item['link_str'];
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -463,7 +437,7 @@ function make_detail_url($item)
|
||||||
if ($item['link_str']) {
|
if ($item['link_str']) {
|
||||||
return $item['link_str'];
|
return $item['link_str'];
|
||||||
} else {
|
} else {
|
||||||
return url('article/detail', ['id'=>$item['alias']?:$item['id']])->build();
|
return url($item['type'].'/detail', ['id'=>$item['alias']?:$item['id']])->build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -603,11 +577,15 @@ function tpl_get_advert($type, $row)
|
||||||
{
|
{
|
||||||
$advertList = cache(Data::DATA_ADVERT . '_' . $type);
|
$advertList = cache(Data::DATA_ADVERT . '_' . $type);
|
||||||
if ($advertList === null) {
|
if ($advertList === null) {
|
||||||
if ($type > 0) {
|
$advertList = (new Advert())->alias("a")
|
||||||
$advertList = Db::name('advert')->where('position', $type)->where('status', 1)->order('sort desc')->limit($row)->select();
|
->leftJoin("advert_info i",'a.id = i.advert_id')
|
||||||
} else {
|
->field("i.*")
|
||||||
$advertList = Db::name('advert')->where('status', 1)->order('sort desc')->limit($row)->select();
|
->where('a.alias', $type)
|
||||||
}
|
->where('a.status', 1)
|
||||||
|
->where('i.status', 1)
|
||||||
|
->order('sort desc')
|
||||||
|
->limit($row)
|
||||||
|
->select();
|
||||||
//处理文件cdn信息
|
//处理文件cdn信息
|
||||||
foreach ($advertList as $key => &$item) {
|
foreach ($advertList as $key => &$item) {
|
||||||
if (empty($item['cover_path'])){
|
if (empty($item['cover_path'])){
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use app\common\model\Comment as commentModel;
|
||||||
use app\common\model\Document;
|
use app\common\model\Document;
|
||||||
use app\common\model\DocumentCategory;
|
use app\common\model\DocumentCategory;
|
||||||
use app\common\model\DocumentCategoryContent;
|
use app\common\model\DocumentCategoryContent;
|
||||||
use app\common\model\Tag as TagModel;
|
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
|
|
@ -61,28 +60,16 @@ class Article extends Base
|
||||||
$this->urlrecord($dc['title']);
|
$this->urlrecord($dc['title']);
|
||||||
}
|
}
|
||||||
//读取列表页模板
|
//读取列表页模板
|
||||||
if ($dc['type'] == 0) {
|
$template = Data::DOCUMENT_CATEGORY . '/' . ($dc['template'] ?: 'list_default.html');
|
||||||
if (empty($dc['template'])) {
|
$templateFile = config('view.view_path') . $template;
|
||||||
$this->error('请在栏目分类中,指定当前栏目的列表模板!');
|
if (!is_file($templateFile)) {
|
||||||
}
|
|
||||||
} elseif ($dc['type'] == 1) {
|
|
||||||
if (empty($dc['template'])) {
|
|
||||||
$this->error('请在栏目分类中,指定当前栏目的单篇模板!');
|
|
||||||
}
|
|
||||||
//如果是单篇栏目,加载内容
|
|
||||||
$contentModel = new DocumentCategoryContent();
|
|
||||||
$dcContent = $contentModel->find($id);
|
|
||||||
$dc['content'] = $dcContent['content'];
|
|
||||||
}
|
|
||||||
$listTmp = $dc['template'];
|
|
||||||
if (!is_file(config('view.view_path') . 'category/' . $listTmp)) {
|
|
||||||
$this->error('模板文件不存在!');
|
$this->error('模板文件不存在!');
|
||||||
}
|
}
|
||||||
Log::info('列表页模板路径:' . config('view.view_path') . 'category/' . $listTmp);
|
Log::info('列表页模板路径:' . $templateFile);
|
||||||
//文章兼容字段
|
//文章兼容字段
|
||||||
$dc['category_id'] = $dc['id'];
|
$dc['category_id'] = $dc['id'];
|
||||||
//判断seo标题是否存在
|
//判断seo标题是否存在
|
||||||
$dc['meta_title'] = $dc['meta_title'] ? $dc['meta_title'] : $dc['title'];
|
$dc['meta_title'] = $dc['meta_title'] ?: $dc['title'];
|
||||||
//判断SEO 为空则取系统
|
//判断SEO 为空则取系统
|
||||||
$article['keywords'] = $dc['keywords'] ?: web_config('keywords');
|
$article['keywords'] = $dc['keywords'] ?: web_config('keywords');
|
||||||
$article['description'] = $dc['description'] ?: web_config('description');
|
$article['description'] = $dc['description'] ?: web_config('description');
|
||||||
|
|
@ -96,8 +83,8 @@ class Article extends Base
|
||||||
//缓存当前页面栏目分类树ids
|
//缓存当前页面栏目分类树ids
|
||||||
cache(Data::CURR_CATEGORY_PATENT_ID, $dc['pid'] ? $dc['pid'] . ',' . $id : $id);
|
cache(Data::CURR_CATEGORY_PATENT_ID, $dc['pid'] ? $dc['pid'] . ',' . $id : $id);
|
||||||
//去除后缀
|
//去除后缀
|
||||||
$listTmp = substr($listTmp, 0, strpos($listTmp, '.'));
|
$template = substr($template, 0, strpos($template, '.'));
|
||||||
return $this->fetch('category/' . $listTmp);
|
return $this->fetch($template);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -118,34 +105,21 @@ class Article extends Base
|
||||||
}
|
}
|
||||||
//获取该文章
|
//获取该文章
|
||||||
$documentModel = new Document();
|
$documentModel = new Document();
|
||||||
if (is_numeric($id)){
|
$article = $documentModel->getInfo($id, Data::DOCUMENT_TYPE_ARTICLE);
|
||||||
$article = $documentModel->where('status', 1)->where('id', $id)->find();
|
|
||||||
}else{
|
|
||||||
$article = $documentModel->where('status', 1)->where('alias', $id)->find();
|
|
||||||
}
|
|
||||||
if (!$article) {
|
if (!$article) {
|
||||||
$this->error('文章不存在或已删除!');
|
$this->error('文章不存在或已删除!');
|
||||||
}
|
}
|
||||||
$article = $article->toArray();
|
|
||||||
//根据分类id找分类信息
|
//根据分类id找分类信息
|
||||||
$dc = get_document_category($article['category_id']);
|
$dc = get_document_category($article['category_id']);
|
||||||
if (!$dc) {
|
if (!$dc) {
|
||||||
$this->error('栏目不存在或已删除!');
|
$this->error('栏目不存在或已删除!');
|
||||||
}
|
}
|
||||||
//获取该文章内容
|
|
||||||
//根据文章类型,加载不同的内容。
|
|
||||||
$articleType = $article['type'] ? $article['type'] : 'article';
|
|
||||||
$articleExt = $documentModel::name('document_' . $articleType)->where('id', $article['id'])->find();
|
|
||||||
if (!$articleExt) {
|
|
||||||
$this->error('文章不存在或已删除!');
|
|
||||||
}
|
|
||||||
$articleExt = $articleExt->toArray();
|
|
||||||
$article = array_merge($article, $articleExt);
|
|
||||||
//添加当前页面的位置信息
|
//添加当前页面的位置信息
|
||||||
$article['position'] = tpl_get_position($dc);
|
$article['position'] = tpl_get_position($dc);
|
||||||
//更新浏览次数
|
//更新浏览次数
|
||||||
$documentModel->where('id', $article['id'])->inc('view')->update();
|
$documentModel->where('id', $article['id'])->inc('view')->update();
|
||||||
$templateFile = config('view.view_path') . 'article/' . $articleType . '.html';
|
$template = Data::DOCUMENT_TYPE_ARTICLE . '/' . ($article['theme'] ?: 'detail.html');
|
||||||
|
$templateFile = config('view.view_path') . $template;
|
||||||
if (!is_file($templateFile)) {
|
if (!is_file($templateFile)) {
|
||||||
$this->error('模板文件不存在!');
|
$this->error('模板文件不存在!');
|
||||||
}
|
}
|
||||||
|
|
@ -168,7 +142,9 @@ class Article extends Base
|
||||||
$this->urlrecord($article['title']);
|
$this->urlrecord($article['title']);
|
||||||
}
|
}
|
||||||
Log::info('详情页模板路径:' . $templateFile);
|
Log::info('详情页模板路径:' . $templateFile);
|
||||||
return $this->fetch('article/' . $articleType);
|
//去除后缀
|
||||||
|
$template = substr($template, 0, strpos($template, '.'));
|
||||||
|
return $this->fetch($template);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -123,4 +123,51 @@ class Index extends Base
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关于页面
|
||||||
|
* @param Request $request
|
||||||
|
* @author 木子的忧伤
|
||||||
|
* @date 2022-06-21 23:48
|
||||||
|
*/
|
||||||
|
public function about(Request $request)
|
||||||
|
{
|
||||||
|
$id = "about";
|
||||||
|
//获取该文章
|
||||||
|
$documentModel = new Document();
|
||||||
|
$article = $documentModel->getInfo($id, Data::DOCUMENT_TYPE_PAGE);
|
||||||
|
if (!$article) {
|
||||||
|
$this->error('文章不存在或已删除!');
|
||||||
|
}
|
||||||
|
//添加当前页面的位置信息
|
||||||
|
|
||||||
|
$article['position'] = '<a href="/">首页</a><span>></span>';
|
||||||
|
//更新浏览次数
|
||||||
|
$documentModel->where('id', $article['id'])->inc('view')->update();
|
||||||
|
$template = Data::DOCUMENT_TYPE_PAGE . '/' . ($article['theme'] ?: 'detail.html');
|
||||||
|
$templateFile = config('view.view_path') . $template;
|
||||||
|
if (!is_file($templateFile)) {
|
||||||
|
$this->error('模板文件不存在!');
|
||||||
|
}
|
||||||
|
$article['category_title'] = "单页";
|
||||||
|
//判断SEO 为空则取系统
|
||||||
|
$article['keywords'] = $article['keywords'] ?: web_config('keywords');
|
||||||
|
$article['description'] = $article['description'] ?: web_config('description');
|
||||||
|
//输出文章内容
|
||||||
|
$this->assign('apeField', $article);
|
||||||
|
$this->assign('id', $id);
|
||||||
|
//当前页面所属分类id
|
||||||
|
$this->assign('cid', $article['category_id']);
|
||||||
|
//设置文章的url
|
||||||
|
$article['link_str'] = make_detail_url($article);
|
||||||
|
//判断后台统计配置是否开启 1 开启
|
||||||
|
if (web_config("web_statistics") == 1) {
|
||||||
|
//统计url
|
||||||
|
$this->urlrecord($article['title']);
|
||||||
|
}
|
||||||
|
Log::info('详情页模板路径:' . $templateFile);
|
||||||
|
//去除后缀
|
||||||
|
$template = substr($template, 0, strpos($template, '.'));
|
||||||
|
return $this->fetch($template);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -23,83 +23,6 @@ use think\facade\Log;
|
||||||
*/
|
*/
|
||||||
class Page extends Base
|
class Page extends Base
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 列表页
|
|
||||||
* @return string
|
|
||||||
* @throws Exception
|
|
||||||
* @throws DataNotFoundException
|
|
||||||
* @throws DbException
|
|
||||||
* @throws ModelNotFoundException
|
|
||||||
* @author 木子的忧伤
|
|
||||||
* @date 2021-10-29 0:17
|
|
||||||
*/
|
|
||||||
public function lists()
|
|
||||||
{
|
|
||||||
$dc = false;
|
|
||||||
//栏目分类id
|
|
||||||
$id = input('id/d');
|
|
||||||
//栏目分类标识
|
|
||||||
$name = input('name');
|
|
||||||
if ($id) {
|
|
||||||
//获取分类信息
|
|
||||||
$dc = get_document_category($id);
|
|
||||||
} elseif ($name) {
|
|
||||||
//接收name字段,当name不为空的时候,通过name查询分类,一般name会用于伪静态
|
|
||||||
$dc = get_document_category_by_name($name);
|
|
||||||
}
|
|
||||||
if (!$dc) {
|
|
||||||
$this->error('栏目不存在或已删除!');
|
|
||||||
}
|
|
||||||
//赋值分类id,可能是通过栏目分类id获取的栏目分类数据
|
|
||||||
$id = $dc['id'];
|
|
||||||
$documentCategoryModel = new DocumentCategory();
|
|
||||||
//栏目存在 增加访问量
|
|
||||||
$documentCategoryModel->where('id|alias', $id)->inc('view')->update();
|
|
||||||
//判断后台统计配置是否开启 1 开启
|
|
||||||
if (web_config("web_statistics") == 1) {
|
|
||||||
//统计url
|
|
||||||
$this->urlrecord($dc['title']);
|
|
||||||
}
|
|
||||||
//读取列表页模板
|
|
||||||
if ($dc['type'] == 0) {
|
|
||||||
if (empty($dc['template'])) {
|
|
||||||
$this->error('请在栏目分类中,指定当前栏目的列表模板!');
|
|
||||||
}
|
|
||||||
} elseif ($dc['type'] == 1) {
|
|
||||||
if (empty($dc['template'])) {
|
|
||||||
$this->error('请在栏目分类中,指定当前栏目的单篇模板!');
|
|
||||||
}
|
|
||||||
//如果是单篇栏目,加载内容
|
|
||||||
$contentModel = new DocumentCategoryContent();
|
|
||||||
$dcContent = $contentModel->find($id);
|
|
||||||
$dc['content'] = $dcContent['content'];
|
|
||||||
}
|
|
||||||
$listTmp = $dc['template'];
|
|
||||||
if (!is_file(config('view.view_path') . 'category/' . $listTmp)) {
|
|
||||||
$this->error('模板文件不存在!');
|
|
||||||
}
|
|
||||||
Log::info('列表页模板路径:' . config('view.view_path') . 'category/' . $listTmp);
|
|
||||||
//文章兼容字段
|
|
||||||
$dc['category_id'] = $dc['id'];
|
|
||||||
//判断seo标题是否存在
|
|
||||||
$dc['meta_title'] = $dc['meta_title'] ? $dc['meta_title'] : $dc['title'];
|
|
||||||
//判断SEO 为空则取系统
|
|
||||||
$article['keywords'] = $dc['keywords'] ?: web_config('keywords');
|
|
||||||
$article['description'] = $dc['description'] ?: web_config('description');
|
|
||||||
//添加当前页面的位置信息
|
|
||||||
$dc['position'] = tpl_get_position($dc);
|
|
||||||
//输出文章分类
|
|
||||||
$this->assign('apeField', $dc);
|
|
||||||
$this->assign('id', $id);
|
|
||||||
//当前页面所属分类id
|
|
||||||
$this->assign('cid', $id);
|
|
||||||
//缓存当前页面栏目分类树ids
|
|
||||||
cache(Data::CURR_CATEGORY_PATENT_ID, $dc['pid'] ? $dc['pid'] . ',' . $id : $id);
|
|
||||||
//去除后缀
|
|
||||||
$listTmp = substr($listTmp, 0, strpos($listTmp, '.'));
|
|
||||||
return $this->fetch('category/' . $listTmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情页
|
* 详情页
|
||||||
* @return string
|
* @return string
|
||||||
|
|
@ -118,34 +41,21 @@ class Page extends Base
|
||||||
}
|
}
|
||||||
//获取该文章
|
//获取该文章
|
||||||
$documentModel = new Document();
|
$documentModel = new Document();
|
||||||
$article = $documentModel->where('status', 1)->where('id|alias', $id)->find();
|
$article = $documentModel->getInfo($id, Data::DOCUMENT_TYPE_PAGE);
|
||||||
if (!$article) {
|
if (!$article) {
|
||||||
$this->error('文章不存在或已删除!');
|
$this->error('文章不存在或已删除!');
|
||||||
}
|
}
|
||||||
$article = $article->toArray();
|
|
||||||
//根据分类id找分类信息
|
|
||||||
$dc = get_document_category($article['category_id']);
|
|
||||||
if (!$dc) {
|
|
||||||
$this->error('栏目不存在或已删除!');
|
|
||||||
}
|
|
||||||
//获取该文章内容
|
|
||||||
//根据文章类型,加载不同的内容。
|
|
||||||
$articleType = $article['type'] ? $article['type'] : 'article';
|
|
||||||
$articleExt = $documentModel::name('document_' . $articleType)->where('id', $article['id'])->find();
|
|
||||||
if (!$articleExt) {
|
|
||||||
$this->error('文章不存在或已删除!');
|
|
||||||
}
|
|
||||||
$articleExt = $articleExt->toArray();
|
|
||||||
$article = array_merge($article, $articleExt);
|
|
||||||
//添加当前页面的位置信息
|
//添加当前页面的位置信息
|
||||||
$article['position'] = tpl_get_position($dc);
|
|
||||||
|
$article['position'] = '<a href="/">首页</a><span>></span>';
|
||||||
//更新浏览次数
|
//更新浏览次数
|
||||||
$documentModel->where('id', $article['id'])->inc('view')->update();
|
$documentModel->where('id', $article['id'])->inc('view')->update();
|
||||||
$templateFile = config('view.view_path') . 'article/' . $articleType . '.html';
|
$template = Data::DOCUMENT_TYPE_PAGE . '/' . ($article['theme'] ?: 'detail.html');
|
||||||
|
$templateFile = config('view.view_path') . $template;
|
||||||
if (!is_file($templateFile)) {
|
if (!is_file($templateFile)) {
|
||||||
$this->error('模板文件不存在!');
|
$this->error('模板文件不存在!');
|
||||||
}
|
}
|
||||||
$article['category_title'] = $dc['title'];
|
$article['category_title'] = "单页";
|
||||||
//判断SEO 为空则取系统
|
//判断SEO 为空则取系统
|
||||||
$article['keywords'] = $article['keywords'] ?: web_config('keywords');
|
$article['keywords'] = $article['keywords'] ?: web_config('keywords');
|
||||||
$article['description'] = $article['description'] ?: web_config('description');
|
$article['description'] = $article['description'] ?: web_config('description');
|
||||||
|
|
@ -154,8 +64,6 @@ class Page extends Base
|
||||||
$this->assign('id', $id);
|
$this->assign('id', $id);
|
||||||
//当前页面所属分类id
|
//当前页面所属分类id
|
||||||
$this->assign('cid', $article['category_id']);
|
$this->assign('cid', $article['category_id']);
|
||||||
//缓存当前页面栏目分类树ids
|
|
||||||
cache(Data::CURR_CATEGORY_PATENT_ID, $dc['pid'] ? $dc['pid'] . ',' . $article['category_id'] : $article['category_id']);
|
|
||||||
//设置文章的url
|
//设置文章的url
|
||||||
$article['link_str'] = make_detail_url($article);
|
$article['link_str'] = make_detail_url($article);
|
||||||
//判断后台统计配置是否开启 1 开启
|
//判断后台统计配置是否开启 1 开启
|
||||||
|
|
@ -164,7 +72,9 @@ class Page extends Base
|
||||||
$this->urlrecord($article['title']);
|
$this->urlrecord($article['title']);
|
||||||
}
|
}
|
||||||
Log::info('详情页模板路径:' . $templateFile);
|
Log::info('详情页模板路径:' . $templateFile);
|
||||||
return $this->fetch('article/' . $articleType);
|
//去除后缀
|
||||||
|
$template = substr($template, 0, strpos($template, '.'));
|
||||||
|
return $this->fetch($template);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -210,196 +120,4 @@ class Page extends Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 文章标签页面
|
|
||||||
* @return string
|
|
||||||
* @throws DataNotFoundException
|
|
||||||
* @throws DbException
|
|
||||||
* @throws ModelNotFoundException
|
|
||||||
* @author 木子的忧伤
|
|
||||||
* @date 2021-10-29 0:19
|
|
||||||
*/
|
|
||||||
public function tag()
|
|
||||||
{
|
|
||||||
$tag = input('t');
|
|
||||||
if (!trim($tag)) {
|
|
||||||
$this->error('请输入标签');
|
|
||||||
}
|
|
||||||
if (!mb_check_encoding($tag, 'utf-8')) {
|
|
||||||
$tag = iconv('gbk', 'utf-8', $tag);
|
|
||||||
}
|
|
||||||
$apeField['id'] = '0';
|
|
||||||
$apeField['title'] = $tag;
|
|
||||||
$apeField['meta_title'] = $tag;
|
|
||||||
$apeField['keywords'] = web_config('keywords');
|
|
||||||
$apeField['description'] = web_config('description');
|
|
||||||
$apeField['position'] = '<a href="/">首页</a> > <a>' . $tag . '</a>';
|
|
||||||
$this->assign('apeField', $apeField);
|
|
||||||
$this->assign('tag', $tag);
|
|
||||||
|
|
||||||
//清除可能存在的栏目分类树id
|
|
||||||
cache(Data::CURR_CATEGORY_PATENT_ID, false);
|
|
||||||
//模板兼容性标签
|
|
||||||
$this->assign('id', false);
|
|
||||||
$this->assign('cid', false);
|
|
||||||
$templateFile = config('view.view_path') . 'article/tag.html';
|
|
||||||
if (!is_file($templateFile)) {
|
|
||||||
$this->error('模板文件不存在!');
|
|
||||||
}
|
|
||||||
return $this->fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签列表
|
|
||||||
* @return mixed
|
|
||||||
* @author 木子的忧伤
|
|
||||||
* @date 2021-11-11 0:27
|
|
||||||
*/
|
|
||||||
public function tagList()
|
|
||||||
{
|
|
||||||
$where = Util::postMore([
|
|
||||||
['name', ''],
|
|
||||||
['document_id', ''],
|
|
||||||
['start_time', ''],
|
|
||||||
['end_time', ''],
|
|
||||||
['page', 1],
|
|
||||||
['limit', 10]
|
|
||||||
]);
|
|
||||||
return app("json")->layui(TagModel::getList($where));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索页面
|
|
||||||
* @return string
|
|
||||||
* @throws DataNotFoundException
|
|
||||||
* @throws DbException
|
|
||||||
* @throws ModelNotFoundException
|
|
||||||
* @author 木子的忧伤
|
|
||||||
* @date 2021-10-29 0:18
|
|
||||||
*/
|
|
||||||
public function search()
|
|
||||||
{
|
|
||||||
$kw = input('kw');
|
|
||||||
if (!trim($kw)) {
|
|
||||||
$this->error('请输入搜索关键词');
|
|
||||||
}
|
|
||||||
if (!mb_check_encoding($kw, 'utf-8')) {
|
|
||||||
$kw = iconv('gbk', 'utf-8', $kw);
|
|
||||||
}
|
|
||||||
$apeField['id'] = '0';
|
|
||||||
$apeField['title'] = '搜索';
|
|
||||||
$apeField['meta_title'] = '搜索';
|
|
||||||
$apeField['keywords'] = web_config('keywords');
|
|
||||||
$apeField['description'] = web_config('description');
|
|
||||||
$apeField['position'] = '<a href="/">首页</a> > <a>搜索</a>';
|
|
||||||
$this->assign('apeField', $apeField);
|
|
||||||
$this->assign('kw', $kw);
|
|
||||||
//清除可能存在的栏目分类树id
|
|
||||||
cache(Data::CURR_CATEGORY_PATENT_ID, false);
|
|
||||||
//模板兼容性标签
|
|
||||||
$this->assign('id', false);
|
|
||||||
$this->assign('cid', false);
|
|
||||||
$templateFile = config('view.view_path') . 'article/search.html';
|
|
||||||
if (!is_file($templateFile)) {
|
|
||||||
$this->error('模板文件不存在!');
|
|
||||||
}
|
|
||||||
return $this->fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户首页
|
|
||||||
* @return string
|
|
||||||
* @throws Exception
|
|
||||||
* @author 木子的忧伤
|
|
||||||
* @date 2022-01-24 1:23
|
|
||||||
*/
|
|
||||||
public function user()
|
|
||||||
{
|
|
||||||
$author = input('author');
|
|
||||||
if (!trim($author)) {
|
|
||||||
$this->error('请输入搜索关键词');
|
|
||||||
}
|
|
||||||
if (!mb_check_encoding($author, 'utf-8')) {
|
|
||||||
$kw = iconv('gbk', 'utf-8', $author);
|
|
||||||
}
|
|
||||||
$apeField['id'] = '0';
|
|
||||||
$apeField['title'] = $author;
|
|
||||||
$apeField['meta_title'] = $author;
|
|
||||||
$apeField['keywords'] = web_config('keywords');
|
|
||||||
$apeField['description'] = web_config('description');
|
|
||||||
$apeField['position'] = '<a href="/">首页</a> > <a>' . $author . '</a>';
|
|
||||||
$this->assign('apeField', $apeField);
|
|
||||||
$this->assign('author', $author);
|
|
||||||
|
|
||||||
//清除可能存在的栏目分类树id
|
|
||||||
cache(Data::CURR_CATEGORY_PATENT_ID, false);
|
|
||||||
//模板兼容性标签
|
|
||||||
$this->assign('id', false);
|
|
||||||
$this->assign('cid', false);
|
|
||||||
$templateFile = config('view.view_path') . 'article/user.html';
|
|
||||||
if (!is_file($templateFile)) {
|
|
||||||
$this->error('模板文件不存在!');
|
|
||||||
}
|
|
||||||
return $this->fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关于页面
|
|
||||||
* @param Request $request
|
|
||||||
* @author 木子的忧伤
|
|
||||||
* @date 2022-06-21 23:48
|
|
||||||
*/
|
|
||||||
public function about(Request $request)
|
|
||||||
{
|
|
||||||
$id = "about";
|
|
||||||
//获取该文章
|
|
||||||
$documentModel = new Document();
|
|
||||||
$article = $documentModel->where('status', 1)->where('id|alias', $id)->find();
|
|
||||||
if (!$article) {
|
|
||||||
$this->error('文章不存在或已删除!');
|
|
||||||
}
|
|
||||||
$article = $article->toArray();
|
|
||||||
//根据分类id找分类信息
|
|
||||||
$dc = get_document_category($article['category_id']);
|
|
||||||
if (!$dc) {
|
|
||||||
$this->error('栏目不存在或已删除!');
|
|
||||||
}
|
|
||||||
//获取该文章内容
|
|
||||||
//根据文章类型,加载不同的内容。
|
|
||||||
$articleType = Document::DOCUMENT_TYPE_PAGE;
|
|
||||||
$articleExt = $documentModel::name('document_' . $articleType)->where('id', $article['id'])->find();
|
|
||||||
if (!$articleExt) {
|
|
||||||
$this->error('文章不存在或已删除!');
|
|
||||||
}
|
|
||||||
$articleExt = $articleExt->toArray();
|
|
||||||
$article = array_merge($article, $articleExt);
|
|
||||||
//添加当前页面的位置信息
|
|
||||||
$article['position'] = tpl_get_position($dc);
|
|
||||||
//更新浏览次数
|
|
||||||
$documentModel->where('id', $article['id'])->inc('view')->update();
|
|
||||||
$templateFile = config('view.view_path') . 'article/' . $articleType . '.html';
|
|
||||||
if (!is_file($templateFile)) {
|
|
||||||
$this->error('模板文件不存在!');
|
|
||||||
}
|
|
||||||
$article['category_title'] = $dc['title'];
|
|
||||||
//判断SEO 为空则取系统
|
|
||||||
$article['keywords'] = $article['keywords'] ?: web_config('keywords');
|
|
||||||
$article['description'] = $article['description'] ?: web_config('description');
|
|
||||||
//输出文章内容
|
|
||||||
$this->assign('apeField', $article);
|
|
||||||
$this->assign('id', $id);
|
|
||||||
//当前页面所属分类id
|
|
||||||
$this->assign('cid', $article['category_id']);
|
|
||||||
//缓存当前页面栏目分类树ids
|
|
||||||
cache(Data::CURR_CATEGORY_PATENT_ID, $dc['pid'] ? $dc['pid'] . ',' . $article['category_id'] : $article['category_id']);
|
|
||||||
//设置文章的url
|
|
||||||
$article['link_str'] = make_detail_url($article);
|
|
||||||
//判断后台统计配置是否开启 1 开启
|
|
||||||
if (web_config("web_statistics") == 1) {
|
|
||||||
//统计url
|
|
||||||
$this->urlrecord($article['title']);
|
|
||||||
}
|
|
||||||
Log::info('详情页模板路径:' . $templateFile);
|
|
||||||
return $this->fetch('article/' . $articleType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -13,9 +13,9 @@ return [
|
||||||
// 磁盘类型
|
// 磁盘类型
|
||||||
'type' => 'local',
|
'type' => 'local',
|
||||||
// 磁盘路径
|
// 磁盘路径
|
||||||
'root' => app()->getRootPath() . 'public/upload',
|
'root' => app()->getRootPath() . 'public/storage',
|
||||||
// 磁盘路径对应的外部URL路径
|
// 磁盘路径对应的外部URL路径
|
||||||
'url' => '/upload',
|
'url' => '/storage',
|
||||||
// 可见性
|
// 可见性
|
||||||
'visibility' => 'public',
|
'visibility' => 'public',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,327 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh">
|
|
||||||
<head>
|
|
||||||
<title>{$apeField['title']} - {:web_config('title')}</title>
|
|
||||||
<meta name="keywords" content="{$apeField['keywords']}" />
|
|
||||||
<meta name="description" content="{$apeField['description']}"/>
|
|
||||||
{include file="public/head" /}
|
|
||||||
<style>
|
|
||||||
.post-content-post img {
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style>
|
|
||||||
post-content-content img {
|
|
||||||
box-shadow: 0 0 5px 0 rgba(0, 0, 0, .1);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="__CSS__/comment-module.css">
|
|
||||||
<link rel="stylesheet" href="__CSS__/post-content.css">
|
|
||||||
<link rel="stylesheet" href="__LIB__/fancybox/jquery.fancybox.min.css">
|
|
||||||
<link rel="stylesheet" href="__LIB__/highlight/style/corepress-dark.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<script>NProgress.start();</script>
|
|
||||||
<div id="app">
|
|
||||||
{include file="public/header" /}
|
|
||||||
<div class="top-divider"></div>
|
|
||||||
<main class="container">
|
|
||||||
<div class="html-main">
|
|
||||||
<div class="post-main">
|
|
||||||
<div class="post-content-body">
|
|
||||||
<div class="crumbs-plane-body">
|
|
||||||
<div class="crumbs-plane">
|
|
||||||
<span class="corepress-crumbs-ul">{$apeField['position']|raw}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="post-content">
|
|
||||||
<h1 class="post-title">{$apeField['title']}</h1>
|
|
||||||
<div class="post-info">
|
|
||||||
<div class="post-info-left">
|
|
||||||
<a class="nickname url fn j-user-card" data-user="1"
|
|
||||||
href="{:url('article/user')}?author={$apeField['author']}"><i class="fa fa-user" aria-hidden="true"></i>{$apeField['author']}
|
|
||||||
</a>
|
|
||||||
<span class="dot">•</span>
|
|
||||||
<time class="entry-date published" datetime="{$apeField['create_time']}" pubdate=""><i
|
|
||||||
class="far fa-clock"></i>
|
|
||||||
{$apeField['create_time']}
|
|
||||||
</time>
|
|
||||||
<span class="dot">•</span><i class="fas fa-folder"></i>
|
|
||||||
<a href="{:url('article/lists')}?id={$apeField['category_id']}" rel="category tag"> {$apeField['category_title']}</a>
|
|
||||||
<span class="dot">•</span>
|
|
||||||
<span><i class="fa fa-eye" aria-hidden="true"></i>{$apeField['view']} 阅读</span>
|
|
||||||
</div>
|
|
||||||
<div class="post-info-right">
|
|
||||||
<span title="关闭或显示侧边栏" class="post-info-switch-sidebar post-info-switch-sidebar-show"><i class="fas fa-toggle-on"></i></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="post-content-post">
|
|
||||||
<div class="post-content-content">
|
|
||||||
{$apeField['content']|raw}
|
|
||||||
</div>
|
|
||||||
<div class="post-end-tools">
|
|
||||||
<div class="post-copyright">
|
|
||||||
<p>版权声明:
|
|
||||||
<br />作者:{$apeField['author']}
|
|
||||||
<br />链接:
|
|
||||||
<span>
|
|
||||||
<u>
|
|
||||||
<a href="{$Request.domain . $Request.url}" target="_blank">{$Request.domain . $Request.url}</a>
|
|
||||||
</u>
|
|
||||||
</span>
|
|
||||||
<br />来源:{:web_config('title')}
|
|
||||||
<br />文章版权归作者所有,未经允许请勿转载。</p>
|
|
||||||
</div>
|
|
||||||
<div class="post-end-dividing">THE END</div>
|
|
||||||
<div class="post-tags"></div>
|
|
||||||
<div class="post-end-tool-btns">
|
|
||||||
<div class="post-share-btn post-end-tool-btn-item" onclick="showplane('.post-share-btn','#share-plane',event)">
|
|
||||||
{:file_echo_svg('__IMG__/share-btn.svg')}分享</div>
|
|
||||||
<div class="post-qrcode-btn post-end-tool-btn-item" onclick="showplane('.post-qrcode-btn','#qrcode-plane',event)">
|
|
||||||
{:file_echo_svg('__IMG__/svg-ewm.svg')}二维码</div>
|
|
||||||
<div class="post-reward-btn post-end-tool-btn-item" onclick="showplane('.post-reward-btn','#reward-plane',event)">
|
|
||||||
{:file_echo_svg('__IMG__/reward.svg')}打赏</div>
|
|
||||||
<div id="share-plane" class="post-pop-plane">
|
|
||||||
<div class="post-share-list">
|
|
||||||
<a href="https://connect.qq.com/widget/shareqq/index.html?url={$Request.domain.$Request.url}&title={$apeField['title']}&source={:web_config('title')}&desc={:web_config('title')}-{$apeField['description']}&pics=&summary={$apeField['abstract']}" target="_blank">
|
|
||||||
{:file_echo_svg('__IMG__/share-qq.svg')}
|
|
||||||
</a>
|
|
||||||
<a href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={$Request.domain.$Request.url}&title={$apeField['title']}&source={:web_config('title')}&desc={:web_config('title')}-{$apeField['description']}&pics=&summary={$apeField['abstract']}" target="_blank">
|
|
||||||
{:file_echo_svg('__IMG__/share-qzone.svg')}
|
|
||||||
</a>
|
|
||||||
<a href="https://service.weibo.com/share/share.php?url={$Request.domain.$Request.url}&title={$apeField['title']}&pic=&appkey=&searchPic=true" target="_blank">
|
|
||||||
{:file_echo_svg('__IMG__/share-weibo.svg')}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="qrcode-plane" class="post-pop-plane">
|
|
||||||
<div id="qrcode-img"></div>
|
|
||||||
</div>
|
|
||||||
<div id="reward-plane" class="post-pop-plane">
|
|
||||||
{notempty name="(web_config('web_weixin_pay'))"}<img src="{:file_cdn(web_config('web_weixin_pay'))}" alt="{:web_config('web_weixin_pay')}" />{/notempty}
|
|
||||||
{notempty name="(web_config('web_zhifubao_pay'))"}<img src="{:file_cdn(web_config('web_zhifubao_pay'))}" alt="{:web_config('web_zhifubao_pay')}"/>{/notempty}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="post-turn-page-plane">
|
|
||||||
<div class="post-turn-page post-turn-page-previous">
|
|
||||||
<div class="post-turn-page-main">
|
|
||||||
{ape:prenext get="pre" cid="$apeField['category_id']"}
|
|
||||||
<div>
|
|
||||||
<a href="{:url('/index/article/detail')}?id={$field['id']}">{$field['title']}</a>
|
|
||||||
</div>
|
|
||||||
<div class="post-turn-page-link-pre">
|
|
||||||
<a href="{:url('/index/article/detail')}?id={$field['id']}"><<上一篇></上一篇></a>
|
|
||||||
</div>
|
|
||||||
{/ape:prenext}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="post-turn-page post-turn-page-next">
|
|
||||||
{ape:prenext get="next" cid="$apeField['category_id']"}
|
|
||||||
<div class="post-turn-page-main">
|
|
||||||
<a href="{:url('/index/article/detail')}?id={$field['id']}">{$field['title']}</a>
|
|
||||||
<div class="post-turn-page-link-next">
|
|
||||||
<a href="javascript:">下一篇>></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/ape:prenext}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="post-tool-plane"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="relevant-plane">
|
|
||||||
<div class="plane-title">相关内容</div>
|
|
||||||
<div>
|
|
||||||
<ul class="relevant-list">
|
|
||||||
{ape:relevant row="5" id="$apeField['id']"}
|
|
||||||
<li><a href="{$field['url']}">{$field['title']}</a></li>
|
|
||||||
{/ape:relevant}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{if web_config('comment_close') ==1}
|
|
||||||
<div id="comments" class="responsesWrapper">
|
|
||||||
<div class="reply-title">发表评论</div>
|
|
||||||
<div id="respond" class="comment-respond">
|
|
||||||
<h3 id="reply-title" class="comment-reply-title">
|
|
||||||
<small>
|
|
||||||
<a rel="nofollow" id="cancel-comment-reply-link" href="{:url('/index/article/detail')}?id={$field['id']}#respond" style="display:none;">
|
|
||||||
取消回复
|
|
||||||
</a>
|
|
||||||
</small>
|
|
||||||
</h3>
|
|
||||||
<form action="{:url('/index/article/create_comment')}" method="post" id="form_comment" class="comment-form">
|
|
||||||
<div class="comment-user-plane">
|
|
||||||
<div class="logged-in-as">
|
|
||||||
<img class="comment-user-avatar" width="48" height="auto" src="__IMG__/avatar.png" alt="comment-user-avatar">
|
|
||||||
</div>
|
|
||||||
<div class="comment_form_textarea_box">
|
|
||||||
<textarea class="comment_form_textarea" name="content" id="comment"
|
|
||||||
placeholder="发表你的看法" rows="5"></textarea>
|
|
||||||
<div id="comment_addplane">
|
|
||||||
<button class="popover-btn popover-btn-face" type="button">
|
|
||||||
<i class="far fa-smile-wink">
|
|
||||||
</i>添加表情
|
|
||||||
</button>
|
|
||||||
<div class="conment-face-plane">
|
|
||||||
{:file_load_face('__IMG__/face/')}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{if web_config('comment_visitor') && empty($user_id)}
|
|
||||||
<div class="comment_userinput">
|
|
||||||
<div class="comment-form-author">
|
|
||||||
<input id="author" name="author" placeholder="昵称(*)" type="text" value="{$Request.cookie.comment_author}" size="30"
|
|
||||||
class="required"/>
|
|
||||||
</div>
|
|
||||||
<div class="comment-form-email">
|
|
||||||
<input id="email" name="email" type="text" placeholder="邮箱(*)" value="{$Request.cookie.comment_author_email}"
|
|
||||||
class="required"/>
|
|
||||||
</div>
|
|
||||||
<div class="comment-form-url">
|
|
||||||
<input id="url" placeholder="网址" name="url" type="text" value="{$Request.cookie.comment_author_url}" size="30"/>
|
|
||||||
</div>
|
|
||||||
<div style="display: none" class="comment-form-cookies-consent">
|
|
||||||
<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent"
|
|
||||||
type="checkbox" value="yes" checked="checked"/>记住用户信息
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div class="form-submit">
|
|
||||||
<div style="text-align: right">
|
|
||||||
<input name="submit" type="submit" id="commit_submit" class="button primary-btn"
|
|
||||||
value="发表评论">
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="document_id" value="{$apeField['id']}"
|
|
||||||
id="comment_document_id">
|
|
||||||
<input type="hidden" name="pid" id="comment_parent" value="0">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<!-- #respond -->
|
|
||||||
<meta content="UserComments:0" itemprop="interactionCount">
|
|
||||||
<h3 class="comments-title">共有<span class="commentCount">{:get_comment_count($apeField['id'])}</span>条评论</h3>
|
|
||||||
<div class="comment-sofa">
|
|
||||||
{if get_comment_count($apeField['id']) ==0}
|
|
||||||
<i class="fas fa-couch"></i>沙发空余
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<ol class="commentlist">
|
|
||||||
{ape:comment type="top" typeId="$apeField['id']" void='field'}
|
|
||||||
<li class="comment">
|
|
||||||
<div class="comment-item" id="comment-{$field['id']}">
|
|
||||||
<div class="comment-media">
|
|
||||||
<div class="avatar-img">
|
|
||||||
<img src="{$field['cover_path']}" alt="avatar-im">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="comment-metadata">
|
|
||||||
<div class="media-body">
|
|
||||||
<p class="author_name">{$field['author']}<a href="{$field['url']}" rel="external nofollow ugc" target="_blank" class="url"></a><span class="comment-zhan"><img title="网站主" src="__IMG__/zhan.svg" alt=""></span></p>
|
|
||||||
<div class="comment-text">
|
|
||||||
<p>{:comment_face($field['content'],'__IMG__/face/')}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span class="comment-pub-time">{$field['create_time']}</span>
|
|
||||||
<span class="comment-btn-reply">
|
|
||||||
<a rel="nofollow" class="comment-reply-link" href="{$field['reply_url']}" data-commentid="{$field['id']}" data-postid="{$apeField['id']}" data-belowelement="comment-{$field['id']}" data-respondelement="respond" data-replyto="回复给{$field['author']}" aria-label="回复给{$field['author']}"><i class="fa fa-reply"></i> 回复</a>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{ape:comment type="son" typeId="$field['id']" void="vo"}
|
|
||||||
<ol class="children">
|
|
||||||
<li class="comment">
|
|
||||||
<div class="comment-item" id="comment-{$vo.id}">
|
|
||||||
<div class="comment-media">
|
|
||||||
<div class="avatar-img">
|
|
||||||
<img src="{$field['cover_path']}" alt="">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="comment-metadata">
|
|
||||||
<div class="media-body">
|
|
||||||
<p class="author_name">{$vo['author']}<span class="user-identity user-admin" title="{$vo['author']}"></span><span class="comment-from">@<a href="#comment-2264">{$field['author']}</a></span></p>
|
|
||||||
<div class="comment-text">
|
|
||||||
<p>{:comment_face($vo['content'],'__IMG__/face/')}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span class="comment-pub-time">{$vo.create_time}</span>
|
|
||||||
<span class="comment-btn-reply">
|
|
||||||
<a rel="nofollow" class="comment-reply-link" href="{$vo['reply_url']}" data-commentid="{$vo.id}" data-postid="{$apeField['id']}" data-belowelement="comment-{$vo.id}" data-respondelement="respond" data-replyto="回复给{$vo['author']}" aria-label="回复给{$vo['author']}"><i class="fa fa-reply"></i> 回复</a>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li><!-- #comment-## -->
|
|
||||||
</ol><!-- .children -->
|
|
||||||
{/ape:comment}
|
|
||||||
</li><!-- #comment-## -->
|
|
||||||
{/ape:comment}
|
|
||||||
</ol>
|
|
||||||
<script type='text/javascript' src='__JS__/comment-reply.min.js'></script>
|
|
||||||
<script type='text/javascript'>
|
|
||||||
$('body').on('click', '.comment-reply-link', function (e) {
|
|
||||||
addComment.moveForm("li-comment-" + $(this).attr('data-commentid'), $(this).attr('data-commentid'), "respond", $(this).attr('data-postid'));
|
|
||||||
e.stopPropagation();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$(document).click(function (e) {
|
|
||||||
$('.conment-face-plane').css("opacity", "0");
|
|
||||||
$('.conment-face-plane').css("visibility", "hidden");
|
|
||||||
e.stopPropagation();
|
|
||||||
});
|
|
||||||
$('body').on('click', '.img-pace', function (e) {
|
|
||||||
$('.comment_form_textarea').val($('.comment_form_textarea').val() + '[f=' + $(this).attr('facename') + ']')
|
|
||||||
});
|
|
||||||
$('body').on('click', '.popover-btn-face', function (e) {
|
|
||||||
if ($('.conment-face-plane').css("visibility") == 'visible') {
|
|
||||||
$('.conment-face-plane').css("opacity", "0");
|
|
||||||
$('.conment-face-plane').css("visibility", "hidden");
|
|
||||||
} else {
|
|
||||||
$('.conment-face-plane').css("opacity", "1");
|
|
||||||
$('.conment-face-plane').css("visibility", "visible");
|
|
||||||
}
|
|
||||||
e.stopPropagation();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<nav class="comment-navigation pages"></nav>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="sidebar">
|
|
||||||
<div class="sidebar-box-list">
|
|
||||||
<div class="aside-box">
|
|
||||||
<h2 class="widget-title">热门文章</h2>
|
|
||||||
{ape:arclist row="8" orderBy="view desc" type="where"}
|
|
||||||
<div class="hot-post-widget-item">
|
|
||||||
<div>
|
|
||||||
<span class="hot-post-widget-item-num">{$i}</span>
|
|
||||||
<span class="hot-post-widget-item-title">
|
|
||||||
<a href="{$field['url']}">{:cn_substr($field['title'],15)}</a>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="hot-post-widget-item-meta">
|
|
||||||
<div>{$field['create_time']}</div>
|
|
||||||
<div>
|
|
||||||
<a href="{:url('article/lists')}?id={$field['category_id']}">{:cn_substr($field['category_title'],5)}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/ape:arclist}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{include file="public/footer"/}
|
|
||||||
</div>
|
|
||||||
<script src="__LIB__/highlight/init.js"></script>
|
|
||||||
<script src="__JS__/post-content.js"></script>
|
|
||||||
<script src="__JS__/clipboard.min.js"></script>
|
|
||||||
<script src="__LIB__/fancybox/jquery.fancybox.min.js"></script>
|
|
||||||
<script src="__LIB__/fancybox/init.js"></script>
|
|
||||||
<script src="__LIB__/highlight/highlight.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="swiper-container carousel">
|
<div class="swiper-container carousel">
|
||||||
<div class="swiper-wrapper">
|
<div class="swiper-wrapper">
|
||||||
{ape:advert row="5" type="1"}
|
{ape:advert row="5" type="INDEX_SLIDE"}
|
||||||
<div class="swiper-slide">
|
<div class="swiper-slide">
|
||||||
<a href="{$field['url']}" >
|
<a href="{$field['url']}" >
|
||||||
<img src="{$field['cover_path']}" alt="{$field['title']}">
|
<img src="{$field['cover_path']}" alt="{$field['title']}">
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,6 @@
|
||||||
class="far fa-clock"></i>
|
class="far fa-clock"></i>
|
||||||
{$apeField['create_time']}
|
{$apeField['create_time']}
|
||||||
</time>
|
</time>
|
||||||
<span class="dot">•</span><i class="fas fa-folder"></i>
|
|
||||||
<a href="{:url('article/lists')}?id={$apeField['category_id']}" rel="category tag"> {$apeField['category_title']}</a>
|
|
||||||
<span class="dot">•</span>
|
<span class="dot">•</span>
|
||||||
<span><i class="fa fa-eye" aria-hidden="true"></i>{$apeField['view']} 阅读</span>
|
<span><i class="fa fa-eye" aria-hidden="true"></i>{$apeField['view']} 阅读</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -102,30 +100,6 @@
|
||||||
{notempty name="(web_config('web_weixin_pay'))"}<img src="{:file_cdn(web_config('web_weixin_pay'))}" alt="{:web_config('web_weixin_pay')}" />{/notempty}
|
{notempty name="(web_config('web_weixin_pay'))"}<img src="{:file_cdn(web_config('web_weixin_pay'))}" alt="{:web_config('web_weixin_pay')}" />{/notempty}
|
||||||
{notempty name="(web_config('web_zhifubao_pay'))"}<img src="{:file_cdn(web_config('web_zhifubao_pay'))}" alt="{:web_config('web_zhifubao_pay')}"/>{/notempty}
|
{notempty name="(web_config('web_zhifubao_pay'))"}<img src="{:file_cdn(web_config('web_zhifubao_pay'))}" alt="{:web_config('web_zhifubao_pay')}"/>{/notempty}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="post-turn-page-plane">
|
|
||||||
<div class="post-turn-page post-turn-page-previous">
|
|
||||||
<div class="post-turn-page-main">
|
|
||||||
{ape:prenext get="pre" cid="$apeField['category_id']"}
|
|
||||||
<div>
|
|
||||||
<a href="{:url('/index/article/detail')}?id={$field['id']}">{$field['title']}</a>
|
|
||||||
</div>
|
|
||||||
<div class="post-turn-page-link-pre">
|
|
||||||
<a href="{:url('/index/article/detail')}?id={$field['id']}"><<上一篇></上一篇></a>
|
|
||||||
</div>
|
|
||||||
{/ape:prenext}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="post-turn-page post-turn-page-next">
|
|
||||||
{ape:prenext get="next" cid="$apeField['category_id']"}
|
|
||||||
<div class="post-turn-page-main">
|
|
||||||
<a href="{:url('/index/article/detail')}?id={$field['id']}">{$field['title']}</a>
|
|
||||||
<div class="post-turn-page-link-next">
|
|
||||||
<a href="javascript:">下一篇>></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/ape:prenext}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-tool-plane"></div>
|
<div class="post-tool-plane"></div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue