From 308d3b3b7883a92a761dfaf4f607a9f4658213cf Mon Sep 17 00:00:00 2001
From: Codex Assistant <codex@example.com>
Date: 星期四, 06 十一月 2025 09:58:25 +0800
Subject: [PATCH] 修改页面
---
backend/src/main/java/com/rongyichuang/auth/api/AuthGraphqlApi.java | 73 ++++++++++++++++++++++++++++++++++++
1 files changed, 73 insertions(+), 0 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
new file mode 100644
index 0000000..4738fae
--- /dev/null
+++ b/backend/src/main/java/com/rongyichuang/auth/api/AuthGraphqlApi.java
@@ -0,0 +1,73 @@
+package com.rongyichuang.auth.api;
+
+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 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鎺у埗鍣�
+ */
+@Controller
+public class AuthGraphqlApi {
+
+ @Autowired
+ private AuthService authService;
+
+ /**
+ * 寰俊鐧诲綍
+ */
+ @MutationMapping
+ public WxLoginResponse wxLogin(@Argument WxLoginRequest input) {
+ try {
+ return authService.wxLogin(input);
+ } catch (Exception e) {
+ throw new RuntimeException("寰俊鐧诲綍澶辫触: " + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Web绔櫥褰�
+ */
+ @MutationMapping
+ 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) {
+ try {
+ return authService.decryptPhoneNumber(encryptedData, iv, sessionKey);
+ } catch (Exception e) {
+ throw new RuntimeException("鎵嬫満鍙疯В瀵嗗け璐�: " + e.getMessage(), e);
+ }
+ }
+
+ /**
+ * 鑾峰彇寰俊鎵嬫満鍙凤紙鏂扮増API锛�
+ */
+ @MutationMapping
+ public PhoneDecryptResponse getPhoneNumberByCode(@Argument String 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