Commit f5b42e48 authored by 汪波's avatar 汪波

Merge remote-tracking branch 'origin/dev' into dev

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