Feedback.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\model\user;
  12. use app\common\model\BaseModel;
  13. class Feedback extends BaseModel
  14. {
  15. public static function tablePk(): ?string
  16. {
  17. return 'feedback_id';
  18. }
  19. public static function tableName(): string
  20. {
  21. return 'feedback';
  22. }
  23. public function getImagesAttr($val)
  24. {
  25. return $val ? json_decode($val, true) : [];
  26. }
  27. public function setImagesAttr($val)
  28. {
  29. return json_encode($val ?: []);
  30. }
  31. public function getUpdateTimeAttr($value)
  32. {
  33. if ($value) return date('m月d日',strtotime($value));
  34. return $value;
  35. }
  36. public function user()
  37. {
  38. return $this->hasOne(User::class,'uid','uid');
  39. }
  40. public function type()
  41. {
  42. return $this->hasOne(FeedBackCategory::class,'feedback_category_id','type');
  43. }
  44. }