diff --git a/application/admin/controller/widget/Images.php b/application/admin/controller/widget/Images.php index 3206a7cd..8d8a348a 100644 --- a/application/admin/controller/widget/Images.php +++ b/application/admin/controller/widget/Images.php @@ -57,8 +57,6 @@ class Images extends AuthController $thumbPath = Upload::thumb($res->dir); //产品图片上传记录 $fileInfo = $res->fileInfo->getinfo(); - //入口是public需要替换图片路径 - $res->dir = str_replace('public/uploads','',$res->dir); SystemAttachmentModel::attachmentAdd($res->fileInfo->getSaveName(),$fileInfo['size'],$fileInfo['type'],$res->dir,$thumbPath,$pid); $info = array( // "originalName" => $fileInfo['name'], @@ -94,8 +92,14 @@ class Images extends AuthController public function deleteimganddata($att_id){ $attinfo = SystemAttachmentModel::get($att_id)->toArray(); if($attinfo){ - @unlink(ROOT_PATH.ltrim($attinfo['att_dir'],'.')); - @unlink(ROOT_PATH.ltrim($attinfo['satt_dir'],'.')); + if(strpos($attinfo['att_dir'],'public') !== false){ + @unlink(ROOT_PATH.ltrim($attinfo['att_dir'],'/')); + @unlink(ROOT_PATH.ltrim($attinfo['satt_dir'],'/')); + }else{ + @unlink(ROOT_PATH.ltrim('public'.$attinfo['att_dir'],'/')); + @unlink(ROOT_PATH.ltrim('public'.$attinfo['satt_dir'],'/')); + } + SystemAttachmentModel::where(['att_id'=>$att_id])->delete(); } } diff --git a/application/admin/view/wechat/wechat_news_category/append.php b/application/admin/view/wechat/wechat_news_category/append.php index f860ee5d..60a037e5 100644 --- a/application/admin/view/wechat/wechat_news_category/append.php +++ b/application/admin/view/wechat/wechat_news_category/append.php @@ -119,13 +119,11 @@ + -
- -
{/block} {block name="script"} diff --git a/application/admin/view/widget/images.php b/application/admin/view/widget/images.php index be6c4f95..1084e759 100644 --- a/application/admin/view/widget/images.php +++ b/application/admin/view/widget/images.php @@ -77,7 +77,7 @@ {volist name="list" id="vo"}
- +
{/volist} diff --git a/application/common.php b/application/common.php index b317a5b6..bdec6d55 100644 --- a/application/common.php +++ b/application/common.php @@ -20,7 +20,7 @@ function sensitive_words_filter($str) { if (!$str) return ''; - $file = ROOT_PATH. PUBILC_PATH.'static/plug/censorwords/CensorWords'; + $file = ROOT_PATH. PUBILC_PATH.'/static/plug/censorwords/CensorWords'; $words = file($file); foreach($words as $word) { diff --git a/application/config.php b/application/config.php index d295564c..e6716354 100644 --- a/application/config.php +++ b/application/config.php @@ -144,14 +144,13 @@ return [ // 视图输出字符串内容替换 'view_replace_str' => [ - '{__ADMIN_PATH}'=>PUBILC_PATH.'system/', - '{__FRAME_PATH}'=>PUBILC_PATH.'system/frame/', - '{__PLUG_PATH}'=>PUBILC_PATH.'static/plug/', - '{__MODULE_PATH}'=>PUBILC_PATH.'system/module/', - '{__STATIC_PATH}'=>PUBILC_PATH.'static/', - '{__PUBLIC_PATH}'=>PUBILC_PATH, - '{__UPLOAD_PATH}'=>UPLOAD_PATH, - '{__WAP_PATH}'=>PUBILC_PATH.'wap/first/static/' + '{__ADMIN_PATH}'=>PUBILC_PATH.'/system/', + '{__FRAME_PATH}'=>PUBILC_PATH.'/system/frame/', + '{__PLUG_PATH}'=>PUBILC_PATH.'/static/plug/', + '{__MODULE_PATH}'=>PUBILC_PATH.'/system/module/', + '{__STATIC_PATH}'=>PUBILC_PATH.'/static/', + '{__PUBLIC_PATH}'=>PUBILC_PATH.'/', + '{__WAP_PATH}'=>PUBILC_PATH.'/wap/first/static/' ], // 默认跳转页面对应的模板文件 'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl', diff --git a/extend/service/UploadService.php b/extend/service/UploadService.php index 1aac2723..2544b733 100644 --- a/extend/service/UploadService.php +++ b/extend/service/UploadService.php @@ -47,7 +47,11 @@ class UploadService self::$uploadStatus->filePath = self::pathToUrl($filePath); self::$uploadStatus->fileInfo = $fileInfo; self::$uploadStatus->uploadPath = $path; - self::$uploadStatus->dir = $filePath; + if(strpos(PUBILC_PATH,'public') !== false){ + self::$uploadStatus->dir = $filePath; + }else{ + self::$uploadStatus->dir = str_replace('/public','',$filePath); + } self::$uploadStatus->status = true; return self::$uploadStatus; } @@ -79,7 +83,7 @@ class UploadService */ protected static function uploadDir($path, $root=null) { - if($root === null) $root = 'public/' . 'uploads'; + if($root === null) $root = UPLOAD_PATH; return $root . DS . $path; } @@ -155,7 +159,7 @@ class UploadService */ public static function thumb($filePath, $ratio=8, $pre='s_') { - $filePath = ROOT_PATH.ltrim(ltrim($filePath,'.'),'/'); + $filePath = ltrim($filePath,'/'); $img = self::openImage($filePath); $width = $img->width() * $ratio / 10; $height = $img->height() * $ratio / 10; @@ -163,7 +167,6 @@ class UploadService $fileName = basename($filePath); $savePath = $dir.DS.$pre.$fileName; $img->thumb($width,$height)->save($savePath); - $savePath = str_replace(ROOT_PATH.'public/uploads','',$savePath); - return ltrim($savePath,'.'); + return DS.$savePath; } } \ No newline at end of file diff --git a/index.php b/index.php index ba58f4fa..1abfbf35 100644 --- a/index.php +++ b/index.php @@ -24,8 +24,8 @@ if(file_exists("./public/install/") && !file_exists("./public/install/install.lo // 定义应用目录 define('APP_PATH', __DIR__ . '/application/'); //静态文件目录 -define('PUBILC_PATH', '/public/'); +define('PUBILC_PATH', '/public'); //上传文件目录 -define('UPLOAD_PATH', '/public/uploads'); +define('UPLOAD_PATH', 'public/uploads'); // 加载框架引导文件 require __DIR__ . '/thinkphp/start.php'; diff --git a/public/index.php b/public/index.php index e792aca8..71f9802b 100644 --- a/public/index.php +++ b/public/index.php @@ -24,8 +24,8 @@ if(file_exists("./install/") && !file_exists("./install/install.lock")){ // 定义应用目录 define('APP_PATH', __DIR__ . '/../application/'); //静态文件目录 -define('PUBILC_PATH', '/'); +define('PUBILC_PATH', ''); //上传文件目录 -define('UPLOAD_PATH', '/uploads'); +define('UPLOAD_PATH', 'public/uploads'); // 加载框架引导文件 require __DIR__ . '/../thinkphp/start.php';