diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index e23e4b1fe..06203ff9a 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -19,7 +19,7 @@ use controller\BasicAdmin; use library\Data; use library\Tools; use think\Db; -use think\response\View; +use think\View; /** * 后台入口 diff --git a/application/admin/controller/Plugs.php b/application/admin/controller/Plugs.php index d31223923..23ec04295 100644 --- a/application/admin/controller/Plugs.php +++ b/application/admin/controller/Plugs.php @@ -40,6 +40,8 @@ class Plugs extends BasicAdmin { /** * 文件上传 + * @param string $mode + * @return \think\response\View */ public function upfile($mode = 'one') { $types = $this->request->get('type', 'jpg,png'); diff --git a/application/admin/controller/User.php b/application/admin/controller/User.php index 0036b4ad6..6621d7499 100644 --- a/application/admin/controller/User.php +++ b/application/admin/controller/User.php @@ -44,7 +44,7 @@ class User extends BasicAdmin { /** * 授权管理 - * @return type + * @return array|string */ public function auth() { return $this->_form($this->table, 'auth'); @@ -88,7 +88,7 @@ class User extends BasicAdmin { /** * 表单数据默认处理 - * @param type $data + * @param array $data */ public function _form_filter(&$data) { if ($this->request->isPost()) { diff --git a/application/admin/model/Node.php b/application/admin/model/Node.php index d0b83b9a7..ab089d334 100644 --- a/application/admin/model/Node.php +++ b/application/admin/model/Node.php @@ -27,13 +27,12 @@ class Node { /** * 应用用户权限节点 - * @param type $authid * @return bool */ public static function applyAuthNode() { cache('need_access_node', null); if (($authorize = session('user.authorize'))) { - $nodes = (array) Db::name('SystemAuthNode')->where('auth', 'in', explode(',', $authorize))->column('node'); + $nodes = (array)Db::name('SystemAuthNode')->where('auth', 'in', explode(',', $authorize))->column('node'); return session('user.nodes', $nodes); } return false; @@ -58,7 +57,7 @@ class Node { /** * 检查用户节点权限 - * @param string $node + * @param string $node 节点 * @return bool */ public static function checkAuthNode($node) { @@ -69,7 +68,7 @@ class Node { if (!in_array($auth_node, self::getAuthNode())) { return true; } - return in_array($auth_node, (array) session('user.nodes')); + return in_array($auth_node, (array)session('user.nodes')); } /** @@ -77,15 +76,16 @@ class Node { * @return array */ static public function get() { - $data = Db::name('SystemNode')->select(); - $nodes = []; $alias = []; - foreach ($data as $vo) { + foreach (Db::name('SystemNode')->select() as $vo) { $alias["{$vo['node']}"] = $vo; } + $nodes = []; foreach (self::getNodeTree(APP_PATH) as $thr) { - if (stripos($thr, 'admin/plugs') === 0 || stripos($thr, 'admin/login') === 0 || stripos($thr, 'admin/index') === 0 || stripos($thr, 'index') === 0 || stripos($thr, 'store/api') === 0) { - continue; + foreach (['admin/plugs', 'admin/login', 'admin/index', 'store/api', 'index'] as $str) { + if (stripos($thr, $str) === 0) { + continue 2; + } } $tmp = explode('/', $thr); $one = $tmp[0]; @@ -99,26 +99,22 @@ class Node { /** * 获取节点列表 - * @param string $path - * @param array $nodes + * @param string $path 路径 + * @param array $nodes 额外数据 * @return array */ static public function getNodeTree($path, $nodes = []) { - foreach (self::getFilePaths($path) as $vo) { - if (stripos($vo, DS . 'controller' . DS) === false) { + foreach (self::_getFilePaths($path) as $vo) { + if (!preg_match('|/(\w+)/controller/(\w+)|', str_replace(DS, '/', $vo), $matches) || count($matches) !== 3) { continue; } - $_tmp = explode(DS, $vo); - $controllerName = preg_replace('|\.php$|', '', array_pop($_tmp)); - array_pop($_tmp); - $moduleName = array_pop($_tmp); - $className = config('app_namespace') . "\\{$moduleName}\\controller\\{$controllerName}"; + $className = config('app_namespace') . str_replace('/', '\\', $matches[0]); if (!class_exists($className)) { continue; } foreach (get_class_methods($className) as $actionName) { if ($actionName[0] !== '_') { - $nodes[] = strtolower("{$moduleName}/{$controllerName}/{$actionName}"); + $nodes[] = strtolower("{$matches[1]}/{$matches[2]}/{$actionName}"); } } } @@ -127,19 +123,18 @@ class Node { /** * 获取所有PHP文件 - * @param string $path - * @param array $data - * @param string $ext + * @param string $path 目录 + * @param array $data 额外数据 + * @param string $ext 文件后缀 * @return array */ - static private function getFilePaths($path, $data = [], $ext = 'php') { + static private function _getFilePaths($path, $data = [], $ext = 'php') { foreach (scandir($path) as $dir) { if ($dir[0] === '.') { continue; } - $tmp = realpath($path . DS . $dir); - if ($tmp && (is_dir($tmp) || pathinfo($tmp, PATHINFO_EXTENSION) === $ext)) { - is_dir($tmp) ? $data = array_merge($data, self::getFilePaths($tmp)) : $data[] = $tmp; + if (($tmp = realpath($path . DS . $dir)) && (is_dir($tmp) || pathinfo($tmp, PATHINFO_EXTENSION) === $ext)) { + is_dir($tmp) ? $data = array_merge($data, self::_getFilePaths($tmp)) : $data[] = $tmp; } } return $data; diff --git a/application/admin/view/user.form.html b/application/admin/view/user.form.html index 58074f9f1..b7a581233 100644 --- a/application/admin/view/user.form.html +++ b/application/admin/view/user.form.html @@ -14,7 +14,7 @@ <div class="layui-form-item"> <label class="layui-form-label">联系手机</label> <div class="layui-input-block"> - <input type="tel" name="phone" value='{$vo.phone|default=""}' pattern="^1[3-9][0-9]{9}$" title="请输入联系手机" placeholder="请输入联系手机" class="layui-input"> + <input type="tel" autofocus name="phone" value='{$vo.phone|default=""}' pattern="^1[3-9][0-9]{9}$" title="请输入联系手机" placeholder="请输入联系手机" class="layui-input"> </div> </div> diff --git a/application/admin/view/user.pass.html b/application/admin/view/user.pass.html index 9dff0cb73..f2d0be21a 100644 --- a/application/admin/view/user.pass.html +++ b/application/admin/view/user.pass.html @@ -15,7 +15,7 @@ <div class="layui-form-item"> <label class="layui-form-label">旧的密码</label> <div class="layui-input-block"> - <input type="password" name="oldpassword" value='' pattern="^\S{1,}$" required="" title="请输入旧的密码" placeholder="请输入旧的密码" class="layui-input"> + <input type="password" autofocus name="oldpassword" value='' pattern="^\S{1,}$" required="" title="请输入旧的密码" placeholder="请输入旧的密码" class="layui-input"> </div> </div> {/if} diff --git a/application/common.php b/application/common.php index 00d518f70..a343aa6dd 100644 --- a/application/common.php +++ b/application/common.php @@ -85,8 +85,7 @@ function auth($node) { function sysconf($name) { static $config = []; if (empty($config)) { - $list = Db::name('SystemConfig')->select(); - foreach ($list as $vo) { + foreach (Db::name('SystemConfig')->select() as $vo) { $config[$vo['name']] = $vo['value']; } } diff --git a/application/extra/view/admin.main.top.html b/application/extra/view/admin.main.top.html index ae104b7bf..b4d4adf1f 100644 --- a/application/extra/view/admin.main.top.html +++ b/application/extra/view/admin.main.top.html @@ -25,6 +25,15 @@ style='width:50px;'> <span class='glyphicon glyphicon-refresh'></span> </a> + <script> + require(['jquery'],function(){ + $('[data-reload]').hover(function(){ + $(this).find('.glyphicon').addClass('fa-spin'); + },function(){ + $(this).find('.glyphicon').removeClass('fa-spin'); + }); + }); + </script> <div class="topbar-left topbar-user"> <div class="dropdown topbar-info-item"> <a href="#" class="dropdown-toggle topbar-btn text-center" data-toggle="dropdown"> diff --git a/extend/controller/BasicAdmin.php b/extend/controller/BasicAdmin.php index bfe736626..d79b795c4 100644 --- a/extend/controller/BasicAdmin.php +++ b/extend/controller/BasicAdmin.php @@ -57,15 +57,12 @@ class BasicAdmin extends Controller { */ public function _initialize() { # 用户登录状态检查 - if ($this->checkLogin || $this->checkAuth) { - if (!$this->_isLogin()) { - $this->redirect('@admin/login'); - } + if (($this->checkLogin || $this->checkAuth) && !$this->_isLogin()) { + $this->redirect('@admin/login'); } # 节点访问权限检查 if ($this->checkLogin && $this->checkAuth) { - $node = strtolower($this->request->module() . '/' . $this->request->controller() . '/' . $this->request->action()); - if (!auth($node)) { + if (!auth(join('/', [$this->request->module(), $this->request->controller(), $this->request->action()]))) { $this->error('抱歉,您没有访问该模块的权限!'); } } @@ -123,7 +120,7 @@ class BasicAdmin extends Controller { } if ($is_page) { $row_page = $this->request->get('rows', cookie('rows'), 'intval'); - cookie('rows', $row_page >= 10 ? $row_page : 10); + cookie('rows', $row_page >= 10 ? $row_page : 20); $page = $db->paginate($row_page, $total, ['query' => $this->request->get()]); $result['list'] = $page->all(); $result['page'] = preg_replace(['|href="(.*?)"|', '|pagination|'], ['data-open="$1" href="javascript:void(0);"', 'pagination pull-right'], $page->render()); @@ -185,7 +182,7 @@ class BasicAdmin extends Controller { * @return bool */ protected function _callback($method, &$data) { - foreach (array($method, "_" . $this->request->action() . "{$method}") as $method) { + foreach ([$method, "_" . $this->request->action() . "{$method}"] as $method) { if (method_exists($this, $method) && false === $this->$method($data)) { return false; } diff --git a/extend/controller/BasicApi.php b/extend/controller/BasicApi.php index ebeaa25f6..9706e78b0 100644 --- a/extend/controller/BasicApi.php +++ b/extend/controller/BasicApi.php @@ -39,7 +39,7 @@ class BasicApi { exit($this->response('禁止访问接口安全方法!', 'ACCESS_NOT_ALLOWED')->send()); } // 访问 Token 检测处理 - $this->token = $this->request->request('token', $this->request->header('token', false)); + $this->token = $this->request->param('token', $this->request->header('token', false)); // if ((empty($this->token) || !$this->getCache($this->token)) && ($this->request->action() !== 'auth')) { if (empty($this->token) && $this->request->action() !== 'auth') { exit($this->response('访问TOKEN失效,请重新授权!', 'ACCESS_TOKEN_FAILD')->send()); @@ -48,10 +48,10 @@ class BasicApi { /** * 输出返回数据 - * @access protected - * @param mixed $data 要返回的数据 - * @param String $type 返回类型 JSON XML - * @param integer $code HTTP状态码 + * @param string $msg 提示消息内容 + * @param string $code 业务状态码 + * @param mixed $data 要返回的数据 + * @param string $type 返回类型 JSON XML * @return Response */ public function response($msg, $code = 'SUCCESS', $data = [], $type = 'json') { @@ -73,7 +73,7 @@ class BasicApi { /** * 读取缓存 * @param string $name 缓存标识 - * @param mixed $default 默认值 + * @param mixed $default 默认值 * @return mixed */ public function getCache($name, $default = false) { diff --git a/extend/service/FileService.php b/extend/service/FileService.php index 6307032a2..0757c656a 100644 --- a/extend/service/FileService.php +++ b/extend/service/FileService.php @@ -123,6 +123,7 @@ class FileService { $auth = new Auth(sysconf('storage_qiniu_access_key'), sysconf('storage_qiniu_secret_key')); return file_get_contents($auth->privateDownloadUrl(self::getBaseUriQiniu() . $filename)); } + Log::error("通过{$storage}读取文件{$filename}的不存在!"); return null; } diff --git a/extend/service/PayService.php b/extend/service/PayService.php index e75cdb278..5f8ffa833 100644 --- a/extend/service/PayService.php +++ b/extend/service/PayService.php @@ -15,6 +15,7 @@ namespace service; use library\Data; +use library\QRcode; use think\Db; use think\Log; use Wechat\WechatPay; @@ -50,6 +51,10 @@ class PayService { if ($prepayid === false) { return false; } + $filename = join('/', str_split(md5($prepayid), 16)) . '.png'; + if (!FileService::hasFile($filename)) { + FileService::save($filename, QRcode::png($prepayid, $filename, Constants::QR_ECLEVEL_L, 8)); + } $filename = ROOT_PATH . "public/upload/{$pay->appid}/payqrc/" . join('/', str_split(md5($prepayid), 16)) . '.png'; !is_dir(dirname($filename)) && mkdir(dirname($filename), 0755, true); !file_exists($filename) && QRcode::png($prepayid, $filename, Constants::QR_ECLEVEL_L, 8); diff --git a/public/static/theme/default/img/login_bg.jpg b/public/static/theme/default/img/login_bg.jpg deleted file mode 100644 index 82aaa46e6..000000000 Binary files a/public/static/theme/default/img/login_bg.jpg and /dev/null differ diff --git a/vendor/autoload.php b/vendor/autoload.php index a6cf0b238..f13ee49fa 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit1d73f902df261cf5d17436029a67d17d::getLoader(); +return ComposerAutoloaderInit92a5fe0bb87f97baabea0fdabbc00865::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 340e3c715..e2df802e2 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit1d73f902df261cf5d17436029a67d17d +class ComposerAutoloaderInit92a5fe0bb87f97baabea0fdabbc00865 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit1d73f902df261cf5d17436029a67d17d return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit1d73f902df261cf5d17436029a67d17d', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit92a5fe0bb87f97baabea0fdabbc00865', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit1d73f902df261cf5d17436029a67d17d', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit92a5fe0bb87f97baabea0fdabbc00865', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit1d73f902df261cf5d17436029a67d17d::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit92a5fe0bb87f97baabea0fdabbc00865::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit1d73f902df261cf5d17436029a67d17d $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit1d73f902df261cf5d17436029a67d17d::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit92a5fe0bb87f97baabea0fdabbc00865::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire1d73f902df261cf5d17436029a67d17d($fileIdentifier, $file); + composerRequire92a5fe0bb87f97baabea0fdabbc00865($fileIdentifier, $file); } return $loader; } } -function composerRequire1d73f902df261cf5d17436029a67d17d($fileIdentifier, $file) +function composerRequire92a5fe0bb87f97baabea0fdabbc00865($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 0475b8054..738c68cb0 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit1d73f902df261cf5d17436029a67d17d +class ComposerStaticInit92a5fe0bb87f97baabea0fdabbc00865 { public static $files = array ( '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', @@ -273,9 +273,9 @@ class ComposerStaticInit1d73f902df261cf5d17436029a67d17d public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit1d73f902df261cf5d17436029a67d17d::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit1d73f902df261cf5d17436029a67d17d::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit1d73f902df261cf5d17436029a67d17d::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit92a5fe0bb87f97baabea0fdabbc00865::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit92a5fe0bb87f97baabea0fdabbc00865::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit92a5fe0bb87f97baabea0fdabbc00865::$classMap; }, null, ClassLoader::class); }