1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/3/13
- * Time: 上午8:46
- */
- namespace backend\controllers;
- use backend\base\CommonController;
- use backend\base\Help;
- use backend\server\NewsInformation;
- use common\models\CategoryCity;
- use common\models\Developers;
- use common\models\House;
- use common\models\PushmMansion;
- use Yii;
- use common\models\PushmRotation;
- use common\models\PushmVilla;
- use common\models\PushmMenu;
- use common\models\PushmRecommend;
- use common\models\PushChoice;
- use common\models\PushmHouse;
- use common\models\PushmCity;
- use common\models\PushmTimelimitsgroup;
- use common\models\PushmCharacteristic;
- use backend\server\UploadFile;
- /*
- * 热门区域 type = 1
- * 首页-拨打电话号码- 随机区域 type = 2
- *
- * */
- class PushmController extends CommonController
- {
- /*
- * 豪宅专区
- * */
- public function actionMansion ()
- {
- return $this->render( 'mansion' );
- }
-
- /*
- * 豪宅专区 - 数据
- * */
- public function actionMansionform ()
- {
- $model = new PushmMansion();
- $input = Yii::$app->request->post();
- $rows = $model->getList( $input );
-
- if ( $rows != null ) {
- $imgUrl = Yii::$app->params[ 'httpImg' ][ 'host' ] . Yii::$app->params[ 'httpImg' ][ 'housealbum' ];
- foreach ( $rows as &$val ) {
- $val[ 'create_at' ] = date( 'Y-m-d H:i' , $val[ 'create_at' ] );
- $val[ 'img' ] = $imgUrl . $val[ 'img' ];
- }
- return Help::JsonData( 0 , Yii::t( 'app' , 'get_success' ) , $model->Total( Yii::$app->request->post() ) , $rows );
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'get_error' ) );
- }
-
- /*
- * 豪宅专区 - 添加页面
- * */
- public function actionMansionadd ()
- {
- $developers = $this->Developers();
- return $this->render( 'mansionadd' , [ 'developers' => $developers ] );
- }
-
- /*
- * 豪宅专区 - 添加页面 - 添加数据
- * */
- public function actionMansionaddform ()
- {
- $model = new PushmMansion();
- $input = Yii::$app->request->post();
-
- if ( $input != null ) {
- $url = Yii::$app->params[ 'img_url' ][ 'housealbum' ];
- $img = UploadFile::InstanceImgName( 'img' , $url );
-
- if ( is_string( $img ) ) {
- $model->img = $img;
- }
-
- if ( $model->load( $input , '' ) && $model->save( false ) ) return Help::JsonCode( Help::SUCCESS , '添加成功' );
- }
- return Help::JsonCode( Help::ERROR , '添加失败' );
- }
-
- /*
- * 豪宅专区 - 修改页面
- * */
- public function actionMansionedit ()
- {
- $model = new PushmMansion();
- $input = Yii::$app->request->get();
- $row = $model->FindById( $input[ 'id' ] );
-
- if ( $row != null ) {
- $house = new House();
- $house = $house->FindById( $row[ 'hid' ] );
-
- $developers = $this->Developers();
- foreach ( $developers as &$val ) {
- $val[ 'checked' ] = '';
- if ( $val[ 'id' ] == $row[ 'did' ] ) {
- $val[ 'checked' ] = 'selected';
- }
- }
-
- $imgUrl = Yii::$app->params[ 'httpImg' ][ 'host' ] . Yii::$app->params[ 'httpImg' ][ 'housealbum' ];
- $row[ 'img' ] = $imgUrl . $row[ 'img' ];
-
- return $this->render( 'mansionedit' , [ 'model' => $row , 'house' => $house , 'developers' => $developers ] );
- }
- }
-
- /*
- * 豪宅专区 - 修改页面 - 修改数据
- * */
- public function actionMansioneditform ()
- {
- $model = new PushmMansion();
- $input = Yii::$app->request->post();
- $row = $model->FindById( $input[ 'id' ] );
-
- if ( $row != null ) {
- $url = Yii::$app->params[ 'img_url' ][ 'housealbum' ];
- $img = UploadFile::InstanceImgName( 'img' , $url );
-
- if ( is_string( $img ) ) {
- UploadFile::delImg( $url , $row->img );
- $row->img = $img;
- }
-
- if ( $row->load( $input , '' ) && $row->update() == true ) return Help::JsonCode( Help::SUCCESS , '修改成功' );
- }
-
- return Help::JsonCode( Help::ERROR , '修改失败' );
- }
-
- /*
- * 豪宅专区 - 审核排序删除
- * */
- public function actionMansiondelshow ()
- {
- $model = new PushmMansion();
- $input = Yii::$app->request->post();
- $row = $model->FindById( $input[ 'id' ] );
-
- if ( $row != null ) {
- switch ( $input[ 'type' ] ) {
- case 'sort':
- $row->sort = $input[ 'sort' ];
- break;
-
- case 'show':
- if ( $row->is_show == 1 ) {
- $row->is_show = 2;
- } else {
- $row->is_show = 1;
- }
- break;
-
- case 'del':
- if ( !empty( $row->img ) ) {
- UploadFile::delImg( Yii::$app->params[ 'img_url' ][ 'housealbum' ] , $row->img );
- }
- if ( $row->delete() ) {
- return Help::JsonCode( Help::SUCCESS , '删除成功' );
- }
- break;
- }
- if ( $row->update( false ) ) return Help::JsonCode( Help::SUCCESS , '修改成功' );
- }
-
- return Help::JsonCode( Help::ERROR , '修改失败' );
- }
-
- /*
- * 豪宅专区 - 批量删除
- * */
- public function actionMansiondelall ()
- {
- $input = Yii::$app->request->post();
- $model = PushmMansion::find()->where( [ 'in' , 'id' , $input[ 'id' ] ] )->all();
- $delall = PushmMansion::deleteAll( [ 'id' => $input[ 'id' ] ] );
-
- if ( $delall ) {
- foreach ( $model as $value ) {
- UploadFile::delImg( Yii::$app->params[ 'img_url' ][ 'housealbum' ] , $value[ 'img' ] );
- }
- return Help::JsonCode( Help::SUCCESS , '批量删除成功' );
- }
- return Help::JsonCode( Help::ERROR , '批量删除失败' );
- }
-
-
- /*
- * 推送首页轮播
- * */
- public function actionRotation ()
- {
- $city = $this->City();
- return $this->render( 'rotation' , [ 'city' => $city ] );
- }
-
- /*
- * 推送首页轮播数据
- * */
- public function actionRotationforms ()
- {
- $model = new PushmRotation();
-
- $rows = $model->getList( Yii::$app->request->post() );
- if ( $rows != null ) {
- $imgUrl = Yii::$app->params[ 'httpImg' ][ 'host' ] . Yii::$app->params[ 'httpImg' ][ 'push_lb' ];
- foreach ( $rows as &$val ) {
- $val[ 'create_at' ] = date( 'Y-m-d H:i' , $val[ 'create_at' ] );
- $val[ 'img' ] = $imgUrl . $val[ 'img' ];
- }
- return Help::JsonData( 0 , Yii::t( 'app' , 'get_success' ) , $model->Total( Yii::$app->request->post() ) , $rows );
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'get_error' ) );
- }
-
- /*
- * 推送首页轮播 - 添加页面
- */
- public function actionRotationadd ()
- {
- $cityModel = $this->City();
- return $this->render( 'rotationadd' , [ 'city' => $cityModel ] );
- }
-
- /*
- * 推送首页轮播 - 添加数据
- */
- public function actionRotationform ()
- {
- try {
- $model = new PushmRotation();
- $input = Yii::$app->request->post();
- $url = Yii::$app->params[ 'img_url' ][ 'push_lb' ];
- $img = UploadFile::InstanceImgName_v1( 'img' , $url );
- if ( is_string( $img ) ) {
- $input[ 'img' ] = $img;
- }
- $model->load( $input , '' );
- if ( $model->save() ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'add_success' ) );
- return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'add_error' ) , $model->errors );
- } catch ( \Exception $e ) {
- return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'add_error' ) , $e->getMessage() );
-
- }
-
- }
-
- /*
- * 推送首页轮播 - 修改
- */
- public function actionRotationedit ()
- {
- $model = new PushmRotation();
- $input = Yii::$app->request->get();
- $row = $model->FindById( $input[ 'id' ] );
- if ( $row != null ) {
- $imgUrl = Yii::$app->params[ 'httpImg' ][ 'host' ] . Yii::$app->params[ 'httpImg' ][ 'push_lb' ];
- $row[ 'img' ] = $imgUrl . $row[ 'img' ];
- $cityModel = $this->City();
- foreach ( $cityModel as &$val ) {
- $val[ 'checked' ] = '';
- if ( $val[ 'id' ] == $row[ 'city' ] ) {
- $val[ 'checked' ] = 'selected';
- }
- }
- return $this->render( 'rotationedit' , [ 'model' => $row , 'city' => $cityModel ] );
- }
- }
-
- /*
- * 推送首页轮播 - 修改数据
- * */
- public function actionRotationeditform ()
- {
- $model = new PushmRotation();
- $input = Yii::$app->request->post();
- $setAttribute = $model->Authenticator( $input );
- if ( is_object( $setAttribute ) ) {
- $row = $model->FindById( $input[ 'id' ] );
- if ( $row != null ) {
- $row = Help::SetAttr( $input , $model , $row );
- $url = Yii::$app->params[ 'img_url' ][ 'push_lb' ];
- $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' ) , $setAttribute );
- }
-
- /*
- * 推送首页轮播 - 删除 and 禁用
- * */
- public function actionImgdelshow ()
- {
- $model = new PushmRotation();
- $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 'sort':
- if ( is_numeric( $input[ 'sort' ] ) ) {
- $row->sort = $input[ 'sort' ];
- }
-
- break;
- case 'del':
- if ( $row->delete() ) {
- UploadFile::delImg( Yii::$app->params[ 'img_url' ][ 'push_lb' ] , $row->img );
- return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'edit_success' ) );
- }
- break;
- case 'expiration':
- $row->expiration_date = $input[ 'expiration' ];
- 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 actionVilla ()
- {
- return $this->render( 'villa' );
- }
-
- /*
- * 推送首页轮播数据
- * */
- public function actionVillaforms ()
- {
- $model = new PushmVilla();
- $rows = $model->getList( Yii::$app->request->post() );
- if ( $rows != null ) {
- $imgUrl = Yii::$app->params[ 'httpImg' ][ 'host' ] . Yii::$app->params[ 'httpImg' ][ 'villa' ];
- foreach ( $rows as &$val ) {
- $val[ 'create_at' ] = date( 'Y-m-d H:i' , $val[ 'create_at' ] );
- $val[ 'img' ] = $imgUrl . $val[ 'img' ];
- }
- return Help::JsonData( 0 , Yii::t( 'app' , 'get_success' ) , $model->Total() , $rows );
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'get_error' ) );
- }
-
- /*
- * 推送首页轮播 - 添加页面
- */
- public function actionVillaadd ()
- {
- $cityModel = $this->City();
- $developers = $this->Developers();
- return $this->render( 'villaadd' , [ 'city' => $cityModel , 'developers' => $developers ] );
- }
-
- /*
- * 推送首页轮播 - 添加数据
- */
- public function actionVillaform ()
- {
- $model = new PushmVilla();
- $input = Yii::$app->request->post();
- $model = $model->Authenticator( $input );
- if ( is_object( $model ) ) {
- $url = Yii::$app->params[ 'img_url' ][ 'villa' ];
- $img = UploadFile::InstanceImgName( 'img' , $url );
- if ( is_string( $img ) ) {
- $model->img = $img;
- //压缩图片
- $compressParams = [];
- $compressParams[ 'data' ][ 'imgname' ] = $img;;
- $compressParams[ 'data' ][ 'url' ] = $url;
- $compressParams[ 'data' ][ 'source' ] = '移动端推送位,首页热门活动@添加';
- $ya = new \backend\event\TinifyEvent();
- $ya->CompressImg( $compressParams );
- }
- if ( $model->save( false ) ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'add_success' ) );
- }
- return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'add_error' ) , $model );
- }
-
- /*
- * 推送首页轮播 - 修改
- */
- public function actionVillaedit ()
- {
- $model = new PushmVilla();
- $input = Yii::$app->request->get();
- $row = $model->FindById( $input[ 'id' ] );
- if ( $row != null ) {
- $imgUrl = Yii::$app->params[ 'httpImg' ][ 'host' ] . Yii::$app->params[ 'httpImg' ][ 'villa' ];
- $row[ 'img' ] = $imgUrl . $row[ 'img' ];
- $cityModel = $this->City();
- $developers = $this->Developers();
- foreach ( $cityModel as &$val ) {
- $val[ 'checked' ] = '';
- if ( $val[ 'id' ] == $row[ 'city' ] ) {
- $val[ 'checked' ] = 'selected';
- }
- }
- foreach ( $developers as &$val ) {
- $val[ 'checked' ] = '';
- if ( $val[ 'id' ] == $row[ 'developers' ] ) {
- $val[ 'checked' ] = 'selected';
- }
- }
- return $this->render( 'villaedit' , [ 'model' => $row , 'city' => $cityModel , 'developers' => $developers ] );
- }
- }
-
- /*
- * 推送首页轮播 - 修改数据
- * */
- public function actionVillaeditform ()
- {
- $model = new PushmVilla();
- $input = Yii::$app->request->post();
- $setAttribute = $model->Authenticator( $input );
- if ( is_object( $setAttribute ) ) {
- $row = $model->FindById( $input[ 'id' ] );
- if ( $row != null ) {
- $row = Help::SetAttr( $input , $model , $row );
- $url = Yii::$app->params[ 'img_url' ][ 'villa' ];
- $img = UploadFile::InstanceImgName( 'img' , $url );
- if ( is_string( $img ) ) {
- UploadFile::delImg( $url , $row->img );
- $row->img = $img;
- //压缩图片
- $compressParams = [];
- $compressParams[ 'data' ][ 'imgname' ] = $img;;
- $compressParams[ 'data' ][ 'url' ] = $url;
- $compressParams[ 'data' ][ 'source' ] = '移动端推送位,首页热门活动@修改';
- $ya = new \backend\event\TinifyEvent();
- $ya->CompressImg( $compressParams );
- }
- if ( $row->save( false ) ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'edit_success' ) );
- }
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'edit_error' ) , $setAttribute );
- }
-
- /*
- * 推送首页轮播 - 删除 and 禁用
- * */
- public function actionVillaimgdelshow ()
- {
- $model = new PushmVilla();
- $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 actionRecommend ()
- {
-
- return $this->render( 'recommend' );
- }
-
- public function actionRecommendform ()
- {
- $model = new PushmRecommend();
- $input = Yii::$app->request->post();
- $rows = $model->getList( $input );
- if ( $rows != null ) {
- 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::JsonData( Help::ERROR , Yii::t( 'app' , 'get_error' ) , 0 );
- }
-
- /*
- * 移动端导航推荐
- * */
- public function actionMenu ()
- {
- return $this->render( 'menu' );
- }
-
- /*
- * 推送移动端导航推荐
- * */
- public function actionMenuforms ()
- {
- $model = new PushmMenu();
- $rows = $model->getList( Yii::$app->request->post() );
- if ( $rows != null ) {
- 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 actionMenuadd ()
- {
- $cityModel = $this->City();
- $menu = $this->parentMenu();
- return $this->render( 'menuadd' , [ 'city' => $cityModel , 'menu' => $menu ] );
- }
-
- //*获取父级菜单*/
- private function parentMenu ()
- {
- $frontend = new \common\models\Frontend();
- //$menu=$frontend->PidList(0)
- return $frontend->PidList( 0 );
- }
-
- /*
- * 推送移动端导航推荐
- */
- public function actionMenuform ()
- {
- $model = new PushmMenu();
- $input = Yii::$app->request->post();
- $model = $model->Authenticator( $input );
- if ( is_object( $model ) ) {
- if ( $model->save( false ) ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'add_success' ) );
- }
- return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'add_error' ) , $model );
- }
-
- public function actionMenudel ()
- {
- $model = new PushmMenu();
- $input = Yii::$app->request->post();
- $row = $model->FindById( $input[ 'id' ] );
- if ( $row != null ) {
- switch ( $input[ 'type' ] ) {
- 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 actionRecommendadd ()
- {
- return $this->render( 'recommendadd' );
-
- }
-
- /*
- * 首页-品房推荐 - 添加数据
- * */
- public function actionRecommendaddform ()
- {
- $model = new PushmRecommend();
- $input = Yii::$app->request->post();
- $auth = $model->Authenticator( $input );
- if ( is_object( $auth ) ) {
- // $url = Yii::$app->params['img_url']['hot_activity'];
- // $img = UploadFile::InstanceImgName('img',$url);
- // if(is_string($img))
- // {
- // $auth->img = $img;
- // }
-
- 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 actionRecommendedit ()
- {
- $model = new PushmRecommend();
- $row = $model->FindById( Yii::$app->request->get( 'id' ) );
- if ( $row != null ) {
- return $this->render( 'recommendedit' , [ 'model' => $row ] );
- }
- }
-
- /*
- * 首页-品房推荐 - 修改数据
- * */
- public function actionRecommendeditform ()
- {
- $model = new PushmRecommend();
- $input = Yii::$app->request->post();
- $setAttribute = $model->Authenticator( $input );
- if ( is_object( $setAttribute ) ) {
- $row = $model->FindById( $input[ 'id' ] );
- if ( $row != null ) {
- $row = Help::SetAttr( $input , $model , $row );
-
- if ( $row->save() ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'edit_success' ) );
- }
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'edit_error' ) , $setAttribute );
- }
-
- /*
- * 首页-品房推荐 - 删除 and 禁用
- * */
- public function actionRecommenddelshow ()
- {
- $model = new PushmRecommend();
- $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 actionHotsale ()
- {
- return $this->render( 'hotsale' , [ 'type' => 1 ] );
- }
-
-
- /*
- * 首页-热销楼盘 - 数据
- * */
- public function actionHotsaleform ()
- {
- $model = new PushmHouse();
- $input = Yii::$app->request->post();
- if ( !empty( $input[ 'city_id' ] ) ) {
-
- $input[ 'city_id' ] = explode( ',' , $input[ 'city_id' ] );
- }
- $result = $model->getList( $input );
-
-
- if ( $result != null ) {
- foreach ( $result as &$val ) {
- $val[ 'create_at' ] = date( 'Y-m-d H:i' , $val[ 'create_at' ] );
- }
-
- return Help::JsonData( 0 , Yii::t( 'app' , 'get_success' ) , $model->Totalhotsalefeng( $input ) , $result );
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'get_error' ) );
- }
-
- /*
- * 首页-热销楼盘 - 添加
- */
- public function actionHotsaleadd ()
- {
- return $this->render( 'hotsaleadd' , [ 'type' => Yii::$app->request->get( 'type' ) ] );
- }
-
- /*
- * 首页-热销楼盘 - 添加数据
- */
- public function actionHotsaleaddform ()
- {
- $input = Yii::$app->request->post();
- $model = new PushmHouse();
- $model->scenario = 'add';
- $validate = $model->Authenticator( $input );
- if ( is_object( $validate ) ) {
- if ( $validate->save( false ) ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'add_success' ) );
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'add_error' ) , $validate );
- }
-
- /*
- * 首页-热销楼盘- - 删除 and 禁用
- * */
- public function actionSaledelshow ()
- {
- $model = new PushmHouse();
- $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':
- if ( is_numeric( $input[ '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 actionHotsaledelall ()
- {
- $input = Yii::$app->request->post();
- $delall = PushmHouse::deleteAll( [ 'id' => $input[ 'id' ] ] );
-
- if ( $delall ) {
- return Help::JsonCode( Help::SUCCESS , '批量删除成功' );
- }
- return Help::JsonCode( Help::ERROR , '批量删除失败' );
- }
-
- /*
- * 搜索框 - 热门筛选
- * */
- public function actionHotscreen ()
- {
- return $this->render( 'hotsale' , [ 'type' => 2 ] );
- }
-
- /*
- * 首页 - 精选楼盘
- * */
- public function actionHotselected ()
- {
-
- return $this->render( 'hotsale' , [ 'type' => 4 , 'city_id' => Yii::$app->request->get( 'city_id' ) ] );
- }
-
- /*
- *首页-热门地区
- * */
- public function actionHotcity ()
- {
- return $this->render( 'hotcity' , [ 'type' => 1 ] );
- }
-
- /*
- * 首页-热门区域-数据列表
- * */
- public function actionHotcityform ()
- {
- $model = new PushmCity();
-
- $input = Yii::$app->request->post();
- $model->type = $input[ 'type' ];
- $rows = $model->getList( $input );
- 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 , '成功' , $model->Total() , $rows );
- }
- }
-
- /*
- * 首页-热门区域-数据列表
- * */
- public function actionHotcityadd ()
- {
- $cityModel = ( new CategoryCity() )->SortgetList( [] );
- return $this->render( 'hotcityadd' , [ 'type' => Yii::$app->request->get( 'type' ) , 'city' => $cityModel ] );
- }
-
- /*
- * 首页-热门区域-数据列表
- * */
- public function actionHotcityaddform ()
- {
- $model = new PushmCity();
-
- $input = Yii::$app->request->post();
- $model->scenario = 'add';
- $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 actionHotcityedit ()
- {
- $model = new PushmCity();
- $input = Yii::$app->request->get();
- $row = $model->FindById( $input[ 'id' ] );
- if ( $row != null ) {
- $cityModel = ( new CategoryCity() )->SortgetList( [] );
- foreach ( $cityModel as &$val ) {
- $val[ 'checked' ] = '';
- if ( $val[ 'id' ] == $row[ 'city_id' ] ) {
- $val[ 'checked' ] = 'selected';
- }
- }
- return $this->render( 'hotcityedit' , [ 'model' => $row , 'city' => $cityModel ] );
- }
- }
-
- /*
- * 推送首页轮播 - 修改数据
- * */
- public function actionHotcityeditform ()
- {
- $model = new PushmCity();
- $input = Yii::$app->request->post();
- $setAttribute = $model->Authenticator( $input );
- if ( is_object( $setAttribute ) ) {
- $row = $model->FindById( $input[ 'id' ] );
- if ( $row != null ) {
- $row = Help::SetAttr( $input , $model , $row );
- if ( $row->save( false ) ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'edit_success' ) );
- }
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'edit_error' ) , $setAttribute );
- }
-
-
- /*
- * 首页-精选 - 删除 and 禁用
- * */
- public function actionCitydelshow ()
- {
- $model = new PushmCity();
- $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':
- if ( !empty( $row->img ) ) {
- UploadFile::delImg( Yii::$app->params[ 'img_url' ][ 'city' ] , $row->img );
- }
- if ( $row->delete() ) {
- return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'edit_success' ) );
- }
- break;
- case 'sort':
- if ( !is_numeric( $input[ 'sort' ] ) ) {
- return Help::JsonCode( Help::ERROR , '请输入数字' );
- }
- $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 actionCharacteristic ()
- {
- return $this->render( 'characteristic' );
- }
-
- /*
- * 首页-特色类型 数据
- * */
- public function actionCharacteristicform ()
- {
- $model = new PushmCharacteristic();
- $input = Yii::$app->request->post();
- $rows = $model->getList( $input );
- if ( !empty( $rows ) ) {
- $url = Yii::$app->params[ 'httpImg' ][ 'host' ] . Yii::$app->params[ 'httpImg' ][ 'characteristic' ];
- foreach ( $rows as &$val ) {
- $val[ 'create_at' ] = date( 'Y-m-d H:i' , $val[ 'create_at' ] );
- $val[ 'img' ] = $url . $val[ 'img' ];
- }
- return Help::JsonData( 0 , Yii::t( 'app' , 'get_success' ) , $model->Total() , $rows );
- }
- }
-
- /*
- * 首页-特色类型 添加页面
- * */
- public function actionCharacteristicadd ()
- {
- return $this->render( 'characteristicadd' );
- }
-
- /*
- * 首页-特色类型 添加页面
- * */
- public function actionCharacteristicaddform ()
- {
- $model = new PushmCharacteristic();
- $input = Yii::$app->request->post();
- $auth = $model->Authenticator( $input );
- if ( is_object( $auth ) ) {
- $url = Yii::$app->params[ 'img_url' ][ 'characteristic' ];
- $imgStr = UploadFile::InstanceImgName( 'img' , $url );
- if ( is_string( $imgStr ) ) {
- $auth->img = $imgStr;
- }
- 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 actionCharacteristicedit ()
- {
- $model = new PushmCharacteristic();
- $row = $model->FindById( Yii::$app->request->get( 'id' ) );
- if ( $row != null ) {
- $row[ 'img' ] = Yii::$app->params[ 'httpImg' ][ 'host' ] . Yii::$app->params[ 'httpImg' ][ 'characteristic' ] . $row[ 'img' ];
- return $this->render( 'characteristicedit' , [ 'model' => $row , 'get' => Yii::$app->request->get() ] );
- }
-
- }
-
-
- /*
- * 首页-特色类型 修改页面
- * */
- public function actionCharacteristiceditform ()
- {
- $model = new PushmCharacteristic();
- $input = Yii::$app->request->post();
- $auth = $model->Authenticator( $input );
- if ( is_object( $auth ) ) {
- $row = $model->FindById( $input[ 'id' ] );
- if ( !empty( $row ) ) {
- $url = Yii::$app->params[ 'img_url' ][ 'characteristic' ];
- $imgStr = UploadFile::InstanceImgName( 'img' , $url );
- $result = Help::SetAttr( $input , $auth , $row );
- if ( is_string( $imgStr ) ) {
- UploadFile::delImg( $url , $row[ 'img' ] );
- $result->img = $imgStr;
- }
- if ( $result->save( false ) ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'edit_success' ) );
- }
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'edit_error' ) , $auth );
- }
-
- /*
- * 首页-特色类型 - 删除 and 禁用
- * */
- public function actionCharacteristicdelshow ()
- {
- $model = new PushmCharacteristic();
- $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':
- if ( !empty( $row->img ) ) {
- UploadFile::delImg( Yii::$app->params[ 'img_url' ][ 'characteristic' ] , $row->img );
- }
- if ( $row->delete() ) {
- return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'edit_success' ) );
- }
- break;
- case 'sort':
- if ( !is_numeric( $input[ 'sort' ] ) ) {
- return Help::JsonCode( Help::ERROR , '请输入数字' );
- }
- $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 actionRandcity ()
- {
- return $this->render( 'randcity' , [ 'type' => 2 ] );
- }
-
- /*
- * 首页 - 拨打电话 数据
- * */
- public function actionRandcityform ()
- {
- $model = new PushmCity();
-
- $input = Yii::$app->request->post();
- $model->type = $input[ 'type' ];
- $rows = $model->getList( $input );
- if ( !empty( $rows ) ) {
- foreach ( $rows as &$val ) {
- $val[ 'create_at' ] = date( 'Y-m-d H:i' , $val[ 'create_at' ] );
- }
- return Help::JsonData( 0 , '成功' , $model->Total() , $rows );
- }
- }
-
- /*
- * 首页 - 拨打电话 添加页面
- * */
- public function actionRandcityadd ()
- {
- return $this->render( 'randcityadd' , [ 'type' => Yii::$app->request->get( 'type' ) ] );
- }
-
- /*
- * 首页 - 拨打电话 添加数据
- * */
- public function actionRandcityaddform ()
- {
-
- }
-
- /********限时团购*********/
- public function actionTimelimitsgroup ()
- {
- $cityModel = $this->City();
- return $this->render( 'timelimitsgroup' , [ 'type' => 1 , 'city' => $cityModel ] );
- }
-
- public function actionTimelimitsgroupform ()
- {
- $model = new PushmTimelimitsgroup();
- $input = Yii::$app->request->post();
- $result = $model->getList( $input );
-
- if ( $result != null ) {
- foreach ( $result 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( $input ) , $result );
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'get_error' ) );
- }
-
- public function actionTimelimitsgroupadd ()
- {
- $cityModel = $this->City();
- return $this->render( 'timelimitsgroupadd' , [ 'type' => Yii::$app->request->get( 'type' ) , 'city' => $cityModel ] );
- }
-
- public function actionTimelimitsgroupaddform ()
- {
- $input = Yii::$app->request->post();
- $model = new PushmTimelimitsgroup();
- $model->scenario = 'add';
- $validate = $model->Authenticator( $input );
- if ( is_object( $validate ) ) {
- if ( $validate->save( false ) ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'add_success' ) );
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'add_error' ) , $validate );
- }
-
- /*
- * 首页 - 修改页面
- */
- public function actionTimelimitsgroupedit ()
- {
- $model = new PushmTimelimitsgroup();
- $cityModel = $this->City();
- $row = $model->FindById( Yii::$app->request->get( 'id' ) );
- if ( $row != null ) {
- return $this->render( 'timelimitsgroupedit' , [ 'type' => Yii::$app->request->get( 'type' ) , 'row' => $row , 'house_name' => Yii::$app->request->get( 'house_name' ) , 'city' => $cityModel ] );
- }
- }
-
- /*
- * 显示抢购 修改数据
- * */
- public function actionTimelimitsgroupeditform ()
- {
- $model = new PushmTimelimitsgroup();
- $input = Yii::$app->request->post();
- $setAttribute = $model->Authenticator( $input );
- if ( is_object( $setAttribute ) ) {
- $row = $model->FindById( $input[ 'id' ] );
- if ( $row != null ) {
- $row = Help::SetAttr( $input , $model , $row );
-
- if ( $row->save() ) return Help::JsonCode( Help::SUCCESS , Yii::t( 'app' , 'edit_success' ) );
- }
- }
- return Help::JsonCode( Help::ERROR , Yii::t( 'app' , 'edit_error' ) , $setAttribute );
- }
-
- /*排序 删除 显示*/
- public function actionTimelimitsgroupdelandshow ()
- {
- $model = new PushmTimelimitsgroup();
- $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;
- case 'click':
- $row->click = $input[ 'click' ];
- break;
- case 'group_num':
- $row->group_num = $input[ 'group_num' ];
- 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' ) );
- }
-
- private function Developers ()
- {
- $developers = new \common\models\Developers();
- $developers->is_del = 1;
- $developers = $developers->getList( [] );
- return $developers;
- }
-
- private function City ()
- {
- $city = new \common\models\CategoryCity();
- $city->state = 1;
- $city->pid = 0;
- $cityModel = $city->getList( [] );
- return $cityModel;
- }
-
- public function actionHothouse ()
- {
- return $this->render( 'hothouse' , [ 'type' => 1 ] );
- }
-
- /**
- * 添加推送楼盘
- * @return string
- */
- public function actionHothouseadd ()
- {
- return $this->render( 'hothouseadd' , [ 'type' => Yii::$app->request->get( 'type' ) ] );
- }
- }
|