From afeeed281e60466b576fbe74d339634cc5d07b82 Mon Sep 17 00:00:00 2001 From: Codex Assistant <codex@example.com> Date: 星期三, 08 十月 2025 08:56:42 +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