52 lines
1.1 KiB
PHP
Executable File
52 lines
1.1 KiB
PHP
Executable File
<?php
|
||
|
||
namespace api\controllers\gm\v1;
|
||
|
||
use Yii;
|
||
|
||
class CityController extends Common
|
||
{
|
||
//主界面
|
||
public function beforeAction($action)
|
||
{
|
||
if (!$this->pid) {
|
||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||
}
|
||
return parent::beforeAction($action);
|
||
}
|
||
|
||
//主界面
|
||
public function actionIndex()
|
||
{
|
||
$apis = [
|
||
'list'=>'城市列表',
|
||
];
|
||
$this->result('您正使用CMTS-GM系统车主管理接口!', $apis, 200);
|
||
}
|
||
|
||
public function actionList()
|
||
{
|
||
$s = $this->search();
|
||
$res = $s['res'];
|
||
if (!$res) {
|
||
$this->result('没有查询到相应的数据!', [], 0);
|
||
}
|
||
|
||
$return = [];
|
||
$return['code'] = 200;
|
||
$return['msg'] = '查询成功!';
|
||
$return['data']= [
|
||
'total'=>count($res),
|
||
'citys' => $res,
|
||
'page'=>$this->page
|
||
];
|
||
$this->result($return['msg'], $return['data'], $return['code']);
|
||
}
|
||
|
||
private function search(){
|
||
$citys = Yii::$app->params['citys'];
|
||
|
||
return ['res'=>$citys];
|
||
}
|
||
}
|