Feedback.php 892 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. use traits\model\SoftDelete;
  5. use app\common\Enum\FeedbackEnum;
  6. class Feedback extends Model
  7. {
  8. use SoftDelete;
  9. // 表名
  10. protected $table = 'shop_feedback';
  11. // 自动写入时间戳字段
  12. protected $autoWriteTimestamp = 'integer';
  13. // 定义时间戳字段名
  14. protected $createTime = 'createtime';
  15. protected $updateTime = 'updatetime';
  16. protected $deleteTime = 'deletetime';
  17. // 追加属性
  18. protected $append = [
  19. ];
  20. public function user()
  21. {
  22. return $this->belongsTo('User', 'user_id', 'id');
  23. }
  24. public function getTypeTextAttr($value, $data)
  25. {
  26. return FeedbackEnum::getFeedbackTypeText($data['type']);
  27. }
  28. public function getImageTextAttr($value, $data){
  29. return json_decode($data['images'], true);
  30. }
  31. }