From 3714621173c606c4c58439ed8941100ce9ddea14 Mon Sep 17 00:00:00 2001
From: Codex Assistant <codex@example.com>
Date: 星期三, 05 十一月 2025 15:10:49 +0800
Subject: [PATCH] bug
---
backend/src/main/java/com/rongyichuang/auth/api/AuthGraphqlApi.java | 47 +++++++++++++++++++++++++++++++----------------
1 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/backend/src/main/java/com/rongyichuang/auth/api/AuthGraphqlApi.java b/backend/src/main/java/com/rongyichuang/auth/api/AuthGraphqlApi.java
index a49349c..4738fae 100644
--- a/backend/src/main/java/com/rongyichuang/auth/api/AuthGraphqlApi.java
+++ b/backend/src/main/java/com/rongyichuang/auth/api/AuthGraphqlApi.java
@@ -1,20 +1,18 @@
package com.rongyichuang.auth.api;
-import com.rongyichuang.auth.dto.LoginRequest;
-import com.rongyichuang.auth.dto.LoginResponse;
import com.rongyichuang.auth.dto.PhoneDecryptResponse;
import com.rongyichuang.auth.dto.WxLoginRequest;
import com.rongyichuang.auth.dto.WxLoginResponse;
+import com.rongyichuang.auth.dto.LoginRequest;
+import com.rongyichuang.auth.dto.LoginResponse;
import com.rongyichuang.auth.service.AuthService;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.graphql.data.method.annotation.Argument;
import org.springframework.graphql.data.method.annotation.MutationMapping;
import org.springframework.stereotype.Controller;
/**
- * 璁よ瘉GraphQL API
+ * 璁よ瘉GraphQL API鎺у埗鍣�
*/
@Controller
public class AuthGraphqlApi {
@@ -23,29 +21,42 @@
private AuthService authService;
/**
- * Web绔敤鎴风櫥褰�
+ * 寰俊鐧诲綍
*/
@MutationMapping
- public LoginResponse webLogin(@Argument LoginRequest input) {
- return authService.login(input);
+ public WxLoginResponse wxLogin(@Argument WxLoginRequest input) {
+ try {
+ return authService.wxLogin(input);
+ } catch (Exception e) {
+ throw new RuntimeException("寰俊鐧诲綍澶辫触: " + e.getMessage(), e);
+ }
}
/**
- * 寰俊灏忕▼搴忕櫥褰�
+ * Web绔櫥褰�
*/
@MutationMapping
- public WxLoginResponse wxLogin(@Argument WxLoginRequest input) throws JsonProcessingException, JsonMappingException {
- return authService.wxLogin(input);
+ public LoginResponse webLogin(@Argument LoginRequest input) {
+ try {
+ return authService.login(input);
+ } catch (Exception e) {
+ throw new RuntimeException("鐧诲綍澶辫触: " + e.getMessage(), e);
+ }
}
/**
* 瑙e瘑寰俊鎵嬫満鍙凤紙鏃х増API锛�
*/
@MutationMapping
- public PhoneDecryptResponse decryptPhoneNumber(@Argument String encryptedData,
- @Argument String iv,
- @Argument String sessionKey) {
- return authService.decryptPhoneNumber(encryptedData, iv, sessionKey);
+ public PhoneDecryptResponse decryptPhoneNumber(
+ @Argument String encryptedData,
+ @Argument String iv,
+ @Argument String sessionKey) {
+ try {
+ return authService.decryptPhoneNumber(encryptedData, iv, sessionKey);
+ } catch (Exception e) {
+ throw new RuntimeException("鎵嬫満鍙疯В瀵嗗け璐�: " + e.getMessage(), e);
+ }
}
/**
@@ -53,6 +64,10 @@
*/
@MutationMapping
public PhoneDecryptResponse getPhoneNumberByCode(@Argument String code) {
- return authService.getPhoneNumberByCode(code);
+ try {
+ return authService.getPhoneNumberByCode(code);
+ } catch (Exception e) {
+ throw new RuntimeException("鑾峰彇鎵嬫満鍙峰け璐�: " + e.getMessage(), e);
+ }
}
}
\ No newline at end of file
--
Gitblit v1.8.0