46 lines
3.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* 设置
*/
use think\Db;
use think\migration\Migrator;
use think\migration\db\Column;
class Setting extends Migrator
{
public function change()
{
$table = $this->table('setting', ['comment' => '设置', 'engine' => 'InnoDB', 'encoding' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci']);
$table
->addColumn('setting_group_id', 'integer', ['limit' => 10, 'default' => 0, 'comment' => '所属分组'])
->addColumn('name', 'string', ['limit' => 50, 'default' => '', 'comment' => '名称'])
->addColumn('description', 'string', ['limit' => 100, 'default' => '', 'comment' => '描述'])
->addColumn('code', 'string', ['limit' => 50, 'default' => '', 'comment' => '代码'])
->addColumn('content', 'text', [ 'comment' => '设置配置及内容'])
->addColumn('sort_number', 'integer', ['limit' => 10, 'default' => 1000, 'comment' => '排序'])
->addColumn('create_time', 'integer', ['limit' => 10, 'default' => 0, 'comment' => '创建时间'])
->addColumn('update_time', 'integer', ['limit' => 10, 'default' => 0, 'comment' => '更新时间'])
->addColumn('delete_time', 'integer', ['limit' => 10, 'default' => 0, 'comment' => '删除时间'])
->create();
$this->insertData();
}
protected function insertData()
{
$sql = 'INSERT INTO `agency_setting` (`id`, `setting_group_id`, `name`, `description`, `code`, `content`, `sort_number`, `create_time`, `update_time`, `delete_time`) VALUES
(1, 1, \'基本设置\', \'后台的基本信息设置\', \'base\', \'[{"name":"\u540e\u53f0\u540d\u79f0","field":"name","type":"text","content":"\u897f\u6e38\u4ee3\u7406\u7cfb\u7edf","option":""},{"name":"\u540e\u53f0\u7b80\u79f0","field":"short_name","type":"text","content":"\u897f\u6e38","option":""},{"name":"\u540e\u53f0\u4f5c\u8005","field":"author","type":"text","content":"\u4fee\u7f18","option":""},{"name":"\u540e\u53f0\u7248\u672c","field":"version","type":"text","content":"0.1","option":""}]\', 1000, 1640278457, 1641222694, 0),
(2, 1, \'登录设置\', \'后台登录相关设置\', \'login\', \'[{"name":"\u767b\u5f55token\u9a8c\u8bc1","field":"token","type":"switch","content":"0","option":""},{"name":"\u9a8c\u8bc1\u7801","field":"captcha","type":"select","content":"1","option":"0||\u4e0d\u5f00\u542f\r\n1||\u56fe\u5f62\u9a8c\u8bc1\u7801\r\n2||\u6ed1\u52a8\u9a8c\u8bc1"},{"name":"\u767b\u5f55\u80cc\u666f","field":"background","type":"image","content":"\/static\/admin\/images\/login-default-bg.jpg","option":""}]\', 1000, 1640278457, 1640279329, 0),
(3, 1, \'首页设置\', \'后台首页参数设置\', \'index\', \'[{"name":"\u9ed8\u8ba4\u5bc6\u7801\u8b66\u544a","field":"password_warning","type":"switch","content":"1","option":""},{"name":"\u662f\u5426\u663e\u793a\u63d0\u793a\u4fe1\u606f","field":"show_notice","type":"switch","content":"1","option":""},{"name":"\u63d0\u793a\u4fe1\u606f\u5185\u5bb9","field":"notice_content","type":"text","content":"\u6b22\u8fce\u6765\u5230\u4f7f\u7528\u672c\u7cfb\u7edf\u5de6\u4fa7\u4e3a\u83dc\u5355\u533a\u57df\u53f3\u4fa7\u4e3a\u529f\u80fd\u533a。","option":""}]\', 1000, 1640278457, 1640278457, 0);
';
$query = Db::query($sql);
if ($query) {
$msg = '配置导入成功.' . "\n";
print ($msg);
}
}
}