request->post(); $listhouseModel = new ListHouse(); return $listhouseModel->getList($input); } //添加listhouse信息 public function addListHouse() { $input = Yii::$app->request->post(); $data = []; if (!empty($input['hid']) && !empty($input['list_id'])) { $data['hid'] = $input['hid']; $data['list_id'] = $input['list_id']; } else { return ['code' => '300', 'msg' => '信息不全']; } $listhouseModel = new ListHouse(); if ($listhouseModel->listExists(['list_id' => $data['list_id'], 'hid' => $data['hid']])) { return ['code' => '300', 'msg' => '该楼盘已经存在']; } if (isset($input['informationInfo']) && is_array($input['informationInfo'])) { $data['information'] = json_encode($input['informationInfo'], JSON_UNESCAPED_UNICODE); } $listhouseModel->load($data, ''); if ($listhouseModel->validate() && $listhouseModel->save()) { return ['code' => '200', 'msg' => '新增完成']; } else { return ['code' => '300', 'msg' => '新增失败']; } } //执行修改 public function editListHouse() { $input = Yii::$app->request->post(); if (isset($input['informationInfo']) && is_array($input['informationInfo'])) { $input['information'] = json_encode($input['informationInfo'], JSON_UNESCAPED_UNICODE); unset($input['informationInfo']); } $rows = ListHouse::findOne($input['id']); unset($input['id']); $rows->load($input, ''); if ($rows->update()) { return ['code' => '200', 'msg' => '修改完成']; } else { return ['code' => '200', 'msg' => '修改失败']; } } /* * 列表数据状态设置 * */ public function setList() { $input = Yii::$app->request->post(); if (!empty($input['id'])) { $model = ListHouse::findOne($input['id']); switch ($input['code']) { case 'del': if ($model->delete()) return ['code' => 200, 'msg' => '删除完成']; break; case 'state': $model->state = $input['val']; if ($model->save()) return ['code' => 200, 'msg' => '状态设置完成']; break; case 'sort': $model->sort = $input['val']; if ($model->save()) return ['code' => 200, 'msg' => '排序设置完成']; break; } return ['code' => 300, 'msg' => '执行失败']; } } //数据添加验证 public function varcherListInfo() { $input = Yii::$app->request->post(); switch ($input['list_id']){ case 10://3DVR if(!(Vr::find()->where(['hid'=>$input['hid']])->exists())) return ['code'=>300,'msg'=>'该楼盘不存在3DVR']; break; case 11://航拍 $data = HouseDetail::findOne($input['hid']); if(empty($data['panorama'])) return ['code'=>300,'msg'=>'该楼盘不存在航拍720视频']; break; } return ['code'=>200,'msg'=>'信息符合']; } //====================================================================================================================== }