Files
duolamaojiazhen/application/api/server/CityService.php
gitfjn f6d50d8d98 城市查询列表
轮播图
首页图标
2025-12-22 21:26:10 +08:00

28 lines
626 B
PHP

<?php
namespace app\api\server;
use think\Db;
use think\facade\Cache;
use think\facade\Config;
class CityService
{
public function list()
{
$cacheKey = 'city_cache_keys';
if (Cache::store('redis')->has($cacheKey)) {
return Cache::store('redis')->get($cacheKey);
}
//查询市级名称
$data = Db::name('dev_region')
->order('id', 'asc')
->field('id,parent_id,name')
->where('level',1)
->select();
if ($data) {
Cache::store('redis')->set($cacheKey, $data);
}
return $data;
}
}