mirror of https://github.com/1099438829/apeblog
一大波修复和优化
This commit is contained in:
parent
c491923d38
commit
e0d951cc27
|
|
@ -2,21 +2,21 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\FormBuilder as Form;
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\model\Admin as aModel;
|
use app\common\model\Admin as aModel;
|
||||||
use app\common\model\AdminRole as rModel;
|
use app\common\model\AdminRole as rModel;
|
||||||
use app\common\model\User as userModel;
|
use app\common\model\User as userModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
use app\admin\extend\FormBuilder as Form;
|
|
||||||
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 think\Exception;
|
use think\Exception;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\facade\Route as Url;
|
|
||||||
use think\Facade\Log;
|
use think\Facade\Log;
|
||||||
|
use think\facade\Route as Url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账号管理
|
* 账号管理
|
||||||
|
|
@ -161,7 +161,7 @@ class Admin extends AuthController
|
||||||
aModel::insert($data);
|
aModel::insert($data);
|
||||||
//添加前台用户
|
//添加前台用户
|
||||||
$userId = userModel::addAdminUser($data);
|
$userId = userModel::addAdminUser($data);
|
||||||
$res = aModel::update(['uid'=>$userId], ['id' => $id]);
|
$res = aModel::update(['uid' => $userId], ['id' => $id]);
|
||||||
} else {
|
} else {
|
||||||
$userInfo = aModel::get($id);
|
$userInfo = aModel::get($id);
|
||||||
if ($userInfo['password'] != $data['password']) $data['password'] = md5(md5($data['password']));
|
if ($userInfo['password'] != $data['password']) $data['password'] = md5(md5($data['password']));
|
||||||
|
|
@ -169,12 +169,12 @@ class Admin extends AuthController
|
||||||
$data['update_time'] = time();
|
$data['update_time'] = time();
|
||||||
aModel::update($data, ['id' => $id]);
|
aModel::update($data, ['id' => $id]);
|
||||||
//同步更新前台用户
|
//同步更新前台用户
|
||||||
$res = userModel::updateAdminUser($userInfo['uid'],$data);
|
$res = userModel::updateAdminUser($userInfo['uid'], $data);
|
||||||
}
|
}
|
||||||
// 提交事务
|
// 提交事务
|
||||||
Db::commit();
|
Db::commit();
|
||||||
}catch (Exception $exception){
|
} catch (Exception $exception) {
|
||||||
Log::error('用户添加失败,失败原因'.$exception->getMessage());
|
Log::error('用户添加失败,失败原因' . $exception->getMessage());
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$res = false;
|
$res = false;
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\FormBuilder as Form;
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\model\AdminAuth as aModel;
|
use app\common\model\AdminAuth as aModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
use app\admin\extend\FormBuilder as Form;
|
|
||||||
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;
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\model\AdminLog as lModel;
|
use app\common\model\AdminLog as lModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\common\model\AdminRole as rModel;
|
use app\admin\extend\FormBuilder as Form;
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\model\AdminAuth as aModel;
|
use app\common\model\AdminAuth as aModel;
|
||||||
|
use app\common\model\AdminRole as rModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
use app\admin\extend\FormBuilder as Form;
|
|
||||||
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;
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,13 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
|
use app\common\model\Comment as CommentModel;
|
||||||
use app\common\model\Document;
|
use app\common\model\Document;
|
||||||
use app\common\model\DocumentCategory as cModel;
|
use app\common\model\DocumentCategory as cModel;
|
||||||
use app\common\model\Tag as TagModel;
|
|
||||||
use app\common\model\DocumentArticle;
|
|
||||||
use app\common\model\Comment as CommentModel;
|
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
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 think\Exception;
|
|
||||||
use think\facade\Db;
|
|
||||||
use think\facade\Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Article
|
* Class Article
|
||||||
|
|
@ -73,7 +68,7 @@ class Article extends AuthController
|
||||||
* @author 木子的忧伤
|
* @author 木子的忧伤
|
||||||
* @date 2021-02-28 22:43
|
* @date 2021-02-28 22:43
|
||||||
*/
|
*/
|
||||||
public function save($id = "")
|
public function save()
|
||||||
{
|
{
|
||||||
$data = Util::postMore([
|
$data = Util::postMore([
|
||||||
['id', ''],
|
['id', ''],
|
||||||
|
|
@ -98,13 +93,12 @@ class Article extends AuthController
|
||||||
['author', $this->adminInfo['nickname']],
|
['author', $this->adminInfo['nickname']],
|
||||||
['uid', $this->adminId],
|
['uid', $this->adminId],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($data['title'] == "") return app("json")->fail("文章名称不能为空");
|
if ($data['title'] == "") return app("json")->fail("文章名称不能为空");
|
||||||
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, Document::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,14 +149,13 @@ class Article extends AuthController
|
||||||
*/
|
*/
|
||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
$where = Util::postMore([
|
$where = Util::getMore([
|
||||||
['name', ''],
|
|
||||||
['id', '']
|
['id', '']
|
||||||
]);
|
]);
|
||||||
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"], Document::DOCUMENT_TYPE_ARTICLE);
|
||||||
if (empty($info)) {
|
if (empty($info)) {
|
||||||
$this->error('数据不存在');
|
$this->error('数据不存在');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,10 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\constant\Data;
|
use app\common\constant\Data;
|
||||||
use app\common\model\DocumentCategory as aModel;
|
use app\common\model\DocumentCategory as aModel;
|
||||||
use app\common\model\DocumentCategoryContent;
|
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
|
|
@ -54,30 +53,29 @@ class Category extends AuthController
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function save($id = "")
|
public function save()
|
||||||
{
|
{
|
||||||
$data = Util::postMore([
|
$data = Util::postMore([
|
||||||
|
['id', ''],
|
||||||
['title', ''],
|
['title', ''],
|
||||||
['alias', ''],
|
['alias', ''],
|
||||||
['type', ''],
|
|
||||||
['pid', 0],
|
['pid', 0],
|
||||||
['meta_title', ''],
|
['meta_title', ''],
|
||||||
['keywords', ''],
|
['keywords', ''],
|
||||||
['description', ''],
|
['description', ''],
|
||||||
['template', ''],
|
['template', ''],
|
||||||
['link_str', ''],
|
|
||||||
['sort', 0],
|
['sort', 0],
|
||||||
['status', 1]
|
['status', 1]
|
||||||
]);
|
]);
|
||||||
if ($data['title'] == "") return app("json")->fail("分类名称不能为空");
|
if ($data['title'] == "") return app("json")->fail("分类名称不能为空");
|
||||||
if ($data['type'] == "") return app("json")->fail("类型不能为空");
|
if ($data['template'] == "") return app("json")->fail("模板不能为空");
|
||||||
//判断是否写了别名,没写则需要生成
|
//判断是否写了别名,没写则需要生成
|
||||||
if ($data['alias'] == "") $data['alias'] = get_rand_str(8);
|
if ($data['alias'] == "") $data['alias'] = get_rand_str(8);
|
||||||
if ($id == "") {
|
if ($data['id'] == "") {
|
||||||
$model = new aModel();
|
$model = new aModel();
|
||||||
$res = $model->insert($data);
|
$res = $model->insert($data);
|
||||||
} else {
|
} else {
|
||||||
$res = aModel::update($data, ['id' => $id]);
|
$res = aModel::update($data, ['id' => $data['id']]);
|
||||||
}
|
}
|
||||||
cache(Data::DATA_DOCUMENT_CATEGORY_LIST, null);
|
cache(Data::DATA_DOCUMENT_CATEGORY_LIST, null);
|
||||||
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败");
|
return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败");
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
|
use app\common\extend\Database;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FilesystemIterator;
|
use FilesystemIterator;
|
||||||
|
|
@ -16,8 +18,6 @@ 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 think\facade\Db;
|
use think\facade\Db;
|
||||||
use app\common\extend\Database;
|
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 数据库备份还原控制器
|
* 数据库备份还原控制器
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
use app\common\model\Attachment;
|
|
||||||
use app\admin\extend\storage\QcloudCoService;
|
use app\admin\extend\storage\QcloudCoService;
|
||||||
use app\admin\extend\Util as Util;
|
use app\admin\extend\Util as Util;
|
||||||
|
use app\common\model\Attachment;
|
||||||
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;
|
||||||
|
|
@ -32,8 +32,8 @@ class File extends AuthController
|
||||||
$saveName = Filesystem::putFile($fileType, $file);
|
$saveName = Filesystem::putFile($fileType, $file);
|
||||||
$filePath = Filesystem::url($saveName);
|
$filePath = Filesystem::url($saveName);
|
||||||
//转换因为win导致的兼容问题
|
//转换因为win导致的兼容问题
|
||||||
if(strtoupper(substr(PHP_OS,0,3))==='WIN'){
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
$filePath = str_replace( DIRECTORY_SEPARATOR, '/',$filePath);
|
$filePath = str_replace(DIRECTORY_SEPARATOR, '/', $filePath);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
@ -62,8 +62,8 @@ class File extends AuthController
|
||||||
if (!file_exists($path)) mkdir($path, 0755, true);
|
if (!file_exists($path)) mkdir($path, 0755, true);
|
||||||
$saveName = $path . md5(time()) . ".{$type}";
|
$saveName = $path . md5(time()) . ".{$type}";
|
||||||
//转换因为win导致的兼容问题
|
//转换因为win导致的兼容问题
|
||||||
if(strtoupper(substr(PHP_OS,0,3))==='WIN'){
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
$saveName = str_replace( DIRECTORY_SEPARATOR, '/',$saveName);
|
$saveName = str_replace(DIRECTORY_SEPARATOR, '/', $saveName);
|
||||||
}
|
}
|
||||||
if (file_put_contents($saveName, base64_decode(str_replace($result[1], '', $data['image'])))) return app("json")->success("上传成功", ['src' => "/" . $saveName]);
|
if (file_put_contents($saveName, base64_decode(str_replace($result[1], '', $data['image'])))) return app("json")->success("上传成功", ['src' => "/" . $saveName]);
|
||||||
else return app("json")->fail("上传失败,写入文件失败!");
|
else return app("json")->fail("上传失败,写入文件失败!");
|
||||||
|
|
@ -81,7 +81,7 @@ class File extends AuthController
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
// 获取表单上传文件 例如上传了001.jpg
|
// 获取表单上传文件 例如上传了001.jpg
|
||||||
$file = $this->request->file('file');//根据表单name替换imgFile
|
$file = $this->request->file('file');//根据表单name替换imgFile
|
||||||
$fileType = $this->request->post("type")?:'file';
|
$fileType = $this->request->post("type") ?: 'file';
|
||||||
switch ($fileType) {
|
switch ($fileType) {
|
||||||
case 'file':
|
case 'file':
|
||||||
$fileSize = 10 * 1024 * 1024;
|
$fileSize = 10 * 1024 * 1024;
|
||||||
|
|
@ -120,8 +120,8 @@ class File extends AuthController
|
||||||
$saveName = Filesystem::putFile($fileType, $file);
|
$saveName = Filesystem::putFile($fileType, $file);
|
||||||
$filePath = Filesystem::url($saveName);
|
$filePath = Filesystem::url($saveName);
|
||||||
//转换因为win导致的兼容问题
|
//转换因为win导致的兼容问题
|
||||||
if(strtoupper(substr(PHP_OS,0,3))==='WIN'){
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
$filePath = str_replace( DIRECTORY_SEPARATOR, '/',$filePath);
|
$filePath = str_replace(DIRECTORY_SEPARATOR, '/', $filePath);
|
||||||
}
|
}
|
||||||
return $saveName ? app("json")->code()->success("上传成功", ['filePath' => $filePath, "name" => basename($saveName)]) : app("json")->fail("上传失败");
|
return $saveName ? app("json")->code()->success("上传成功", ['filePath' => $filePath, "name" => basename($saveName)]) : app("json")->fail("上传失败");
|
||||||
} catch (ValidateException $e) {
|
} catch (ValidateException $e) {
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\FormBuilder as Form;
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\constant\Data;
|
use app\common\constant\Data;
|
||||||
use app\common\model\FriendLink as aModel;
|
use app\common\model\FriendLink as aModel;
|
||||||
use app\admin\extend\FormBuilder as Form;
|
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
|
use app\admin\extend\FormBuilder as Form;
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\model\Attachment;
|
use app\common\model\Attachment;
|
||||||
use app\common\model\AttachmentCategory;
|
use app\common\model\AttachmentCategory;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
use app\admin\extend\FormBuilder as Form;
|
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
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;
|
||||||
|
|
@ -184,7 +184,7 @@ class Image extends AuthController
|
||||||
switch ($image['storage']) {
|
switch ($image['storage']) {
|
||||||
case 1:
|
case 1:
|
||||||
$filePath = app()->getRootPath() . 'public' . $image['path'];
|
$filePath = app()->getRootPath() . 'public' . $image['path'];
|
||||||
if (file_exists($filePath)){
|
if (file_exists($filePath)) {
|
||||||
unlink(app()->getRootPath() . 'public' . $image['path']);
|
unlink(app()->getRootPath() . 'public' . $image['path']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@ use app\common\model\Document;
|
||||||
use app\common\model\Document as DocumentModel;
|
use app\common\model\Document as DocumentModel;
|
||||||
use app\common\model\DocumentCategory;
|
use app\common\model\DocumentCategory;
|
||||||
use app\common\model\DocumentCategory as DocumentCategoryModel;
|
use app\common\model\DocumentCategory as DocumentCategoryModel;
|
||||||
|
use app\common\model\FriendLink;
|
||||||
use app\common\model\MessageForm;
|
use app\common\model\MessageForm;
|
||||||
|
use app\common\model\User;
|
||||||
use Exception;
|
use Exception;
|
||||||
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\model\User;
|
|
||||||
use \app\common\model\FriendLink;
|
|
||||||
|
|
||||||
class Index extends AuthController
|
class Index extends AuthController
|
||||||
{
|
{
|
||||||
|
|
@ -87,7 +87,7 @@ class Index extends AuthController
|
||||||
}
|
}
|
||||||
$str = '';
|
$str = '';
|
||||||
if ($page == 1) {
|
if ($page == 1) {
|
||||||
if(file_exists('sitemap.xml'))
|
if (file_exists('sitemap.xml'))
|
||||||
unlink('sitemap.xml');
|
unlink('sitemap.xml');
|
||||||
$str .= '<?xml version="1.0" encoding="utf-8"?>';
|
$str .= '<?xml version="1.0" encoding="utf-8"?>';
|
||||||
$str .= '<urlset>';
|
$str .= '<urlset>';
|
||||||
|
|
@ -102,7 +102,7 @@ class Index extends AuthController
|
||||||
$pagesize = 100;
|
$pagesize = 100;
|
||||||
|
|
||||||
//获取文章分类url
|
//获取文章分类url
|
||||||
$documentCategoryModel=new DocumentCategoryModel();
|
$documentCategoryModel = new DocumentCategoryModel();
|
||||||
$categoryInfo = $documentCategoryModel->field('id,title,create_time')
|
$categoryInfo = $documentCategoryModel->field('id,title,create_time')
|
||||||
->where('display', 1)->where('status', 1)
|
->where('display', 1)->where('status', 1)
|
||||||
->page($page, $pagesize)
|
->page($page, $pagesize)
|
||||||
|
|
@ -111,14 +111,14 @@ class Index extends AuthController
|
||||||
foreach ($categoryInfo as $v) {
|
foreach ($categoryInfo as $v) {
|
||||||
$str .= '<url>';
|
$str .= '<url>';
|
||||||
$str .= '<loc>' . $domain . url('article/lists?id=' . $v['id']) . '</loc>';
|
$str .= '<loc>' . $domain . url('article/lists?id=' . $v['id']) . '</loc>';
|
||||||
$str .= '<lastmod>' . $v['create_time']. '</lastmod>';
|
$str .= '<lastmod>' . $v['create_time'] . '</lastmod>';
|
||||||
$str .= '<changefreq>always</changefreq>';
|
$str .= '<changefreq>always</changefreq>';
|
||||||
$str .= '<priority>0.8</priority>';
|
$str .= '<priority>0.8</priority>';
|
||||||
$str .= '</url>';
|
$str .= '</url>';
|
||||||
}
|
}
|
||||||
//获取详细页分类url
|
//获取详细页分类url
|
||||||
$documentModel=new DocumentModel();
|
$documentModel = new DocumentModel();
|
||||||
$documentInfo =$documentModel->field('id,create_time')
|
$documentInfo = $documentModel->field('id,create_time')
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
->page($page, $pagesize)
|
->page($page, $pagesize)
|
||||||
->order('id desc')->select();
|
->order('id desc')->select();
|
||||||
|
|
@ -136,7 +136,7 @@ class Index extends AuthController
|
||||||
if (!(file_put_contents('sitemap.xml', $str, FILE_APPEND | LOCK_EX))) {
|
if (!(file_put_contents('sitemap.xml', $str, FILE_APPEND | LOCK_EX))) {
|
||||||
$this->error('站点地图更新失败!');
|
$this->error('站点地图更新失败!');
|
||||||
} else {
|
} else {
|
||||||
$this->success('站点地图全部更新完成!', null,'stop');
|
$this->success('站点地图全部更新完成!', null, 'stop');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//写入
|
//写入
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\model\InvitationCode as aModel;
|
use app\common\model\InvitationCode as aModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\common\model\Admin as adminModel;
|
|
||||||
use app\admin\extend\Util as Util;
|
use app\admin\extend\Util as Util;
|
||||||
|
use app\common\model\Admin as adminModel;
|
||||||
use Exception;
|
use Exception;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\model\MessageForm as aModel;
|
use app\common\model\MessageForm as aModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,16 @@
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\admin\extend\FormBuilder as Form;
|
use app\admin\extend\FormBuilder as Form;
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\constant\Data;
|
use app\common\constant\Data;
|
||||||
use app\common\model\Nav as aModel;
|
use app\common\model\Nav as aModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
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 think\facade\Route as Url;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Nav
|
* Class Nav
|
||||||
|
|
@ -60,7 +59,7 @@ class Nav extends AuthController
|
||||||
$form = array();
|
$form = array();
|
||||||
$form[] = Elm::select('pid', '上级导航', (int)$pid)->options(aModel::returnOptions())->col(10);
|
$form[] = Elm::select('pid', '上级导航', (int)$pid)->options(aModel::returnOptions())->col(10);
|
||||||
$form[] = Elm::input('title', '导航名称')->col(10);
|
$form[] = Elm::input('title', '导航名称')->col(10);
|
||||||
// $form[] = Elm::frameInput('icon', '图标', Url::buildUrl('admin/icon/index', array('fodder' => 'icon')))->icon("ios-ionic")->width('96%')->height('390px')->col(10);
|
// $form[] = Elm::frameInput('icon', '图标', Url::buildUrl('admin/icon/index', array('fodder' => 'icon')))->icon("ios-ionic")->width('96%')->height('390px')->col(10);
|
||||||
$form[] = Elm::input('url', '链接地址')->col(10);
|
$form[] = Elm::input('url', '链接地址')->col(10);
|
||||||
$form[] = Elm::input('params', '参数')->placeholder("php数组,不懂不要填写")->col(10);
|
$form[] = Elm::input('params', '参数')->placeholder("php数组,不懂不要填写")->col(10);
|
||||||
$form[] = Elm::number('sort', '排序')->col(10);
|
$form[] = Elm::number('sort', '排序')->col(10);
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\common\model\Document;
|
|
||||||
use app\common\model\Comment as CommentModel;
|
|
||||||
use app\admin\extend\Util as Util;
|
use app\admin\extend\Util as Util;
|
||||||
|
use app\common\model\Comment as CommentModel;
|
||||||
|
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;
|
||||||
|
|
@ -84,7 +84,7 @@ class Page extends AuthController
|
||||||
['is_recommend', 0],
|
['is_recommend', 0],
|
||||||
['is_top', 0],
|
['is_top', 0],
|
||||||
['is_hot', 0],
|
['is_hot', 0],
|
||||||
['theme',''],
|
['theme', ''],
|
||||||
['link_str', ''],
|
['link_str', ''],
|
||||||
['cover_path', ''],
|
['cover_path', ''],
|
||||||
['display', 1],
|
['display', 1],
|
||||||
|
|
@ -98,8 +98,8 @@ 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, Document::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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ 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"], Document::DOCUMENT_TYPE_PAGE);
|
||||||
if (empty($info)) {
|
if (empty($info)) {
|
||||||
$this->error('数据不存在');
|
$this->error('数据不存在');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\FormBuilder as Form;
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\constant\Data;
|
use app\common\constant\Data;
|
||||||
use app\common\model\SystemConfig as cModel;
|
use app\common\model\SystemConfig as cModel;
|
||||||
use app\common\model\SystemConfigTab as tModel;
|
use app\common\model\SystemConfigTab as tModel;
|
||||||
|
|
@ -9,8 +11,6 @@ use app\Request;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
use app\admin\extend\FormBuilder as Form;
|
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use Psr\SimpleCache\InvalidArgumentException;
|
use Psr\SimpleCache\InvalidArgumentException;
|
||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
|
||||||
|
use app\admin\extend\FormBuilder as Form;
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
|
use app\common\model\SystemConfig as cModel;
|
||||||
|
use app\common\model\SystemConfigTab as tModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
use app\admin\extend\FormBuilder as Form;
|
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use app\common\model\SystemConfigTab as tModel;
|
|
||||||
use app\common\model\SystemConfig 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;
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\Request;
|
|
||||||
use app\admin\extend\Util as Util;
|
use app\admin\extend\Util as Util;
|
||||||
|
use app\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trait TemplateTrait
|
* Trait TemplateTrait
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
use app\common\model\SystemConfig as cModel;
|
|
||||||
use app\Request;
|
|
||||||
use app\admin\extend\Util as Util;
|
use app\admin\extend\Util as Util;
|
||||||
|
use app\common\model\SystemConfig as cModel;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\extend\FormBuilder as Form;
|
||||||
|
use app\admin\extend\Util as Util;
|
||||||
use app\common\model\User as aModel;
|
use app\common\model\User as aModel;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use app\admin\extend\Util as Util;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use FormBuilder\Exception\FormBuilderException;
|
use FormBuilder\Exception\FormBuilderException;
|
||||||
use FormBuilder\Factory\Elm;
|
use FormBuilder\Factory\Elm;
|
||||||
use app\admin\extend\FormBuilder as Form;
|
|
||||||
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;
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@
|
||||||
<div class="tab-pane fade active in" id="home">
|
<div class="tab-pane fade active in" id="home">
|
||||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>文章名称</label>
|
<label for="title">文章名称</label>
|
||||||
<input type="text" class="form-control" id="title" name="title" value="{$info.title}" placeholder="文章名称"/>
|
<input type="text" class="form-control" id="title" name="title" placeholder="文章名称"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>别名</label>
|
<label for="alias">别名</label>
|
||||||
<input type="text" class="form-control" id="alias" name="alias" value="{$info.alias}" placeholder="别名索引"/>
|
<input type="text" class="form-control" id="alias" name="alias" placeholder="别名索引"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="category_id">栏目分类</label>
|
<label for="category_id">栏目分类</label>
|
||||||
|
|
@ -69,8 +69,8 @@
|
||||||
placeholder="请输入摘要">
|
placeholder="请输入摘要">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="abstract">标签</label>
|
<label for="tags">标签</label>
|
||||||
<input class="form-control js-tags-input" type="text" name="tags" data-height="38px"
|
<input class="form-control js-tags-input" id="tags" type="text" name="tags" data-height="38px"
|
||||||
placeholder="请输入标签">
|
placeholder="请输入标签">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
|
|
@ -113,8 +113,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="abstract">排序</label>
|
<label for="sort">排序</label>
|
||||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序" value="99">
|
<input type="text" class="form-control" id="sort" name="sort" placeholder="请输入排序" value="99">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="link_str">外链</label>
|
<label for="link_str">外链</label>
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@
|
||||||
<div class="tab-pane fade active in" id="home">
|
<div class="tab-pane fade active in" id="home">
|
||||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>文章名称</label>
|
<label for="title">文章名称</label>
|
||||||
<input type="hidden" name="id" value="{$info.id}">
|
<input type="hidden" name="id" value="{$info.id}">
|
||||||
<input type="text" class="form-control" id="title" name="title" placeholder="文章名称" value="{$info.title}"/>
|
<input type="text" class="form-control" id="title" name="title" placeholder="文章名称" value="{$info.title}"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>别名</label>
|
<label for="alias">别名</label>
|
||||||
<input type="text" class="form-control" id="alias" name="alias" value="{$info.alias}"
|
<input type="text" class="form-control" id="alias" name="alias" value="{$info.alias}"
|
||||||
placeholder="别名索引"/>
|
placeholder="别名索引"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,66 +3,42 @@
|
||||||
<head>
|
<head>
|
||||||
<title>添加分类 - {:system_config('title')}后台管理系统</title>
|
<title>添加分类 - {:system_config('title')}后台管理系统</title>
|
||||||
{include file="public/header" /}
|
{include file="public/header" /}
|
||||||
<!--标签插件-->
|
|
||||||
<link rel="stylesheet" href="/static/admin/js/jquery-tags-input/jquery.tagsinput.min.css">
|
|
||||||
<!--富文本输入框-->
|
|
||||||
<link rel="stylesheet" href="/static/admin/js/summernote/summernote.min.css">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-header">
|
||||||
<ul id="myTabs" class="nav nav-tabs" role="tablist">
|
<h4>基本信息</h4>
|
||||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
<ul class="card-actions">
|
||||||
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">SEO设置</a></li>
|
<li>
|
||||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
<button type="button" data-toggle="tooltip" title="" data-original-title="返回"
|
||||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></button>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="myTabContent" class="tab-content">
|
</div>
|
||||||
<div class="tab-pane fade active in" id="home">
|
<div class="card-body">
|
||||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>分类名称</label>
|
<label for="title">分类名称</label>
|
||||||
<input type="text" class="form-control" id="title" name="title" value=""
|
<input type="text" class="form-control" id="title" name="title" value="" placeholder="分类名称"/>
|
||||||
placeholder="分类名称"/>
|
</div>
|
||||||
</div>
|
<div class="form-group col-md-12">
|
||||||
<div class="form-group col-md-12">
|
<div class="row">
|
||||||
<label>别名</label>
|
<div class="col-xs-3">
|
||||||
<input type="text" class="form-control" id="alias" name="alias" value=""
|
|
||||||
placeholder="别名"/>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="pid">上级分类</label>
|
<label for="pid">上级分类</label>
|
||||||
<div class="form-controls">
|
<div class="form-controls">
|
||||||
<select name="pid" id="pid" class="form-control">
|
<select name="pid" id="pid" class="form-control">
|
||||||
<option value="">请选择</option>
|
|
||||||
<option value="0">顶级分类</option>
|
<option value="0">顶级分类</option>
|
||||||
{volist name="category" id="vo"}
|
{volist name="category" id="vo"}
|
||||||
<option value="{$vo.id}" {notempty name="pid" }{if $vo.id== $pid}selected{
|
<option value="{$vo.id}" {notempty name="pid" }{if $vo.id== $pid}selected{/if}{/notempty}>{$vo.html}{$vo.title}</option>
|
||||||
/if}{/notempty}>{$vo.html}{$vo.title}</option>
|
|
||||||
{/volist}
|
{/volist}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="col-xs-3">
|
||||||
<label>排序</label>
|
<label>展示模板</label>
|
||||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序">
|
<div class="form-group form-controls">
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label>属性</label>
|
|
||||||
<div class="form-controls">
|
|
||||||
<select name="type" id="type" class="form-control">
|
|
||||||
<!-- <option value="0">请选择</option>-->
|
|
||||||
<option value="1">列表</option>
|
|
||||||
<option value="2">单页</option>
|
|
||||||
<option value="3">外联</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label>主题风格</label>
|
|
||||||
<div class="form-controls">
|
|
||||||
<select name="template" class="form-control">
|
<select name="template" class="form-control">
|
||||||
{volist name="template_list" id="vo"}
|
{volist name="template_list" id="vo"}
|
||||||
<option value="{$vo.template}">{$vo.name}</option>
|
<option value="{$vo.template}">{$vo.name}</option>
|
||||||
|
|
@ -70,44 +46,33 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12" id="page-link-str" style="display: none">
|
<div class="col-xs-3">
|
||||||
<label>外链</label>
|
<label for="alias">URL名称</label>
|
||||||
<input type="text" class="form-control" name="link_str" placeholder="外链">
|
<input class="form-control" id="alias" name="alias" type="text" placeholder="URL名称">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12" id="page-content" style="display: none">
|
<div class="col-xs-3">
|
||||||
<label>单页内容</label>
|
<label for="sort">排序</label>
|
||||||
<textarea id="content" name="content" data-provide="summernote" data-min-height="480"></textarea>
|
<input type="text" class="form-control" id="sort" name="sort" placeholder="请输入排序" value="99">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
</div>
|
||||||
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="profile">
|
<div class="form-group col-md-12">
|
||||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
<label for="meta_title">seo标题</label>
|
||||||
<div class="form-group col-md-12">
|
<input type="text" class="form-control" id="meta_title" name="meta_title" placeholder="请输入seo关键字">
|
||||||
<label for="meta_title">seo标题</label>
|
|
||||||
<input type="text" class="form-control" id="meta_title" name="meta_title"
|
|
||||||
placeholder="请输入seo关键字">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="keywords">seo关键字</label>
|
|
||||||
<input type="text" class="form-control" id="keywords" name="keywords"
|
|
||||||
placeholder="请输入seo关键字">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="description">seo描述</label>
|
|
||||||
<input type="text" class="form-control" name="description" id="description"
|
|
||||||
placeholder="seo描述">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="form-group col-md-12">
|
||||||
|
<label for="keywords">seo关键字</label>
|
||||||
|
<input type="text" class="form-control" id="keywords" name="keywords" placeholder="请输入seo关键字">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="description">seo描述</label>
|
||||||
|
<input type="text" class="form-control" name="description" id="description" placeholder="seo描述">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -115,104 +80,7 @@
|
||||||
{include file="public/footer"/}
|
{include file="public/footer"/}
|
||||||
<!--select2-->
|
<!--select2-->
|
||||||
<script type="text/javascript" src="/static/admin/js/select2.min.js"></script>
|
<script type="text/javascript" src="/static/admin/js/select2.min.js"></script>
|
||||||
<!--富文本输入框-->
|
|
||||||
<script type="text/javascript" src="/static/admin/js/summernote/summernote.min.js"></script>
|
|
||||||
<script type="text/javascript" src="/static/admin/js/summernote/lang/summernote-zh-CN.min.js"></script>
|
|
||||||
<!--标签-->
|
|
||||||
<script src="/static/admin/js/jquery-tags-input/jquery.tagsinput.min.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
|
||||||
$('#tag').select2();
|
|
||||||
});
|
|
||||||
$(document).ready(function(){
|
|
||||||
$('[data-provide="summernote"]').each(function() {
|
|
||||||
var options = {
|
|
||||||
dialogsInBody: true,
|
|
||||||
lang: 'zh-CN',
|
|
||||||
dialogsFade: true
|
|
||||||
};
|
|
||||||
var config = {};
|
|
||||||
$.each( $(this).data(), function(key, value){
|
|
||||||
key = key.replace(/-([a-z])/g, function(x){return x[1].toUpperCase();});
|
|
||||||
if ( key == 'provide' ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
config[key] = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
options = $.extend(options, config);
|
|
||||||
options.toolbar = [
|
|
||||||
// [groupName, [list of button]]
|
|
||||||
['para_style', ['style']],
|
|
||||||
['style', ['bold', 'italic', 'underline', 'clear']],
|
|
||||||
['font', ['strikethrough', 'superscript', 'subscript']],
|
|
||||||
['fontsize', ['fontname', 'fontsize', 'height']],
|
|
||||||
['color', ['color']],
|
|
||||||
['para', ['ul', 'ol', 'paragraph', 'hr']],
|
|
||||||
['table', ['table']],
|
|
||||||
['insert', ['link', 'picture', 'video']],
|
|
||||||
['do', ['undo', 'redo']],
|
|
||||||
['misc', ['fullscreen', 'codeview']]
|
|
||||||
];
|
|
||||||
$(this).summernote(options);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '[data-summernote-edit]', function(){
|
|
||||||
var target = $(this).data('summernote-edit');
|
|
||||||
$(target).summernote({focus: true});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '[data-summernote-save]', function(){
|
|
||||||
var target = $(this).data('summernote-save');
|
|
||||||
var markup = $(target).summernote('code');
|
|
||||||
$(target).summernote('destroy');
|
|
||||||
alert('修改完成');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 选择文件
|
|
||||||
* @param inputName
|
|
||||||
*/
|
|
||||||
function btnClick(inputName) {
|
|
||||||
$("#file_" + inputName).click()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 异步上传
|
|
||||||
* @param inputName
|
|
||||||
*/
|
|
||||||
function upload(inputName) {
|
|
||||||
var formData = new FormData();
|
|
||||||
formData.append("type", 'image');
|
|
||||||
formData.append("file", $("#file_" + inputName)[0].files[0]);
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: '/admin/file/upload',
|
|
||||||
data: formData,
|
|
||||||
cache: false,
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code == 200) {
|
|
||||||
$("#" + inputName).val(res.data.filePath);
|
|
||||||
let html = ' <figure>\n' +
|
|
||||||
' <img src="' + res.data.filePath + '" alt="' + res.data.name + '">\n' +
|
|
||||||
' <figcaption>\n' +
|
|
||||||
' <a class="btn btn-round btn-square btn-danger btn-image-delete" href="#!"><i class="mdi mdi-delete"></i></a>\n' +
|
|
||||||
' </figcaption>\n' +
|
|
||||||
' </figure>';
|
|
||||||
$('#pic-image').html(html);
|
|
||||||
$('#pic-image').show().next('li').hide();
|
|
||||||
} else {
|
|
||||||
lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(".add-form").submit(function () {
|
$(".add-form").submit(function () {
|
||||||
let Arr = $('.add-form').serializeArray();
|
let Arr = $('.add-form').serializeArray();
|
||||||
let checkResult = true;
|
let checkResult = true;
|
||||||
|
|
@ -224,6 +92,11 @@
|
||||||
throw "分类名称不能为空";
|
throw "分类名称不能为空";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'template':
|
||||||
|
if (!item.value) {
|
||||||
|
throw "展示模板不能为空";
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
|
|
@ -245,37 +118,6 @@
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
|
|
||||||
//删除事件
|
|
||||||
$('body').on('click', '.btn-image-delete', function () {
|
|
||||||
$('#pic-image').hide().next('li').show();
|
|
||||||
$('#cover_path').val('');
|
|
||||||
})
|
|
||||||
|
|
||||||
// 切换类型选择事件
|
|
||||||
$("body").on("change", "#type", function () {
|
|
||||||
let type = parseInt($(this).val());
|
|
||||||
switch (type) {
|
|
||||||
case 1:
|
|
||||||
//普通
|
|
||||||
$('#page-link-str').hide().children('input').val();
|
|
||||||
$('#page-content').hide().children('textarea').val();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$('#page-content').show();
|
|
||||||
$('#page-link-str').hide().children('input').val();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
//单页
|
|
||||||
//外联
|
|
||||||
$('#page-link-str').show();
|
|
||||||
$('#page-content').hide().children('textarea').val();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -3,121 +3,77 @@
|
||||||
<head>
|
<head>
|
||||||
<title>添加文章 - {:system_config('title')}后台管理系统</title>
|
<title>添加文章 - {:system_config('title')}后台管理系统</title>
|
||||||
{include file="public/header" /}
|
{include file="public/header" /}
|
||||||
<!--标签插件-->
|
|
||||||
<link rel="stylesheet" href="/static/admin/js/jquery-tags-input/jquery.tagsinput.min.css">
|
|
||||||
<!--富文本输入框-->
|
|
||||||
<link rel="stylesheet" href="/static/admin/js/summernote/summernote.min.css">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-header">
|
||||||
<ul id="myTabs" class="nav nav-tabs" role="tablist">
|
<h4>基本信息</h4>
|
||||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
<ul class="card-actions">
|
||||||
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">SEO设置</a></li>
|
<li>
|
||||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
<button type="button" data-toggle="tooltip" title="" data-original-title="返回"
|
||||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></button>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="myTabContent" class="tab-content">
|
</div>
|
||||||
<div class="tab-pane fade active in" id="home">
|
<div class="card-body">
|
||||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>分类名称</label>
|
<label for="title">分类名称</label>
|
||||||
<input type="text" class="form-control" id="title" name="title" value="{$info.title}"
|
<input type="hidden" name="id" value="{$info.id}">
|
||||||
placeholder="分类名称"/>
|
<input type="text" class="form-control" id="title" name="title" value="{$info.title}" placeholder="分类名称"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label>别名</label>
|
<div class="row">
|
||||||
<input type="text" class="form-control" id="alias" name="alias"
|
<div class="col-xs-3">
|
||||||
value="{$info.alias}" placeholder="别名"/>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="pid">上级分类</label>
|
<label for="pid">上级分类</label>
|
||||||
<div class="form-controls">
|
<div class="form-controls">
|
||||||
<select name="pid" id="pid" class="form-control">
|
<select name="pid" id="pid" class="form-control">
|
||||||
<option value="">请选择</option>
|
|
||||||
<option value="0">顶级分类</option>
|
<option value="0">顶级分类</option>
|
||||||
{volist name="category" id="vo"}
|
{volist name="category" id="vo"}
|
||||||
<option value="{$vo.id}" {if $vo.id== $info.pid}selected{
|
<option value="{$vo.id}" {notempty name="pid" }{if $vo.id== $pid}selected{/if}{/notempty}>{$vo.html}{$vo.title}</option>
|
||||||
/if}>{$vo.html}{$vo.title}</option>
|
|
||||||
{/volist}
|
{/volist}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
<div class="col-xs-3">
|
||||||
<label>排序</label>
|
<label>展示模板</label>
|
||||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序"
|
<div class="form-group form-controls">
|
||||||
value="{$info.sort}">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label>属性</label>
|
|
||||||
<div class="form-controls">
|
|
||||||
<select name="type" id="type" class="form-control">
|
|
||||||
<option value="0" {if 0== $info.type}selected{
|
|
||||||
/if}>请选择</option>
|
|
||||||
<option value="1" {if 1== $info.type}selected{
|
|
||||||
/if}>列表</option>
|
|
||||||
<option value="2" {if 2== $info.type}selected{
|
|
||||||
/if}>单页</option>
|
|
||||||
<option value="3" {if 3== $info.type}selected{
|
|
||||||
/if}>外联</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label>主题风格</label>
|
|
||||||
<div class="form-controls">
|
|
||||||
<select name="template" class="form-control">
|
<select name="template" class="form-control">
|
||||||
{volist name="template_list" id="vo"}
|
{volist name="template_list" id="vo"}
|
||||||
<option value="{$vo.template}" {notempty name="info.template" }{if
|
<option value="{$vo.template}" {notempty name="info.template" }{if $vo.template== $info.template}selected{/if}{/notempty}>{$vo.name}</option>
|
||||||
$vo.template== $info.template}selected{
|
|
||||||
/if}{/notempty}>{$vo.name}</option>
|
|
||||||
{/volist}
|
{/volist}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12" id="page-link-str" {if
|
<div class="col-xs-3">
|
||||||
3!=$info.type}style="display:none;"{/if}>
|
<label for="alias">URL名称</label>
|
||||||
<label>外链</label>
|
<input class="form-control" id="alias" name="alias" type="text" value="{$info.alias}" placeholder="URL名称">
|
||||||
<input type="text" class="form-control" name="link_str" placeholder="外链"
|
|
||||||
value="{$info.link_str}">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12" id="page-content" {if
|
<div class="col-xs-3">
|
||||||
2!=$info.type}style="display:none;"{/if}>
|
<label for="sort">排序</label>
|
||||||
<label>单页内容</label>
|
<input type="text" class="form-control" id="sort" name="sort" placeholder="请输入排序" value="{$info.sort}">
|
||||||
<textarea id="content" name="content" data-min-height="480" data-provide="summernote">{$info.content}</textarea>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12">
|
</div>
|
||||||
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="profile">
|
<div class="form-group col-md-12">
|
||||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
<label for="meta_title">seo标题</label>
|
||||||
<div class="form-group col-md-12">
|
<input type="text" class="form-control" id="meta_title" name="meta_title" placeholder="请输入seo关键字" value="{$info.meta_title}">
|
||||||
<label for="meta_title">seo标题</label>
|
|
||||||
<input type="text" class="form-control" id="meta_title" name="meta_title"
|
|
||||||
placeholder="请输入seo关键字" value="{$info.meta_title}">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="keywords">seo关键字</label>
|
|
||||||
<input type="text" class="form-control" id="keywords" name="keywords"
|
|
||||||
placeholder="请输入seo关键字" value="{$info.keywords}">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<label for="description">seo描述</label>
|
|
||||||
<input type="text" class="form-control" name="description" id="description"
|
|
||||||
placeholder="seo描述" value="{$info.description}">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-12">
|
|
||||||
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="form-group col-md-12">
|
||||||
|
<label for="keywords">seo关键字</label>
|
||||||
|
<input type="text" class="form-control" id="keywords" name="keywords" placeholder="请输入seo关键字" value="{$info.keywords}">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="description">seo描述</label>
|
||||||
|
<input type="text" class="form-control" name="description" id="description" placeholder="seo描述" value="{$info.description}">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -125,104 +81,7 @@
|
||||||
{include file="public/footer"/}
|
{include file="public/footer"/}
|
||||||
<!--select2-->
|
<!--select2-->
|
||||||
<script type="text/javascript" src="/static/admin/js/select2.min.js"></script>
|
<script type="text/javascript" src="/static/admin/js/select2.min.js"></script>
|
||||||
<!--富文本输入框-->
|
|
||||||
<script type="text/javascript" src="/static/admin/js/summernote/summernote.min.js"></script>
|
|
||||||
<script type="text/javascript" src="/static/admin/js/summernote/lang/summernote-zh-CN.min.js"></script>
|
|
||||||
<!--标签-->
|
|
||||||
<script src="/static/admin/js/jquery-tags-input/jquery.tagsinput.min.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
|
||||||
$('#tag').select2();
|
|
||||||
});
|
|
||||||
$(document).ready(function(){
|
|
||||||
$('[data-provide="summernote"]').each(function() {
|
|
||||||
var options = {
|
|
||||||
dialogsInBody: true,
|
|
||||||
lang: 'zh-CN',
|
|
||||||
dialogsFade: true
|
|
||||||
};
|
|
||||||
var config = {};
|
|
||||||
$.each( $(this).data(), function(key, value){
|
|
||||||
key = key.replace(/-([a-z])/g, function(x){return x[1].toUpperCase();});
|
|
||||||
if ( key == 'provide' ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
config[key] = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
options = $.extend(options, config);
|
|
||||||
options.toolbar = [
|
|
||||||
// [groupName, [list of button]]
|
|
||||||
['para_style', ['style']],
|
|
||||||
['style', ['bold', 'italic', 'underline', 'clear']],
|
|
||||||
['font', ['strikethrough', 'superscript', 'subscript']],
|
|
||||||
['fontsize', ['fontname', 'fontsize', 'height']],
|
|
||||||
['color', ['color']],
|
|
||||||
['para', ['ul', 'ol', 'paragraph', 'hr']],
|
|
||||||
['table', ['table']],
|
|
||||||
['insert', ['link', 'picture', 'video']],
|
|
||||||
['do', ['undo', 'redo']],
|
|
||||||
['misc', ['fullscreen', 'codeview']]
|
|
||||||
];
|
|
||||||
$(this).summernote(options);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '[data-summernote-edit]', function(){
|
|
||||||
var target = $(this).data('summernote-edit');
|
|
||||||
$(target).summernote({focus: true});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '[data-summernote-save]', function(){
|
|
||||||
var target = $(this).data('summernote-save');
|
|
||||||
var markup = $(target).summernote('code');
|
|
||||||
$(target).summernote('destroy');
|
|
||||||
alert('修改完成');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 选择文件
|
|
||||||
* @param inputName
|
|
||||||
*/
|
|
||||||
function btnClick(inputName) {
|
|
||||||
$("#file_" + inputName).click()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 异步上传
|
|
||||||
* @param inputName
|
|
||||||
*/
|
|
||||||
function upload(inputName) {
|
|
||||||
var formData = new FormData();
|
|
||||||
formData.append("type", 'image');
|
|
||||||
formData.append("file", $("#file_" + inputName)[0].files[0]);
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: '/admin/file/upload',
|
|
||||||
data: formData,
|
|
||||||
cache: false,
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
success: function (res) {
|
|
||||||
if (res.code == 200) {
|
|
||||||
$("#" + inputName).val(res.data.filePath);
|
|
||||||
let html = ' <figure>\n' +
|
|
||||||
' <img src="' + res.data.filePath + '" alt="' + res.data.name + '">\n' +
|
|
||||||
' <figcaption>\n' +
|
|
||||||
' <a class="btn btn-round btn-square btn-danger btn-image-delete" href="#!"><i class="mdi mdi-delete"></i></a>\n' +
|
|
||||||
' </figcaption>\n' +
|
|
||||||
' </figure>';
|
|
||||||
$('#pic-image').html(html);
|
|
||||||
$('#pic-image').show().next('li').hide();
|
|
||||||
} else {
|
|
||||||
lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(".add-form").submit(function () {
|
$(".add-form").submit(function () {
|
||||||
let Arr = $('.add-form').serializeArray();
|
let Arr = $('.add-form').serializeArray();
|
||||||
let checkResult = true;
|
let checkResult = true;
|
||||||
|
|
@ -234,6 +93,11 @@
|
||||||
throw "分类名称不能为空";
|
throw "分类名称不能为空";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'template':
|
||||||
|
if (!item.value) {
|
||||||
|
throw "展示模板不能为空";
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
|
|
@ -245,47 +109,16 @@
|
||||||
if (!checkResult) {
|
if (!checkResult) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$.post(url = "/admin/category/save?id={$info.id}", $('.add-form').serialize(), function (res) {
|
$.post(url = "/admin/category/save", $('.add-form').serialize(), function (res) {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
parent.location.reload();
|
location.href = '/admin/category/index';
|
||||||
}, 2000)
|
}, 2000)
|
||||||
} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
|
|
||||||
//删除事件
|
|
||||||
$('body').on('click', '.btn-image-delete', function () {
|
|
||||||
$('#pic-image').hide().next('li').show();
|
|
||||||
$('#cover_path').val('');
|
|
||||||
})
|
|
||||||
|
|
||||||
// 切换类型选择事件
|
|
||||||
$("body").on("change", "#type", function () {
|
|
||||||
let type = parseInt($(this).val());
|
|
||||||
switch (type) {
|
|
||||||
case 1:
|
|
||||||
//普通
|
|
||||||
$('#page-link-str').hide().children('input').val();
|
|
||||||
$('#page-content').hide().children('textarea').val();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$('#page-content').show();
|
|
||||||
$('#page-link-str').hide().children('input').val();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
//单页
|
|
||||||
//外联
|
|
||||||
$('#page-link-str').show();
|
|
||||||
$('#page-content').hide().children('textarea').val();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -59,14 +59,14 @@ class Document extends BaseModel
|
||||||
* @param string $status
|
* @param string $status
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getInfo($id,$type= self::DOCUMENT_TYPE_ARTICLE,$status = ''): array
|
public function getInfo($id,$type= self::DOCUMENT_TYPE_ARTICLE,$status = 1): array
|
||||||
{
|
{
|
||||||
if (empty($id)){
|
if (empty($id)){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$model = self::alias('a')
|
$model = self::alias('a')
|
||||||
->leftJoin('document_article p','a.id = p.id')
|
->field("a.*,p.content")
|
||||||
->where("a.type",Document::DOCUMENT_TYPE_PAGE);
|
->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{
|
||||||
|
|
@ -102,6 +102,12 @@ class Document extends BaseModel
|
||||||
if ($data['is_hot']) $data['is_hot'] = 1;
|
if ($data['is_hot']) $data['is_hot'] = 1;
|
||||||
if ($data['display']) $data['display'] = 1;
|
if ($data['display']) $data['display'] = 1;
|
||||||
if ($data['is_top']) $data['is_top'] = 1;
|
if ($data['is_top']) $data['is_top'] = 1;
|
||||||
|
//判断是否主键冲突
|
||||||
|
$info = $this->where("alias",$data['alias'])->find();
|
||||||
|
if ($info && (!empty($data['id']) && $info->id != $data['id'] )){
|
||||||
|
self::setErrorInfo("别名已存在,请修改后重试");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// 启动事务
|
// 启动事务
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
if (empty($data['id'])) {
|
if (empty($data['id'])) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue