OrderEffectiveLog.php 702 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\common\model\orders;
  3. use app\common\model\BaseModel;
  4. use app\common\model\goods\Goods;
  5. /**
  6. * @author 林海涛
  7. * @date 2024/7/17 下午5:23
  8. */
  9. class OrderEffectiveLog extends BaseModel
  10. {
  11. protected $name = 'order_effective_log';
  12. public function goods()
  13. {
  14. return $this->hasOne(Goods::class, 'id', 'goods_id');
  15. }
  16. public function getEndEffectiveTimeAttr($value,$data)
  17. {
  18. return !empty($data['end_effective_time'])?date('Y-m-d H:i:s',$data['end_effective_time']):'';
  19. }
  20. public static function getEffectiveUnitTextAttr($value,$data)
  21. {
  22. $type = [1 => '天',2=> '小时'];
  23. return $type[$data['effective_unit']];
  24. }
  25. }