优化 用户/应用 操作时删除cache

This commit is contained in:
何秀钢 2019-10-06 17:36:54 +08:00
parent b621ed09a9
commit 00d8d2d8f5
2 changed files with 24 additions and 0 deletions

View File

@ -148,6 +148,10 @@ class App extends Base {
} else {
$appInfo = AdminApp::get($id);
cache('AccessToken:' . $appInfo['app_secret'], null);
if($oldWiki = cache('WikiLogin:' . $id)) {
cache('WikiLogin:' . $oldWiki, null);
}
return $this->buildSuccess();
}
}
@ -180,6 +184,10 @@ class App extends Base {
} else {
$appInfo = AdminApp::get($postData['id']);
cache('AccessToken:' . $appInfo['app_secret'], null);
if($oldWiki = cache('WikiLogin:' . $postData['id'])) {
cache('WikiLogin:' . $oldWiki, null);
}
return $this->buildSuccess();
}
}
@ -198,6 +206,9 @@ class App extends Base {
cache('AccessToken:' . $appInfo['app_secret'], null);
AdminApp::destroy($id);
if($oldWiki = cache('WikiLogin:' . $id)) {
cache('WikiLogin:' . $oldWiki, null);
}
return $this->buildSuccess();
}

View File

@ -162,6 +162,10 @@ class User extends Base {
if ($res === false) {
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR);
} else {
if($oldAdmin = cache('Login:' . $id)) {
cache('Login:' . $oldAdmin, null);
}
return $this->buildSuccess();
}
}
@ -201,6 +205,9 @@ class User extends Base {
'group_id' => $groups
]);
}
if($oldAdmin = cache('Login:' . $postData['id'])) {
cache('Login:' . $oldAdmin, null);
}
return $this->buildSuccess();
}
@ -237,6 +244,9 @@ class User extends Base {
$userData = AdminUserData::get(['uid' => $postData['id']]);
$userData->head_img = $headImg;
$userData->save();
if($oldWiki = cache('WikiLogin:' . $postData['id'])) {
cache('WikiLogin:' . $oldWiki, null);
}
return $this->buildSuccess();
}
@ -259,6 +269,9 @@ class User extends Base {
}
AdminUser::destroy($id);
AdminAuthGroupAccess::destroy(['uid' => $id]);
if($oldAdmin = cache('Login:' . $id)) {
cache('Login:' . $oldAdmin, null);
}
return $this->buildSuccess();