pid = 0; $cityList = $city->getList([], ['city_name', 'id']); return $this->render('index', ['city' => $cityList]); } /* * 获取楼盘列表数据 * */ public function actionIndexform() { $model = new Houses(); $rows = $model->GroupList(Yii::$app->request->post()); if ($rows != null) { return Help::JsonData(0, '成功', $rows['count'], $rows['data']); } } /* * 添加楼盘页面 * */ public function actionCreate() { $model = new Houses(); $rows = $model->HouseRelation(); return $this->render('create', ['model' => $rows]); } /* * 添加楼盘数据 * */ public function actionCreatefrom() { $model = new Houses(); $result = $model->add(Yii::$app->request->post()); if ($result === true) { return Help::JsonCode(200, '新楼盘添加成功'); } return Help::JsonCode(300, '新楼盘添加失败', $result); } /* *修改楼盘的显示页面 * */ public function actionEdit() { $modelDetails = new \common\models\House(); $modelDetails->id = Yii::$app->request->get('id'); $row = $modelDetails->HousesAll(); if ($row != null) { $model = new Houses(); $rows = $model->HouseRelation(); $row['characteristic'] = json_decode($row['characteristic']); $row['type'] = json_decode($row['type']); $row['architecture_type'] = json_decode($row['architecture_type']); $row['property_tag'] = json_decode($row['property_tag']); // $row['fit'] = explode(',',$row['fit']); $row['evaluating'] = json_decode($row['evaluating']); if (empty($row['province'])) { $city = \common\models\CategoryCity::findOne($row['city']); if ($city) { $row['province'] = \common\models\CategoryCity::findOne($city['pid'])['id']; } } // if(!empty($details['architecture_type'])) if (in_array($val['id'], $details['architecture_type'])) echo 'checked' $row['thumb'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['houses'] . $row['thumb'] . Yii::$app->params['pfgwatermark']; $row['video_img'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['house_video'] . $row['video_img'] . Yii::$app->params['pfgwatermark']; $row['panorama_img'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['house_video'] . $row['panorama_img'] . Yii::$app->params['pfgwatermark']; return $this->render('edit', ['model' => $rows, 'details' => $row]); } } /* * 修改楼盘信息 * */ public function actionEditfrom() { $post = Yii::$app->request->post(); $model = new Houses(); $result = $model->Edit($post); if ($result === true) { return Help::JsonCode(Help::SUCCESS, '楼盘修改成功'); } return Help::JsonCode(Help::ERROR, '楼盘修改失败', $result); } /* * 楼盘排序页面 * */ public function actionHousesort() { return $this->render('housesort'); } /* * 排序页面一键清零 * */ public function actionQingzero() { $post = Yii::$app->request->post(); if (empty($post['city'])) return Help::JsonCode(Help::ERROR, '请先选择区域'); $city = CategoryCity::findOne($post['city']); if ($city['pid'] == 0) { $city = CategoryCity::find()->andWhere(['pid' => $city['id'], 'del' => 1])->column(); } else { $city = $city['id']; } $houseid = House::find()->andWhere(['city' => $city, 'del' => 1])->column(); $zero = Yii::$app->request->post('zero'); switch ($zero) { case 1: $state = House::updateAll(['sort' => 0], ['id' => $houseid]); if ($state) return Help::JsonCode(Help::SUCCESS, '清零成功', $zero); break; case 2: $state = HouseDetail::updateAll(['regionsort' => 0], ['hid' => $houseid]); if ($state) return Help::JsonCode(Help::SUCCESS, '清零成功', $zero); break; case 3: $state = HouseDetail::updateAll(['allsort' => 0], ['hid' => $houseid]); if ($state) return Help::JsonCode(Help::SUCCESS, '清零成功', $zero); break; } return Help::JsonCode(Help::ERROR, '没有可清零的数据', $zero); } /* * 单独修改排序 * */ public function actionHousesortedit() { // $model = new \common\models\House(); $input = Yii::$app->request->post(); if (!empty($input['type']) && $input['type'] == 'allsort') { $model = new \common\models\HouseDetail(); $find = $model->FindById($input['id']); } else if (!empty($input['type']) && $input['type'] == 'regionsort') { $model = new \common\models\HouseDetail(); $find = $model->FindById($input['id']); } else { $model = new \common\models\House(); $find = $model->FindById($input['id']); } if ($find != null) { switch ($input['type']) { case 'deal_num': $find->deal_num = $input['deal_num']; break; case 'sort': $find->sort = $input['sort']; break; case 'stars': $find->stars = $input['stars']; break; case 'city_ranking': $find->city_ranking = $input['city_ranking']; break; case 'allsort': $find->allsort = $input['allsort']; break; case 'regionsort': $find->regionsort = $input['regionsort']; break; } if (!empty($input['examineid'])) { switch ($find->is_view) { case 1: $find->is_view = 2; break; case 2: $find->is_view = 1; break; } } if ($find->update(false) == true) return Help::JsonCode(Help::SUCCESS, '操作成功'); } return Help::JsonCode(Help::ERROR, '操作失败'); } /* * 删除楼盘 * */ public function actionHousedel() { $result = \common\models\House::updateAll(['del' => 2, 'update_at' => $_SERVER['REQUEST_TIME']], ['id' => Yii::$app->request->post('hid')]); if ($result > 0) { $arr = []; foreach (Yii::$app->request->post('hid') as $key => $val) { $arr[$key]['uid'] = Yii::$app->session['user_info']['uid']; $arr[$key]['hid'] = $val; $arr[$key]['create_at'] = $_SERVER['REQUEST_TIME']; $arr[$key]['type'] = 2; } $res = Yii::$app->db->createCommand()->batchInsert(\common\models\UserHouse::tableName(), ['uid', 'hid', 'create_at', 'type'], $arr)->execute(); return Help::JsonCode(Help::SUCCESS, '删除成功'); } return Help::JsonCode(Help::ERROR, '删除失败'); } public function actionOpenstate() { $id = Yii::$app->request->get('hid'); if (!empty($id)) { $model = new \common\models\HouseAuditingrecord(); $model->hid = $id; $rows = $model->getList(); if (!empty($rows)) { foreach ($rows as &$val) { $val['create_at'] = date('Y-m-d H:i', $val['create_at']); $val['house_state'] = Yii::$app->params['house_view'][$val['house_state']]; } } return $this->render('openstate', ['hid' => $id, 'model' => $rows]); } } public function actionOpenstateform() { $input = Yii::$app->request->post(); $house = new House(); $find = $house->FindById($input['hid']); if (!empty($find)) { $Transaction = Yii::$app->db->beginTransaction(); $input['house_state'] = $find['is_view']; switch ($find['is_view']) { case 1: $find->is_view = 2; break; case 2: $find->is_view = 1; break; } $input['house_state'] = $find->is_view; $input['uid'] = Yii::$app->session['user_info']['uid']; $model = new \common\models\HouseAuditingrecord(); if ($model->load($input, '') && $model->save() && $find->save(false)) { $Transaction->commit(); return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'edit_success')); } $Transaction->rollBack(); return Help::JsonCode(Help::ERROR, Yii::t('app', 'edit_error'), $model->errors); } } //批量操作 public function actionBatchsave() { return $this->render('batchsave'); } //批量操作 public function actionBatchsaveform() { $input = Yii::$app->request->post(); $model = \common\models\House::updateAll(['is_view' => 2], ['city' => $input['city']]); if ($model > 0) { return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'edit_success')); } return Help::JsonCode(Help::ERROR, Yii::t('app', 'edit_error')); } //================================楼盘资讯====================================== /* * 关联楼盘的资讯 * */ public function actionNewslist() { $model = new \common\models\CategoryNews(); $list = $model->getList([], ['id', 'news_name']); return $this->render('newslist', ['name' => Yii::$app->request->get(), 'category' => $list]); } /* * 获取跟楼盘有关的资讯 * */ public function actionNewslistform() { $model = new Houses(); $result = $model->FilterNews(); if (!empty($result['data'])) { return Help::JsonData(0, '成功', $result['count'], $result['data']); } return Help::JsonCode(Help::ERROR, '暂无关联的资讯信息'); } /* * 加载资讯列表页面, * */ public function actionLoadnews() { $model = new \common\models\CategoryNews(); $list = $model->getList([], ['id', 'news_name']); return $this->render('loadnews', ['category' => $list, 'hid' => Yii::$app->request->get('hid')]); } /* * 加载资讯列表数据, * */ public function actionLoadnewslist() { $model = new Houses(); $rows = $model->FilterLoadNews(); if (!empty($rows)) { return Help::JsonData(0, '成功', $rows['count'], $rows['data']); } return Help::JsonCode(Help::ERROR, '暂无关联的资讯信息'); } /* * 楼盘关联资讯数据 * */ public function actionRelationnews() { $model = new Houses(); $row = $model->RelationNewsRecord(); if ($row === true) return Help::JsonCode(Help::SUCCESS, '资讯加载成功'); return Help::JsonCode(Help::ERROR, '资讯加载失败'); } /* * 删除楼盘关联的资讯 * */ public function actionHousenewsdel() { $model = new \common\models\HouseNews(); $row = $model->FingById(Yii::$app->request->post('dataid')); if ($row != null) { if (Yii::$app->request->post('type') == 2) { if ($row->is_view == 2) { $row->is_view = 1; } else { $row->is_view = 2; } } else { $row->del = 2; } if ($row->update() == true) return Help::JsonCode(Help::SUCCESS, '删除成功'); } return Help::JsonCode(Help::ERROR, '删除失败'); } /* * 删除楼盘关联的资讯(改) * */ public function actionHousenewsdelgai() { $input = Yii::$app->request->post(); if($input['hn'] == 'news'){//资讯是从news表里的 $row = \common\models\News::findOne($input['nid']); $row->hid = 0; if($row->update(false)){ return Help::JsonCode(Help::SUCCESS, '删除成功'); } }elseif(is_numeric($input['hn'])){ $model = new \common\models\HouseNews(); $row = $model->FingById($input['hn']); if($row->delete()){ return Help::JsonCode(Help::SUCCESS, '删除成功'); } } return Help::JsonCode(Help::ERROR, '删除失败'); } //================================楼盘相册====================================== /* * 楼盘相册页面 * */ public function actionAlbum() { $model = new \common\models\CategoryAlbum(); $album = $model->getList([], ['id', 'name']); return $this->render('album', ['post' => Yii::$app->request->get(), 'model' => $album]); } /* * 楼盘相册数据 * */ public function actionAlbumform() { $model = new \common\models\HouseAlbum(); $result = $model->AlbumGroup(Yii::$app->request->post()); // foreach ($result as &$val) // { // $val['state'] = Yii::$app->params['newsStatus'][$val['state']]; // } if ($result != null) { return Help::JsonData(0, '成功', 0, $result); } return Help::JsonCode(Help::ERROR, '暂无相册信息,请添加相册'); } /* * 添加楼盘相册页面 * */ public function actionAlbumadd() { $model = new \common\models\CategoryAlbum(); $album = $model->getList([], ['id', 'name']); return $this->render('albumadd', ['post' => Yii::$app->request->get(), 'model' => $album]); } /* * 添加楼盘相册数据 * */ public function actionAlbumaddform() { $model = new Houses(); $result = $model->HouseAibumCreate(); if ($result === true) { return Help::JsonCode(Help::SUCCESS, '添加成功'); } return Help::JsonCode(Help::ERROR, '添加失败', $result); } /* * 修改楼盘相册页面 * */ public function actionAlbumedit() { $model = new \common\models\CategoryAlbum(); $album = $model->getList([], ['id', 'name']); $modelAlbum = new \common\models\HouseAlbum(); $modelAlbum->hid = Yii::$app->request->get('id'); $modelAlbum->album_id = Yii::$app->request->get('alnumid'); $rows = $modelAlbum->getList(); if ($album != null) { foreach ($album as &$val) { $val['selected'] = ''; if ($val['id'] == Yii::$app->request->get('alnumid')) { $val['selected'] = 'selected'; } } foreach ($rows as &$val) { if (!empty($val['img'])) { $val['img'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['housealbums'] . $val['img'] . Yii::$app->params['pfgwatermark']; } } } return $this->render('albumedit', ['post' => Yii::$app->request->get(), 'model' => $album, 'albumlist' => $rows]); } /* * 修改相册数据 * */ public function actionAlbumeditformdata() { $model = new Houses(); $result = $model->HouseAlbumSave(); if ($result == true) return Help::JsonCode(Help::SUCCESS, '修改成功'); return Help::JsonCode(Help::ERROR, '修改失败'); } /* * 楼盘相册状态修改 * */ public function actionAlbumstatesave() { $model = new Houses(); $row = $model->AlbumStateSave(1); if ($row === true) return Help::JsonCode(Help::SUCCESS, '操作成功'); return Help::JsonCode(Help::ERROR, '操作失败'); } /* * 楼盘相册删除 * */ public function actionAlbumdel() { $model = new Houses(); $row = $model->AlbumStateSave(2); if ($row === true) return Help::JsonCode(Help::SUCCESS, '操作成功'); return Help::JsonCode(Help::ERROR, '操作失败'); } //================================楼盘户型====================================== /* * 楼盘户型页面 * */ public function actionHousetype() { return $this->render('housetype', ['post' => Yii::$app->request->get()]); } /* * 楼盘户型数据 * */ public function actionHousetypeform() { $model = new \common\models\HouseType(); $model->hid = Yii::$app->request->post('hid'); $rows = $model->TypeGroup(); foreach ($rows as &$val) { $val['state'] = Yii::$app->params['newsStatus'][$val['state']]; } if ($rows != null) { return Help::JsonData(0, '成功', 0, $rows); } return Help::JsonCode(Help::ERROR, '暂无户型信息。'); } /* * 楼盘户型添加页面 * */ public function actionHousetypeadd() { $model = new \common\models\CategoryHousetype(); $rows = $model->getList([], ['id', 'huxing_name']); return $this->render('housetypeadd', ['typemodel' => $rows, 'post' => Yii::$app->request->get()]); } /* * 楼盘户型添加数据 * */ public function actionHousetypeaddform() { $model = new Houses(); $result = $model->HouseTypeCreate(); if ($result === true) { return Help::JsonCode(Help::SUCCESS, '添加成功'); } return Help::JsonCode(Help::ERROR, '添加失败', $result); } /* * 楼盘类型修改 * */ public function actionHousetypeedit() { $model = new \common\models\CategoryHousetype(); $houseType = $model->getList([], ['id', 'huxing_name']); $modelAlbum = new \common\models\HouseType(); $modelAlbum->hid = Yii::$app->request->get('id'); $modelAlbum->type_id = Yii::$app->request->get('type'); $rows = $modelAlbum->getList(); $hot = $rows[0]['hot']; if ($houseType != null) { foreach ($houseType as &$val) { $val['selected'] = ''; if ($val['id'] == Yii::$app->request->get('type')) { $val['selected'] = 'selected'; } } foreach ($rows as &$val) { if (!empty($val['img'])) { $val['img'] = Yii::$app->params['httpImg']['hosts'] . Yii::$app->params['httpImg']['housetypes'] . $val['img'] . Yii::$app->params['pfgwatermark']; } } } return $this->render('housetypeedit', ['post' => Yii::$app->request->get(), 'model' => $houseType, 'albumlist' => $rows, 'hot' => $hot]); } /* * 户型数据修改 * */ public function actionHousetypeeditform() { $model = new Houses(); $result = $model->HouseTypeSave(); if ($result === true) return Help::JsonCode(Help::SUCCESS, '修改成功'); return Help::JsonCode(Help::ERROR, '修改失败'); } /* * 户型状态修改 * */ public function actionTypetatesave() { $model = new Houses(); $row = $model->HouseTypeStateSave(1); if ($row === true) return Help::JsonCode(Help::SUCCESS, '操作成功'); return Help::JsonCode(Help::ERROR, '操作失败'); } /* * 楼盘户型删除 * */ public function actionTypedel() { $model = new Houses(); $row = $model->HouseTypeStateSave(2); if ($row === true) return Help::JsonCode(Help::SUCCESS, '操作成功'); return Help::JsonCode(Help::ERROR, '操作失败'); } //================================楼盘价格====================================== /* * 价格历史列表显示页面 * */ public function actionPriceview() { return $this->render('priceview', ['post' => Yii::$app->request->get()]); } /* * 价格历史数据 * */ public function actionPriceviewform() { $model = new \common\models\HousePriceRecord(); // p($_POST); $model->hid = Yii::$app->request->post('hid'); $rows = $model->getList(Yii::$app->request->post()); if ($rows != null) { return Help::JsonData(0, '成功', $model->Total(), $rows); } return Help::JsonCode(Help::ERROR, '暂无历史价格信息'); } /* * 价格添加页面 * */ public function actionPriceadd() { $model = new \common\models\House(); $row = $model->FindById(Yii::$app->request->get('hid')); if ($row != null) { // p($row); return $this->render('priceadd', ['post' => Yii::$app->request->get(), 'model' => $row]); } } /* * 价格数据添加 * */ public function actionPriceaddform() { $model = new Houses(); $result = $model->HousePriceRecordadd(Yii::$app->request->post()); if ($result === true) { return Help::JsonCode(Help::SUCCESS, '操作成功'); } return Help::JsonCode(Help::ERROR, '操作失败', $result); } /* * 价格修改页面 * */ public function actionPriceedit() { $model = new \common\models\HousePriceRecord(); $row = $model->FindById(Yii::$app->request->get('id')); if ($row != null) { return $this->render('priceedit', ['model' => $row, 'post' => Yii::$app->request->get()]); } } /* * 价格数据修改 * */ public function actionPriceeditform() { $model = new Houses(); // p(Yii::$app->request->post()); // exit; // p(Yii::$app->request->post()); $result = $model->HousePriceRecordSave(Yii::$app->request->post()); if ($result === true) { return Help::JsonCode(Help::SUCCESS, '操作成功'); } return Help::JsonCode(Help::ERROR, '操作失败', $result); } /* * 楼盘历史价格删除 * */ public function actionPricedel() { $model = new Houses(); $result = $model->HousePriceDelete(Yii::$app->request->post()); if ($result === true) { return Help::JsonCode(Help::SUCCESS, '操作成功'); } return Help::JsonCode(Help::ERROR, '操作失败', $result); } //================================楼盘周边配套====================================== /* * 楼盘配套显示页面 * */ public function actionPeitao() { $house = new \common\models\HouseDetail(); $input = Yii::$app->request->get(); $ld = $house->FindById($input['id']); return $this->render('peitao', ['post' => $input, 'ld' => $ld]); } /* * 楼盘周边配套列表数据 * */ public function actionPeitaoform() { $model = new \common\models\HouseFacilities(); $model->hid = Yii::$app->request->post('hid'); $rows = $model->FacilitiesGroup(); foreach ($rows as &$val) { $val['state'] = Yii::$app->params['newsStatus'][$val['state']]; } if ($rows != null) { return Help::JsonData(0, '成功', 0, $rows); } return Help::JsonCode(Help::ERROR, '暂无周边配套信息。'); } /* * 楼盘周边配套添加页面 * */ public function actionPeitaoadd() { $model = new \common\models\CategoryFacilities(); $rows = $model->getList([]); $input = Yii::$app->request->get(); return $this->render('peitaoadd', ['post' => $input, 'faci' => $rows]); } /* * 楼盘周边配套添加数据 * */ public function actionPeitaoaddform() { $model = new \common\models\HouseFacilities(); $input = Yii::$app->request->post(); $arr = []; if (!empty($input['data'])) { foreach ($input['data'] as $key => $val) { $arr[$key]['fid'] = $input['type_id']; $arr[$key]['name'] = $val['title']; $arr[$key]['distance'] = $val['rout']; $arr[$key]['latitude_longitude'] = $val['point']; $arr[$key]['hid'] = $input['hid']; $arr[$key]['create_at'] = $_SERVER['REQUEST_TIME']; $arr[$key]['update_at'] = $_SERVER['REQUEST_TIME']; } $result = Yii::$app->db->createCommand()->batchInsert(\common\models\HouseFacilities::tableName(), ['fid', 'name', 'distance', 'latitude_longitude', 'hid', 'create_at', 'update_at'], $arr)->execute(); if ($result > 0) { return Help::JsonCode(Help::SUCCESS, '添加成功'); } } return Help::JsonCode(Help::ERROR, '添加失败'); } /* * 楼盘周边配套修改页面 * */ public function actionPeitaoedit() { if (Yii::$app->request->isPost) { $model = new \common\models\HouseFacilities(); $model->hid = Yii::$app->request->post('hid'); $model->fid = Yii::$app->request->post('fid'); $rows = $model->getList(); if ($rows != null) return Help::JsonData(0, '成功', 0, $rows); } $model = new \common\models\CategoryFacilities(); $rows = $model->getList([]); return $this->render('peitaoedit', ['post' => Yii::$app->request->get(), 'faci' => $rows]); } /* * 楼盘周边配套修改 * */ public function actionPeitaodel() { $input = Yii::$app->request->post(); $result = \common\models\HouseFacilities::updateAll(['del' => 2, 'update_at' => $_SERVER['REQUEST_TIME']], ['fid' => $input['type_id'], 'hid' => $input['hid'], 'del' => 1]); if ($result > 0) { return Help::JsonCode(Help::SUCCESS, '操作成功'); } return Help::JsonCode(Help::ERROR, '操作失败'); } /* * 楼盘周边配套修改数据 * */ public function actionPeitaoeditform() { $input = Yii::$app->request->post(); $result = ''; $arr = []; if (!empty($input['data'])) { foreach ($input['data'] as $key => $val) { $arr[$key]['fid'] = $input['type_id']; $arr[$key]['name'] = $val['title']; $arr[$key]['distance'] = $val['rout']; $arr[$key]['latitude_longitude'] = $val['point']; $arr[$key]['hid'] = $input['hid']; $arr[$key]['create_at'] = $_SERVER['REQUEST_TIME']; $arr[$key]['update_at'] = $_SERVER['REQUEST_TIME']; } $result = Yii::$app->db->createCommand()->batchInsert(\common\models\HouseFacilities::tableName(), ['fid', 'name', 'distance', 'latitude_longitude', 'hid', 'create_at', 'update_at'], $arr)->execute(); } if (!empty($input['dataId'])) { $result = \common\models\HouseFacilities::updateAll(['del' => 2, 'update_at' => $_SERVER['REQUEST_TIME']], ['id' => $input['dataId']]); } return Help::JsonCode(Help::SUCCESS, '修改成功'); if ($result > 0) { return Help::JsonCode(Help::SUCCESS, '修改成功'); } return Help::JsonCode(Help::ERROR, '修改失败'); // // $input = Yii::$app->request->post(); // if(!empty($input['delall'])) // { // $result = \common\models\HouseFacilities::updateAll(['del'=>2,'update_at'=>$_SERVER['REQUEST_TIME']],['id'=>$input['delall']]); // } // $model = new \common\models\HouseFacilities(); // if(!empty($input['edit_matingName'])) // { // // foreach ($input['edit_matingName'] as $key=>$val) // { // $_model = clone $model; // $find = $_model::findOne($input['edit_id'][$key]); // if($find != null) // { // $find->name = $input['edit_matingName'][$key]; // $find->distance = $input['edit_distance'][$key]; // $find->latitude_longitude = $input['edit_longitude'][$key]; // $result = $find->save(); // } // } // } // // if(!empty($input['name'])) // { // // foreach ($input['name'] as $key=>$val) // { // $_model = clone $model; // if(!empty($input['name'][$key])) // { // $arr['name'] = $input['name'][$key]; // } // // if(!empty($input['name'][$key])) // { // $arr['distance'] = $input['distance'][$key]; // } // // if(!empty($input['longitude'][$key])){ // $arr['latitude_longitude'] = $input['longitude'][$key]; // } // // $arr['fid'] = $input['fid']; // $arr['hid'] = $input['hid']; // $auth = $_model->Authenticator($arr); // if(is_array($auth)) return Help::JsonCode(Help::ERROR,'操作失败',$auth); // $result = $auth->save(); // } // } // // if($input['is_fid'] != $input['fid']) // { // $result = \common\models\HouseFacilities::updateAll(['fid'=>$input['is_fid'],'update_at'=>$_SERVER['REQUEST_TIME']],['fid'=>$input['fid'],'hid'=>$input['hid']]); // } // // if($result > 0 ) // { // return Help::JsonCode(Help::SUCCESS,'操作成功'); // } // return Help::JsonCode(Help::ERROR,'操作失败'); } /* * 楼盘预售证列表 - 页面 * */ public function actionPresell() { return $this->render('presell', ['get' => Yii::$app->request->get()]); } /* * 楼盘预售证列表 - 数据 * */ public function actionPresellform() { $model = new HousePermit(); $rows = $model->getList(Yii::$app->request->post()); if (!empty($rows)) { $model->hid = Yii::$app->request->post('hid'); return Help::JsonData(0, Yii::t('app', 'get_success'), $model->Total(), $rows); } return Help::JsonCode(Help::ERROR, Yii::t('app', 'get_error')); } /* * 楼盘预售证添加 - 页面 * */ public function actionPreselladd() { return $this->render('preselladd', ['get' => Yii::$app->request->get()]); } /* * 楼盘预售证添加 -数据 * */ public function actionPreselladdform() { $model = new HousePermit(); $auth = $model->Authenticator(Yii::$app->request->post()); if (is_object($auth)) { if ($auth->save()) return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'add_success')); } return Help::JsonCode(Help::ERROR, Yii::t('app', 'add_error'), $auth); } /* * 楼盘预售证修改 * */ public function actionPreselledit() { $model = new HousePermit(); $find = $model->FindById(Yii::$app->request->get('id')); return $this->render('preselledit', ['model' => $find]); } /* * 楼盘预售证修改 - 数据 * */ public function actionPreselleditform() { $model = new HousePermit(); $input = Yii::$app->request->post(); $row = $model->Authenticator($input); if (is_object($row)) { $find = $model->FindById($input['id']); if (!empty($find)) { $auth = Help::SetAttr($input, $row, $find); if ($auth->save()) return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'edit_success')); } } return Help::JsonCode(Help::ERROR, Yii::t('app', 'edit_error'), $row); } /* * 楼盘预售证删除 * */ public function actionPreselldel() { $model = new HousePermit(); $del = $model->FindById(Yii::$app->request->post('id')); if (!empty($del)) { $del->del = 2; if ($del->save()) return Help::JsonCode(Help::SUCCESS, Yii::t('app', 'edit_success')); } return Help::JsonCode(Help::ERROR, Yii::t('app', 'edit_error')); } }