52 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
| <?php
 | |
| 
 | |
| namespace app\model;
 | |
| 
 | |
| use think\model\relation\HasOne;
 | |
| 
 | |
| /**
 | |
|  * 用户提交的任务记录
 | |
|  * */
 | |
| class TaskAccount extends Base
 | |
| {
 | |
|     protected $autoWriteTimestamp = true;
 | |
| 
 | |
|     static $status_default  = 0;//待审核
 | |
|     static $status_success  = 1;//审核通过
 | |
|     static $status_fail     = 2;//审核失败
 | |
|     static $status_repeat   = 3;//重复
 | |
|     static $status_notsubmit= 4;//未提交的任务
 | |
| 
 | |
|     public static function allStatus(): array
 | |
|     {
 | |
|         return [
 | |
|             self::$status_default   => '待审核',
 | |
|             self::$status_success   => '通过',
 | |
|             self::$status_fail      => '拒绝',
 | |
|             self::$status_repeat    => '审核通过后可以重新完成',
 | |
|         ];
 | |
|     }
 | |
| 
 | |
| 
 | |
| 
 | |
|     /**
 | |
|      * 模型关联:用户
 | |
|      *
 | |
|      * @return HasOne
 | |
|      */
 | |
|     public function account(): HasOne
 | |
|     {
 | |
|         return $this->hasOne(Account::class, 'id', 'account_id');
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * 模型关联:任务
 | |
|      *
 | |
|      * @return HasOne
 | |
|      */
 | |
|     public function task(): HasOne
 | |
|     {
 | |
|         return $this->hasOne(Task::class, 'id', 'task_id');
 | |
|     }
 | |
| }
 |