54 lines
1.3 KiB
PHP
Executable File
54 lines
1.3 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* @Author: fm453
|
|
* @Date: 2018-08-17 19:39:41
|
|
* @Last Modified by: fm453
|
|
* @Last Modified time: 2021-09-11 07:37:17
|
|
* @Email: fm453@lukegzs.com
|
|
*/
|
|
namespace backend\controllers;
|
|
|
|
use Yii;
|
|
use yii\data\Pagination;
|
|
use yii\helpers\Url;
|
|
// use addons\models\Citys;
|
|
|
|
class CityController extends \yii\web\Controller
|
|
{
|
|
//替代常规的_construct 析构函数;其他方法调用前执行
|
|
public function init()
|
|
{
|
|
parent::init();
|
|
$session = Yii::$app->session;
|
|
if(isset($_GET['pid']) && (int)$_GET['pid']>0){
|
|
$session->set('pid',(int)$_GET['pid']);
|
|
}
|
|
$pid = $session->get('pid');
|
|
if(!$pid){
|
|
return Yii::$app->response->redirect(['index/index']);
|
|
}
|
|
}
|
|
|
|
//主界面
|
|
public function actionIndex()
|
|
{
|
|
return $this->render('../layouts/dev',[]);
|
|
}
|
|
|
|
public function actionSelect()
|
|
{
|
|
$citys = Yii::$app->params['citys'];
|
|
$pager = new Pagination(['totalCount' =>count($citys), 'pageSize' => '100']);
|
|
$callback = isset($_GET['callback']) ? $_GET['callback'] : 'city';
|
|
$search=[];
|
|
return $this->render('select',[
|
|
'citys'=>$citys,
|
|
'pager' => $pager,
|
|
'search'=>$search,
|
|
'callback'=>$callback
|
|
]);
|
|
}
|
|
|
|
}
|