WxLive.php 851 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\common\model\plus\live;
  3. use app\common\model\BaseModel;
  4. /**
  5. * 微信直播模型
  6. */
  7. class WxLive extends BaseModel
  8. {
  9. protected $name = 'app_wx_live';
  10. protected $pk = 'live_id';
  11. //附加字段
  12. protected $append = ['start_time_text','end_time_text'];
  13. /**
  14. * 有效期-开始时间
  15. * @param $value
  16. * @return array
  17. */
  18. public function getStartTimeTextAttr($value, $data)
  19. {
  20. return date('Y-m-d H:i:s', $data['start_time']);
  21. }
  22. /**
  23. * 有效期-开始时间
  24. * @param $value
  25. * @return array
  26. */
  27. public function getEndTimeTextAttr($value, $data)
  28. {
  29. return date('Y-m-d H:i:s', $data['end_time']);
  30. }
  31. /**
  32. * 详情
  33. */
  34. public static function detail($live_id)
  35. {
  36. return (new static())->find($live_id);
  37. }
  38. }