Commit e65cd9ef authored by 杨培's avatar 杨培

迁移调整

parent 85a7e496
......@@ -187,7 +187,7 @@ class Course extends \yii\db\ActiveRecord
*/
public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'user_id'])->select('id,username,role,avatar');;
return $this->hasOne(User::className(), ['id' => 'user_id'])->select('id,username,role,avatar');
}
/**
......
......@@ -4,7 +4,7 @@ use yii\db\Migration;
class m160927_115425_classes_teacher_init extends Migration
{
public $table = '{{%classes_teacher}}';
public $table = '{{%course_teacher}}';
public function up()
{
......@@ -15,16 +15,14 @@ class m160927_115425_classes_teacher_init extends Migration
}
$this->createTable($this->table, [
'class_id' => $this->integer()->notNull()->unsigned(),
'teacher_id' => $this->integer()->notNull()->unsigned(),
'course_id' => $this->integer(10)->notNull()->unsigned(),
'teacher_id' => $this->integer(10)->notNull()->unsigned(),
], $tableOptions);
$this->addCommentOnTable($this->table, '讲师课堂关系表');
$this->addPrimaryKey(
'pk',
$this->table,
['class_id', 'teacher_id']
);
$this->addCommentOnTable($this->table, '讲师课程关系表');
$this->createIndex('course_id', $this->table, 'course_id');
$this->createIndex('teacher_id', $this->table, 'teacher_id');
}
public function down()
......
......@@ -17,14 +17,17 @@ class m160927_122843_teacher_init extends Migration
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned(),
'user_id' => $this->integer()->notNull()->unsigned(),
'class_id' => $this->integer(10)->unsigned()->notNull(),
'name' => $this->string(64)->notNull(),
'avatar' => $this->string(255)->notNull(),
'intro' => $this->text()->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');
$this->createIndex('user_id', $this->table, 'user_id');
$this->createIndex('class_id', $this->table, 'class_id');
}
......
......@@ -15,12 +15,12 @@ class m160927_123009_member_init extends Migration
}
$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(),
'id' => $this->primaryKey(10)->unsigned(),
'user_id' => $this->integer(10)->notNull()->unsigned(),
'member_id' => $this->integer(10)->notNull()->unsigned(),
'type' => $this->smallInteger(1)->notNull()->unsigned()->comment('会员类型 0 未付费 1 付费'),
'created_at' => $this->integer(10)->unsigned()->notNull(),
'updated_at' => $this->integer(10)->unsigned()->notNull()
], $tableOptions);
$this->addCommentOnTable($this->table, '用户会员表');
$this->createIndex('index-user_id', $this->table, 'user_id');
......
<?php
/* @var $this yii\web\View */
/**
* @var $this yii\web\View
* @var $data array
* @var $pagination \yii\data\Pagination
*/
?>
<div class="vip-top clearfix">
<div class="col-md-6">
......@@ -31,33 +35,25 @@
</tr>
</thead>
<tbody>
<tr>
<td>2016-12-11</td>
<td>18788860327 / 百丐洪七公</td>
<td>推广</td>
<td>《中国为什么这么久还没有进入社会主义社会》</td>
<td>¥123.00</td>
</tr>
<tr>
<td>2016-12-11</td>
<td>18788860327 / 百丐洪七公</td>
<td>推广</td>
<td>《中国为什么这么久还没有进入社会主义社会》</td>
<td>¥123.00</td>
</tr>
<?php foreach ($data as $row) { ?>
<tr>
<td>2016-12-11</td>
<td><?=$row['user']['telephone']?> / <?=$row['user']['username']?></td>
<td>推广</td>
<?php if (!empty($row['firstOrder'])) { ?>
<td>《<?=$row['firstOrder']['course']['name']?>》</td>
<td>¥<?=$row['firstOrder']['credit_total']?></td>
<?php } else { ?>
<td>无</td>
<td>¥0</td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
<div class="text-center hide">
<ul class="pagination pagination-sm">
<li><a href="#">&laquo;</a></li>
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li><a href="#">&raquo;</a></li>
</ul>
<?=\yii\widgets\LinkPager::widget(['pagination'=>$pagination])?>
</div>
</div>
</div>
\ No newline at end of file
......@@ -51,7 +51,7 @@ var vm = new Vue({
var self = this;
//添加讲师
$.post("/teacher-manager/add", {
$.post("/teacher-manager/save", {
name: self.addTeacherName
}, function(t) {
if (!t.error) {
......@@ -169,12 +169,14 @@ var vm = new Vue({
url : '/my-course/upload', //文件上传的接口地址
params: {
"_csrf-frontend": $("meta[name='csrf-token']").attr("content"),
tmp: self.tmp
"tmp": self.tmp
},
fileKey: 'file', //服务器端获取文件数据的参数名
connectionCount: 3,
leaveConfirm: '正在上传文件'
}
});
editor;
}
});
\ 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