modified 统一代码规范

This commit is contained in:
何秀钢 2019-10-24 11:45:31 +08:00
parent 1134aedf45
commit be6f7ede0d
16 changed files with 23 additions and 26 deletions

View File

@ -2,7 +2,6 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\util\ReturnCode; use app\util\ReturnCode;
class Index extends Base { class Index extends Base {
@ -18,19 +17,19 @@ class Index extends Base {
//过滤错误 //过滤错误
if ($error) { if ($error) {
switch ($error) { switch ($error) {
case 1 : case 1:
$error_message = '您上传的文件超过了PHP.INI配置文件中UPLOAD_MAX-FILESIZE的大小'; $error_message = '您上传的文件超过了PHP.INI配置文件中UPLOAD_MAX-FILESIZE的大小';
break; break;
case 2 : case 2:
$error_message = '您上传的文件超过了PHP.INI配置文件中的post_max_size的大小'; $error_message = '您上传的文件超过了PHP.INI配置文件中的post_max_size的大小';
break; break;
case 3 : case 3:
$error_message = '文件只被部分上传'; $error_message = '文件只被部分上传';
break; break;
case 4 : case 4:
$error_message = '文件不能为空'; $error_message = '文件不能为空';
break; break;
default : default:
$error_message = '未知错误'; $error_message = '未知错误';
} }
die($error_message); die($error_message);

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminApp extends Migrator { class AdminApp extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -43,7 +44,7 @@ class AdminApp extends Migrator {
*/ */
public function change() { public function change() {
$table = $this->table('admin_app', [ $table = $this->table('admin_app', [
'comment' => 'appId和appSecret表' 'comment' => 'appId和appSecret表',
])->setCollation('utf8mb4_general_ci'); ])->setCollation('utf8mb4_general_ci');
$table->addColumn('app_id', 'string', [ $table->addColumn('app_id', 'string', [
'limit' => 50, 'limit' => 50,

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminAppGroup extends Migrator { class AdminAppGroup extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -35,7 +36,6 @@ class AdminAppGroup extends Migrator {
* PRIMARY KEY (`id`) * PRIMARY KEY (`id`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用组,目前只做管理使用,没有实际权限控制'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用组,目前只做管理使用,没有实际权限控制';
*/ */
public function change() { public function change() {
$table = $this->table('admin_app_group', [ $table = $this->table('admin_app_group', [
'comment' => '应用组,目前只做管理使用,没有实际权限控制' 'comment' => '应用组,目前只做管理使用,没有实际权限控制'

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminAuthGroup extends Migrator { class AdminAuthGroup extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -34,7 +35,6 @@ class AdminAuthGroup extends Migrator {
* PRIMARY KEY (`id`) * PRIMARY KEY (`id`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限组'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限组';
*/ */
public function change() { public function change() {
$table = $this->table('admin_auth_group', [ $table = $this->table('admin_auth_group', [
'comment' => '权限组' 'comment' => '权限组'

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminAuthGroupAccess extends Migrator { class AdminAuthGroupAccess extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -35,7 +36,6 @@ class AdminAuthGroupAccess extends Migrator {
* KEY `groupId` (`groupId`) * KEY `groupId` (`groupId`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和组的对应关系'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和组的对应关系';
*/ */
public function change() { public function change() {
$table = $this->table('admin_auth_group_access', [ $table = $this->table('admin_auth_group_access', [
'comment' => '用户和组的对应关系' 'comment' => '用户和组的对应关系'

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminAuthRule extends Migrator { class AdminAuthRule extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -35,7 +36,6 @@ class AdminAuthRule extends Migrator {
* PRIMARY KEY (`id`) * PRIMARY KEY (`id`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限细节'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限细节';
*/ */
public function change() { public function change() {
$table = $this->table('admin_auth_rule', [ $table = $this->table('admin_auth_rule', [
'comment' => '权限细节' 'comment' => '权限细节'

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminFields extends Migrator { class AdminFields extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -41,7 +42,6 @@ class AdminFields extends Migrator {
* KEY `hash` (`hash`) * KEY `hash` (`hash`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用于保存各个API的字段规则'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用于保存各个API的字段规则';
*/ */
public function change() { public function change() {
$table = $this->table('admin_fields', [ $table = $this->table('admin_fields', [
'comment' => '用于保存各个API的字段规则' 'comment' => '用于保存各个API的字段规则'

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminGroup extends Migrator { class AdminGroup extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -39,7 +40,6 @@ class AdminGroup extends Migrator {
* PRIMARY KEY (`id`) * PRIMARY KEY (`id`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='接口组管理'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='接口组管理';
*/ */
public function change() { public function change() {
$table = $this->table('admin_group', [ $table = $this->table('admin_group', [
'comment' => '接口组管理' 'comment' => '接口组管理'

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminList extends Migrator { class AdminList extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -42,7 +43,6 @@ class AdminList extends Migrator {
* KEY `hash` (`hash`) * KEY `hash` (`hash`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用于维护接口信息'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用于维护接口信息';
*/ */
public function change() { public function change() {
$table = $this->table('admin_list', [ $table = $this->table('admin_list', [
'comment' => '用于维护接口信息' 'comment' => '用于维护接口信息'
@ -87,6 +87,5 @@ class AdminList extends Migrator {
'default' => 'default', 'default' => 'default',
'comment' => '当前接口所属的接口分组' 'comment' => '当前接口所属的接口分组'
])->addIndex(['hash'])->create(); ])->addIndex(['hash'])->create();
} }
} }

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminMenu extends Migrator { class AdminMenu extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -39,7 +40,6 @@ class AdminMenu extends Migrator {
* PRIMARY KEY (`id`) * PRIMARY KEY (`id`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='目录信息'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='目录信息';
*/ */
public function change() { public function change() {
$table = $this->table('admin_menu', [ $table = $this->table('admin_menu', [
'comment' => '目录信息' 'comment' => '目录信息'

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminUser extends Migrator { class AdminUser extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -40,7 +41,6 @@ class AdminUser extends Migrator {
* KEY `create_time` (`create_time`) * KEY `create_time` (`create_time`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员认证信息'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员认证信息';
*/ */
public function change() { public function change() {
$table = $this->table('admin_user', [ $table = $this->table('admin_user', [
'comment' => '管理员认证信息' 'comment' => '管理员认证信息'

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class AdminUserAction extends Migrator { class AdminUserAction extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -38,7 +39,6 @@ class AdminUserAction extends Migrator {
* KEY `uid` (`uid`) * KEY `uid` (`uid`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户操作日志'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户操作日志';
*/ */
public function change() { public function change() {
$table = $this->table('admin_user_action', [ $table = $this->table('admin_user_action', [
'comment' => '用户操作日志' 'comment' => '用户操作日志'

View File

@ -1,10 +1,9 @@
<?php <?php
use think\migration\Migrator; use think\migration\Migrator;
use think\migration\db\Column;
class AdminUserData extends Migrator class AdminUserData extends Migrator {
{
/** /**
* Change Method. * Change Method.
* *
@ -39,7 +38,6 @@ class AdminUserData extends Migrator
* KEY `uid` (`uid`) * KEY `uid` (`uid`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员数据表'; * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员数据表';
*/ */
public function change() { public function change() {
$table = $this->table('admin_user_data', [ $table = $this->table('admin_user_data', [
'comment' => '管理员数据表' 'comment' => '管理员数据表'

View File

@ -3,6 +3,7 @@
use think\migration\Migrator; use think\migration\Migrator;
class IniAdminMenu extends Migrator { class IniAdminMenu extends Migrator {
/** /**
* 初始化数据 * 初始化数据
* @author zhaoxiang <zhaoxiang051405@gmail.com> * @author zhaoxiang <zhaoxiang051405@gmail.com>

View File

@ -1,9 +1,9 @@
<?php <?php
use think\migration\Migrator; use think\migration\Migrator;
use think\migration\db\Column;
class IniAdminGroup extends Migrator { class IniAdminGroup extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -30,7 +30,6 @@ class IniAdminGroup extends Migrator {
* VALUES * VALUES
* (1, '默认分组', '默认分组', 1, 'default', 0, 0, '', 0); * (1, '默认分组', '默认分组', 1, 'default', 0, 0, '', 0);
*/ */
public function up() { public function up() {
$data = [ $data = [
'name' => '默认分组', 'name' => '默认分组',
@ -40,7 +39,7 @@ class IniAdminGroup extends Migrator {
'create_time' => time(), 'create_time' => time(),
'update_time' => time(), 'update_time' => time(),
'image' => '', 'image' => '',
'hot' => 0, 'hot' => 0
]; ];
$this->table('admin_group')->insert($data)->saveData(); $this->table('admin_group')->insert($data)->saveData();

View File

@ -6,6 +6,7 @@ use \app\util\Strs;
use \app\util\Tools; use \app\util\Tools;
class IniAdminUser extends Migrator { class IniAdminUser extends Migrator {
/** /**
* Change Method. * Change Method.
* *
@ -27,7 +28,6 @@ class IniAdminUser extends Migrator {
* Remember to call "create()" or "update()" and NOT "save()" when working * Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class. * with the Table class.
*/ */
public function up() { public function up() {
$pass = Strs::randString(8); $pass = Strs::randString(8);
$data = [ $data = [