From 6a1100f018dee0db5bcc15115f2239966d9b8af1 Mon Sep 17 00:00:00 2001 From: Karson Date: Wed, 17 Jan 2018 17:29:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=89=8D=E5=8F=B0=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=92=8CAPI=E6=A8=A1=E5=9D=97=E7=9A=84=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=8E=A7=E5=88=B6=E5=8A=9F=E8=83=BD=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9ECRUD=E6=8E=92=E9=99=A4=E5=AD=97=E6=AE=B5=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20=E6=96=B0=E5=A2=9EAPI=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E5=8F=91=E9=80=81=E3=80=81=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E6=8E=A7=E5=88=B6=E5=99=A8=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=89=8D=E5=8F=B0=E9=80=9A=E7=94=A8=E7=9A=84=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E6=9D=83=E9=99=90=E7=B1=BBAuth=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=89=8D=E5=8F=B0Token=E6=93=8D=E4=BD=9C=E7=B1=BB=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9A=84=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E5=8E=8B=E7=BC=A9=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=9C=A8Windows=E4=B8=8B=E8=B7=AF=E5=BE=84=E4=B8=AD=E5=90=AB?= =?UTF-8?q?=E6=9C=89=E7=A9=BA=E6=A0=BC=E5=AF=BC=E8=87=B4=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84BUG=20=E4=BF=AE=E5=A4=8Dfastadmin.less=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=BC=96=E8=AF=91=E4=B8=BACSS=E7=9A=84BUG=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=20=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=A7=84=E5=88=99=E7=9A=84=E5=A2=9E=E6=94=B9=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=90=8E=E5=8F=B0=E7=9A=AE=E8=82=A4Black=EF=BC=8C?= =?UTF-8?q?=E5=AE=9E=E4=B8=BAWhite=20=E4=BC=98=E5=8C=96=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E9=A1=B5=E6=A8=A1=E6=9D=BF=E5=9C=A8Chrome=E4=B8=8B=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=BF=BB=E8=AF=91=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 12 +- application/admin/command/Min.php | 6 +- application/admin/controller/Addon.php | 27 +- application/admin/lang/zh-cn/addon.php | 1 - application/admin/lang/zh-cn/auth/rule.php | 4 +- application/admin/view/auth/rule/add.html | 4 +- application/admin/view/auth/rule/edit.html | 4 +- application/admin/view/common/control.html | 4 +- application/api/config.php | 2 +- application/api/controller/Common.php | 50 ++ application/api/controller/Demo.php | 55 ++ application/api/controller/Index.php | 27 + application/api/controller/Sms.php | 103 ++++ application/api/lang/zh-cn.php | 91 +++ application/api/model/Area.php | 93 +++ application/common/controller/Api.php | 296 ++++++++- application/common/controller/Frontend.php | 74 ++- application/common/library/Auth.php | 573 ++++++++++++++++++ application/common/library/Sms.php | 138 +++++ application/common/library/Token.php | 84 +++ application/common/model/Attachment.php | 10 +- application/common/model/Category.php | 4 +- application/common/model/Config.php | 3 + application/common/view/tpl/dispatch_jump.tpl | 2 +- application/config.php | 2 +- application/index/controller/Index.php | 2 + application/index/view/index/index.html | 4 +- application/index/view/layout/common.html | 103 ++++ composer.json | 4 +- public/assets/css/backend.css | 4 + public/assets/css/backend.min.css | 2 +- public/assets/css/fastadmin.min.css | 196 ++++++ public/assets/css/frontend.css | 554 ++++++++++++++++- public/assets/css/frontend.min.css | 2 +- public/assets/css/skins/_all-skins.css | 216 +++---- public/assets/css/skins/skin-black-light.css | 174 ------ public/assets/css/skins/skin-black.css | 167 ----- public/assets/css/skins/skin-white-light.css | 174 ++++++ public/assets/css/skins/skin-white.css | 167 +++++ public/assets/js/backend/addon.js | 22 +- public/assets/js/backend/auth/rule.js | 8 +- public/assets/js/backend/index.js | 4 +- public/assets/js/require-backend.min.js | 4 +- public/assets/js/require-frontend.js | 4 +- public/assets/js/require-frontend.min.js | 4 +- public/assets/less/backend.less | 4 + public/assets/less/bootstrap.less | 1 + public/assets/less/fastadmin.less | 2 + public/assets/less/frontend.less | 527 +++++++++++++++- public/assets/less/skins/_all-skins.less | 4 +- ...black-light.less => skin-white-light.less} | 6 +- .../{skin-black.less => skin-white.less} | 6 +- public/install.php | 4 +- 53 files changed, 3511 insertions(+), 527 deletions(-) create mode 100644 application/api/controller/Common.php create mode 100644 application/api/controller/Demo.php create mode 100644 application/api/controller/Index.php create mode 100644 application/api/controller/Sms.php create mode 100644 application/api/lang/zh-cn.php create mode 100644 application/api/model/Area.php create mode 100644 application/common/library/Auth.php create mode 100644 application/common/library/Sms.php create mode 100644 application/common/library/Token.php create mode 100644 application/index/view/layout/common.html delete mode 100644 public/assets/css/skins/skin-black-light.css delete mode 100644 public/assets/css/skins/skin-black.css create mode 100644 public/assets/css/skins/skin-white-light.css create mode 100644 public/assets/css/skins/skin-white.css rename public/assets/less/skins/{skin-black-light.less => skin-white-light.less} (95%) mode change 100755 => 100644 rename public/assets/less/skins/{skin-black.less => skin-white.less} (96%) mode change 100755 => 100644 diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index 3e8a4394..2d4d543a 100644 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -87,6 +87,11 @@ class Crud extends Command */ protected $reservedField = ['admin_id', 'createtime', 'updatetime']; + /** + * 排除字段 + */ + protected $ignoreFields = []; + /** * 排序字段 */ @@ -122,6 +127,7 @@ class Crud extends Command ->addOption('citysuffix', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'automatically generate citypicker component with suffix', null) ->addOption('selectpagesuffix', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'automatically generate selectpage component with suffix', null) ->addOption('selectpagessuffix', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'automatically generate multiple selectpage component with suffix', null) + ->addOption('ignorefields', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'ignore fields', null) ->addOption('sortfield', null, Option::VALUE_OPTIONAL, 'sort field', null) ->addOption('editorclass', null, Option::VALUE_OPTIONAL, 'automatically generate editor class', null) ->setDescription('Build CRUD controller and model from table'); @@ -174,6 +180,8 @@ class Crud extends Command $selectpagesuffix = $input->getOption('selectpagesuffix'); //selectpage多选后缀 $selectpagessuffix = $input->getOption('selectpagessuffix'); + //排除字段 + $ignoreFields = $input->getOption('ignorefields'); //排序字段 $sortfield = $input->getOption('sortfield'); //编辑器Class @@ -196,6 +204,8 @@ class Crud extends Command $this->selectpageSuffix = $selectpagesuffix; if ($selectpagessuffix) $this->selectpagesSuffix = $selectpagessuffix; + if ($ignoreFields) + $this->ignoreFields = $ignoreFields; if ($editorclass) $this->editorClass = $editorclass; if ($sortfield) @@ -444,7 +454,7 @@ class Crud extends Command } $inputType = ''; //createtime和updatetime是保留字段不能修改和添加 - if ($v['COLUMN_KEY'] != 'PRI' && !in_array($field, $this->reservedField)) + if ($v['COLUMN_KEY'] != 'PRI' && !in_array($field, $this->reservedField) && !in_array($field, $this->ignoreFields)) { $inputType = $this->getFieldType($v); diff --git a/application/admin/command/Min.php b/application/admin/command/Min.php index d2fb4c62..cec70732 100644 --- a/application/admin/command/Min.php +++ b/application/admin/command/Min.php @@ -57,8 +57,8 @@ class Min extends Command { if (IS_WIN) { - // Winsows下请手动配置配置该值,一般将该值配置为 '"C:/Program Files/nodejs/node.exe"',除非你的Node安装路径有变更 - $nodeExec = '"C:/Program Files/nodejs/node.exe"'; + // Winsows下请手动配置配置该值,一般将该值配置为 '"C:\Program Files\nodejs\node.exe"',除非你的Node安装路径有变更 + $nodeExec = '"C:\Program Files\nodejs\node.exe"'; } else { @@ -117,7 +117,7 @@ class Min extends Command $output->info("Compress " . $data["{$res}BaseName"] . ".{$res}"); // 执行压缩 - echo exec("{$nodeExec} {$minPath}r.js -o {$tempFile} >> {$minPath}node.log"); + echo exec("{$nodeExec} \"{$minPath}r.js\" -o \"{$tempFile}\" >> \"{$minPath}node.log\""); } } diff --git a/application/admin/controller/Addon.php b/application/admin/controller/Addon.php index 73cf8058..4abe86f0 100644 --- a/application/admin/controller/Addon.php +++ b/application/admin/controller/Addon.php @@ -305,31 +305,15 @@ class Addon extends Backend { $offset = (int) $this->request->get("offset"); $limit = (int) $this->request->get("limit"); - $filter = $this->request->get("filter"); - $filter = (array) json_decode($filter, true); - foreach ($filter as $k => &$v) - { - $v = htmlspecialchars(strip_tags($v)); - } - unset($v); - $where = ['status' => 'normal']; - if (isset($filter['id'])) - { - $where['id'] = (int) $filter['id']; - } - if (isset($filter['name'])) - { - $where['name'] = ['like', "%{$filter['name']}%"]; - } - if (isset($filter['title'])) - { - $where['title'] = ['like', "%{$filter['title']}%"]; - } + $search = $this->request->get("search"); + $search = htmlspecialchars(strip_tags($search)); $addons = get_addon_list(); $list = []; foreach ($addons as $k => $v) { + if ($search && stripos($v['name'], $search) === FALSE && stripos($v['intro'], $search) === FALSE) + continue; $v['flag'] = ''; $v['banner'] = ''; $v['image'] = ''; @@ -340,8 +324,9 @@ class Addon extends Backend $v['createtime'] = 0; $list[] = $v; } + $total = count($list); $list = array_slice($list, $offset, $limit); - $result = array("total" => count($addons), "rows" => $list); + $result = array("total" => $total, "rows" => $list); $callback = $this->request->get('callback') ? "jsonp" : "json"; return $callback($result); diff --git a/application/admin/lang/zh-cn/addon.php b/application/admin/lang/zh-cn/addon.php index 7f3257ac..c7ad05e8 100644 --- a/application/admin/lang/zh-cn/addon.php +++ b/application/admin/lang/zh-cn/addon.php @@ -58,7 +58,6 @@ return [ 'Uninstall successful' => '卸载成功', 'Operate successful' => '操作成功', 'Addon info file was not found' => '插件配置文件未找到', - 'Addon info file data incorrect' => '插件配置文件未找到', 'Addon info file data incorrect' => '插件配置信息不正确', 'Addon already exists' => '上传的插件已经存在', ]; diff --git a/application/admin/lang/zh-cn/auth/rule.php b/application/admin/lang/zh-cn/auth/rule.php index 5493d3f7..574be8a6 100644 --- a/application/admin/lang/zh-cn/auth/rule.php +++ b/application/admin/lang/zh-cn/auth/rule.php @@ -6,10 +6,12 @@ return [ 'Remark' => '备注', 'Icon' => '图标', 'Alert' => '警告', - 'Name' => '规则URL', + 'Name' => '规则', 'Controller/Action' => '控制器名/方法名', 'Ismenu' => '菜单', 'Search icon' => '搜索图标', + 'Menu tips' => '规则任意,不可重复,仅做层级显示,无需匹配控制器和方法', + 'Node tips' => '控制器/方法名', 'The non-menu rule must have parent' => '非菜单规则节点必须有父级', 'If not necessary, use the command line to build rule' => '非必要情况下请直接使用命令行php think menu来生成', 'Name only supports letters, numbers, underscore and slash' => 'URL规则只能是小写字母、数字、下划线和/组成', diff --git a/application/admin/view/auth/rule/add.html b/application/admin/view/auth/rule/add.html index 7f808a3c..c9a8e1aa 100644 --- a/application/admin/view/auth/rule/add.html +++ b/application/admin/view/auth/rule/add.html @@ -12,13 +12,13 @@
- {:build_select('row[pid]', $ruledata, null, ['class'=>'form-control selectpicker', 'required'=>''])} + {:build_select('row[pid]', $ruledata, null, ['class'=>'form-control', 'required'=>''])}
- +
diff --git a/application/admin/view/auth/rule/edit.html b/application/admin/view/auth/rule/edit.html index e0afebc2..9f507993 100644 --- a/application/admin/view/auth/rule/edit.html +++ b/application/admin/view/auth/rule/edit.html @@ -8,13 +8,13 @@
- {:build_select('row[pid]', $ruledata, $row['pid'], ['class'=>'form-control selectpicker', 'required'=>''])} + {:build_select('row[pid]', $ruledata, $row['pid'], ['class'=>'form-control', 'required'=>''])}
- +
diff --git a/application/admin/view/common/control.html b/application/admin/view/common/control.html index 68d41ffd..0ddd8d49 100644 --- a/application/admin/view/common/control.html +++ b/application/admin/view/common/control.html @@ -30,13 +30,13 @@

