HouseDetail.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/3/4
  6. * Time: 上午9:34
  7. */
  8. namespace common\models;
  9. use Yii;
  10. class HouseDetail extends Common
  11. {
  12. public function rules()
  13. {
  14. return [
  15. ['phone_sales', 'string', 'max' => '15'],
  16. ['main_units', 'string', 'max' => 80],
  17. ['longitude_latitude', 'string', 'max' => 50],
  18. ['info', 'string'],
  19. // ['evaluating','string'],
  20. ['price_unit', 'in', 'range' => Yii::$app->params['HousePriceUnit']],
  21. [['open_time', 'launch_time'], 'string', 'max' => 50],
  22. [['address', 'sales_address', 'land_agent', 'panorama'], 'string', 'max' => 100],
  23. ['house_cx', 'string', 'max' => 50],
  24. ['developers', 'string', 'max' => 50],
  25. [['property_company', 'property_costs', 'sale_permit'], 'string', 'max' => 50],
  26. ['preferential', 'string', 'max' => 100],
  27. ['planning_area', 'string', 'max' => 20],
  28. ['features', 'string', 'max' => 2000],
  29. ['parking_num', 'string', 'max' => 20],
  30. ['total_building', 'string', 'max' => 10],
  31. [['bus_route', 'floor_condition'], 'string', 'max' => 200],
  32. [['construction_area', 'planning_households'], 'string', 'max' => 50],
  33. [['volume_rate', 'greening_rate'], 'string', 'max' => 50],
  34. ['hot', 'in', 'range' => [1, 2]],
  35. ['property_tag', 'each', 'rule' => ['integer']],
  36. // ['fit','each','rule'=>['integer']]
  37. ['fit', 'in', 'range' => array_flip(Yii::$app->params['Housefit'])],
  38. ['panorama', 'default', 'value' => ''],
  39. [['push_reason', 'preferential_price', 'preferential_zt'], 'string'],
  40. ['video_url', 'string'], ['video_img', 'string'], ['panorama_img', 'string'],
  41. ];
  42. }
  43. public function attributeLabels()
  44. {
  45. return [
  46. 'phone_sales' => '电话号码',
  47. 'main_units' => '主力户型',
  48. 'address' => '项目地址',
  49. 'sales_address' => '售楼地址',
  50. 'property_company' => '物业公司',
  51. 'property_costs' => '物业费',
  52. 'sale_permit' => '许可证号',
  53. 'preferential' => '优惠信息',
  54. 'planning_area' => '占地面积',
  55. 'parking_num' => '车位数量',
  56. 'volume_rate' => '容积率',
  57. 'total_building' => '总栋数',
  58. 'longitude_latitude' => '经纬度',
  59. 'panorama' => 'VR全景看房',
  60. 'greening_rate' => '绿化率',
  61. 'house_cx' => '产权年限',
  62. 'info' => '文章内容',
  63. 'bus_route' => '公交路线',
  64. 'construction_area' => '建筑面积',
  65. 'planning_households' => '总户数',
  66. 'floor_condition' => '楼层状况',
  67. 'features' => '楼盘特点',
  68. 'hot' => '热门楼盘',
  69. 'property_tag' => '楼盘标签',
  70. 'developers' => '开发商',
  71. 'open_time' => '开盘时间',
  72. 'launch_time' => '交房时间',
  73. 'land_agent' => '投资商',
  74. 'price_unit' => '价格单位',
  75. 'fit' => '装修情况',
  76. 'evaluating' => '楼盘评测',
  77. ];
  78. }
  79. public function Authenticator($input)
  80. {
  81. $this->load($input, '');
  82. if (!$this->validate()) return $this->errors;
  83. return $this;
  84. }
  85. public function FindById($id)
  86. {
  87. return self::findOne($id);
  88. }
  89. }