1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-02 07:04:56 +08:00
course-tencent-cloud/db/migrations/20200827113559_insert_user_data.php
koogua f318fccada !9 修正插入数据不一致以及后台菜单参数类型报错
* 1.修正插入的管理帐号数据
* 纠正迁移文件和时间代码中字段不一致
* 更新版本号
* 完善后台今日统计,增加权限白名单,增加后台首页菜单,调整后台登录页样式
* Merge branch 'koogua/I1XFCF' of https://gitee.com/koogua/course-tencen…
* 前台学习资料部分完成
* !2 后台运营统计合并
* 后台学习资料部分完成
* Merge branch 'master' into develop
* Merge branch 'master' of https://github.com/xiaochong0302/course-tencent-cloud
* 1.增加changelog.md
* 1.简化部分路由地址
* Merge pull request #2 from xiaochong0302/dependabot/composer/symfony/h…
* Bump symfony/http-foundation from 4.3.4 to 5.1.6
2020-10-26 20:09:31 +08:00

65 lines
1.5 KiB
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
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class InsertUserData extends AbstractMigration
{
public function up()
{
$now = time();
$account = [
'id' => 10000,
'email' => '10000@163.com',
'password' => '1a1e4568f1a3740b8853a8a16e29bc87',
'salt' => 'MbZWxN3L',
'create_time' => $now,
];
$this->table('kg_account')->insert($account)->saveData();
$user = [
'id' => $account['id'],
'name' => '酷瓜云网课',
'avatar' => '/img/avatar/default.png',
'title' => '官方人员',
'about' => '酷瓜云课堂依托腾讯云基础服务使用C扩展框架PHALCON开发',
'admin_role' => 1,
'edu_role' => 2,
'create_time' => $now,
];
$this->table('kg_user')->insert($user)->saveData();
$imUser = [
'id' => $user['id'],
'name' => $user['name'],
'avatar' => $user['avatar'],
'create_time' => $now,
];
$this->table('kg_im_user')->insert($imUser)->saveData();
}
public function down()
{
$id = 10000;
$sql = sprintf('DELETE FROM kg_account WHERE id = %d', $id);
$this->execute($sql);
$sql = sprintf('DELETE FROM kg_user WHERE id = %d', $id);
$this->execute($sql);
$sql = sprintf('DELETE FROM kg_im_user WHERE id = %d', $id);
$this->execute($sql);
}
}