mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-06 04:27:55 +00:00
feat 新增支付宝获取OpenId相关接口
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package cn.daxpay.single.admin.controller.extra;
|
||||
|
||||
import cn.bootx.platform.common.core.annotation.IgnoreAuth;
|
||||
import cn.bootx.platform.common.core.rest.Res;
|
||||
import cn.bootx.platform.common.core.rest.ResResult;
|
||||
import cn.daxpay.single.service.core.extra.AliPayAuthService;
|
||||
import cn.daxpay.single.service.dto.extra.AuthUrlResult;
|
||||
import cn.daxpay.single.service.dto.extra.OpenIdResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 支付宝认证控制器
|
||||
* @author xxm
|
||||
* @since 2024/6/16
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@Tag(name = "支付宝认证控制器")
|
||||
@RestController
|
||||
@RequestMapping("/alipay/auth")
|
||||
@RequiredArgsConstructor
|
||||
public class AliPayAuthController {
|
||||
private final AliPayAuthService aliPayAuthService;
|
||||
|
||||
|
||||
@Operation(summary = "返回获取OpenId授权页面地址和标识码")
|
||||
@PostMapping("/generateAuthUrl")
|
||||
public ResResult<AuthUrlResult> generateAuthUrl(){
|
||||
return Res.ok(aliPayAuthService.generateAuthUrl());
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "根据标识码查询OpenId")
|
||||
@GetMapping("/queryOpenId")
|
||||
public ResResult<OpenIdResult> queryOpenId(String code){
|
||||
return Res.ok(aliPayAuthService.queryOpenId(code));
|
||||
}
|
||||
}
|
@@ -3,9 +3,9 @@ package cn.daxpay.single.admin.controller.extra;
|
||||
import cn.bootx.platform.common.core.annotation.IgnoreAuth;
|
||||
import cn.bootx.platform.common.core.rest.Res;
|
||||
import cn.bootx.platform.common.core.rest.ResResult;
|
||||
import cn.daxpay.single.service.core.extra.WeChatOpenIdService;
|
||||
import cn.daxpay.single.service.dto.extra.WeChatAuthUrlResult;
|
||||
import cn.daxpay.single.service.dto.extra.WeChatOpenIdResult;
|
||||
import cn.daxpay.single.service.core.extra.WeChatAuthService;
|
||||
import cn.daxpay.single.service.dto.extra.AuthUrlResult;
|
||||
import cn.daxpay.single.service.dto.extra.OpenIdResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -15,28 +15,28 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
*
|
||||
* 微信认证控制器
|
||||
* @author xxm
|
||||
* @since 2024/6/15
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@Tag(name = "微信OpenId服务类")
|
||||
@Tag(name = "微信认证控制器")
|
||||
@RestController
|
||||
@RequestMapping("/wechat/openId/")
|
||||
@RequestMapping("/wechat/auth/")
|
||||
@RequiredArgsConstructor
|
||||
public class WechatOpenIdController {
|
||||
private final WeChatOpenIdService wechatOpenIdService;
|
||||
public class WechatAuthController {
|
||||
private final WeChatAuthService wechatAuthService;
|
||||
|
||||
@Operation(summary = "返回获取OpenId授权页面地址和标识码")
|
||||
@PostMapping("/generateAuthUrl")
|
||||
public ResResult<WeChatAuthUrlResult> generateAuthUrl(){
|
||||
return Res.ok(wechatOpenIdService.generateAuthUrl());
|
||||
public ResResult<AuthUrlResult> generateAuthUrl(){
|
||||
return Res.ok(wechatAuthService.generateAuthUrl());
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "根据标识码查询OpenId")
|
||||
@GetMapping("/queryOpenId")
|
||||
public ResResult<WeChatOpenIdResult> queryOpenId(String code){
|
||||
return Res.ok(wechatOpenIdService.queryOpenId(code));
|
||||
public ResResult<OpenIdResult> queryOpenId(String code){
|
||||
return Res.ok(wechatAuthService.queryOpenId(code));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user