Commit 2f1b9778 authored by xiabin's avatar xiabin

123

parent f9b80170
......@@ -15,7 +15,7 @@ return [
],
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=192.168.1.185;dbname=zuiketang',
'dsn' => 'mysql:host=192.168.1.185;dbname=zuiketang1',
'username' => 'root',
'password' => 'mysql123',
'charset' => 'utf8',
......
<?php
use yii\db\Migration;
class m160927_104153_users_init extends Migration
{
public $table = '{{%users}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'username' => $this->string()->notNull()->unique(),
'auth_key' => $this->string(32)->notNull(),
'password_hash' => $this->string()->notNull(),
'password_reset_token' => $this->string(64)->defaultValue(''),
'telephone' => $this->string(15)->notNull()->unique(),
'role' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 普通 1 讲师'),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 正常 1 锁定'),
'avatar' => $this->string(128)->notNull()->defaultValue(''),
'wx_open_id' => $this->string(32)->defaultValue('')->comment('登录微信id'),
'ip' => $this->string(32)->notNull(),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
'logged_at' => $this->integer()->notNull()
], $tableOptions);
$this->createIndex('index-id-status', $this->table, ['id', 'status'], TRUE);
$this->createIndex('index-wx_open_id', $this->table, 'wx_open_id');
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
......@@ -24,11 +24,13 @@ class m160927_113951_weixin_init extends Migration
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '用户绑定微信表');
$this->createIndex('index-user_id', $this->table, 'user_id');
}
public function down()
{
echo "m160927_113951_winxin_init cannot be reverted.\n";
$this->dropTable($this->table);
}
......
<?php
use yii\db\Migration;
class m160927_114841_browse_record_init extends Migration
{
public $table = '{{%browse_record}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'course_id' => $this->integer()->notNull()->unsigned(),
'time' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '浏览记录表');
$this->createIndex('index-user_id', $this->table, 'user_id');
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_115114_classes_init extends Migration
{
public $table = '{{%classes}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'id_number' => $this->string(64)->notNull(),
'id_name' => $this->string(64)->notNull(),
'name' => $this->string(64)->notNull(),
'intro' => $this->text()->notNull(),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '用户课堂表');
$this->createIndex('index-user_id-status', $this->table, ['user_id', 'status']);
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_115425_classes_teacher_init extends Migration
{
public $table = '{{%classes_teacher}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'class_id' => $this->integer()->notNull()->unsigned(),
'teacher_id' => $this->integer()->notNull()->unsigned(),
], $tableOptions);
$this->addCommentOnTable($this->table, '讲师课堂关系表');
$this->addPrimaryKey(
'pk',
$this->table,
['class_id', 'teacher_id']
);
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_120435_favorite_init extends Migration
{
public $table = '{{%favorite}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'course_id' => $this->integer()->notNull()->unsigned(),
'created_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '收藏表');
$this->createIndex('index-course_id', $this->table, 'course_id');
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_120550_comments_init extends Migration
{
public $table = '{{%comments}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'course_id' => $this->integer()->notNull()->unsigned(),
'parent_id' => $this->integer()->notNull()->unsigned(),
'content' => $this->text()->notNull(),
'ip' => $this->string(32)->notNull(),
'created_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '评论表');
$this->createIndex('index-course_id', $this->table, 'course_id');
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_120953_consume_init extends Migration
{
public $table = '{{%consume}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'orders_id' => $this->integer()->notNull()->unsigned(),
], $tableOptions);
$this->addCommentOnTable($this->table, '用户消费表');
$this->createIndex('index-user_id', $this->table, 'user_id');
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_121107_course_init extends Migration
{
public $table = '{{%course}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'classed_id' => $this->integer()->notNull()->unsigned(),
'avatar' => $this->string(255)->notNull(),
'name' => $this->string(32)->notNull(),
'price' => $this->integer()->notNull(),
'free_time' => $this->integer()->notNull(),
'intro' => $this->text()->notNull(),
'preview_pic' => $this->string(255)->notNull(),
'recommend' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 表示推荐 1推荐'),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
$this->createIndex(
'index-user_id-status',
$this->table,
['user_id', 'status'],
FALSE
);
$this->addCommentOnTable($this->table, '用户课程表');
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_121625_courseware_init extends Migration
{
public $table = '{{%courseware}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'course_id' => $this->integer()->notNull()->unsigned(),
'type' => $this->smallInteger()->notNull()->defaultValue(0)->unsigned()->comment('课件类型 默认0'),
'name' => $this->string(128)->notNull(),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '),
'size' => $this->string(32)->notNull()->comment('文件大小 kb'),
'time' => $this->string(32)->notNull()->comment('视频时间 秒'),
'format' => $this->string(16)->notNull()->comment('格式'),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '用户课件表');
$this->createIndex('index-course_id', $this->table, 'course_id');
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_122057_income_init extends Migration
{
public $table = '{{%income}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'orders_id' => $this->integer()->notNull()->unsigned(),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未结算 1 结算 '),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '用户收入表');
$this->createIndex('index-user_id-status', $this->table, ['user_id', 'status']);
$this->createIndex('index-orders_id', $this->table, 'orders_id');
}
public function down()
{
echo "m160927_113951_winxin_init cannot be reverted.\n";
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_122231_orders_init extends Migration
{
public $table = '{{%orders}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'course_id' => $this->integer()->notNull()->unsigned(),
'number' => $this->string(32)->notNull(),
'credit' => $this->string(32)->notNull()->comment('消费'),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->unsigned()->comment('0 未支付 1 已支付'),
'pay_order' => $this->string(64)->notNull()->comment('第三方支付订单'),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '用户订单表');
$this->createIndex('index-user_id', $this->table, 'user_id');
}
public function down()
{
echo "m160927_113951_winxin_init cannot be reverted.\n";
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_122734_support_init extends Migration
{
public $table = '{{%support}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'courseware_id' => $this->integer()->notNull()->unsigned(),
'created_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '用户点赞表');
$this->createIndex('index-courseware_id', $this->table, 'courseware_id');
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_122843_teacher_init extends Migration
{
public $table = '{{%teacher}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'name' => $this->string(64)->notNull(),
'avatar' => $this->string(255)->notNull(),
'intro' => $this->text()->notNull(''),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '讲师表');
$this->createIndex('index-user_id', $this->table, 'user_id');
}
public function down()
{
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
use yii\db\Migration;
class m160927_123009_member_init extends Migration
{
public $table = '{{%member}}';
public function up()
{
$tableOptions = NULL;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'member_id' => $this->integer()->notNull()->unsigned(),
'type' => $this->smallInteger()->notNull()->unsigned()->comment('会员类型 0 未付费 1 付费'),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
$this->addCommentOnTable($this->table, '用户会员表');
$this->createIndex('index-user_id', $this->table, 'user_id');
}
public function down()
{
echo "m160927_113951_winxin_init cannot be reverted.\n";
$this->dropTable($this->table);
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
<?php
namespace frontend\controllers;
class ClassesInfoController extends \yii\web\Controller
{
public function actionIndex()
{
return $this->render('index');
}
}
<?php
namespace frontend\controllers;
class HomeController extends \yii\web\Controller
{
public function actionIndex()
{
return $this->render('index');
}
}
<?php
namespace frontend\controllers;
class MyCourseController extends \yii\web\Controller
{
public function actionIndex()
{
return $this->render('index');
}
}
<?php
namespace frontend\controllers;
class MyIncomeController extends \yii\web\Controller
{
public function actionIndex()
{
return $this->render('index');
}
}
<?php
namespace frontend\controllers;
class MyMemberController extends \yii\web\Controller
{
public function actionIndex()
{
return $this->render('index');
}
}
<?php
namespace frontend\controllers;
class TeacherManagerController extends \yii\web\Controller
{
public function actionIndex()
{
return $this->render('index');
}
}
<?php
/* @var $this yii\web\View */
?>
<h1>classes-info/index</h1>
<p>
You may change the content of this page by modifying
the file <code><?= __FILE__; ?></code>.
</p>
<?php
/* @var $this yii\web\View */
?>
<h1>home/index</h1>
<p>
You may change the content of this page by modifying
the file <code><?= __FILE__; ?></code>.
</p>
<?php
/* @var $this yii\web\View */
?>
<h1>my-course/index</h1>
<p>
You may change the content of this page by modifying
the file <code><?= __FILE__; ?></code>.
</p>
<?php
/* @var $this yii\web\View */
?>
<h1>my-income/index</h1>
<p>
You may change the content of this page by modifying
the file <code><?= __FILE__; ?></code>.
</p>
<?php
/* @var $this yii\web\View */
?>
<h1>my-member/index</h1>
<p>
You may change the content of this page by modifying
the file <code><?= __FILE__; ?></code>.
</p>
<?php
/* @var $this yii\web\View */
?>
<h1>teacher-manager/index</h1>
<p>
You may change the content of this page by modifying
the file <code><?= __FILE__; ?></code>.
</p>
/index.php
/index-test.php
/js/node_modules/*
/js/assets/*
\ No newline at end of file
/node_modules/*
/assets/*
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment