add api for iyuu approve

This commit is contained in:
xiaomlove
2023-09-03 04:54:24 +08:00
parent d4648cd59c
commit b4d4d8f9e0
4 changed files with 30 additions and 1 deletions

View File

@@ -60,4 +60,16 @@ class AuthenticateRepository extends BaseRepository
$user->checkIsNormal();
return $user;
}
public function iyuuApprove($token, $id, $verity)
{
$secret = env('IYUU_SECRET');
$user = User::query()->findOrFail($id, User::$commonFields);
$user->checkIsNormal();
$encryptedResult = md5($token . $id . sha1($user->passkey) . $secret);
if ($encryptedResult != $verity) {
throw new \InvalidArgumentException("Invalid uid or passkey");
}
return true;
}
}