城市查询列表
轮播图 首页图标
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user