Guarantee.php 974 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class Guarantee extends Model
  5. {
  6. // 表名
  7. protected $name = 'shop_guarantee';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = 'int';
  10. // 定义时间戳字段名
  11. protected $createTime = 'createtime';
  12. protected $updateTime = 'updatetime';
  13. protected $deleteTime = false;
  14. // 追加属性
  15. protected $append = [
  16. 'status_text'
  17. ];
  18. protected static $tagCount = 0;
  19. public function getStatusList()
  20. {
  21. return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
  22. }
  23. public function getStatusTextAttr($value, $data)
  24. {
  25. $value = $value ?: ($data['status'] ?? '');
  26. $list = $this->getStatusList();
  27. return $list[$value] ?? '';
  28. }
  29. public function getImageAttr($value, $data)
  30. {
  31. $value = $value ? $value : "/assets/addons/shop/img/checked.png";
  32. return cdnurl($value, true);
  33. }
  34. }