12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace catchAdmin\wind\model\get;
- use catchAdmin\system\model\SysDictData;
- use think\facade\Db;
- trait FanGet
- {
- public function getWindNameAttr()
- {
- $wind_id = $this->wind_id;
- $wind_name = Db::name('wind')->where('id',$wind_id)->value('name');
- return $wind_name;
- }
- public function getImgAttr()
- {
- $data = $this->getData('img');
- if(empty($data))
- {
- $data = [];
- }
- else
- {
- $data = json_decode($data,true);
- }
- return $data;
- }
- public function setImgAttr($value)
- {
-
- return json_encode($value);
- }
-
- public function getModelNameAttr()
- {
- $id = $this->fan_model;
- $name = Db::name('device_mold')->where('id',$id)->where('device_type',4)->value('name');
- return $name;
- }
- public function getFanModelAttr($value)
- {
- return (int)$value;
- }
- }
|