|
|
@@ -48,12 +48,29 @@ class SecretService
|
|
|
switch ($stepStatus) {
|
|
|
case StepStatus::MY_INPUT_OLD_SECRET:
|
|
|
return SecretService::inputOldSecret($chatId, $text, $messageId);
|
|
|
+ case StepStatus::MY_INPUT_SECRET_PASS:
|
|
|
+ return SecretService::showSecretKey();
|
|
|
+
|
|
|
default:
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private static function showSecretKey($chatId, $password, $messageId): array
|
|
|
+ {
|
|
|
+ $user = User::where('member_id', $chatId)->first();
|
|
|
+ if ($user->secret_pass === $password) {
|
|
|
+ $text = "秘钥:{$user->secret_key}\n\n";
|
|
|
+ $text .= "请保管好你的秘钥";
|
|
|
+ return [
|
|
|
+ 'chat_id' => $chatId,
|
|
|
+ 'text' => $text,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+
|
|
|
private static function view($chatId, $messageId): array
|
|
|
{
|
|
|
$text = "请输入查看密码";
|
|
|
@@ -63,6 +80,9 @@ class SecretService
|
|
|
$user->secret_key = $secretKey;
|
|
|
$user->save();
|
|
|
}
|
|
|
+
|
|
|
+ Cache::put(get_step_key($chatId), StepStatus::MY_INPUT_SECRET_PASS);
|
|
|
+
|
|
|
return [
|
|
|
'chat_id' => $chatId,
|
|
|
'text' => $text,
|