68 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			68 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
| <?php
 | |
| 
 | |
| namespace app\model;
 | |
| 
 | |
| class Task extends Base
 | |
| {
 | |
|     protected $autoWriteTimestamp = true;
 | |
|     // 任务类型 暂时确定4中
 | |
|     public const TYPE_SHARE             = 'share';              // 分享
 | |
|     public const TYPE_SIGN_IN           = 'sign_in';            // 签到
 | |
|     public const TYPE_OFFLINE_SIGN_IN   = 'offline_sign_in';    // 线下签到
 | |
|     public const TYPE_SHARE_SCREENSHOTS = 'share_screenshots';  // 分享截图
 | |
| 
 | |
|     // 奖励类型
 | |
|     public const reward_type_coin           = 'coin';            // 孔雀币
 | |
|     public const reward_type_score          = 'score';        // 积分
 | |
| 
 | |
|     public static function allType(): array
 | |
|     {
 | |
|         return [
 | |
|             self::TYPE_SHARE  => '分享',
 | |
|             self::TYPE_SIGN_IN => '签到',
 | |
|             self::TYPE_OFFLINE_SIGN_IN   => '线下签到',
 | |
|             self::TYPE_SHARE_SCREENSHOTS   => '分享截图',
 | |
|         ];
 | |
|     }
 | |
|     public static function allLogType(): array
 | |
|     {
 | |
|         return [
 | |
|             self::reward_type_coin  => '完成任务奖励孔雀币',
 | |
|             self::reward_type_score => '完成任务奖励积分',
 | |
|         ];
 | |
|     }
 | |
| 
 | |
| 
 | |
|     public static function allRewardType(): array
 | |
|     {
 | |
|         return [
 | |
|             self::reward_type_coin  => '孔雀币',
 | |
|             self::reward_type_score => '积分',
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     public function getStartAtAttr($value)
 | |
|     {
 | |
|         if ($value <= 0) {
 | |
|             return '长期';
 | |
|         }
 | |
|         return date("Y-m-d H:i:s",$value);
 | |
|     }
 | |
|     public function getEndAtAttr($value)
 | |
|     {
 | |
|         if ($value <= 0) {
 | |
|             return '长期';
 | |
|         }
 | |
|         return date("Y-m-d H:i:s",$value);
 | |
|     }
 | |
|     public function setStartAtAttr($value)
 | |
|     {
 | |
|         return strtotime($value);
 | |
|     }
 | |
|     public function setEndAtAttr($value)
 | |
|     {
 | |
|         return strtotime($value);
 | |
|     }
 | |
| 
 | |
| }
 |