Files
BESCMS/dayrui/App/Block/Config/Install.php
T

25 lines
843 B
PHP
Raw 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
/**
* Block 站点表安装(原 Install_site.sql
* App::install 会先跑 Install.php;此处按站点创建 {siteid}_block
*/
$m = \Phpcmf\Service::M();
$t = \Phpcmf\Service::M('table');
$sites = !empty($m->site) ? $m->site : [SITE_ID => SITE_ID];
foreach ($sites as $siteid) {
$table = $m->dbprefix($siteid.'_block');
if ($m->is_table_exists($table)) {
continue;
}
$t->create_table($table, [
'id' => 'smallint(5) unsigned NOT NULL AUTO_INCREMENT',
'name' => 'varchar(100) NOT NULL COMMENT \'名称\'',
'code' => 'varchar(100) NOT NULL COMMENT \'别名\'',
'hide' => 'tinyint(1) unsigned NOT NULL COMMENT \'隐藏\'',
'content' => 'text NOT NULL COMMENT \'内容\'',
], [
'PRIMARY KEY (`id`)',
'KEY `code` (`code`)',
], '资料块表');
}