1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace common\models;
- class HousePrice extends AllclickRecord
- {
- public function rules()
- {
- return [
- ['price', 'required', 'message' => '户型不能为空'],
- ['state', 'in', 'range' => [1, 2]],
- ['del', 'in', 'range' => [1, 2]],
- ];
- }
- public function FindById($id)
- {
- return self::findOne($id);
- }
- public function getList($input, $arr = null)
- {
- $query = self::find();
- $query->select($arr);
- $query = $this->WhereFouse($query);
- if (!empty($input['page'])) {
- $query->offset = ($input['page'] - 1) * $input['limit'];
- $query->limit = $input['limit'];
- }
- return $query->orderBy(['sort' => SORT_ASC])->asArray()->all();
- }
- public function WhereFouse($query)
- {
- $query->andFilterWhere(['del' => $this->setDel]);
- $query->andFilterWhere(['price' => $this->price]);
- $query->andFilterWhere(['state' => $this->state]);
- return $query;
- }
- public function Total()
- {
- $query = self::find();
- $query = $this->WhereFouse($query);
- return $query->count();
- }
- }
|