28 lines
557 B
PHP
28 lines
557 B
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\api\server\CityService;
|
|
|
|
class City extends ApiBase
|
|
{
|
|
public $like_not_need_login = ['index'];
|
|
|
|
// 类型属性声明
|
|
protected CityService $cityService;
|
|
|
|
/**
|
|
* 构造函数 - 必须初始化类型属性
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
// 初始化服务
|
|
$this->cityService = new CityService();
|
|
}
|
|
public function index()
|
|
{
|
|
$array = $this->cityService->list();
|
|
return $this->_success($array);
|
|
}
|
|
} |