HotelRoomModel.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\common\model;
  3. use app\api\controller\Hotel;
  4. use think\Db;
  5. use think\Model;
  6. /**
  7. * 群组
  8. */
  9. class HotelRoomModel extends Model
  10. {
  11. // 表名
  12. protected $name = 'hotel_room';
  13. // 开启自动写入时间戳字段
  14. protected $autoWriteTimestamp = false;
  15. // 定义时间戳字段名
  16. protected $createTime = false;
  17. protected $updateTime = false;
  18. protected $deleteTime = false;
  19. public function getWifiPhoneAttr($value, $data)
  20. {
  21. return explode(',',$value);
  22. }
  23. public function getRoomLayoutAttr($value, $data)
  24. {
  25. return explode(',',$value);
  26. }
  27. public function getWashUseAttr($value, $data)
  28. {
  29. return explode(',',$value);
  30. }
  31. public function getFacilityAttr($value, $data)
  32. {
  33. return explode(',',$value);
  34. }
  35. public function getBathroomAttr($value, $data)
  36. {
  37. return explode(',',$value);
  38. }
  39. public function getImageAttr($value, $data)
  40. {
  41. return cdnurl($value);
  42. }
  43. public function getImagesAttr($value, $data)
  44. {
  45. $value = explode(',',$value);
  46. foreach ($value as &$v){
  47. $v = cdnurl($v);
  48. }
  49. return $value;
  50. }
  51. public function hotel()
  52. {
  53. return $this->hasOne(HotelModel::class, 'id', 'hotel_id');
  54. }
  55. }