fix
This commit is contained in:
parent
36adffa6a3
commit
462b8ade91
@ -17,6 +17,11 @@ class Util
|
|||||||
return Db::connection('plugin.admin.mysql');
|
return Db::connection('plugin.admin.mysql');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function schema()
|
||||||
|
{
|
||||||
|
return Db::schema('plugin.admin.mysql');
|
||||||
|
}
|
||||||
|
|
||||||
static public function passwordVerify($password, $hash)
|
static public function passwordVerify($password, $hash)
|
||||||
{
|
{
|
||||||
return password_verify($password, $hash);
|
return password_verify($password, $hash);
|
||||||
|
@ -349,12 +349,10 @@ EOF;
|
|||||||
|
|
||||||
namespace $namespace;
|
namespace $namespace;
|
||||||
|
|
||||||
use support\Model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
$properties
|
$properties
|
||||||
*/
|
*/
|
||||||
class $class extends Model
|
class $class extends Base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The table associated with the model.
|
* The table associated with the model.
|
||||||
|
@ -63,7 +63,7 @@ class TableController extends Base
|
|||||||
$table_comment = $data['table']['comment'];
|
$table_comment = $data['table']['comment'];
|
||||||
$columns = $data['columns'];
|
$columns = $data['columns'];
|
||||||
$keys = $data['keys'];
|
$keys = $data['keys'];
|
||||||
Util::db()->schema()->create($table_name, function (Blueprint $table) use ($columns) {
|
Util::schema()->create($table_name, function (Blueprint $table) use ($columns) {
|
||||||
$type_method_map = Util::methodControlMap();
|
$type_method_map = Util::methodControlMap();
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
if (!isset($column['type'])) {
|
if (!isset($column['type'])) {
|
||||||
@ -82,7 +82,7 @@ class TableController extends Base
|
|||||||
Util::db()->statement("ALTER TABLE `$table_name` COMMENT '$table_comment'");
|
Util::db()->statement("ALTER TABLE `$table_name` COMMENT '$table_comment'");
|
||||||
|
|
||||||
// 索引
|
// 索引
|
||||||
Util::db()->schema()->table($table_name, function (Blueprint $table) use ($keys) {
|
Util::schema()->table($table_name, function (Blueprint $table) use ($keys) {
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$name = $key['name'];
|
$name = $key['name'];
|
||||||
$columns = $key['columns'];
|
$columns = $key['columns'];
|
||||||
@ -123,7 +123,7 @@ class TableController extends Base
|
|||||||
// 改表名
|
// 改表名
|
||||||
if ($table_name != $old_table_name) {
|
if ($table_name != $old_table_name) {
|
||||||
Util::checkTableName($table_name);
|
Util::checkTableName($table_name);
|
||||||
Util::db()->schema()->rename($old_table_name, $table_name);
|
Util::schema()->rename($old_table_name, $table_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$old_columns = $this->getSchema($table_name, 'columns');
|
$old_columns = $this->getSchema($table_name, 'columns');
|
||||||
@ -156,7 +156,7 @@ class TableController extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
$old_columns = $this->getSchema($table_name, 'columns');
|
$old_columns = $this->getSchema($table_name, 'columns');
|
||||||
Util::db()->schema()->table($table_name, function (Blueprint $table) use ($columns, $old_columns, $keys, $table_name) {
|
Util::schema()->table($table_name, function (Blueprint $table) use ($columns, $old_columns, $keys, $table_name) {
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
$field = $column['field'];
|
$field = $column['field'];
|
||||||
// 新字段
|
// 新字段
|
||||||
@ -183,7 +183,7 @@ class TableController extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
$old_keys = $this->getSchema($table_name, 'keys');
|
$old_keys = $this->getSchema($table_name, 'keys');
|
||||||
Util::db()->schema()->table($table_name, function (Blueprint $table) use ($keys, $old_keys, $table_name) {
|
Util::schema()->table($table_name, function (Blueprint $table) use ($keys, $old_keys, $table_name) {
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$key_name = $key['name'];
|
$key_name = $key['name'];
|
||||||
$old_key = $old_keys[$key_name] ?? [];
|
$old_key = $old_keys[$key_name] ?? [];
|
||||||
@ -519,7 +519,7 @@ class TableController extends Base
|
|||||||
if (in_array($table_name, $table_not_allow_drop)) {
|
if (in_array($table_name, $table_not_allow_drop)) {
|
||||||
return $this->json(400, "$table_name 不允许删除");
|
return $this->json(400, "$table_name 不允许删除");
|
||||||
}
|
}
|
||||||
Util::db()->schema()->drop($table_name);
|
Util::schema()->drop($table_name);
|
||||||
// 删除schema
|
// 删除schema
|
||||||
Util::db()->table('wa_options')->where('name', "table_form_schema_$table_name")->delete();
|
Util::db()->table('wa_options')->where('name', "table_form_schema_$table_name")->delete();
|
||||||
return $this->json(0, 'ok');
|
return $this->json(0, 'ok');
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace plugin\admin\app\model;
|
namespace plugin\admin\app\model;
|
||||||
|
|
||||||
use support\Model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property integer $id (主键)
|
* @property integer $id (主键)
|
||||||
@ -11,7 +10,7 @@ use support\Model;
|
|||||||
* @property string $created_at 创建时间
|
* @property string $created_at 创建时间
|
||||||
* @property string $updated_at 更新时间
|
* @property string $updated_at 更新时间
|
||||||
*/
|
*/
|
||||||
class Option extends Model
|
class Option extends Base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The table associated with the model.
|
* The table associated with the model.
|
||||||
|
Loading…
Reference in New Issue
Block a user