diff --git a/app/admin/controller/Common.php b/app/admin/controller/Common.php index 3762915..c7207ea 100644 --- a/app/admin/controller/Common.php +++ b/app/admin/controller/Common.php @@ -1,10 +1,4 @@ 'auth', 'domain' => $_SERVER['HTTP_HOST']]), true); - //if(!$auth['code']) die('程序未授权,请联系QQ:1591788658 授权!'); if(empty(session('admin')) || empty(cookie('admin'))) return $this->redirect('login/'); $this->admin = Db::name('user')->where('username', session('admin'))->find(); if(count($this->admin) > 0) { diff --git a/app/admin/controller/Picture.php b/app/admin/controller/Picture.php index 387e0aa..927cec1 100644 --- a/app/admin/controller/Picture.php +++ b/app/admin/controller/Picture.php @@ -1,11 +1,5 @@ getUserName($val['user_id']); switch ($val['scheme_id']) { case 1: - $url = "{$this->web['domain']}/pic/{$val['path']}"; break; + $url = "{$this->web['domain']}/{$val['path']}"; break; case 2: $url = "{$scheme['qiniu']['domain']}/{$val['path']}"; break; case 3: diff --git a/app/config.php b/app/config.php index 841d058..3b9c44d 100644 --- a/app/config.php +++ b/app/config.php @@ -249,5 +249,5 @@ return [ 'theme_path' => str_replace("\\", "/", APP_PATH . "index/view/theme"), //文件上传路径 - 'file_path' => str_replace("\\", "/", ROOT_PATH . "public/pic"), + 'file_path' => str_replace("\\", "/", ROOT_PATH . "public"), ]; diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 41ade65..3561617 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -50,17 +50,17 @@ class Index extends Common private function localUpload($file) { if($file) { - $date = date('Ymd', time()); - $info = $file->validate(['size'=> $this->conf['upload_max_filesize'] * 1024, 'ext'=> $this->conf['upload_images_ext']])->rule('uniqid')->move("{$this->conf['file_path']}/{$this->user['id']}/" . $date); + $date = date('Y-m-d', time()); + $info = $file->validate(['size'=> $this->conf['upload_max_filesize'] * 1024, 'ext'=> $this->conf['upload_images_ext']])->rule('uniqid')->move("{$this->conf['file_path']}/" . $date); if($info) { - $file_path = str_replace("\\", "/", Config::get('web.domain') . "/pic/{$this->user['id']}/{$date}/{$info->getSaveName()}"); + $file_path = str_replace("\\", "/", Config::get('web.domain') . "/{$date}/{$info->getSaveName()}"); return $this->saveImg( 1, $info->getFilename(), $file->getInfo('type'), $info->getSize(), $info->hash('sha1'), - str_replace("\\", "/", "{$this->user['id']}/{$date}/{$info->getSaveName()}"), + str_replace("\\", "/", "{$date}/{$info->getSaveName()}"), $file_path ); } else { diff --git a/app/index/controller/User.php b/app/index/controller/User.php index 00866a6..5aebc8d 100644 --- a/app/index/controller/User.php +++ b/app/index/controller/User.php @@ -55,7 +55,7 @@ class User extends Common foreach ($data as &$val) { switch ($val['scheme_id']) { case 1: - $val['url'] = "{$this->web['domain']}/pic/{$val['path']}"; break; + $val['url'] = "{$this->web['domain']}/{$val['path']}"; break; case 2: $val['url'] = "{$scheme['qiniu']['domain']}/{$val['path']}"; break; case 3: