diff --git a/application/admin/command/Addon.php b/application/admin/command/Addon.php index 3b1f6fb1..fc242ce6 100644 --- a/application/admin/command/Addon.php +++ b/application/admin/command/Addon.php @@ -120,7 +120,7 @@ class Addon extends Command $output->warning($v); } $output->info("Are you sure you want to " . ($action == 'enable' ? 'override' : 'delete') . " all those files? Type 'yes' to continue: "); - $line = fgets(STDIN); + $line = fgets(defined('STDIN') ? STDIN : fopen('php://stdin', 'r')); if (trim($line) != 'yes') { throw new Exception("Operation is aborted!"); } @@ -156,7 +156,7 @@ class Addon extends Command $output->warning($v); } $output->info("Are you sure you want to override all those files? Type 'yes' to continue: "); - $line = fgets(STDIN); + $line = fgets(defined('STDIN') ? STDIN : fopen('php://stdin', 'r')); if (trim($line) != 'yes') { throw new Exception("Operation is aborted!"); } @@ -186,7 +186,7 @@ class Addon extends Command $output->warning($v); } $output->info("Are you sure you want to delete all those files? Type 'yes' to continue: "); - $line = fgets(STDIN); + $line = fgets(defined('STDIN') ? STDIN : fopen('php://stdin', 'r')); if (trim($line) != 'yes') { throw new Exception("Operation is aborted!"); } diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index 14ace38b..43210167 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -840,7 +840,7 @@ class Crud extends Command } $data = [ - 'databaseConfigName' => $db, + 'modelConnection' => $db == 'database' ? '' : "protected \$connection = '{$db}';", 'controllerNamespace' => $controllerNamespace, 'modelNamespace' => $modelNamespace, 'validateNamespace' => $validateNamespace, diff --git a/application/admin/command/Crud/stubs/model.stub b/application/admin/command/Crud/stubs/model.stub index 8b8182f6..4e92e3a9 100755 --- a/application/admin/command/Crud/stubs/model.stub +++ b/application/admin/command/Crud/stubs/model.stub @@ -10,8 +10,8 @@ class {%modelName%} extends Model {%softDelete%} - //数据库 - protected $connection = '{%databaseConfigName%}'; + {%modelConnection%} + // 表名 protected ${%modelTableType%} = '{%modelTableTypeName%}'; diff --git a/application/admin/command/Menu.php b/application/admin/command/Menu.php index 02ec31f5..c81d072a 100755 --- a/application/admin/command/Menu.php +++ b/application/admin/command/Menu.php @@ -81,7 +81,7 @@ class Menu extends Command } if (!$force) { $output->info("Are you sure you want to delete all those menu? Type 'yes' to continue: "); - $line = fgets(STDIN); + $line = fgets(defined('STDIN') ? STDIN : fopen('php://stdin', 'r')); if (trim($line) != 'yes') { throw new Exception("Operation is aborted!"); } diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index 25e036bf..56f2b7e6 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -67,7 +67,7 @@ class Index extends Backend $rule = [ 'username' => 'require|length:3,30', 'password' => 'require|length:3,30', - '__token__' => 'token', + '__token__' => 'require|token', ]; $data = [ 'username' => $username, diff --git a/application/index/controller/User.php b/application/index/controller/User.php index b1dbc916..0c346918 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -92,7 +92,7 @@ class User extends Frontend 'email' => 'require|email', 'mobile' => 'regex:/^1\d{10}$/', 'captcha' => 'require|captcha', - '__token__' => 'token', + '__token__' => 'require|token', ]; $msg = [ @@ -152,7 +152,7 @@ class User extends Frontend $rule = [ 'account' => 'require|length:3,50', 'password' => 'require|length:6,30', - '__token__' => 'token', + '__token__' => 'require|token', ]; $msg = [ diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js index b6aca287..dfb12b9b 100644 --- a/public/assets/js/require-backend.min.js +++ b/public/assets/js/require-backend.min.js @@ -10394,7 +10394,11 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr var yes = typeof this.yes !== 'undefined' ? this.yes : 1; var no = typeof this.no !== 'undefined' ? this.no : 0; var url = typeof this.url !== 'undefined' ? this.url : ''; - return ""; }, url: function (value, row, index) { diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index 7462d592..65478f44 100644 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -485,7 +485,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table var yes = typeof this.yes !== 'undefined' ? this.yes : 1; var no = typeof this.no !== 'undefined' ? this.no : 0; var url = typeof this.url !== 'undefined' ? this.url : ''; - return ""; }, url: function (value, row, index) { @@ -638,7 +642,8 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : ''; title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text; refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : ''; - confirm = j.confirm ? 'data-confirm="' + j.confirm + '"' : ''; + confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.disable : false); + confirm = confirm ? 'data-confirm="' + confirm + '"' : ''; extend = j.extend ? j.extend : ''; disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false); if (disable) {