diff --git a/README.md b/README.md index 19ec754176d22120ee1d3614dcf35943cdc90da8..82323fdfe3dd963dcd9d989677a54f249665e84f 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ composer create-project apiadmin/apiadmin4 > 第二步:检测环境以及配置数据库 ``` -php think apiadmin:install --db mysql://root:123456@127.0.0.1:3306/apiadmin#utf8 +php think apiadmin:install --db mysql://root:123456@127.0.0.1:3306/apiadmin#utf8mb4 ``` > 第三步:数据库迁移 diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index f96529224614f97da852b49a98efaafc42cb2819..95598b3f6790b596646e7b5e28184f2f04ef01c3 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -2,13 +2,9 @@ namespace app\admin\controller; - use app\util\ReturnCode; class Index extends Base { - public function index() { - return json(['welcome']); - } public function upload() { $path = '/upload/' . date('Ymd', time()) . '/'; @@ -18,19 +14,19 @@ class Index extends Base { //过滤错误 if ($error) { switch ($error) { - case 1 : + case 1: $error_message = '您上传的文件超过了PHP.INI配置文件中UPLOAD_MAX-FILESIZE的大小'; break; - case 2 : + case 2: $error_message = '您上传的文件超过了PHP.INI配置文件中的post_max_size的大小'; break; - case 3 : + case 3: $error_message = '文件只被部分上传'; break; - case 4 : + case 4: $error_message = '文件不能为空'; break; - default : + default: $error_message = '未知错误'; } die($error_message); diff --git a/database/migrations/20190425073802_admin_app.php b/database/migrations/20190425073802_admin_app.php index 91d8253d06bd376b7bbe2b04c50df48fbf50af4b..3d56af753bf4f47f34358cb8603cd0d9f7f15344 100644 --- a/database/migrations/20190425073802_admin_app.php +++ b/database/migrations/20190425073802_admin_app.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminApp extends Migrator { + /** * Change Method. * @@ -43,7 +44,7 @@ class AdminApp extends Migrator { */ public function change() { $table = $this->table('admin_app', [ - 'comment' => 'appId和appSecret表' + 'comment' => 'appId和appSecret表', ])->setCollation('utf8mb4_general_ci'); $table->addColumn('app_id', 'string', [ 'limit' => 50, diff --git a/database/migrations/20190425094427_admin_app_group.php b/database/migrations/20190425094427_admin_app_group.php index c5e1dcc1f1594206f21abf02ab533ef34602eff0..84c618bd5d882b8cabeb6717edb6f9442c5565c4 100644 --- a/database/migrations/20190425094427_admin_app_group.php +++ b/database/migrations/20190425094427_admin_app_group.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminAppGroup extends Migrator { + /** * Change Method. * @@ -35,7 +36,6 @@ class AdminAppGroup extends Migrator { * PRIMARY KEY (`id`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用组,目前只做管理使用,没有实际权限控制'; */ - public function change() { $table = $this->table('admin_app_group', [ 'comment' => '应用组,目前只做管理使用,没有实际权限控制' diff --git a/database/migrations/20190508070533_admin_auth_group.php b/database/migrations/20190508070533_admin_auth_group.php index dde6e81fcdf39798c2767ba234b2fa6bacab5aae..c0d9d4a5f867cf255a219a32f6aa6a83d61cf9da 100644 --- a/database/migrations/20190508070533_admin_auth_group.php +++ b/database/migrations/20190508070533_admin_auth_group.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminAuthGroup extends Migrator { + /** * Change Method. * @@ -34,7 +35,6 @@ class AdminAuthGroup extends Migrator { * PRIMARY KEY (`id`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限组'; */ - public function change() { $table = $this->table('admin_auth_group', [ 'comment' => '权限组' diff --git a/database/migrations/20190508100337_admin_auth_group_access.php b/database/migrations/20190508100337_admin_auth_group_access.php index 77923387cc45813f2a273cb6a5e376807aa474fd..f9eb42f557fe7511227dcd208460f0ef63df0c6a 100644 --- a/database/migrations/20190508100337_admin_auth_group_access.php +++ b/database/migrations/20190508100337_admin_auth_group_access.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminAuthGroupAccess extends Migrator { + /** * Change Method. * @@ -35,7 +36,6 @@ class AdminAuthGroupAccess extends Migrator { * KEY `groupId` (`groupId`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和组的对应关系'; */ - public function change() { $table = $this->table('admin_auth_group_access', [ 'comment' => '用户和组的对应关系' diff --git a/database/migrations/20190508101122_admin_auth_rule.php b/database/migrations/20190508101122_admin_auth_rule.php index 9280fdafb7dff598c96f56b067faa2cafa4ce630..91efbe9cb39ec2faedf8f86406142eef01687bdf 100644 --- a/database/migrations/20190508101122_admin_auth_rule.php +++ b/database/migrations/20190508101122_admin_auth_rule.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminAuthRule extends Migrator { + /** * Change Method. * @@ -35,7 +36,6 @@ class AdminAuthRule extends Migrator { * PRIMARY KEY (`id`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限细节'; */ - public function change() { $table = $this->table('admin_auth_rule', [ 'comment' => '权限细节' diff --git a/database/migrations/20190508152801_admin_fields.php b/database/migrations/20190508152801_admin_fields.php index af5cd6102a09beb1f7ad20d67d2bcfd4143d6a50..49de1743611912b19eec9fadd789421a32cc9530 100644 --- a/database/migrations/20190508152801_admin_fields.php +++ b/database/migrations/20190508152801_admin_fields.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminFields extends Migrator { + /** * Change Method. * @@ -41,7 +42,6 @@ class AdminFields extends Migrator { * KEY `hash` (`hash`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用于保存各个API的字段规则'; */ - public function change() { $table = $this->table('admin_fields', [ 'comment' => '用于保存各个API的字段规则' diff --git a/database/migrations/20190508153800_admin_group.php b/database/migrations/20190508153800_admin_group.php index 6dd61bfd4253bd594cff1ecd572e5067607760c3..68edb471d2a3ac247928d3e0725441069db2a663 100644 --- a/database/migrations/20190508153800_admin_group.php +++ b/database/migrations/20190508153800_admin_group.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminGroup extends Migrator { + /** * Change Method. * @@ -39,7 +40,6 @@ class AdminGroup extends Migrator { * PRIMARY KEY (`id`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='接口组管理'; */ - public function change() { $table = $this->table('admin_group', [ 'comment' => '接口组管理' diff --git a/database/migrations/20190513065521_admin_list.php b/database/migrations/20190513065521_admin_list.php index 2b48480659d9318daf3a56286ce1fcb4c04e1902..321efade333a5af95cff245860fdbf7c99137f6f 100644 --- a/database/migrations/20190513065521_admin_list.php +++ b/database/migrations/20190513065521_admin_list.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminList extends Migrator { + /** * Change Method. * @@ -42,7 +43,6 @@ class AdminList extends Migrator { * KEY `hash` (`hash`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用于维护接口信息'; */ - public function change() { $table = $this->table('admin_list', [ 'comment' => '用于维护接口信息' @@ -87,6 +87,5 @@ class AdminList extends Migrator { 'default' => 'default', 'comment' => '当前接口所属的接口分组' ])->addIndex(['hash'])->create(); - } } diff --git a/database/migrations/20190513070628_admin_menu.php b/database/migrations/20190513070628_admin_menu.php index a15d1edba8fb2c69e52f3d289e730e490ceafd71..6a40e6f9b966375f8b7b425f25141d0c23428bbd 100644 --- a/database/migrations/20190513070628_admin_menu.php +++ b/database/migrations/20190513070628_admin_menu.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminMenu extends Migrator { + /** * Change Method. * @@ -39,7 +40,6 @@ class AdminMenu extends Migrator { * PRIMARY KEY (`id`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='目录信息'; */ - public function change() { $table = $this->table('admin_menu', [ 'comment' => '目录信息' diff --git a/database/migrations/20190513081034_admin_user.php b/database/migrations/20190513081034_admin_user.php index 3cc651bc8189f74fe3e7bf25f6ab6fa51b83ac3e..d346b58ccfa356f0aae2583020d18fdbf231bdd6 100644 --- a/database/migrations/20190513081034_admin_user.php +++ b/database/migrations/20190513081034_admin_user.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminUser extends Migrator { + /** * Change Method. * @@ -40,7 +41,6 @@ class AdminUser extends Migrator { * KEY `create_time` (`create_time`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员认证信息'; */ - public function change() { $table = $this->table('admin_user', [ 'comment' => '管理员认证信息' diff --git a/database/migrations/20190513082503_admin_user_action.php b/database/migrations/20190513082503_admin_user_action.php index e478a49e50f66a044296c41ad8e6d5811f548e85..faefe2469a9cf37051a4ab286be942e9900406af 100644 --- a/database/migrations/20190513082503_admin_user_action.php +++ b/database/migrations/20190513082503_admin_user_action.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class AdminUserAction extends Migrator { + /** * Change Method. * @@ -38,7 +39,6 @@ class AdminUserAction extends Migrator { * KEY `uid` (`uid`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户操作日志'; */ - public function change() { $table = $this->table('admin_user_action', [ 'comment' => '用户操作日志' diff --git a/database/migrations/20190513085755_admin_user_data.php b/database/migrations/20190513085755_admin_user_data.php index 772294d93ac5c9b006f741a06082bc598eae1b09..ee8395043797ee05219af1965e631b324b61c89b 100644 --- a/database/migrations/20190513085755_admin_user_data.php +++ b/database/migrations/20190513085755_admin_user_data.php @@ -1,10 +1,9 @@ table('admin_user_data', [ 'comment' => '管理员数据表' diff --git a/database/migrations/20190513155519_ini_admin_menu.php b/database/migrations/20190513155519_ini_admin_menu.php index 6bad843176a81aa6f9d0e9070ddcae701bfa1906..bc838d6633e3d06a41815f7e13af720a0d298689 100644 --- a/database/migrations/20190513155519_ini_admin_menu.php +++ b/database/migrations/20190513155519_ini_admin_menu.php @@ -3,6 +3,7 @@ use think\migration\Migrator; class IniAdminMenu extends Migrator { + /** * 初始化数据 * @author zhaoxiang diff --git a/database/migrations/20190514034923_ini_admin_group.php b/database/migrations/20190514034923_ini_admin_group.php index dcaba812fb9da0579ddd62e3b817e0e882ac6f62..9f9bd5de7239e2c82055cd2a69dfc995a90ae6fc 100644 --- a/database/migrations/20190514034923_ini_admin_group.php +++ b/database/migrations/20190514034923_ini_admin_group.php @@ -1,9 +1,9 @@ '默认分组', @@ -40,7 +39,7 @@ class IniAdminGroup extends Migrator { 'create_time' => time(), 'update_time' => time(), 'image' => '', - 'hot' => 0, + 'hot' => 0 ]; $this->table('admin_group')->insert($data)->saveData(); diff --git a/database/migrations/20190515031308_ini_admin_user.php b/database/migrations/20190515031308_ini_admin_user.php index dd382f9ed6ee9c62b6af7197ff2e97431668b8fd..6e525b63f7f03d897ff59d8ce4a8703a740602e5 100644 --- a/database/migrations/20190515031308_ini_admin_user.php +++ b/database/migrations/20190515031308_ini_admin_user.php @@ -6,6 +6,7 @@ use \app\util\Strs; use \app\util\Tools; class IniAdminUser extends Migrator { + /** * Change Method. * @@ -27,7 +28,6 @@ class IniAdminUser extends Migrator { * Remember to call "create()" or "update()" and NOT "save()" when working * with the Table class. */ - public function up() { $pass = Strs::randString(8); $data = [