Commit 9622fc21 authored by 杨培's avatar 杨培

审核未通过时记录原因用于后续页面显示

parent 59fe3792
...@@ -78,6 +78,7 @@ class ClassesController extends Controller ...@@ -78,6 +78,7 @@ class ClassesController extends Controller
switch ($check) { switch ($check) {
case Classes::STATUS_OK: case Classes::STATUS_OK:
$class->status = $check; $class->status = $check;
$class->reason = '';
if ($class->save() && $msg) { if ($class->save() && $msg) {
$template = Yii::$app->params['classes.check.msg.ok']; $template = Yii::$app->params['classes.check.msg.ok'];
$sms->send($user->telephone, str_replace('{className}', $class->name, $template)); $sms->send($user->telephone, str_replace('{className}', $class->name, $template));
...@@ -93,6 +94,8 @@ class ClassesController extends Controller ...@@ -93,6 +94,8 @@ class ClassesController extends Controller
} }
$class->status = $check; $class->status = $check;
$class->reason = $reason;
if ($class->save() && $msg) { if ($class->save() && $msg) {
$template = Yii::$app->params['classes.check.msg.failed']; $template = Yii::$app->params['classes.check.msg.failed'];
$sms->send($user->telephone, str_replace(['{className}', '{reason}'], [$class->name, $reason], $template)); $sms->send($user->telephone, str_replace(['{className}', '{reason}'], [$class->name, $reason], $template));
...@@ -109,6 +112,8 @@ class ClassesController extends Controller ...@@ -109,6 +112,8 @@ class ClassesController extends Controller
} }
$class->status = $check; $class->status = $check;
$class->reason = $reason;
if ($class->save() && $msg) { if ($class->save() && $msg) {
$template = Yii::$app->params['classes.check.msg.locked']; $template = Yii::$app->params['classes.check.msg.locked'];
$sms->send($user->telephone, str_replace(['{className}', '{reason}'], [$class->name, $reason], $template)); $sms->send($user->telephone, str_replace(['{className}', '{reason}'], [$class->name, $reason], $template));
......
...@@ -122,6 +122,7 @@ class CourseController extends Controller ...@@ -122,6 +122,7 @@ class CourseController extends Controller
} }
$course->status = $check; $course->status = $check;
$course->reason = '';
$courseware->status = $check; $courseware->status = $check;
if ($course->save() && $courseware->save() && $msg) { if ($course->save() && $courseware->save() && $msg) {
...@@ -140,6 +141,7 @@ class CourseController extends Controller ...@@ -140,6 +141,7 @@ class CourseController extends Controller
} }
$course->status = $check; $course->status = $check;
$course->reason = $reason;
$courseware->status = Courseware::STATUS_FAILED; $courseware->status = Courseware::STATUS_FAILED;
if ($course->save() && $courseware->save() && $msg) { if ($course->save() && $courseware->save() && $msg) {
...@@ -158,6 +160,7 @@ class CourseController extends Controller ...@@ -158,6 +160,7 @@ class CourseController extends Controller
} }
$course->status = $check; $course->status = $check;
$course->reason = $reason;
$courseware->status = Courseware::STATUS_LOCKED; $courseware->status = Courseware::STATUS_LOCKED;
if ($course->save() && $courseware->save() && $msg) { if ($course->save() && $courseware->save() && $msg) {
......
...@@ -39,7 +39,6 @@ $qiniu = \Yii::$app->qiniu; ...@@ -39,7 +39,6 @@ $qiniu = \Yii::$app->qiniu;
<li<?php if ($status == Course::STATUS_LOCKED) {?> class="active"<?php } ?>><a href="<?=Url::to(['course/index', 'status'=>Course::STATUS_LOCKED])?>"><i class="fa fa-lock"></i> 已锁定</a></li> <li<?php if ($status == Course::STATUS_LOCKED) {?> class="active"<?php } ?>><a href="<?=Url::to(['course/index', 'status'=>Course::STATUS_LOCKED])?>"><i class="fa fa-lock"></i> 已锁定</a></li>
</ul> </ul>
</div> </div>
<!-- /.box-body -->
</div> </div>
<?php if ($count > 0) { ?> <?php if ($count > 0) { ?>
......
...@@ -207,6 +207,12 @@ class Utils ...@@ -207,6 +207,12 @@ class Utils
return $count; return $count;
} }
/**
* 将字节数转换为可读文件大小
*
* @param int $bytes
* @return string
*/
public static function byteConvert($bytes) public static function byteConvert($bytes)
{ {
if ($bytes == 0) if ($bytes == 0)
......
...@@ -18,6 +18,7 @@ use yii\db\ActiveRecord; ...@@ -18,6 +18,7 @@ use yii\db\ActiveRecord;
* @property string $intro * @property string $intro
* @property string $desc * @property string $desc
* @property integer $status * @property integer $status
* @property string $reason
* @property integer $created_at * @property integer $created_at
* @property integer $updated_at * @property integer $updated_at
*/ */
...@@ -65,7 +66,7 @@ class Classes extends ActiveRecord ...@@ -65,7 +66,7 @@ class Classes extends ActiveRecord
return [ return [
[['user_id', 'name', 'intro'], 'required'], [['user_id', 'name', 'intro'], 'required'],
[['user_id', 'status'], 'integer'], [['user_id', 'status'], 'integer'],
[['intro', 'desc'], 'string'], [['intro', 'desc', 'reason'], 'string'],
[['name'], 'string', 'max' => 30], [['name'], 'string', 'max' => 30],
]; ];
} }
......
...@@ -22,6 +22,7 @@ use yii\redis\ActiveRecord; ...@@ -22,6 +22,7 @@ use yii\redis\ActiveRecord;
* @property string $preview_pic * @property string $preview_pic
* @property integer $recommend * @property integer $recommend
* @property integer $status * @property integer $status
* @property string $reason
* @property integer $play_count * @property integer $play_count
* @property integer $comment_count * @property integer $comment_count
* @property integer $favorite_count * @property integer $favorite_count
...@@ -85,7 +86,7 @@ class Course extends \yii\db\ActiveRecord ...@@ -85,7 +86,7 @@ class Course extends \yii\db\ActiveRecord
[['name', 'preview_pic'], 'required'], [['name', 'preview_pic'], 'required'],
['name', 'string', 'length' => [1, 60]], ['name', 'string', 'length' => [1, 60]],
[['user_id', 'class_id'], 'integer'], [['user_id', 'class_id'], 'integer'],
['intro', 'string'], [['intro', 'reason'], 'string'],
[['price'], 'number'], [['price'], 'number'],
['free_time', 'integer', 'min' => 0, 'max' => 15], ['free_time', 'integer', 'min' => 0, 'max' => 15],
['recommend', 'boolean'], ['recommend', 'boolean'],
......
...@@ -23,6 +23,7 @@ class m160927_115114_classes_init extends Migration ...@@ -23,6 +23,7 @@ class m160927_115114_classes_init extends Migration
'intro' => $this->text()->notNull(), 'intro' => $this->text()->notNull(),
'desc' => $this->text()->notNull()->comment('案例资源'), 'desc' => $this->text()->notNull()->comment('案例资源'),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '), 'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '),
'reason' => $this->string(128)->notNull()->comment('未审核通过时的原因'),
'created_at' => $this->integer()->notNull(), 'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(), 'updated_at' => $this->integer()->notNull(),
], $tableOptions); ], $tableOptions);
......
...@@ -22,8 +22,9 @@ class m160927_121107_course_init extends Migration ...@@ -22,8 +22,9 @@ class m160927_121107_course_init extends Migration
'price' => $this->decimal(6,2)->unsigned()->notNull()->defaultValue(0), 'price' => $this->decimal(6,2)->unsigned()->notNull()->defaultValue(0),
'free_time' => $this->integer(10)->notNull()->defaultValue(0), 'free_time' => $this->integer(10)->notNull()->defaultValue(0),
'intro' => $this->text()->notNull(), 'intro' => $this->text()->notNull(),
'preview_pic' => $this->string(255)->notNull(), 'preview_pic' => $this->string(200)->notNull(),
'recommend' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 表示推荐 1推荐'), 'recommend' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 表示推荐 1推荐'),
'reason' => $this->string(128)->notNull()->comment('未审核通过时的原因'),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '), 'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '),
'play_count' => $this->integer(10)->unsigned()->notNull()->defaultValue(0)->comment('播放次数'), 'play_count' => $this->integer(10)->unsigned()->notNull()->defaultValue(0)->comment('播放次数'),
'comment_count' => $this->integer(8)->unsigned()->notNull()->defaultValue(0)->comment('评论次数'), 'comment_count' => $this->integer(8)->unsigned()->notNull()->defaultValue(0)->comment('评论次数'),
......
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