Skip to content

Commit

Permalink
更新缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
xhboke committed Jan 10, 2022
1 parent b68c0d1 commit fe40a4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion application/movie/controller/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@

class Info
{
public function getMovieInfo($id): \think\response\Json
public function getMovieInfo($id, $flag = 0): \think\response\Json
{
if ($flag == 1) {
cache('info_' . $id, NULL);
}
if (cache('info_' . $id)) {
return cache('info_' . $id);
} else {
Expand Down
3 changes: 2 additions & 1 deletion route/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
'search_suggest' => '(.*?)',
'name' => '(.*?)',
'page' => '\d+',
'flag' => '\d+',
],
'[subject]' => [
':id$' => ['movie/info/getMovieInfo', ['method' => 'get']],
':id/[:flag]$' => ['movie/info/getMovieInfo', ['method' => 'get']],
':id/comments/[:page]/[:sort]$' => ['movie/info/getComments', ['method' => 'get']],
':id/reviews/[:page]/[:sort]$' => ['movie/info/getReviews', ['method' => 'get']],
':id/celebrities$' => ['movie/info/getCelebrities', ['method' => 'get']],
Expand Down

0 comments on commit fe40a4e

Please sign in to comment.