BaseUserDiscount.php 607 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\data\model;
  3. use think\admin\Model;
  4. /**
  5. * 用户优惠方案模型
  6. * Class BaseUserDiscount
  7. * @package app\data\model
  8. */
  9. class BaseUserDiscount extends Model
  10. {
  11. /**
  12. * 格式化等级规则
  13. * @param mixed $value
  14. * @return mixed
  15. */
  16. public function getItemsAttr($value)
  17. {
  18. return empty($value) ? $value : json_decode($value, true);
  19. }
  20. /**
  21. * 格式化创建时间
  22. * @param string $value
  23. * @return string
  24. */
  25. public function getCreateAtAttr(string $value): string
  26. {
  27. return format_datetime($value);
  28. }
  29. }