| 12345678910111213141516171819202122232425262728293031323334 | 
							- <?php
 
- namespace app\common\model;
 
- class SoldierVideoWatchModel extends BaseModel
 
- {
 
-     // 设置表名
 
-     protected $name = 'soldier_video_watch';
 
-     protected $autoWriteTimestamp = true;
 
-     // 常量
 
-     const STATUS = [1 => '未开始', 2 => '未看完', 3 => '已完成'];
 
-     const STATUS_NO_STARTED  = 1;
 
-     const STATUS_NO_FINISHED = 2;
 
-     const STATUS_FINISH      = 3;
 
-     public function getStatusTextAttr($value, $data)
 
-     {
 
-         return self::STATUS[$data['status']];
 
-     }
 
-     public function user()
 
-     {
 
-         return $this->hasOne(SoldierModel::class, 'id', 'user_id');
 
-     }
 
-     public function video()
 
-     {
 
-         return $this->hasOne(SoldierVideoModel::class, 'id', 'video_id');
 
-     }
 
- }
 
 
  |