FanGet.php 964 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace catchAdmin\wind\model\get;
  3. use catchAdmin\system\model\SysDictData;
  4. use think\facade\Db;
  5. trait FanGet
  6. {
  7. public function getWindNameAttr()
  8. {
  9. $wind_id = $this->wind_id;
  10. $wind_name = Db::name('wind')->where('id',$wind_id)->value('name');
  11. return $wind_name;
  12. }
  13. public function getImgAttr()
  14. {
  15. $data = $this->getData('img');
  16. if(empty($data))
  17. {
  18. $data = [];
  19. }
  20. else
  21. {
  22. $data = json_decode($data,true);
  23. }
  24. return $data;
  25. }
  26. public function setImgAttr($value)
  27. {
  28. return json_encode($value);
  29. }
  30. public function getModelNameAttr()
  31. {
  32. $id = $this->fan_model;
  33. $name = Db::name('device_mold')->where('id',$id)->where('device_type',4)->value('name');
  34. return $name;
  35. }
  36. public function getFanModelAttr($value)
  37. {
  38. return (int)$value;
  39. }
  40. }