/** * Displays homepage. * * @return 首页 */ public function actionIndex() { $cache = \Yii::$app->cache; if (!$cache->get('city')) { $Region = new FinRegion(); $dependency = new \yii\caching\FileDependency(['fileName' => 'example.txt']); $regionval = $Region->getProvince(); $cache->set('city', json_encode($regionval, JSON_UNESCAPED_UNICODE), 3600, $dependency); } return $this->render('index'); }
public function actionPart() { /* 表单模型 */ $model = new FinJobDetails(); /* 兼职类型数据 */ $part = new FinPartType(); $parttype = $part->partComment(); foreach ($parttype as $k => $v) { $data[$v['part_id']] = $v['part_name']; } /* 查询省份 */ $region = new FinRegion(); $province = $region->getProvince(); return $this->render("part", ['model' => $model, 'data' => $data, 'province' => $province]); }
public function actionIndex() { $model = new MerchantBase(); $session = Yii::$app->session; $session->open(); $mer_id = $session->get('user_id') ? $session->get('user_id') : 1; $model = $model->findOne($mer_id); //获取分类 $MerType = new MerType(); $type = $MerType->getType(); $childtype = $MerType->getChildType($model->ind_type); /* 查询省份 */ $region = new FinRegion(); $province = $region->getProvince(); //print_r($model);die; //print_r($model->mer_province);die; $citys = $region->getRegion($model->mer_province); //print_r($citys);die; $areas = $region->getRegion($model->mer_city); //是否被修改 $is_update = Yii::$app->request->get("re"); return $this->render('index', ['model' => $model, 'province' => $province, 'citys' => $citys, 'areas' => $areas, 'type' => $type, 'childtype' => $childtype, 'is_update' => $is_update]); }