Commit e1ac486a authored by xiabin's avatar xiabin

修改model

parent ec005c40
......@@ -83,7 +83,7 @@ class Course extends \yii\db\ActiveRecord
['price', 'integer', 'min' => 0, 'max' => 9999],
['free_time', 'integer', 'min' => 0, 'max' => 15],
['recommend', 'boolean'],
['recommend', 'default', 'value' => 0],
[['recommend', 'comment_count', 'favorit_count', 'support_count', 'play_count'], 'default', 'value' => 0],
['status', 'in', 'range' => [0, 1, 2, 3]]
];
}
......
......@@ -28,6 +28,7 @@ class Courseware extends ActiveRecord
const STATUS_OK = 1;
const STATUS_FAILED = 2;
const STATUS_LOCKED = 3;
/**
* @inheritdoc
*/
......@@ -35,8 +36,9 @@ class Courseware extends ActiveRecord
{
return 'courseware';
}
public function formName() {
public function formName()
{
return '';
}
......@@ -49,7 +51,9 @@ class Courseware extends ActiveRecord
[['user_id', 'course_id', 'name', 'size', 'time', 'format'], 'required'],
[['user_id', 'course_id', 'type', 'status', 'size', 'time'], 'integer'],
[['name'], 'string', 'max' => 128],
[['format'], 'string', 'max' => 16]
[['format'], 'string', 'max' => 16],
[['comment_count', 'favorit_count', 'support_count', 'play_count'], 'default', 'value' => 0],
];
}
......@@ -88,7 +92,7 @@ class Courseware extends ActiveRecord
]
];
}
/**
* 根据id判断数据是否存在
* @param $id
......
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