头像缓存机制

This commit is contained in:
kuaifan 2022-06-18 00:22:58 +08:00
parent 9ea250278d
commit 58e8b7b0a0
3 changed files with 8 additions and 8 deletions

View File

@ -127,7 +127,7 @@ class IndexController extends InvokeController
/**
* 头像
* @return \Psr\Http\Message\StreamInterface
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response
*/
public function avatar()
{
@ -148,7 +148,7 @@ class IndexController extends InvokeController
}
//
$avatar = new InitialAvatar();
return $avatar->name($name)
$content = $avatar->name($name)
->size($size)
->color($color)
->background($background)
@ -156,6 +156,12 @@ class IndexController extends InvokeController
->autoFont()
->generate()
->stream('png', 100);
//
return response($content)
->header('Pragma', 'public')
->header('Cache-Control', 'max-age=1814400')
->header('Content-type', 'image/png')
->header('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + 1814400));
}
/**

View File

@ -60,11 +60,6 @@ server {
proxy_pass http://service;
}
location =/avatar {
expires 30d;
proxy_pass http://service;
}
location @laravels {
proxy_http_version 1.1;
proxy_set_header Connection "";

View File

@ -48,7 +48,6 @@ export default {
const {ret, data, msg} = result;
if (ret === -1 && params.checkRole !== false) {
//身份丢失
state.userId = 0;
$A.modalError({
content: msg,
onOk: () => {