render('freshimg'); } /* * 新房- 大图 数据 * */ public function actionFreshimgform() { $url = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['fresh']; $model = new PushFreshimg(); $rows = $model->getList(Yii::$app->request->post()); if(!empty($rows)) { foreach ($rows as &$val) { $val['img'] = $url.$val['img']; $val['create_at'] = date('Y-m-d H:i',$val['create_at']); } return Help::JsonData(0,Yii::t('app','get_error'),$model->Total(),$rows); } return Help::JsonCode(Help::ERROR,Yii::t('app','get_error')); } /* * 新房- 大图 添加页面 * */ public function actionFreshimgadd() { return $this->render('freshimgadd'); } /* * 新房- 大图 添加数据 * */ public function actionFreshimgaddform() { $model = new PushFreshimg(); $input = Yii::$app->request->post(); $auth = $model->Authenticator($input); if(is_object($auth)) { Yii::$app->params['img_url']['fresh']; $img = UploadFile::InstanceImgName('img', Yii::$app->params['img_url']['fresh']); if(is_string($img)) { $auth->img = $img; } if($auth->save(false)) return Help::JsonCode(Help::SUCCESS,Yii::t('app','add_success')); } return Help::JsonCode(Help::ERROR,Yii::t('app','add_erroe'),$auth); } /* * 新房- 大图 修改页面 * */ public function actionFreshimgedit() { $input = Yii::$app->request->get(); $model = new PushFreshimg(); $row = $model->FindById($input['id']); if(!empty($row)) { $row['img'] = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['fresh'].$row['img']; return $this->render('freshimgedit',['model'=>$row]); } } /* * 新房- 大图 修改数据 * */ public function actionFresheditform() { $input = Yii::$app->request->post(); $model = new PushFreshimg(); $auth = $model->Authenticator($input); if(is_object($auth)) { $row = $model->FindById($input['id']); if(!empty($row)) { $row = Help::SetAttr($input,$auth,$row); $url = Yii::$app->params['img_url']['fresh'];; $img = UploadFile::InstanceImgName('img',$url); if(is_string($img)) { UploadFile::delImg($url,$row->img); $row->img = $img; } if($row->save(false)) return Help::JsonCode(Help::SUCCESS,Yii::t('app','edit_success')); } } return Help::JsonCode(Help::ERROR,Yii::t('app','edit_error')); } /* * 新房- 大图 删除和隐藏 * */ public function actionFreshdelandsow() { $model = new PushFreshimg(); $input = Yii::$app->request->post(); $row = $model->FindById($input['id']); if($row != null) { switch ($input['type']) { case 'show': if($row->is_show == 1) { $row->is_show = 2; } else if($row->is_show == 2) { $row->is_show = 1; } break; case 'del': $row->del = 2; break; } if($row->save(false)) return Help::JsonCode(Help::SUCCESS,Yii::t('app','edit_success')); } return Help::JsonCode(Help::ERROR,Yii::t('app','edit_error')); } /* * 新房 - 推荐楼盘区域页面 * */ public function actionFreshcity() { return $this->render('freshcity'); } /* * 新房 - 推荐楼盘区域数据 * */ public function actionFreshcityform() { $model = new PushFreshcity(); $rows = $model->getList(Yii::$app->request->post()); if(!empty($rows)) { foreach ($rows as &$val) { $val['img'] = Yii::$app->params['httpImg']['host']. Yii::$app->params['httpImg']['city'].$val['img']; $val['create_at'] = date('Y-m-d H:i',$val['create_at']); } return Help::JsonData(0,Yii::t('app','get_success'),$model->Total(),$rows); } return Help::JsonCode(Help::ERROR,Yii::t('app','get_error')); } /* * 新房 - 推荐楼盘区域 添加页面 * */ public function actionFreshcityadd() { return $this->render('freshcityadd'); } /* * 新房 - 推荐楼盘区域 添加数据 * */ public function actionFreshcityaddform() { $input = Yii::$app->request->post(); $model = new PushFreshcity(); $auth = $model->Authenticator($input); if(is_object($auth)) { $img = UploadFile::InstanceImgName('img',Yii::$app->params['img_url']['city']); if(is_string($img)) { $auth->img = $img; } if($auth->save(false)) return Help::JsonCode(Help::SUCCESS,Yii::t('app','add_success')); } return Help::JsonCode(Help::ERROR,Yii::t('app','add_error'),$auth); } /* * 新房 - 推荐楼盘区域 修改页面 * */ public function actionFreshcityedit() { $model = new PushFreshcity(); $row = $model->FindById(Yii::$app->request->get('id')); if(!empty($row)) { $row['img'] = Yii::$app->params['httpImg']['host']. Yii::$app->params['httpImg']['city'].$row['img']; return $this->render('freshcityedit',['model'=>$row,'name'=>Yii::$app->request->get('name')]); } } /* * 新房 - 推荐楼盘区域 修改数据 * */ public function actionFreshcityeditform() { $model = new PushFreshcity(); $input = Yii::$app->request->post(); $auth = $model->Authenticator($input); if(is_object($auth)) { $row = $model->FindById($input['id']); if(!empty($row)) { $rows = Help::SetAttr($input,$auth,$row); $img = UploadFile::InstanceImgName('img',Yii::$app->params['img_url']['city']); if(is_string($img)) { UploadFile::delImg(Yii::$app->params['img_url']['city'],$row->img); $rows->img = $img; } if($rows->save(false)) return Help::JsonCode(Help::SUCCESS,Yii::t('app','edit_success')); } } return Help::JsonCode(Help::ERROR,Yii::t('app','edit_error'),$auth); } public function actionCitydelandshow() { $model = new PushFreshcity(); $input = Yii::$app->request->post(); $row = $model->FindById($input['id']); if($row != null) { switch ($input['type']) { case 'show': if($row->is_show == 1) { $row->is_show = 2; } else if($row->is_show == 2) { $row->is_show = 1; } break; case 'del': $row->del = 2; break; case 'sort': $row->sort = $input['sort']; break; } if($row->save(false)) return Help::JsonCode(Help::SUCCESS,Yii::t('app','edit_success')); } return Help::JsonCode(Help::ERROR,Yii::t('app','edit_error')); } /* * 新房 - 推荐楼盘区域 关联楼盘 * */ public function actionCityhouse() { return $this->render('cityhouse',['id'=>Yii::$app->request->get('id')]); } /* * 新房 - 推荐楼盘区域 关联楼盘 * */ public function actionCityhouseform() { $model = new PushFreshcityhouse(); $rows = $model->getList(Yii::$app->request->post()); if(!empty($rows)) { $model->city_id = Yii::$app->request->post('city_id'); foreach ($rows as &$val) { $val['create_at'] = date('Y-m-d H:i',$val['create_at']); } return Help::JsonData(0,Yii::t('app','get_success'),$model->Total(),$rows); } return Help::JsonCode(Help::ERROR,Yii::t('app','get_error')); } /* * 新房 - 推荐楼盘区域 关联楼盘 * */ public function actionCityhouseadd() { return $this->render('cityhouseadd',['id'=>Yii::$app->request->get('id')]); } /* * 新房 - 推荐楼盘区域 关联楼盘 * */ public function actionCityhouseaddform() { $model = new PushFreshcityhouse(); $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 actionCityhousedelandshow() { $model = new PushFreshcityhouse(); $input = Yii::$app->request->post(); $row = $model->FindById($input['id']); if($row != null) { switch ($input['type']) { case 'show': if($row->is_show == 1) { $row->is_show = 2; } else if($row->is_show == 2) { $row->is_show = 1; } break; case 'del': $row->del = 2; break; case 'sort': $row->sort = $input['sort']; break; } if($row->save(false)) return Help::JsonCode(Help::SUCCESS,Yii::t('app','edit_success')); } return Help::JsonCode(Help::ERROR,Yii::t('app','edit_error')); } }