132 lines
4.7 KiB
PHP
132 lines
4.7 KiB
PHP
<?php
|
|
|
|
use think\migration\Seeder;
|
|
|
|
class LanguageInit extends Seeder
|
|
{
|
|
/**
|
|
* Run Method.
|
|
*
|
|
* Write your database seeder using this method.
|
|
*
|
|
* More information on writing seeders is available here:
|
|
* http://docs.phinx.org/en/latest/seeding.html
|
|
*/
|
|
public function run()
|
|
{
|
|
$data = [
|
|
[
|
|
'id' => null,
|
|
'name' => '中文',
|
|
'code' => 'zh-cn',
|
|
'icon' => 'zh-cn.jpg',
|
|
'locale' => 'zh-cn',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '英文',
|
|
'code' => 'en',
|
|
'icon' => 'en.jpg',
|
|
'locale' => 'en',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '日文',
|
|
'code' => 'jp',
|
|
'icon' => 'jp.jpg',
|
|
'locale' => 'jp',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '越南语',
|
|
'code' => 'VU',
|
|
'icon' => 'VU.jpg',
|
|
'locale' => 'VU',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '泰语',
|
|
'code' => 'TH',
|
|
'icon' => 'TH.jpg',
|
|
'locale' => 'TH',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '印尼语',
|
|
'code' => 'IN',
|
|
'icon' => 'IN.jpg',
|
|
'locale' => 'IN',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '韩语',
|
|
'code' => 'KR',
|
|
'icon' => 'kr.jpg',
|
|
'locale' => 'KR',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '葡萄牙语',
|
|
'code' => 'pt',
|
|
'icon' => 'pt.jpg',
|
|
'locale' => 'pt',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '德语',
|
|
'code' => 'de',
|
|
'icon' => 'de.jpg',
|
|
'locale' => 'de',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '俄语',
|
|
'code' => 'ru',
|
|
'icon' => 'ru.jpg',
|
|
'locale' => 'ru',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '法语',
|
|
'code' => 'fr',
|
|
'icon' => 'fr.jpg',
|
|
'locale' => 'fr',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
],[
|
|
'id' => null,
|
|
'name' => '阿拉伯语',
|
|
'code' => 'al',
|
|
'icon' => 'al.jpg',
|
|
'locale' => 'al',
|
|
'sort' => mt_rand(1,255),
|
|
'status' => 0,
|
|
'create_time' => time()
|
|
]
|
|
];
|
|
|
|
$table = $this->table('language');
|
|
$table->insert($data)->saveData();
|
|
}
|
|
} |