diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php index 68643b1..ef519c5 100644 --- a/app/admin/controller/Admin.php +++ b/app/admin/controller/Admin.php @@ -21,7 +21,7 @@ use app\common\model\User as UserModel; class Admin extends AdminController { //管理员 - public function adminList() + public function index() { if(Request::isAjax()){ $admins = Db::name('admin') @@ -41,12 +41,12 @@ class Admin extends AdminController } return json($res); } - return View::fetch('list'); + return View::fetch(); } //管理员审核 - public function adminCheck() + public function check() { $data = Request::param(); @@ -66,7 +66,7 @@ class Admin extends AdminController } //添加管理员 - public function adminForm() + public function add() { if(Request::isAjax()){ $data = Request::param(); @@ -84,11 +84,11 @@ class Admin extends AdminController } $auth_group = Db::name('auth_group')->select(); View::assign(['auth_group'=>$auth_group]); - return View::fetch('adminform'); + return View::fetch(); } //管理员编辑 - public function adminEdit() + public function edit() { $admin = AdminModel::find(input('id')); @@ -136,7 +136,7 @@ class Admin extends AdminController $admin = AdminModel::find(Session::get('admin_id')); if(Request::isAjax()){ $data = Request::param(); - $result = $admin->update($data); + $result = $admin->allowField(['nickname','sex','mobile','email','remarks'])->update($data); if($result){ $res = ['code'=>0,'msg'=>'更新成功']; } else { diff --git a/app/admin/controller/AuthRule.php b/app/admin/controller/AuthRule.php index 0203222..7384407 100644 --- a/app/admin/controller/AuthRule.php +++ b/app/admin/controller/AuthRule.php @@ -104,7 +104,7 @@ class AuthRule extends AdminController //权限开关 - public function Check() + public function check() { $data = Request::param(); diff --git a/app/admin/controller/Set.php b/app/admin/controller/Set.php index 5b8e748..215c3d8 100644 --- a/app/admin/controller/Set.php +++ b/app/admin/controller/Set.php @@ -145,6 +145,8 @@ class Set extends AdminController if($cy->code != 0){ $cylevel = $cy->level; return $cylevel; + } else { + return 0; } } else { return 0; diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 1618217..050798f 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -35,7 +35,7 @@ class Article extends BaseController switch ($types) { //查询文章,10个分1页 case 'all': - $artList = ArticleModel::field('id,title,cate_id,user_id')->with([ + $artList = ArticleModel::field('id,title,cate_id,user_id,create_time')->with([ 'cate' => function($query){ $query->where('delete_time',0)->field('id,catename'); }, @@ -46,7 +46,7 @@ class Article extends BaseController break; case 'hot': - $artList = ArticleModel::field('id,title,cate_id,user_id')->with([ + $artList = ArticleModel::field('id,title,cate_id,user_id,create_time')->with([ 'cate' => function($query){ $query->where('delete_time',0)->field('id,catename'); }, @@ -57,7 +57,7 @@ class Article extends BaseController break; case 'top': - $artList = ArticleModel::field('id,title,cate_id,user_id')->with([ + $artList = ArticleModel::field('id,title,cate_id,user_id,create_time')->with([ 'cate' => function($query){ $query->where('delete_time',0)->field('id,catename'); }, @@ -68,7 +68,7 @@ class Article extends BaseController break; default: - $artList = ArticleModel::field('id,title,cate_id,user_id')->with([ + $artList = ArticleModel::field('id,title,cate_id,user_id,create_time')->with([ 'cate' => function($query){ $query->where('delete_time',0)->field('id,catename'); }, diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 076c7c4..04cadbb 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -20,7 +20,7 @@ class Index extends BaseController $sliders = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',1)->whereTime('slid_over','>=',time())->select(); //置顶文章 - $artTop = Article::field('id,title,cate_id,user_id')->where(['is_top'=>1,'status'=>1,'delete_time'=>0])->with([ + $artTop = Article::field('id,title,cate_id,user_id,create_time')->where(['is_top'=>1,'status'=>1,'delete_time'=>0])->with([ 'cate' => function($query){ $query->where('delete_time',0)->field('id,catename'); }, @@ -30,7 +30,7 @@ class Index extends BaseController ])->withCount(['comments'])->order('create_time','desc')->limit(5)->withCache(30)->select(); //首页文章显示15条 - $artList = Article::field('id,title,cate_id,user_id')->with([ + $artList = Article::field('id,title,cate_id,user_id,create_time')->with([ 'cate' => function($query){ $query->where('delete_time',0)->field('id,catename'); }, diff --git a/app/index/controller/User.php b/app/index/controller/User.php index 403e289..d4a1c76 100644 --- a/app/index/controller/User.php +++ b/app/index/controller/User.php @@ -140,9 +140,9 @@ class User extends BaseController //用户 $u = Db::name('user')->field('name,nickname,city,sex,sign,user_img,point,create_time')->find($userID ?: Session::get('user_id')); //用户发贴 - $arts = Db::name('user')->alias('u')->join('article a','u.id = a.user_id')->field('u.id,a.id,a.title,a.pv,a.is_hot,a.create_time')->where('a.user_id',input('id') ?: Session::get('user_id'))->select(); + $arts = Db::name('user')->alias('u')->join('article a','u.id = a.user_id')->field('u.id,a.id,a.title,a.pv,a.is_hot,a.create_time,a.delete_time')->where('a.delete_time',0)->where('a.user_id',input('id') ?: Session::get('user_id'))->select(); //用户回答 - $reys = Db::name('comment')->alias('c')->join('article a','c.article_id = a.id')->field('a.id,a.title,c.content,c.create_time')->where('c.user_id',input('id') ?: Session::get('user_id'))->select(); + $reys = Db::name('comment')->alias('c')->join('article a','c.article_id = a.id')->field('a.id,a.title,c.content,c.create_time,c.delete_time')->where('a.delete_time',0)->where('c.user_id',input('id') ?: Session::get('user_id'))->select(); View::assign('u',$u); View::assign('arts',$arts); diff --git a/app/install/config/database.php b/app/install/config/database.php index de860c7..f7a8879 100644 --- a/app/install/config/database.php +++ b/app/install/config/database.php @@ -8,11 +8,11 @@ return [ // 服务器地址 'hostname' => '127.0.0.1', // 数据库名 - 'database' => '', + 'database' => 'taotest', // 用户名 - 'username' => '', + 'username' => 'root', // 密码 - 'password' => '', + 'password' => 'root', // 端口 'hostport' => '3306', // 数据库连接参数 diff --git a/app/install/controller/index.php b/app/install/controller/index.php deleted file mode 100644 index 11d51a4..0000000 --- a/app/install/controller/index.php +++ /dev/null @@ -1,207 +0,0 @@ -alert('已经成功安装了TaoLer社区系统,安装系统已锁定。如需重新安装,请删除根目录下的install.lock文件')"; - die(); - } - } - - //安装首页 - public function index() - { - Session::set('agre',true); - return View::fetch('agreement'); - } - - //test - public function test() - { - if(Session::pull('agre')){ - Session::set('cre',true); - return View::fetch('test'); - } else { - return 'error,请返回安装!'; - } - } - - //test - public function create(){ - if(Session::pull('cre')){ - Session::set('suc',true); - return View::fetch('create'); - } else { - return 'error,请返回安装!'; - } - } - - // 安装成功页面 - public function complete(){ - - if(Session::has('suc') != 'true'){ - return 'error,请返回安装!'; - } - - // 判断是否为post - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - - $data = $_POST; - //var_dump($data); - if (!preg_match("/^[a-zA-Z]{1}([0-9a-zA-Z]|[._]){4,19}$/", $data['admin_user'])) { - die(""); - } - - if (!preg_match("/^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,22}$/", $data['admin_pass'])) { - die(""); - } - if ($data['admin_pass'] != $data['admin_pass2']) { - die(""); - - } - $_SESSION['adminusername'] = $data['admin_user']; - // 生成管理员 - $username = $data['admin_user']; - $create_time = time(); - $salt = substr(md5($create_time),-6); - $pass = md5(substr_replace(md5($data['admin_pass']),$salt,0,6)); - - - if ($data['DB_TYPE'] == 'mysql') { - - //数据库 - $db_s = << [ - 'mysql' => [ - // 数据库类型 - 'type' => 'mysql', - // 服务器地址 - 'hostname' => '{$data['DB_HOST']}', - // 数据库名 - 'database' => '{$data['DB_NAME']}', - // 用户名 - 'username' => '{$data['DB_USER']}', - // 密码 - 'password' => '{$data['DB_PWD']}', - // 端口 - 'hostport' => '{$data['DB_PORT']}', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '{$data['DB_PREFIX']}', - ], - ], -]; -php; - // 创建数据库链接配置文件 - - $fp = fopen('../app/install/config/database.php', "r+b"); - fputs($fp, $db_s); - fclose($fp); - - - $db = Db::connect('mysql'); - //var_dump($db); - $sql = 'CREATE DATABASE IF NOT EXISTS '.$data['DB_NAME'].' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci'; - //$db->execute($sql); - - //创建数据表 - create_tables($db, $data['DB_PREFIX']); - - //管理员 - $table_admin = $data['DB_PREFIX'] . "admin"; - $table_user = $data['DB_PREFIX'] . "user"; - $sql_admin = "UPDATE $table_admin SET username = '{$username}', password = '{$pass}', status=1,create_time = '{$create_time}' WHERE id = 1"; - $sql_user = "UPDATE $table_user SET name = '{$username}', password = '{$pass}', status=1, auth=1, create_time = '{$create_time}' WHERE id = 1"; - $db->execute($sql_admin); - $db->execute($sql_user); - - Db::getConnection()->close(); - } - - $db_str = << [], - // 自动写入时间戳字段 - // true为自动识别类型 false关闭 - // 字符串则明确指定时间字段类型 支持 int timestamp datetime date - 'auto_timestamp' => true, - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', - // 数据库连接配置信息 - 'connections' => [ - 'mysql' => [ - // 数据库类型 - 'type' => 'mysql', - // 服务器地址 - 'hostname' => '{$data['DB_HOST']}', - // 数据库名 - 'database' => '{$data['DB_NAME']}', - // 用户名 - 'username' => '{$data['DB_USER']}', - // 密码 - 'password' => '{$data['DB_PWD']}', - // 端口 - 'hostport' => '{$data['DB_PORT']}', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '{$data['DB_PREFIX']}', - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 是否需要断线重连 - 'break_reconnect' => false, - // 监听SQL - 'trigger_sql' => true, - // 开启字段缓存 - 'fields_cache' => false, - // 字段缓存路径 - 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, - ], - ], -]; -php; - // 创建数据库链接配置文件 - - $fp = fopen('../config/database.php', "r+b"); - fwrite($fp, $db_str); - fclose($fp); - - file_put_contents('../install.lock', 'lock'); - Session::clear(); - return View::fetch('complete'); - } else { - return '安装失败'; - } - - } -} \ No newline at end of file diff --git a/config/cache.php b/config/cache.php index dd492df..7144990 100644 --- a/config/cache.php +++ b/config/cache.php @@ -19,7 +19,7 @@ return [ // 缓存前缀 'prefix' => '', // 缓存有效期 0表示永久缓存 - 'expire' => 0, + 'expire' => 600, // 缓存标签前缀 'tag_prefix' => 'tag:', // 序列化机制 例如 ['serialize', 'unserialize'] diff --git a/config/database-1.php b/config/database-1.php new file mode 100644 index 0000000..dcff575 --- /dev/null +++ b/config/database-1.php @@ -0,0 +1,63 @@ + Env::get('database.driver', 'mysql'), + + // 自定义时间查询规则 + 'time_query_rule' => [], + + // 自动写入时间戳字段 + // true为自动识别类型 false关闭 + // 字符串则明确指定时间字段类型 支持 int timestamp datetime date + 'auto_timestamp' => true, + + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + + // 数据库连接配置信息 + 'connections' => [ + 'mysql' => [ + // 数据库类型 + 'type' => Env::get('database.type', 'mysql'), + // 服务器地址 + 'hostname' => Env::get('database.hostname', '127.0.0.1'), + // 数据库名 + 'database' => Env::get('database.database', ''), + // 用户名 + 'username' => Env::get('database.username', 'root'), + // 密码 + 'password' => Env::get('database.password', ''), + // 端口 + 'hostport' => Env::get('database.hostport', '3306'), + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => Env::get('database.charset', 'utf8'), + // 数据库表前缀 + 'prefix' => Env::get('database.prefix', ''), + + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 是否需要断线重连 + 'break_reconnect' => false, + // 监听SQL + 'trigger_sql' => true, + // 开启字段缓存 + 'fields_cache' => false, + // 字段缓存路径 + 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR, + ], + + // 更多的数据库配置信息 + ], +]; \ No newline at end of file diff --git a/config/database.php b/config/database.php index bf6edb5..61ae363 100644 --- a/config/database.php +++ b/config/database.php @@ -16,11 +16,11 @@ return [ // 服务器地址 'hostname' => '127.0.0.1', // 数据库名 - 'database' => '', + 'database' => 'taotao', // 用户名 - 'username' => '', + 'username' => 'root', // 密码 - 'password' => '', + 'password' => 'root', // 端口 'hostport' => '3306', // 数据库连接参数 diff --git a/config/view.php b/config/view.php index fc8d018..01259a0 100644 --- a/config/view.php +++ b/config/view.php @@ -7,7 +7,7 @@ return [ // 模板引擎类型使用Think 'type' => 'Think', // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 2, + 'auto_rule' => 1, // 模板目录名 'view_dir_name' => 'view', // 模板后缀 diff --git a/public/static/admin/modules/useradmin.js b/public/static/admin/modules/useradmin.js index ae783c6..732a77a 100644 --- a/public/static/admin/modules/useradmin.js +++ b/public/static/admin/modules/useradmin.js @@ -16,7 +16,7 @@ layui.define(['table', 'form'], function(exports){ //用户管理 table.render({ elem: '#LAY-user-manage' - ,url: '/admin/user/list' //模拟接口 + ,url: '/admin/User/list' //模拟接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 100, title: 'ID', sort: true} @@ -50,7 +50,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/user/delete", + url:"/admin/User/delete", data:{id:data.id}, dataType:'json', success:function(data){ @@ -81,7 +81,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑用户' - ,content: '/admin/user/useredit?id='+ data.id + ,content: '/admin/User/userEdit?id='+ data.id ,maxmin: true ,area: ['500px', '450px'] ,btn: ['确定', '取消'] @@ -98,7 +98,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/user/useredit", + url:"/admin/User/userEdit", data:{"id":field.id,"name":field.username,"phone":field.phone,"email":field.email,"user_img":field.avatar,"sex":field.sex}, daType:"json", success:function (res){ @@ -136,7 +136,7 @@ layui.define(['table', 'form'], function(exports){ //管理员管理 table.render({ elem: '#LAY-user-back-manage' - ,url: '/admin/admin/adminList' //模拟接口 + ,url: '/admin/Admin/index' //模拟接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 80, title: 'ID', sort: true} @@ -166,7 +166,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/admin/delete", + url:"/admin/Admin/delete", data:{id:data.id}, dataType:'json', success:function(data){ @@ -197,7 +197,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑管理员' - ,content: '/admin/admin/adminedit?id='+ data.id + ,content: '/admin/Admin/edit?id='+ data.id ,area: ['420px', '420px'] ,btn: ['确定', '取消'] ,yes: function(index, layero){ @@ -212,7 +212,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/admin/adminedit", + url:"/admin/Admin/edit", data:{"id":field.id,"password":field.password,"mobile":field.mobile,"email":field.email,"auth_group_id":field.auth_group_id}, daType:"json", success:function (res){ @@ -251,7 +251,7 @@ layui.define(['table', 'form'], function(exports){ //角色管理 table.render({ elem: '#LAY-user-back-role' - ,url: '/admin/authgroup/list' //模拟接口 + ,url: '/admin/AuthGroup/list' //模拟接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 80, title: 'ID', sort: true} @@ -278,7 +278,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑角色' - ,content: '/admin/authgroup/roleedit?id='+ data.id + ,content: '/admin/AuthGroup/roleEdit?id='+ data.id ,area: ['500px', '480px'] ,btn: ['确定', '取消'] ,yes: function(index, layero){ @@ -310,7 +310,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/authgroup/roleedit", + url:"/admin/AuthGroup/roleEdit", data:{"id":field.id,"rules":rules,"title":field.title,"descr":field.descr}, daType:"json", success:function (res){ @@ -347,7 +347,7 @@ layui.define(['table', 'form'], function(exports){ //权限管理 table.render({ elem: '#LAY-user-auth-rule' - ,url: '/admin/authrule/index' //权限接口 + ,url: '/admin/AuthRule/index' //权限接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 50, title: 'ID'} @@ -377,7 +377,7 @@ layui.define(['table', 'form'], function(exports){ //console.log(data.id); $.ajax({ type:'post', - url:"/admin/authrule/delete", + url:"/admin/AuthRule/delete", data:{id:data.id}, dataType:'json', success:function(data){ @@ -407,7 +407,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑权限' - ,content: '/admin/authrule/edit?id='+ data.id + ,content: '/admin/AuthRule/edit?id='+ data.id ,area: ['420px', '420px'] ,btn: ['确定', '取消'] ,yes: function(index, layero){ @@ -428,7 +428,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/authrule/edit", + url:"/admin/AuthRule/edit", data:{"id":field.id,"pid":field.pid,"title":field.title,"name":field.name,"icon":field.icon,"sort":field.sort,"ishidden":field.ishidden}, daType:"json", success:function (res){ diff --git a/public/static/res/mods/jie.js b/public/static/res/mods/jie.js index 9c8b44e..2cb8584 100644 --- a/public/static/res/mods/jie.js +++ b/public/static/res/mods/jie.js @@ -79,7 +79,7 @@ layui.define('fly', function(exports){ layer.close(index); $.ajax({ type:'get', - url:"/index/article/delete/", + url:"/index/article/delete", data:{id: div.data('id')}, dataType:'json', success:function(data){ @@ -88,7 +88,7 @@ layui.define('fly', function(exports){ icon:6, time:2000 },function(){ - location.href = '/index/index/index/'; + location.href = '/'; }); } else { layer.open({ @@ -155,7 +155,7 @@ layui.define('fly', function(exports){ gather.jiedaActive = { zan: function(li){ //赞 var othis = $(this), ok = othis.hasClass('zanok'); - fly.json('/index/comment/jiedaZan/', { + fly.json('/index/comment/jiedaZan', { ok: ok ,id: li.data('id') }, function(res){ @@ -179,7 +179,7 @@ layui.define('fly', function(exports){ var othis = $(this); layer.confirm('是否采纳该回答为最佳答案?', function(index){ layer.close(index); - fly.json('/index/comment/jiedaCai/', { + fly.json('/index/comment/jiedaCai', { id: li.data('id') }, function(res){ if(res.status === 0){ @@ -194,7 +194,7 @@ layui.define('fly', function(exports){ }); } ,edit: function(li){ //编辑 - fly.json('/index/comment/getDa/', { + fly.json('/index/comment/getDa', { id: li.data('id') }, function(res){ var data = res.rows; diff --git a/route/index/route.php b/route/index/route.php index 77f8752..ef57f67 100644 --- a/route/index/route.php +++ b/route/index/route.php @@ -14,8 +14,8 @@ Route::group(function () { Route::get('jie/:id', 'article/detail'); Route::get('column///','article/cate'); Route::rule('add','article/add'); - Route::rule('del/:id','article/delete'); Route::rule('edit/[:id]','article/edit'); + //Route::rule('del/:id','article/delete'); }); Route::group(function () { Route::rule('u/:id', 'user/home'); diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 839d3cf..49eca96 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -728,12 +728,12 @@ "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "dbdf7e45e6c9a598017e15d3116c1cf96a87c0ae" + "reference": "d4f1ba2b77a88fd55f392b73a7a183844cdc081b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/dbdf7e45e6c9a598017e15d3116c1cf96a87c0ae", - "reference": "dbdf7e45e6c9a598017e15d3116c1cf96a87c0ae", + "url": "https://api.github.com/repos/top-think/framework/zipball/d4f1ba2b77a88fd55f392b73a7a183844cdc081b", + "reference": "d4f1ba2b77a88fd55f392b73a7a183844cdc081b", "shasum": "", "mirrors": [ { @@ -760,7 +760,7 @@ "mockery/mockery": "^1.2", "phpunit/phpunit": "^7.0" }, - "time": "2019-12-28T14:12:22+00:00", + "time": "2020-01-07T08:17:04+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/services.php b/vendor/services.php index 8a1da29..0f38ca8 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\captcha\\CaptchaService', diff --git a/vendor/topthink/framework/src/think/Request.php b/vendor/topthink/framework/src/think/Request.php index 5f8a481..0053c0b 100644 --- a/vendor/topthink/framework/src/think/Request.php +++ b/vendor/topthink/framework/src/think/Request.php @@ -327,12 +327,14 @@ class Request } $request->header = array_change_key_case($header); + $request->server = $_SERVER; + $request->env = $app->env; + + $inputData = $request->getInputData($request->input); - $request->server = $_SERVER; - $request->env = $app->env; $request->get = $_GET; - $request->post = $_POST ?: $request->getInputData($request->input); - $request->put = $request->getInputData($request->input); + $request->post = $_POST ?: $inputData; + $request->put = $inputData; $request->request = $_REQUEST; $request->cookie = $_COOKIE; $request->file = $_FILES ?? []; @@ -982,11 +984,12 @@ class Request protected function getInputData($content): array { - if (false !== strpos($this->contentType(), 'json')) { - return (array) json_decode($content, true); - } elseif (strpos($content, '=')) { + $contentType = $this->contentType(); + if ($contentType == 'application/x-www-form-urlencoded') { parse_str($content, $data); return $data; + } elseif (false !== strpos($contentType, 'json')) { + return (array) json_decode($content, true); } return []; @@ -2051,15 +2054,18 @@ class Request /** * 设置php://input数据 * @access public - * @param string $input RAW数据 + * @param string $input RAW数据 * @return $this */ public function withInput(string $input) { $this->input = $input; if (!empty($input)) { - $this->post = $this->getInputData($input); - $this->put = $this->getInputData($input); + $inputData = $this->getInputData($input); + if (!empty($inputData)) { + $this->post = $inputData; + $this->put = $inputData; + } } return $this; } diff --git a/view/admin/admin/add.html b/view/admin/admin/add.html new file mode 100644 index 0000000..f773449 --- /dev/null +++ b/view/admin/admin/add.html @@ -0,0 +1,57 @@ + +{extend name="public:base" /} + +{block name="body"} + + + + 登录名 + + + + + + 手机 + + + + + + 邮箱 + + + + + + 角色 + + + {volist name="auth_group" id="vo"} + {$vo.title} + {/volist} + + + + 审核状态 + + + + + + + + + +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/view/admin/admin/edit.html b/view/admin/admin/edit.html new file mode 100644 index 0000000..1a42838 --- /dev/null +++ b/view/admin/admin/edit.html @@ -0,0 +1,61 @@ + +{extend name="public:base" /} + +{block name="body"} + + + + + + + 登录名 + + + + + + 密码 + + + + + + 手机 + + + + + + 邮箱 + + + + + + 角色 + + + {volist name="auth_group" id="vo"} + {$vo.title} + {/volist} + + + + + + + + +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/view/admin/admin/index.html b/view/admin/admin/index.html new file mode 100644 index 0000000..03c261c --- /dev/null +++ b/view/admin/admin/index.html @@ -0,0 +1,226 @@ +{extend name="public:base" /} + +{block name="body"} + + + + + + 登录名 + + + + + + 手机 + + + + + + 邮箱 + + + + + + 角色 + + + 管理员 + 超级管理员 + 纠错员 + 采购员 + 推销员 + 运营人员 + 编辑 + + + + + + + + + + + + + + 删除 + 添加 + + + + + + + + + + +{/block} +{block name="js"} + +{/block} diff --git a/view/admin/auth_group/edit-1.html b/view/admin/auth_group/edit-1.html new file mode 100644 index 0000000..0c3d30e --- /dev/null +++ b/view/admin/auth_group/edit-1.html @@ -0,0 +1,119 @@ + + + + + + + + + 权限范围 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//获取选中的checkbox的值 +var mId = ""; +var e =iframeWindow.$(":checkbox"); +e.each(function () { + if($(this).next().hasClass("layui-form-checked")){ + mId+=$(this).val()+","; + }; +}) +mId = mId.substring(0,mId.length-1); + diff --git a/view/admin/auth_group/role.html b/view/admin/auth_group/role.html new file mode 100644 index 0000000..97d9df7 --- /dev/null +++ b/view/admin/auth_group/role.html @@ -0,0 +1,164 @@ +{extend name="public/base" /} + +{block name="body"} + + + + + + + 角色筛选 + + + + 全部角色 + 管理员 + 超级管理员 + 纠错员 + 采购员 + 推销员 + 运营人员 + 编辑 + + + + + + + 删除 + 添加 + + + + + + + + + +{/block} +{block name="js"} + +{/block} + diff --git a/view/admin/auth_group/roleadd.html b/view/admin/auth_group/roleadd.html new file mode 100644 index 0000000..2f2ddad --- /dev/null +++ b/view/admin/auth_group/roleadd.html @@ -0,0 +1,101 @@ +{extend name="public/base" /} + +{block name="body"} + + + + 角色 + + + + + + + 权限范围 + {volist name="menus" id="vo1"} + + + + + + {if condition="isset($vo1['children'])"} + {volist name="vo1['children']" id="vo2"} + {if condition="isset($vo2['children'])"} + + {volist name="vo2['children']" id="vo3"} + + {/volist} + {else /} + + {/if} + {/volist} + {/if} + + + + {/volist} + + + + 具体描述 + + + + + + 提交 + + + +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/view/admin/auth_group/roleedit.html b/view/admin/auth_group/roleedit.html new file mode 100644 index 0000000..a6d34b4 --- /dev/null +++ b/view/admin/auth_group/roleedit.html @@ -0,0 +1,129 @@ +{extend name="public/base" /} + +{block name="body"} + + + + + + + + 角色 + + + {volist name="authGroup" id="vo"} + {$vo.title} + {/volist} + + + + + + 权限范围 + {volist name="menus" id="vo1"} + + + + + + {if condition="isset($vo1['children'])"} + {volist name="vo1['children']" id="vo2"} + {if condition="isset($vo2['children'])"} + + {volist name="vo2['children']" id="vo3"} + + {/volist} + {else /} + + {/if} + {/volist} + {/if} + + + + {/volist} + + + + + 具体描述 + + {$auth.descr} + + + + 提交 + + + +{/block} +{block name="js"} + + + + + +{/block} \ No newline at end of file diff --git a/view/admin/auth_rule/add.html b/view/admin/auth_rule/add.html new file mode 100644 index 0000000..0ce8454 --- /dev/null +++ b/view/admin/auth_rule/add.html @@ -0,0 +1,65 @@ + +{extend name="public:base" /} + +{block name="body"} + + + + 上级菜单 + + + 顶级菜单 + {volist name="AuthRule" id="vo"} + {$vo.title} + {/volist} + + + + + 权限名 + + + + + + 权限地址 + + + + + + 图标 + + + + + + 排序 + + + + + + 显示 + + + + + + + + + +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/view/admin/auth_rule/edit.html b/view/admin/auth_rule/edit.html new file mode 100644 index 0000000..a34a71a --- /dev/null +++ b/view/admin/auth_rule/edit.html @@ -0,0 +1,68 @@ + +{extend name="public:base" /} + +{block name="body"} + + + + + + + 上级菜单 + + + 顶级菜单 + {volist name="AuthRule" id="vo"} + {$vo.title} + {/volist} + + + + + 权限名 + + + + + + 权限地址 + + + + + + 图标 + + + + + + 排序 + + + + + + 显示 + + + + + + + + + +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/view/admin/auth_rule/index.html b/view/admin/auth_rule/index.html new file mode 100644 index 0000000..150d163 --- /dev/null +++ b/view/admin/auth_rule/index.html @@ -0,0 +1,310 @@ +{extend name="public:base" /} + +{block name="body"} + + + + + + 登录名 + + + + + + 手机 + + + + + + 邮箱 + + + + + + 角色 + + + 管理员 + 超级管理员 + 纠错员 + 采购员 + 推销员 + 运营人员 + 编辑 + + + + + + + + + + + + + + 删除 + 添加 + + + + + + + + + + + + + + + + +{/block} +{block name="js"} + + +{/block} diff --git a/view/admin/key_auth/add.html b/view/admin/key_auth/add.html new file mode 100644 index 0000000..884e0c4 --- /dev/null +++ b/view/admin/key_auth/add.html @@ -0,0 +1,67 @@ +{extend name="public/base" /} + +{block name="body"} + + + + 授权等级 + + + 普通 + 初级 + 中级 + 高级 + + + + + 用户 + + + + + + 域名 + + + + + + 到期时间 + + + + + + 状态 + + + + + + + + + + +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/view/admin/key_auth/edit.html b/view/admin/key_auth/edit.html new file mode 100644 index 0000000..f69219d --- /dev/null +++ b/view/admin/key_auth/edit.html @@ -0,0 +1,73 @@ +{extend name="public/base" /} + +{block name="body"} + + + + + 授权等级 + + + 普通 + 初级 + 中级 + 高级 + + + + + + 用户 + + + + + + 域名 + + + + + + + 到期时间 + + + + + + + 状态 + + + + + + + + + + +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/view/admin/key_auth/index.html b/view/admin/key_auth/index.html new file mode 100644 index 0000000..1cda2f8 --- /dev/null +++ b/view/admin/key_auth/index.html @@ -0,0 +1,214 @@ +{extend name="public/base" /} + +{block name="body"} + + + + + 版本发布 + + + + + + 添加 + + + + + ID + 用户 + 域名 + Key + 等级 + 状态 + 申请时间 + 到期时间 + 操作 + + + + {volist name="keys" id="vo"} + + {$vo.id} + {$vo.user} + {$vo.domain} + {$vo.key} + {$vo.auth_level} + {$vo.status?'正常':'禁用'} + {$vo.create_time|date='Y-m-d'} + {$vo.end_time|date='Y-m-d'} + + + 编辑 + 删除 + + + {/volist} + + + + + + + + + + + + + + + +{/block} +{block name="js"} + + + +{/block} \ No newline at end of file diff --git a/view/admin/public/base.html b/view/admin/public/base.html index bd86236..41999c1 100644 --- a/view/admin/public/base.html +++ b/view/admin/public/base.html @@ -12,7 +12,7 @@ {block name="body"}内容{/block} - + {block name="js"}js文件{/block} diff --git a/view/admin/upgrade/index.html b/view/admin/upgrade/index.html index 2921aef..cbb2bf6 100644 --- a/view/admin/upgrade/index.html +++ b/view/admin/upgrade/index.html @@ -78,8 +78,7 @@ var $ = layui.jquery ,layer = layui.layer ,form = layui.form - ,upload = layui.upload; - var layerload = layer.load(); + ,upload = layui.upload; //手动更新,选完文件后不自动上传 upload.render({ @@ -91,9 +90,12 @@ ,exts: 'zip|rar|7z' ,size: 10000 //,multiple: true - ,bindAction: '#upgrade-sys-button' + ,bindAction: '#upgrade-sys-button' + ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。 + layer.load(); //上传loading + } ,done: function(res){ - //layer.close(layerload); //关闭loading + layer.close(layerload); //关闭loading if(res.code == 1){ layer.msg(res.msg,{ icon:6, diff --git a/view/index/public/user-nav.html b/view/index/public/user-nav.html index cbc3804..eaca2ce 100644 --- a/view/index/public/user-nav.html +++ b/view/index/public/user-nav.html @@ -16,6 +16,12 @@ 我的帖子 + + + + + 我的授权 + - + +