request->post(); $rows = $model->getList($input,['id as city_id','city_name']); return $this->render('home',['rows'=>$rows]); } /* * 价格走势 列表 数据 * */ public function actionHomeform() { $model = new Pricetrends(); $model->city_id=Yii::$app->request->post("city_id"); $rows = $model->getList(Yii::$app->request->post()); foreach($rows as $k=>$v) { $model->city_id=$v['city_id']; $data = $model->getCityList(Yii::$app->request->post()); $rows[$k]['count']=count($data); } if(!empty($rows)) { return Help::JsonData(0,'成功',$model->Total(),$rows); } return Help::JsonCode(Help::ERROR,Yii::t('app','get_error')); } /* * 区域历史价格 页面 * */ public function actionRecordprice() { return $this->render('recordprice',['cid'=>Yii::$app->request->get('cid')]); } /* * 区域历史价格数据 * */ public function actionRecordpriceform() { $model = new Pricetrends(); $model->city_id = Yii::$app->request->post('city_id'); $rows = $model->getCityList(Yii::$app->request->post()); if(!empty($rows)) { $arr = Yii::$app->params['CityPriceTrend']; foreach ($rows as &$val) { if(isset($arr[$val['trend']]) && !empty($arr[$val['trend']])) { $val['trend'] = $arr[$val['trend']]; } } return Help::JsonData(0,'成功',$model->cityTotal(),$rows); } return Help::JsonCode(Help::ERROR,Yii::t('app','get_error')); } /* * 价格走势 添加 页面 * */ public function actionPriceadd() { $model = new CategoryCity(); $input = Yii::$app->request->post(); $rows = $model->getList($input,['id','city_name']); return $this->render('priceadd',['rows'=>$rows]); } /* * 价格走势 添加 数据 * */ public function actionPriceaddform() { $model = new \common\models\Pricetrends(); $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 actionPriceedit() { $model = new Pricetrends(); $row = $model->FindById(Yii::$app->request->get('id')); return $this->render('priceedit',['model'=>$row]); } /* * 修改单个区域里面的历史记录 数据 * */ public function actionPriceeditform() { $model = new Pricetrends(); $auth = $model->Authenticator(Yii::$app->request->post()); if(is_object($auth)) { $row = $model->FindById(Yii::$app->request->post('id')); if(!empty($row)) { $attr = Help::SetAttr(Yii::$app->request->post(),$auth,$row); if($attr->save()) { return Help::JsonCode(Help::SUCCESS,Yii::t('app','edit_success')); } } } return Help::JsonCode(Help::ERROR,Yii::t('app','edit_error'),$auth); } /* * 行里添加按钮 * */ public function actionLineadd() { return $this->render('lineadd',['model'=>Yii::$app->request->get()]); } /* * 删除单个区域里面的历史记录 数据 * */ public function actionPricedel() { $model = new Pricetrends(); $row = $model->FindById(Yii::$app->request->post('id')); if(!empty($row)) { $row->del = 2; if($row->save(false)) return Help::JsonCode(Help::SUCCESS,Yii::t('app','edit_success')); } return Help::JsonCode(Help::ERROR,Yii::t('app','edit_error')); } }