修正文件上传和一些bug

This commit is contained in:
liyukun 2021-11-14 00:50:03 +08:00
parent 80e209d04e
commit 73505e1431
5 changed files with 21 additions and 20 deletions

View File

@ -32,7 +32,6 @@ class Article extends AuthController
/** /**
* 文章列表 * 文章列表
* @param Request $request
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
@ -40,7 +39,7 @@ class Article extends AuthController
* @author 李玉坤 * @author 李玉坤
* @date 2021-02-15 23:26 * @date 2021-02-15 23:26
*/ */
public function lst(Request $request) public function lst()
{ {
$where = Util::postMore([ $where = Util::postMore([
['name',''], ['name',''],
@ -89,9 +88,12 @@ class Article extends AuthController
try { try {
$data['author'] = $data['author']?:$this->adminInfo['nickname']; $data['author'] = $data['author']?:$this->adminInfo['nickname'];
$data['uid'] = $this->adminId; $data['uid'] = $this->adminId;
$content = '';
if (!empty($data['content'])){ if (!empty($data['content'])){
$content = $data['content']; $content = $data['content'];
} }
//判断摘要是否为空,为空则从内容摘取
$data['abstract'] = $data['abstract']?:mb_substr($content,0,100);
unset($data['content']); unset($data['content']);
if ($data['is_recommend']) $data['is_recommend'] = 1; if ($data['is_recommend']) $data['is_recommend'] = 1;
if ($data['is_hot']) $data['is_hot'] = 1; if ($data['is_hot']) $data['is_hot'] = 1;
@ -191,7 +193,7 @@ class Article extends AuthController
* @author 李玉坤 * @author 李玉坤
* @date 2021-02-20 17:00 * @date 2021-02-20 17:00
*/ */
public function edit(Request $request) public function edit()
{ {
$where = Util::postMore([ $where = Util::postMore([
['name',''], ['name',''],
@ -219,7 +221,7 @@ class Article extends AuthController
* @return string * @return string
* @throws \Exception * @throws \Exception
*/ */
public function comment($article_id ='') public function comment()
{ {
return $this->fetch(); return $this->fetch();
} }

View File

@ -53,11 +53,10 @@ class FriendLink extends AuthController
/** /**
* 添加友链 * 添加友链
* @param Request $request
* @return string * @return string
* @throws \FormBuilder\Exception\FormBuilderException * @throws \FormBuilder\Exception\FormBuilderException
*/ */
public function add(Request $request) public function add()
{ {
$form = array(); $form = array();
$form[] = Elm::input('title','链接名称')->col(10); $form[] = Elm::input('title','链接名称')->col(10);

View File

@ -7,9 +7,7 @@ use app\common\model\Attachment;
use app\common\model\AttachmentCategory; use app\common\model\AttachmentCategory;
use FormBuilder\Factory\Elm; use FormBuilder\Factory\Elm;
use app\admin\service\FormBuilderService as Form; use app\admin\service\FormBuilderService as Form;
use app\admin\service\storage\QcloudCoService;
use app\admin\service\UtilService as Util; use app\admin\service\UtilService as Util;
use app\common\utils\Json;
/** /**
* Class Images * Class Images
@ -68,6 +66,7 @@ class Images extends AuthController
* @param $id * @param $id
* @return string * @return string
* @throws \FormBuilder\Exception\FormBuilderException * @throws \FormBuilder\Exception\FormBuilderException
* @throws \Exception
*/ */
public function editCategory($id=0,$pid=0) public function editCategory($id=0,$pid=0)
{ {
@ -90,7 +89,7 @@ class Images extends AuthController
/** /**
* 保存目录 * 保存目录
* @param string $id * @param string $id
* @return json * @return mixed
*/ */
public function saveCategory($id="") public function saveCategory($id="")
{ {

View File

@ -7,6 +7,7 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\BaseController; use app\BaseController;
use Exception;
class SystemBasic extends BaseController class SystemBasic extends BaseController
@ -14,11 +15,11 @@ class SystemBasic extends BaseController
/** /**
* 操作失败提示框 * 操作失败提示框
* @param string $msg 提示信息 * @param string $msg 提示信息
* @param string $backUrl 跳转地址 * @param int $backUrl 跳转地址
* @param string $title 标题 * @param string $info
* @param int $duration 持续时间 * @param int $duration 持续时间
* @return mixed * @return mixed
* @throws \Exception * @throws Exception
*/ */
protected function failedNotice($msg = '操作失败', $backUrl = 0, $info = '', $duration = 3) protected function failedNotice($msg = '操作失败', $backUrl = 0, $info = '', $duration = 3)
{ {
@ -33,7 +34,7 @@ class SystemBasic extends BaseController
* @param int $backUrl * @param int $backUrl
* @param string $title * @param string $title
* @return mixed * @return mixed
* @throws \Exception * @throws Exception
*/ */
protected function failedNoticeLast($msg = '操作失败', $backUrl = 0, $info = '') protected function failedNoticeLast($msg = '操作失败', $backUrl = 0, $info = '')
{ {
@ -47,7 +48,7 @@ class SystemBasic extends BaseController
* @param string $title 标题 * @param string $title 标题
* @param int $duration 持续时间 * @param int $duration 持续时间
* @return mixed * @return mixed
* @throws \Exception * @throws Exception
*/ */
protected function successfulNotice($msg = '操作成功',$backUrl = 0,$info = '',$duration = 3) protected function successfulNotice($msg = '操作成功',$backUrl = 0,$info = '',$duration = 3)
{ {
@ -62,7 +63,7 @@ class SystemBasic extends BaseController
* @param int $backUrl * @param int $backUrl
* @param string $title * @param string $title
* @return mixed * @return mixed
* @throws \Exception * @throws Exception
*/ */
protected function successfulNoticeLast($msg = '操作成功',$backUrl = 0,$info = '') protected function successfulNoticeLast($msg = '操作成功',$backUrl = 0,$info = '')
{ {
@ -73,7 +74,7 @@ class SystemBasic extends BaseController
* 错误提醒页面 * 错误提醒页面
* @param string $msg * @param string $msg
* @param int $url * @param int $url
* @throws \Exception * @throws Exception
*/ */
protected function failed($msg = '哎呀…亲…您访问的页面出现错误', $url = 0) protected function failed($msg = '哎呀…亲…您访问的页面出现错误', $url = 0)
{ {
@ -89,7 +90,7 @@ class SystemBasic extends BaseController
* 成功提醒页面 * 成功提醒页面
* @param string $msg * @param string $msg
* @param int $url * @param int $url
* @throws \Exception * @throws Exception
*/ */
protected function successful($msg, $url = 0) protected function successful($msg, $url = 0)
{ {
@ -103,7 +104,7 @@ class SystemBasic extends BaseController
/**异常抛出 /**异常抛出
* @param $name * @param $name
* @throws \Exception * @throws Exception
*/ */
protected function exception($msg = '无法打开页面') protected function exception($msg = '无法打开页面')
{ {
@ -113,7 +114,7 @@ class SystemBasic extends BaseController
/**找不到页面 /**找不到页面
* @param $name * @param $name
* @throws \Exception * @throws Exception
*/ */
public function _empty($name) public function _empty($name)
{ {

View File

@ -303,7 +303,7 @@
formData.append("cid",id); formData.append("cid",id);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/admin/files/upload", url: "/admin/files/image",
enctype: 'multipart/form-data', enctype: 'multipart/form-data',
data: formData, data: formData,
processData: false, processData: false,