城市查询列表
轮播图 首页图标
This commit is contained in:
2
.idea/php.xml
generated
2
.idea/php.xml
generated
@@ -73,7 +73,7 @@
|
||||
<path value="$PROJECT_DIR$/vendor/aliyuncs/oss-sdk-php" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.0">
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.4">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
|
||||
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@@ -2,6 +2,5 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/duolamaojiazhen" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -9,6 +9,11 @@ use think\Db;
|
||||
class Ad extends ApiBase
|
||||
{
|
||||
public $like_not_need_login = ['lists','channel','label','add_comost','add_comost','list_comost','follow_comost','comost_add','label_edit','comost_info','notice','position','position_list','vode_type','video_list','video_info','user_wages','user_wages_add','user_leave','fine','recruit','last_leave','last_fine','notice_list','leave','auth'];
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* 广告图片展示
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
$pid = $this->request->get('pid');
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"php": ">=7.4",
|
||||
"topthink/framework": "5.1.*",
|
||||
"topthink/think-captcha": "2.0.*",
|
||||
"overtrue/wechat": "~4.0",
|
||||
|
||||
@@ -1,29 +1,49 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 缓存设置
|
||||
// +----------------------------------------------------------------------
|
||||
use think\facade\Env;
|
||||
return [
|
||||
|
||||
// 缓存配置为文件类型
|
||||
'type' => 'complex',
|
||||
|
||||
// 默认缓存配置
|
||||
'default' => [
|
||||
// 驱动方式
|
||||
'type' => Env::get('cache.type','File'),
|
||||
'type' => 'File',
|
||||
// 缓存保存目录
|
||||
'path' => '',
|
||||
// 缓存前缀
|
||||
'prefix' => 'like_shop_',
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'expire' => 0,
|
||||
],
|
||||
|
||||
// Redis缓存配置
|
||||
'redis' => [
|
||||
// 驱动方式
|
||||
'type' => 'redis',
|
||||
// Redis服务器地址
|
||||
'host' => Env::get('cache.host','127.0.0.1'),
|
||||
// Redis服务器端口
|
||||
'port' => Env::get('cache.port','6379'),
|
||||
// Redis连接密码(留空表示无密码)
|
||||
'password' => Env::get('cache.pwd',''),
|
||||
// Redis数据库索引(0-15,默认为0)
|
||||
'select' => Env::get('cache.select', 0),
|
||||
// 连接超时时间(秒,0表示不限制)
|
||||
'timeout' => Env::get('cache.timeout', 0),
|
||||
// 是否使用长连接(true=长连接,false=短连接)
|
||||
'persistent' => Env::get('cache.persistent', true),
|
||||
// 缓存前缀,用于区分不同应用或环境的缓存
|
||||
'prefix' => 'like_shop_redis_',
|
||||
// 缓存有效期(秒),0表示永久缓存
|
||||
'expire' => Env::get('cache.expire', 0),
|
||||
],
|
||||
|
||||
'host' => Env::get('cache.host','like-redis'),
|
||||
// File缓存配置
|
||||
'file' => [
|
||||
'type' => 'File',
|
||||
'path' => '',
|
||||
'prefix' => 'like_shop_file_',
|
||||
'expire' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user