Frozen.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Modes;
  3. use Illuminate\Database\Eloquent\Model;
  4. /**
  5. * App\Modes\Frozen
  6. *
  7. * @property int $id
  8. * @property int $uid
  9. * @method static \Illuminate\Database\Eloquent\Builder|\App\Modes\Frozen whereCreatedAt($value)
  10. * @method static \Illuminate\Database\Eloquent\Builder|\App\Modes\Frozen whereId($value)
  11. * @method static \Illuminate\Database\Eloquent\Builder|\App\Modes\Frozen whereFrozenTime($value)
  12. * @method static \Illuminate\Database\Eloquent\Builder|\App\Modes\Frozen whereThawTime($value)
  13. * @method static \Illuminate\Database\Eloquent\Builder|\App\Modes\Frozen whereUid($value)
  14. * @mixin \Eloquent
  15. * @property string $content 分类名称
  16. * @property int $type 1-实体 2-虚拟
  17. */
  18. class Frozen extends Model
  19. {
  20. protected $table = 'frozen';
  21. public static function getUserFrozentimeList($uid,$start,$end){
  22. $list=Frozen::whereUid($uid)->get();
  23. $arr=[];
  24. $kkk=0;
  25. if(!empty($list)){
  26. foreach($list as $k=>$item){
  27. if($item->frozen_time>$start && (empty($item->thaw_time) || $item->thaw_time<$end)){
  28. $thawtime=empty(strtotime($item->thaw_time))?date('Y-m-d H:i:s'):$item->thaw_time;
  29. $arr[$kkk]['startime']=$item->frozen_time;
  30. $arr[$kkk]['endtime']=$thawtime;
  31. $kkk++;
  32. }
  33. }
  34. }
  35. return $arr;
  36. }
  37. }