ADD:添加后台管理端接口;
DEL:删除不必要的头部注释; FIX:修正若干已知错误;
This commit is contained in:
@@ -1,39 +1,51 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-22T07:30:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T09:17:33+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace api\controllers\gm\v1;
|
||||
|
||||
use Yii;
|
||||
use yii\data\Pagination;
|
||||
use yii\helpers\Url;
|
||||
|
||||
// use backend\models\Citys;
|
||||
|
||||
class CityController extends Common
|
||||
{
|
||||
//主界面
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
//主界面
|
||||
public function actionIndex()
|
||||
{
|
||||
return $this->render('../layouts/dev', []);
|
||||
$apis = [
|
||||
'list'=>'城市列表',
|
||||
];
|
||||
$this->result('您正使用CMTS-GM系统车主管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
public function actionSelect()
|
||||
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'];
|
||||
$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
|
||||
]);
|
||||
|
||||
return ['res'=>$citys];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user