getList([]); return $this->render('index',['city'=>$city]); } /* * 团购列表数据 * */ public function actionIndexform() { $model = new GroupPurchase(); $input = Yii::$app->request->post(); if(!empty($input['title'])) { $model->title = $input['title']; } if(!empty($input['city'])) { $model->city = $input['city']; } if(!empty($input['house_name'])) { $model->hid = $input['house_name']; } $rows = $model->getList(Yii::$app->request->post()); if($rows != null) { foreach ($rows as &$val) { $val['create_at'] = date('Y-m-d',$val['create_at']); $val['update_at'] = date('Y-m-d H:m:s',$val['update_at']); } return Help::JsonData(0,'成功',$model->Total(),$rows); } return Help::JsonCode(Help::ERROR,'暂无信息'); } /* * 团购-添加页面 * */ public function actionAdd() { $city = new \common\models\CategoryCity(); $city->pid = 0; $cityList = $city->getList([],['id','city_name']); return $this->render('add',['city'=>$cityList]); } /* * 添加团购数据 * */ public function actionAddform() { $model = new Group(); $result = $model->GroupAdd(); if($result === true) { return Help::JsonCode(Help::SUCCESS,'团购添加成功'); } return Help::JsonCode(Help::ERROR,'添加失败','团购添加失败'); } /* * 编辑团购页面 * */ public function actionEdit() { $cityModel = new CategoryCity(); $city = $cityModel->getList([]); $group = new GroupPurchase(); $groupData = $group->FindById(Yii::$app->request->get('id')); if($groupData != null) { $url = Yii::$app->params['httpImg']['host'].Yii::$app->params['httpImg']['group']; $groupData['img_pc'] = $url.$groupData['img_pc']; $groupData['img_mobile'] = $url.$groupData['img_mobile']; $groupData['many_img'] = json_decode($groupData['many_img'],true); return $this->render('edit',['city'=>$city,'group'=>$groupData,'post'=>Yii::$app->request->get()]); } } /* * 编辑-团购数据 * */ public function actionEditform() { $model = new Group(); $result = $model->GroupEdit(); if($result === true) { return Help::JsonCode(Help::SUCCESS,'修改成功'); } return Help::JsonCode(Help::ERROR,'修改失败',$auth); } /* * 团购修改状态 * */ public function actionIs_view() { $model = new Group(); if($model->StateAndDel(1) === true) return Help::JsonCode(Help::SUCCESS,'操作成功'); return Help::JsonCode(Help::ERROR,'操作失败'); } /* * 团购删除 * */ public function actionDel() { $model = new Group(); if($model->StateAndDel(2) === true) return Help::JsonCode(Help::SUCCESS,'操作成功'); return Help::JsonCode(Help::ERROR,'操作失败'); } /* * 显示所有楼盘信息页面 * */ public function actionAllhouse() { return $this->render('allhouse'); } /* * 获取所有楼盘数据 * */ public function actionAllhouseform() { $model = new House; $input = Yii::$app->request->post(); if(!empty($input['name'])) { $model->name = $input['name']; } $rows = $model->getList($input); if($rows != null) { return Help::JsonData(0,'成功',$model->getListTotal($input),$rows); } } }