{:__('Skins')}

  • Blue

  • -
  • Black

  • +
  • White

  • Purple

  • Green

  • Red

  • Yellow

  • Blue Light

  • -
  • Black Light

  • +
  • White Light

  • Purple Light

  • Green Light

  • Red Light

  • diff --git a/application/api/config.php b/application/api/config.php index 3779064a..1eb84c9a 100644 --- a/application/api/config.php +++ b/application/api/config.php @@ -2,4 +2,4 @@ //配置文件 return [ -]; \ No newline at end of file +]; diff --git a/application/api/controller/Common.php b/application/api/controller/Common.php new file mode 100644 index 00000000..cbdc33df --- /dev/null +++ b/application/api/controller/Common.php @@ -0,0 +1,50 @@ + + * 可选参数:lng,lat + */ + public function init() + { + if ($version = $this->request->request('version')) + { + $lng = $this->request->request('lng'); + $lat = $this->request->request('lat'); + $content = [ + 'citydata' => Area::getCityFromLngLat($lng, $lat), + 'versiondata' => Version::check($version), + 'uploaddata' => Config::get('upload'), + 'coverdata' => Config::get("cover"), + ]; + $this->success('', $content); + } + else + { + $this->error(__('Invalid parameters')); + } + } + +} diff --git a/application/api/controller/Demo.php b/application/api/controller/Demo.php new file mode 100644 index 00000000..160fe58b --- /dev/null +++ b/application/api/controller/Demo.php @@ -0,0 +1,55 @@ + + * 可选参数:无 + */ + public function test1() + { + $this->success('返回成功', ['action' => 'test1']); + } + + /** + * 需要登录的接口 + * + * 必选参数:token
    + * 可选参数:无 + */ + public function test2() + { + $this->success('返回成功', ['action' => 'test2']); + } + + /** + * 需要登录且需要验证有相应组的权限 + * + * 必选参数:token
    + * 可选参数:无 + */ + public function test3() + { + $this->success('返回成功', ['action' => 'test3']); + } + +} diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php new file mode 100644 index 00000000..ecc0fd96 --- /dev/null +++ b/application/api/controller/Index.php @@ -0,0 +1,27 @@ + + * 可选参数:lng,lat + */ + public function index() + { + $this->success('请求成功'); + } + +} diff --git a/application/api/controller/Sms.php b/application/api/controller/Sms.php new file mode 100644 index 00000000..1be29b92 --- /dev/null +++ b/application/api/controller/Sms.php @@ -0,0 +1,103 @@ + + * 可选参数:无 + */ + public function send() + { + $mobile = $this->request->request("mobile"); + $type = $this->request->request("type"); + $type = $type ? $type : 'register'; + + $last = Smslib::get($mobile, $type); + if ($last && time() - $last['createtime'] < 60) + { + $this->error(__('发送频繁')); + } + if ($type) + { + $userinfo = User::getByMobile($mobile); + if ($type == 'register' && $userinfo) + { + //已被注册 + $this->error(__('已被注册')); + } + else if (in_array($type, ['changepwd', 'resetpwd']) && !$userinfo) + { + //未注册 + $this->error(__('未注册')); + } + } + $ret = Smslib::send($mobile, '', $type); + if ($ret) + { + $this->success(__('发送成功')); + } + else + { + $this->error(__('发送失败')); + } + } + + /** + * 检测验证码 + * + * 必选参数:mobile,type,captcha
    + * 可选参数:无 + */ + public function check() + { + $mobile = $this->request->request("mobile"); + $type = $this->request->request("type"); + $type = $type ? $type : 'register'; + $captcha = $this->request->request("captcha"); + + if ($type) + { + $userinfo = User::getByMobile($mobile); + if ($type == 'register' && $userinfo) + { + //已被注册 + $this->error(__('已被注册')); + } + else if (in_array($type, ['changepwd', 'resetpwd']) && !$userinfo) + { + //未注册 + $this->error(__('未注册')); + } + } + $ret = Smslib::check($mobile, $captcha, $type); + if ($ret) + { + $this->success(__('成功')); + } + else + { + $this->error(__('验证码不正确')); + } + } + +} diff --git a/application/api/lang/zh-cn.php b/application/api/lang/zh-cn.php new file mode 100644 index 00000000..53cd5437 --- /dev/null +++ b/application/api/lang/zh-cn.php @@ -0,0 +1,91 @@ + '保持会话', + 'Sign in' => '登入', + 'Username' => '用户名', + 'User id' => '会员ID', + 'Username' => '用户名', + 'Nickname' => '昵称', + 'Password' => '密码', + 'Sign up' => '注 册', + 'Sign in' => '登 录', + 'Sign out' => '注 销', + 'Keep login' => '保持会话', + 'Guest' => '游客', + 'Welcome' => '%s,你好!', + 'Add' => '添加', + 'Edit' => '编辑', + 'Delete' => '删除', + 'Move' => '移动', + 'Name' => '名称', + 'Status' => '状态', + 'Weigh' => '权重', + 'Operate' => '操作', + 'Warning' => '温馨提示', + 'Default' => '默认', + 'Article' => '文章', + 'Page' => '单页', + 'OK' => '确定', + 'Cancel' => '取消', + 'Loading' => '加载中', + 'More' => '更多', + 'Normal' => '正常', + 'Hidden' => '隐藏', + 'Submit' => '提交', + 'Reset' => '重置', + 'Execute' => '执行', + 'Close' => '关闭', + 'Search' => '搜索', + 'Refresh' => '刷新', + 'First' => '首页', + 'Previous' => '上一页', + 'Next' => '下一页', + 'Last' => '末页', + 'None' => '无', + 'Home' => '主页', + 'Online' => '在线', + 'Logout' => '注销', + 'Profile' => '个人资料', + 'Index' => '首页', + 'Hot' => '热门', + 'Recommend' => '推荐', + 'Dashboard' => '控制台', + 'Code' => '编号', + 'Message' => '内容', + 'Line' => '行号', + 'File' => '文件', + 'Menu' => '菜单', + 'Name' => '名称', + 'Weigh' => '权重', + 'Type' => '类型', + 'Title' => '标题', + 'Content' => '内容', + 'Status' => '状态', + 'Operate' => '操作', + 'Append' => '追加', + 'Memo' => '备注', + 'Parent' => '父级', + 'Params' => '参数', + 'Permission' => '权限', + 'Advance search' => '高级搜索', + 'Check all' => '选中全部', + 'Expand all' => '展开全部', + 'Begin time' => '开始时间', + 'End time' => '结束时间', + 'Create time' => '创建时间', + 'Flag' => '标志', + 'Please login first' => '请登录后操作', + 'Redirect now' => '立即跳转', + 'Operation completed' => '操作成功!', + 'Operation failed' => '操作失败!', + 'Unknown data format' => '未知的数据格式!', + 'Network error' => '网络错误!', + 'Advanced search' => '高级搜索', + 'Invalid parameters' => '未知参数', + 'No results were found' => '记录未找到', + 'Parameter %s can not be empty' => '参数%s不能为空', + 'You have no permission' => '你没有权限访问', + 'An unexpected error occurred' => '发生了一个意外错误,程序猿正在紧急处理中', + 'This page will be re-directed in %s seconds' => '页面将在 %s 秒后自动跳转', +]; diff --git a/application/api/model/Area.php b/application/api/model/Area.php new file mode 100644 index 00000000..90500f94 --- /dev/null +++ b/application/api/model/Area.php @@ -0,0 +1,93 @@ + 'geo:province', 2 => 'geo:city', 3 => 'geo:district']; + $rangearr = [1 => 15000, 2 => 1000, 3 => 200]; + $geoname = isset($namearr[$level]) ? $namearr[$level] : $namearr[3]; + $georange = isset($rangearr[$level]) ? $rangearr[$level] : $rangearr[3]; + $neararea = []; + // 读取范围内的ID + $redis = Cache::store('redis')->handler(); + $georadiuslist = []; + if (method_exists($redis, 'georadius')) + { + $georadiuslist = $redis->georadius($geoname, $lng, $lat, $georange, 'km', ['WITHDIST', 'COUNT' => 5, 'ASC']); + } + + if ($georadiuslist) + { + list($id, $distance) = $georadiuslist[0]; + } + $id = isset($id) && $id ? $id : 3; + return self::get($id); + } + + /** + * 根据经纬度获取省份 + * + * @param string $lng 经度 + * @param string $lat 纬度 + * @return array + */ + public static function getProvinceFromLngLat($lng, $lat) + { + $provincedata = []; + $citydata = self::getCityFromLngLat($lng, $lat); + if ($citydata) + { + $provincedata = self::get($citydata['pid']); + } + return $provincedata; + } + + /** + * 根据经纬度获取城市 + * + * @param string $lng 经度 + * @param string $lat 纬度 + * @return array + */ + public static function getCityFromLngLat($lng, $lat) + { + $citydata = []; + $districtdata = self::getDistrictFromLngLat($lng, $lat); + if ($districtdata) + { + $citydata = self::get($districtdata['pid']); + } + return $citydata; + } + + /** + * 根据经纬度获取地区 + * + * @param string $lng 经度 + * @param string $lat 纬度 + * @return array + */ + public static function getDistrictFromLngLat($lng, $lat) + { + $districtdata = self::getAreaFromLngLat($lng, $lat, 3); + return $districtdata; + } + +} diff --git a/application/common/controller/Api.php b/application/common/controller/Api.php index 14ca8e08..b2591417 100644 --- a/application/common/controller/Api.php +++ b/application/common/controller/Api.php @@ -2,14 +2,302 @@ namespace app\common\controller; -use think\controller\Rest; +use app\common\library\Auth; +use think\exception\HttpResponseException; +use think\exception\ValidateException; +use think\Lang; +use think\Loader; +use think\Request; +use think\Response; -class Api extends Rest +/** + * API控制器基类 + */ +class Api { - public function _initialize() - { + /** + * @var Request Request 实例 + */ + protected $request; + /** + * @var bool 验证失败是否抛出异常 + */ + protected $failException = false; + + /** + * @var bool 是否批量验证 + */ + protected $batchValidate = false; + + /** + * @var array 前置操作方法列表 + */ + protected $beforeActionList = []; + + /** + * 无需登录的方法,同时也就不需要鉴权了 + * @var array + */ + protected $noNeedLogin = []; + + /** + * 无需鉴权的方法,但需要登录 + * @var array + */ + protected $noNeedRight = []; + + /** + * 权限Auth + * @var Auth + */ + protected $auth = null; + + /** + * 构造方法 + * @access public + * @param Request $request Request 对象 + */ + public function __construct(Request $request = null) + { + $this->request = is_null($request) ? Request::instance() : $request; + + // 控制器初始化 + $this->_initialize(); + + // 前置操作方法 + if ($this->beforeActionList) + { + foreach ($this->beforeActionList as $method => $options) + { + is_numeric($method) ? + $this->beforeAction($options) : + $this->beforeAction($method, $options); + } + } + } + + /** + * 初始化操作 + * @access protected + */ + protected function _initialize() + { + $this->auth = Auth::instance(); + + $modulename = $this->request->module(); + $controllername = strtolower($this->request->controller()); + $actionname = strtolower($this->request->action()); + + // token + $token = $this->request->request('token'); + + $path = str_replace('.', '/', $controllername) . '/' . $actionname; + // 设置当前请求的URI + $this->auth->setRequestUri($path); + // 检测是否需要验证登录 + if (!$this->auth->match($this->noNeedLogin)) + { + //初始化 + $this->auth->init($token); + //检测是否登录 + if (!$this->auth->isLogin()) + { + $this->error(__('Please login first')); + } + // 判断是否需要验证权限 + if (!$this->auth->match($this->noNeedRight)) + { + // 判断控制器和方法判断是否有对应权限 + if (!$this->auth->check($path)) + { + $this->error(__('You have no permission')); + } + } + } + else + { + // 如果有传递token才验证是否登录状态 + if ($token) + { + $this->auth->init($token); + } + } + // 加载当前控制器语言包 + $this->loadlang($controllername); + } + + /** + * 加载语言文件 + * @param string $name + */ + protected function loadlang($name) + { + Lang::load(APP_PATH . $this->request->module() . '/lang/' . Lang::detect() . '/' . str_replace('.', '/', $name) . '.php'); + } + + /** + * 操作成功返回的数据 + * @param string $msg 提示信息 + * @param mixed $data 要返回的数据 + * @param string $type 输出类型 + * @param array $header 发送的 Header 信息 + */ + protected function success($msg = '', $data = '', $type = 'json', array $header = []) + { + $this->result($data, 1, $msg, $type, $header); + } + + /** + * 操作失败返回的数据 + * @param string $msg 提示信息 + * @param mixed $data 要返回的数据 + * @param string $type 输出类型 + * @param array $header 发送的 Header 信息 + */ + protected function error($msg = '', $data = '', $type = 'json', array $header = []) + { + $this->result($data, 0, $msg, $type, $header); + } + + /** + * 返回封装后的 API 数据到客户端 + * @access protected + * @param mixed $data 要返回的数据 + * @param int $code 返回的 code + * @param mixed $msg 提示信息 + * @param string $type 返回数据格式 + * @param array $header 发送的 Header 信息 + * @return void + * @throws HttpResponseException + */ + protected function result($data, $code = 0, $msg = '', $type = '', array $header = []) + { + $result = [ + 'code' => $code, + 'msg' => $msg, + 'time' => Request::instance()->server('REQUEST_TIME'), + 'data' => $data, + ]; + $type = $type ?: $this->getResponseType(); + $response = Response::create($result, $type)->header($header); + + throw new HttpResponseException($response); + } + + /** + * 未找到请求的接口 + */ + public function _empty() + { + return $this->error('Api not found'); + } + + /** + * 前置操作 + * @access protected + * @param string $method 前置操作方法名 + * @param array $options 调用参数 ['only'=>[...]] 或者 ['except'=>[...]] + * @return void + */ + protected function beforeAction($method, $options = []) + { + if (isset($options['only'])) + { + if (is_string($options['only'])) + { + $options['only'] = explode(',', $options['only']); + } + + if (!in_array($this->request->action(), $options['only'])) + { + return; + } + } + elseif (isset($options['except'])) + { + if (is_string($options['except'])) + { + $options['except'] = explode(',', $options['except']); + } + + if (in_array($this->request->action(), $options['except'])) + { + return; + } + } + + call_user_func([$this, $method]); + } + + /** + * 设置验证失败后是否抛出异常 + * @access protected + * @param bool $fail 是否抛出异常 + * @return $this + */ + protected function validateFailException($fail = true) + { + $this->failException = $fail; + + return $this; + } + + /** + * 验证数据 + * @access protected + * @param array $data 数据 + * @param string|array $validate 验证器名或者验证规则数组 + * @param array $message 提示信息 + * @param bool $batch 是否批量验证 + * @param mixed $callback 回调方法(闭包) + * @return array|string|true + * @throws ValidateException + */ + protected function validate($data, $validate, $message = [], $batch = false, $callback = null) + { + if (is_array($validate)) + { + $v = Loader::validate(); + $v->rule($validate); + } + else + { + // 支持场景 + if (strpos($validate, '.')) + { + list($validate, $scene) = explode('.', $validate); + } + + $v = Loader::validate($validate); + + !empty($scene) && $v->scene($scene); + } + + // 批量验证 + if ($batch || $this->batchValidate) + $v->batch(true); + // 设置错误信息 + if (is_array($message)) + $v->message($message); + // 使用回调验证 + if ($callback && is_callable($callback)) + { + call_user_func_array($callback, [$v, &$data]); + } + + if (!$v->check($data)) + { + if ($this->failException) + { + throw new ValidateException($v->getError()); + } + + return $v->getError(); + } + + return true; } } diff --git a/application/common/controller/Frontend.php b/application/common/controller/Frontend.php index b95a1465..1ded6444 100644 --- a/application/common/controller/Frontend.php +++ b/application/common/controller/Frontend.php @@ -2,11 +2,15 @@ namespace app\common\controller; +use app\common\library\Auth; use think\Config; use think\Controller; use think\Hook; use think\Lang; +/** + * 前台控制器基类 + */ class Frontend extends Controller { @@ -16,6 +20,24 @@ class Frontend extends Controller */ protected $layout = ''; + /** + * 无需登录的方法,同时也就不需要鉴权了 + * @var array + */ + protected $noNeedLogin = []; + + /** + * 无需鉴权的方法,但需要登录 + * @var array + */ + protected $noNeedRight = []; + + /** + * 权限Auth + * @var Auth + */ + protected $auth = null; + public function _initialize() { //移除HTML标签 @@ -29,6 +51,49 @@ class Frontend extends Controller { $this->view->engine->layout('layout/' . $this->layout); } + $this->auth = Auth::instance(); + + $modulename = $this->request->module(); + $controllername = strtolower($this->request->controller()); + $actionname = strtolower($this->request->action()); + + // token + $token = $this->request->request('token'); + $token = $token ? $token : \think\Cookie::get('token'); + + $path = str_replace('.', '/', $controllername) . '/' . $actionname; + // 设置当前请求的URI + $this->auth->setRequestUri($path); + // 检测是否需要验证登录 + if (!$this->auth->match($this->noNeedLogin)) + { + //初始化 + $this->auth->init($token); + //检测是否登录 + if (!$this->auth->isLogin()) + { + $this->error(__('Please login first'), 'user/login'); + } + // 判断是否需要验证权限 + if (!$this->auth->match($this->noNeedRight)) + { + // 判断控制器和方法判断是否有对应权限 + if (!$this->auth->check($path)) + { + $this->error(__('You have no permission')); + } + } + } + else + { + // 如果有传递token才验证是否登录状态 + if ($token) + { + $this->auth->init($token); + } + } + + $this->view->assign('user', $this->auth->getUser()); // 语言检测 $lang = strip_tags(Lang::detect()); @@ -39,7 +104,7 @@ class Frontend extends Controller // 上传信息配置后 Hook::listen("upload_config_init", $upload); - + // 配置信息 $config = [ 'site' => array_intersect_key($site, array_flip(['name', 'cdnurl', 'version', 'timezone', 'languages'])), @@ -51,11 +116,12 @@ class Frontend extends Controller 'moduleurl' => rtrim(url("/{$modulename}", '', false), '/'), 'language' => $lang ]; - + Config::set('upload', array_merge(Config::get('upload'), $upload)); - + // 配置信息后 Hook::listen("config_init", $config); + // 加载当前控制器语言包 $this->loadlang($controllername); $this->assign('site', $site); $this->assign('config', $config); @@ -69,7 +135,7 @@ class Frontend extends Controller { Lang::load(APP_PATH . $this->request->module() . '/lang/' . Lang::detect() . '/' . str_replace('.', '/', $name) . '.php'); } - + /** * 渲染配置信息 * @param mixed $name 键名或数组 diff --git a/application/common/library/Auth.php b/application/common/library/Auth.php new file mode 100644 index 00000000..f102ade7 --- /dev/null +++ b/application/common/library/Auth.php @@ -0,0 +1,573 @@ +options = array_merge($this->config, $config); + } + $this->options = array_merge($this->config, $options); + } + + /** + * + * @param array $options 参数 + * @return Auth + */ + public static function instance($options = []) + { + if (is_null(self::$instance)) + { + self::$instance = new static($options); + } + + return self::$instance; + } + + /** + * 获取User模型 + * @return User + */ + public function getUser() + { + return $this->_user; + } + + /** + * 兼容调用user模型的属性 + * + * @param string $name + * @return mixed + */ + public function __get($name) + { + return $this->_user ? $this->_user->$name : NULL; + } + + /** + * 根据Token初始化 + * + * @param string $token Token + * @return boolean + */ + public function init($token) + { + if ($this->_logined) + { + return TRUE; + } + if ($this->_error) + return FALSE; + $data = Token::get($token); + if (!$data) + { + return FALSE; + } + $user_id = intval($data['user_id']); + if ($user_id > 0) + { + $user = User::get($user_id); + if (!$user) + { + $this->setError('Account not exist'); + return FALSE; + } + if ($user['status'] != 'normal') + { + $this->setError('Account is locked'); + return FALSE; + } + $this->_user = $user; + $this->_logined = TRUE; + $this->_token = $token; + + //初始化成功的事件 + Hook::listen("user_init_successed", $this->_user); + + return TRUE; + } + else + { + $this->setError('You are not logged in'); + return FALSE; + } + } + + /** + * 注册用户 + * + * @param string $username 用户名 + * @param string $password 密码 + * @param string $email 邮箱 + * @param string $mobile 手机号 + * @param string $extend 扩展参数 + * @return boolean + */ + public function register($username, $password, $email = '', $mobile = '', $extend = []) + { + // 检测用户名或邮箱、手机号是否存在 + if (User::getByUsername($username)) + { + $this->setError('Username already exist'); + return FALSE; + } + if ($email && User::getByEmail($email)) + { + $this->setError('Email already exist'); + return FALSE; + } + if ($mobile && User::getByMobile($mobile)) + { + $this->setError('Mobile already exist'); + return FALSE; + } + + $ip = request()->ip(); + $time = time(); + + $data = [ + 'username' => $username, + 'password' => $password, + 'email' => $email, + 'mobile' => $mobile, + 'level' => 1, + 'score' => 0, + 'avatar' => '', + ]; + $params = array_merge($data, [ + 'nickname' => $username, + 'salt' => Random::alnum(), + 'jointime' => $time, + 'joinip' => $ip, + 'logintime' => $time, + 'loginip' => $ip, + 'prevtime' => $time, + 'status' => 'normal' + ]); + $params['password'] = $this->getEncryptPassword($password, $params['salt']); + $params = array_merge($params, $extend); + + //账号注册时需要开启事务,避免出现垃圾数据 + Db::startTrans(); + try + { + $user = User::create($params); + Db::commit(); + + // 此时的Model中只包含部分数据 + $this->_user = User::get($user->id); + + //设置Token + $this->_token = Random::uuid(); + Token::set($this->_token, $user->id); + + //注册成功的事件 + Hook::listen("user_register_successed", $this->_user); + + return TRUE; + } + catch (Exception $e) + { + $this->setError($e->getMessage()); + Db::rollback(); + return FALSE; + } + } + + /** + * 用户登录 + * + * @param string $account 账号,用户名、邮箱、手机号 + * @param string $password 密码 + * @return array + */ + public function login($account, $password) + { + $field = Validate::is($account, 'email') ? 'email' : (Validate::regex($account, '/^1\d{10}$/') ? 'mobile' : 'username'); + $user = User::get([$field => $account]); + if (!$user) + { + $this->setError('Account is incorrect'); + return FALSE; + } + + if ($user->status != 'normal') + { + $this->setError('Account is locked'); + return FALSE; + } + if ($user->password != $this->getEncryptPassword($password, $user->salt)) + { + $this->setError('Password is incorrect'); + return FALSE; + } + + //直接登录会员 + $this->direct($user->id); + + return TRUE; + } + + /** + * 注销 + * + * @return bool + */ + public function logout() + { + if (!$this->_logined) + { + $this->setError('You are not logged in'); + return false; + } + //设置登录标识 + $this->_logined = FALSE; + //删除Token + Token::delete($this->_token); + //注销成功的事件 + Hook::listen("user_logout_successed", $this->_user); + return TRUE; + } + + /** + * 修改密码 + * @param string $newpassword 新密码 + * @param string $oldpassword 旧密码 + * @param bool $ignoreoldpassword 忽略旧密码 + * @return boolean + */ + public function changepwd($newpassword, $oldpassword = '', $ignoreoldpassword = false) + { + if (!$this->_logined) + { + $this->setError('You are not logged in'); + return false; + } + //判断旧密码是否正确 + if ($this->_user->password == $this->getEncryptPassword($oldpassword, $this->_user->salt) || $ignoreoldpassword) + { + $salt = Random::alnum(); + $newpassword = $this->getEncryptPassword($newpassword, $salt); + $this->_user->save(['password' => $newpassword, 'salt' => $salt]); + + Token::delete($this->_token); + //修改密码成功的事件 + Hook::listen("user_changepwd_successed", $this->_user); + return true; + } + else + { + $this->setError('Password is incorrect'); + return false; + } + } + + /** + * 直接登录账号 + * @param int $user_id + * @return boolean + */ + public function direct($user_id) + { + $user = User::get($user_id); + if ($user) + { + $ip = request()->ip(); + $time = time(); + + //判断连续登录和最大连续登录 + if ($user->logintime < \fast\Date::unixtime('day')) + { + $user->successions = $user->logintime < \fast\Date::unixtime('day', -1) ? 1 : $user->successions + 1; + $user->maxsuccessions = max($user->successions, $user->maxsuccessions); + } + + $user->prevtime = $user->logintime; + //记录本次登录的IP和时间 + $user->loginip = $ip; + $user->logintime = $time; + + $user->save(); + + $this->_user = $user; + + $this->_token = Random::uuid(); + Token::set($this->_token, $user->id); + + //登录成功的事件 + Hook::listen("user_login_successed", $this->_user); + return TRUE; + } + else + { + return FALSE; + } + } + + /** + * 检测是否是否有对应权限 + * @param string $path 控制器/方法 + * @param string $module 模块 默认为当前模块 + * @return boolean + */ + public function check($path = NULL, $module = NULL) + { + if (!$this->_logined) + return false; + + $ruleList = $this->getRuleList(); + $rules = []; + foreach ($ruleList as $k => $v) + { + $rules[] = $v['name']; + } + $url = ($module ? $module : request()->module()) . '/' . (is_null($path) ? $this->getRequestUri() : $path); + return in_array($url, $rules) ? TRUE : FALSE; + } + + /** + * 判断是否登录 + * @return boolean + */ + public function isLogin() + { + if ($this->_logined) + { + return true; + } + return false; + } + + /** + * 获取当前Token + * @return string + */ + public function getToken() + { + return $this->_token; + } + + /** + * 获取会员基本信息 + */ + public function getUserinfo() + { + $data = $this->_user->toArray(); + $allowFields = $this->getAllowFields(); + $userinfo = array_intersect_key($data, array_flip($allowFields)); + $userinfo['token'] = $this->getToken(); + return $userinfo; + } + + /** + * 获取会员组别规则列表 + * @return array + */ + public function getRuleList() + { + if ($this->rules) + return $this->rules; + $group = $this->_user->group; + if (!$group) + { + return []; + } + $rules = explode(',', $group->rules); + $this->rules = UserRule::where('status', 'normal')->where('id', 'in', $rules)->field('id,pid,name,title,ismenu')->select(); + return $this->rules; + } + + /** + * 获取当前请求的URI + * @return string + */ + public function getRequestUri() + { + return $this->requestUri; + } + + /** + * 设置当前请求的URI + * @param string $uri + */ + public function setRequestUri($uri) + { + $this->requestUri = $uri; + } + + /** + * 获取允许输出的字段 + * @return array + */ + public function getAllowFields() + { + return $this->allowFields; + } + + /** + * 设置允许输出的字段 + * @param array $fields + */ + public function setAllowFields($fields) + { + $this->allowFields = $fields; + } + + /** + * 删除一个指定会员 + * @param int $user_id 会员ID + */ + public function delete($user_id) + { + $user = User::get($user_id); + if (!$user) + { + return FALSE; + } + + // 调用事务删除账号 + $result = Db::transaction(function($db) use($user_id) { + // 删除会员 + User::destroy($user_id); + // 删除会员指定的所有Token + Token::clear($user_id); + return TRUE; + }); + if ($result) + { + Hook::listen("user_delete_successed", $user); + } + return $result ? TRUE : FALSE; + } + + /** + * 获取密码加密后的字符串 + * @param string $password 密码 + * @param string $salt 密码盐 + * @return string + */ + public function getEncryptPassword($password, $salt = '') + { + return md5(md5($password) . $salt); + } + + /** + * 检测当前控制器和方法是否匹配传递的数组 + * + * @param array $arr 需要验证权限的数组 + */ + public function match($arr = []) + { + $request = Request::instance(); + $arr = is_array($arr) ? $arr : explode(',', $arr); + if (!$arr) + { + return FALSE; + } + // 是否存在 + if (in_array(strtolower($request->action()), $arr) || in_array('*', $arr)) + { + return TRUE; + } + + // 没找到匹配 + return FALSE; + } + + /** + * 设置会话有效时间 + * @param int $keeptime 默认为永久 + */ + public function keeptime($keeptime = 0) + { + $this->keeptime = $keeptime; + } + + /** + * 渲染用户数据 + * @param array $datalist 二维数组 + * @param mixed $fields 加载的字段列表 + * @param string $fieldkey 渲染的字段 + * @param string $renderkey 结果字段 + * @return array + */ + public function render(&$datalist, $fields = [], $fieldkey = 'user_id', $renderkey = 'userinfo') + { + $fields = !$fields ? ['id', 'nickname', 'level', 'avatar'] : (is_array($fields) ? $fields : explode(',', $fields)); + $ids = []; + foreach ($datalist as $k => $v) + { + if (!isset($v[$fieldkey])) + continue; + $ids[] = $v[$fieldkey]; + } + $list = []; + if ($ids) + { + if (!in_array('id', $fields)) + { + $fields[] = 'id'; + } + $ids = array_unique($ids); + $selectlist = User::where('id', 'in', $ids)->column($fields); + foreach ($selectlist as $k => $v) + { + $list[$v['id']] = $v; + } + } + foreach ($datalist as $k => &$v) + { + $v[$renderkey] = isset($list[$v[$fieldkey]]) ? $list[$v[$fieldkey]] : NULL; + } + unset($v); + return $datalist; + } + + /** + * 设置错误信息 + * + * @param $error 错误信息 + */ + public function setError($error) + { + $this->_error = $error; + return $this; + } + + /** + * 获取错误信息 + * @return string + */ + public function getError() + { + return $this->_error ? __($this->_error) : ''; + } + +} diff --git a/application/common/library/Sms.php b/application/common/library/Sms.php new file mode 100644 index 00000000..ace4e25a --- /dev/null +++ b/application/common/library/Sms.php @@ -0,0 +1,138 @@ + $mobile, 'type' => $type]) + ->order('id', 'DESC') + ->find(); + } + + /** + * 发送验证码 + * + * @param int $mobile 手机号 + * @param int $code 验证码 + * @param string $type 类型 + * @return array + */ + public static function send($mobile, $code = '', $type = 'default') + { + $config = get_addon_config('alisms'); + $code = !$code ? mt_rand(1000, 9999) : $code; + $alisms = new Alisms(); + $ret = $alisms->mobile($mobile) + ->template($config['template'][$type]) + ->param(['code' => $code]) + ->send(); + if ($ret) + { + $time = time(); + MobileCode::create(['type' => $type, 'mobile' => $mobile, 'code' => $code, 'createtime' => $time]); + return TRUE; + } + else + { + return FALSE; + } + } + + /** + * 发送通知 + * @param int $mobile 手机号 + * @param string $template 模板ID + * @param array $params 参数 + * @return boolean + */ + public static function notice($mobile, $template, $params = []) + { + $alisms = Alisms::instance(); + $ret = $alisms->mobile($mobile) + ->template($template) + ->param($params) + ->send(); + return $ret ? TRUE : FALSE; + } + + /** + * 校验验证码 + * + * @param int $mobile 手机号 + * @param int $code 验证码 + * @param string $type 类型 + * @return boolean + */ + public static function check($mobile, $code, $type = 'default') + { + $time = time() - self::$expire; + $obj = MobileCode::where(['mobile' => $mobile, 'type' => $type]) + ->order('id', 'DESC') + ->find(); + if ($obj) + { + if ($obj['createtime'] > $time && $obj['times'] <= self::$maxCheckNums) + { + $correct = $code == $obj['code']; + if (!$correct) + { + $obj->times = $obj->times + 1; + $obj->save(); + } + return $correct; + } + else + { + // 过期则清空该手机验证码 + self::flush($mobile, $type); + return FALSE; + } + } + else + { + return FALSE; + } + } + + /** + * 清空指定手机号验证码 + * + * @param int $mobile 手机号 + * @param string $type 类型 + * @return boolean + */ + public static function flush($mobile, $type = 'default') + { + MobileCode:: + where(['mobile' => $mobile, 'type' => $type]) + ->delete(); + return TRUE; + } + +} diff --git a/application/common/library/Token.php b/application/common/library/Token.php new file mode 100644 index 00000000..42b3f11b --- /dev/null +++ b/application/common/library/Token.php @@ -0,0 +1,84 @@ + $token, 'user_id' => $user_id, 'expiretime' => $expiretime]); + } + + /** + * 获取Token内的信息 + * @param string $token + * @return array + */ + public static function get($token) + { + $data = \app\common\model\Token::get($token); + if ($data) + { + if (!$data['expiretime'] || $data['expiretime'] > time()) + { + return $data; + } + else + { + self::delete($token); + } + } + return []; + } + + /** + * 判断Token是否可用 + * @param string $token Token + * @param int $user_id 会员ID + * @return boolean + */ + public static function check($token, $user_id) + { + $data = self::get($token); + return $data && $data['user_id'] == $user_id ? true : false; + } + + /** + * 删除Token + * @param string $token + * @return boolean + */ + public static function delete($token) + { + $data = \app\common\model\Token::get($token); + if ($data) + { + $data->delete(); + return true; + } + return false; + } + + /** + * 删除指定用户的所有Token + * @param int $user_id + * @return boolean + */ + public static function clear($user_id) + { + \app\common\model\Token::where('user_id', $user_id)->delete(); + return true; + } + +} diff --git a/application/common/model/Attachment.php b/application/common/model/Attachment.php index 73a77c4d..79878c6d 100644 --- a/application/common/model/Attachment.php +++ b/application/common/model/Attachment.php @@ -15,8 +15,10 @@ class Attachment extends Model // 定义字段类型 protected $type = [ ]; - public function setUploadtimeAttr($value) - { - return strtotime($value); - } + + public function setUploadtimeAttr($value) + { + return strtotime($value); + } + } diff --git a/application/common/model/Category.php b/application/common/model/Category.php index 5f491d4e..fa1c9f44 100644 --- a/application/common/model/Category.php +++ b/application/common/model/Category.php @@ -62,8 +62,8 @@ class Category Extends Model /** * 读取分类列表 - * @param string $type 指定类型 - * @param string $status 指定状态 + * @param string $type 指定类型 + * @param string $status 指定状态 * @return array */ public static function getCategoryArray($type = NULL, $status = NULL) diff --git a/application/common/model/Config.php b/application/common/model/Config.php index 832826be..f7bf6e7c 100644 --- a/application/common/model/Config.php +++ b/application/common/model/Config.php @@ -4,6 +4,9 @@ namespace app\common\model; use think\Model; +/** + * 配置模型 + */ class Config extends Model { diff --git a/application/common/view/tpl/dispatch_jump.tpl b/application/common/view/tpl/dispatch_jump.tpl index e7df1865..5869a6df 100644 --- a/application/common/view/tpl/dispatch_jump.tpl +++ b/application/common/view/tpl/dispatch_jump.tpl @@ -1,5 +1,5 @@ {__NOLAYOUT__} - + 跳转提示 diff --git a/application/config.php b/application/config.php index 4ce4183f..20bcae74 100755 --- a/application/config.php +++ b/application/config.php @@ -251,7 +251,7 @@ return [ //登录页默认背景图 'login_background' => "/assets/img/loginbg.jpg", //版本号 - 'version' => '1.0.0.20171206_beta', + 'version' => '1.0.0.20180117_beta', 'api_url' => 'http://api.fastadmin.net', ], ]; diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index af3a85e7..35124055 100755 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -7,6 +7,8 @@ use app\common\controller\Frontend; class Index extends Frontend { + protected $noNeedLogin = '*'; + protected $noNeedRight = '*'; protected $layout = ''; public function _initialize() diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html index 91462495..e75a11ee 100644 --- a/application/index/view/index/index.html +++ b/application/index/view/index/index.html @@ -44,9 +44,9 @@
  • 服务
  • 下载
  • 演示
  • +
  • 捐赠
  • 社区
  • 文档
  • -
  • HTML版
@@ -147,7 +147,7 @@

© 2017 FastAdmin. All Rights Reserved.