切换导航条
此项目
正在载入...
登录
周海龙
/
shopk-main
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
邓超
2 years ago
提交
a31cc4d30cb1ee3e3e71ebf0c2379ac9e5002d2e
1 个父辈
fcd69af5
v2
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
8 行增加
和
5 行删除
app/Http/Controllers/V2/Base.php
app/Http/Controllers/V2/Index.php
routes/web.php
app/Http/Controllers/V2/Base.php
查看文件 @
a31cc4d
...
...
@@ -40,9 +40,9 @@ class Base {
// 缓存
$cacheKey
=
md5
(
$url
.
':'
.
json_encode
(
$data
));
if
(
Cache
::
has
(
$cacheKey
)){
return
Cache
::
get
(
$cacheKey
);
}
// if(Cache::has($cacheKey)){
// return Cache::get($cacheKey);
// }
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
30
);
...
...
@@ -59,7 +59,7 @@ class Base {
$a
=
json_decode
(
$a
,
true
);
// 缓存1小时
Cache
::
set
(
$cacheKey
,
$a
[
'data'
]
??
[],
3600
);
Cache
::
set
(
$cacheKey
,
$a
[
'data'
]
??
[],
empty
(
$a
[
'data'
])
?
120
:
3600
);
return
$a
[
'data'
]
??
[];
}
...
...
app/Http/Controllers/V2/Index.php
查看文件 @
a31cc4d
...
...
@@ -79,11 +79,12 @@ class Index extends Base
*/
public
function
page
(
$key
){
$page
=
$this
->
getData
(
'page'
,[
'urlkey'
=>
$key
]);
if
(
!
$page
){
return
redirect
(
'/'
);
}
return
response
(
$page
,
200
,[
'Content-Type'
=>
'text/html
charset=urt-8;'
]);
return
response
(
$page
,
200
,[
'Content-Type'
=>
'text/html
;
charset=urt-8;'
]);
}
...
...
routes/web.php
查看文件 @
a31cc4d
...
...
@@ -66,5 +66,7 @@ Route::get('/blogs', [\App\Http\Controllers\V2\Index::class,'blog']);
Route
::
get
(
'/blog/{id}'
,
[
\App\Http\Controllers\V2\Index
::
class
,
'blog_info'
])
->
where
(
'id'
,
'\d+'
);
// 单页
Route
::
get
(
'/page/{key}'
,
[
\App\Http\Controllers\V2\Index
::
class
,
'page'
])
->
where
(
'key'
,
'[a-z_\-\d]{2,}'
);
// 单页的另一种方式
Route
::
get
(
'/{key}'
,
[
\App\Http\Controllers\V2\Index
::
class
,
'page'
])
->
where
(
'key'
,
'[a-z_\-\d]{2,}'
);
...
...
请
注册
或
登录
后发表评论