微信刷脸:无授权码
This commit is contained in:
@@ -11,46 +11,13 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "wx.mp")
|
||||
@ConfigurationProperties(prefix = "dpkj.wx")
|
||||
public class WxMpProperties {
|
||||
/**
|
||||
* 是否使用redis存储access token
|
||||
*/
|
||||
private Boolean useRedis = false;
|
||||
|
||||
/**
|
||||
* redis 配置
|
||||
*/
|
||||
private RedisConfig redisConfig;
|
||||
|
||||
@Data
|
||||
public static class RedisConfig {
|
||||
/**
|
||||
* redis服务器 主机地址
|
||||
*/
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* redis服务器 端口号
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* redis服务器 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* redis 服务连接超时时间
|
||||
*/
|
||||
private Integer timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多个公众号配置信息
|
||||
*/
|
||||
private List<MpConfig> configs;
|
||||
|
||||
@Data
|
||||
public static class MpConfig {
|
||||
/**
|
||||
@@ -126,48 +93,6 @@ public class WxMpProperties {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 访问地址
|
||||
*/
|
||||
private MpUrl url;
|
||||
|
||||
@Data
|
||||
public static class MpUrl {
|
||||
/**
|
||||
* H5地址
|
||||
*/
|
||||
private String h5;
|
||||
|
||||
/**
|
||||
* 接口地址
|
||||
*/
|
||||
private String server;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板消息id
|
||||
*/
|
||||
private MpTemplate template;
|
||||
|
||||
@Data
|
||||
public static class MpTemplate {
|
||||
/**
|
||||
* 缴费通知
|
||||
*/
|
||||
private String payMsg;
|
||||
|
||||
/**
|
||||
* 流程待办
|
||||
*/
|
||||
private String test;
|
||||
|
||||
/**
|
||||
* 流程待办
|
||||
*/
|
||||
private String test2;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信商户支付配置
|
||||
*/
|
||||
@@ -250,4 +175,22 @@ public class WxMpProperties {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 访问地址
|
||||
*/
|
||||
private MpUrl url;
|
||||
@Data
|
||||
public static class MpUrl {
|
||||
/**
|
||||
* H5地址
|
||||
*/
|
||||
private String h5;
|
||||
|
||||
/**
|
||||
* 接口地址
|
||||
*/
|
||||
private String server;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import javax.annotation.Resource;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.Provider;
|
||||
import java.security.Security;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@@ -66,8 +67,6 @@ public class WxpayFaceTestController {
|
||||
WxFacePayResp wxFacePayResp = weChatPayFaceService.doWxPayIniMethod(wxFacePayReq);
|
||||
System.out.println("**************2、获取数据:"+wxFacePayResp.toString());
|
||||
|
||||
|
||||
|
||||
String rawdata = wxFacePayResp.getRawdata();
|
||||
return Result.ok(wxFacePayResp);
|
||||
}
|
||||
@@ -80,15 +79,17 @@ public class WxpayFaceTestController {
|
||||
*/
|
||||
@RequestMapping(value = "/getWxpayfaceAuthinfo", method = RequestMethod.POST)
|
||||
public Result<Map<String, Object>> getWxpayfaceAuthinfo() throws Exception {
|
||||
Map<String, Object> wxFacePayResp = new HashMap<>();
|
||||
// 构建请求参数的JSON字符串
|
||||
WxFacePayReq wxFacePayReq = new WxFacePayReq("getWxpayfaceRawdata","1",System.currentTimeMillis()/1000);
|
||||
WxFacePayResp wxFacePayResp1 = weChatPayFaceService.doWxPayIniMethod(wxFacePayReq);
|
||||
System.out.println("**************2、获取数据返回值:"+wxFacePayResp1.toString());
|
||||
String rawdata = wxFacePayResp1.getRawdata();
|
||||
|
||||
// 构建请求参数的JSON字符串
|
||||
Map<String, Object> wxFacePayResp = weChatPayFaceService.getWxFaceAuthInfoReqMap(rawdata);
|
||||
System.out.println("**************333:"+wxFacePayResp.toString());
|
||||
System.out.println("**************2、获取数据getWxpayfaceRawdata:"+wxFacePayResp1.toString());
|
||||
if("SUCCESS".equals(wxFacePayResp1.getReturn_code())){
|
||||
String rawdata = wxFacePayResp1.getRawdata();
|
||||
// 构建请求参数的JSON字符串
|
||||
wxFacePayResp= weChatPayFaceService.getWxFaceAuthInfoReqMap(rawdata);
|
||||
System.out.println("**************2、获取调用凭证get_wxpayface_authinfo:"+wxFacePayResp.toString());
|
||||
}
|
||||
return Result.ok(wxFacePayResp);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.sun.jna.Native;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @description: 32位的WxpayFaceSDK: /resources/win32-x86/WxpayFaceSDK.dll
|
||||
* @author: Zhangxue
|
||||
* @time: 2025/4/17 17:02
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dpkj.modules.scanface.wx.service;
|
||||
|
||||
|
||||
import com.dpkj.modules.scanface.wx.dll.WxpayFaceSDKDll;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
@@ -56,15 +56,17 @@ public class CallWxpayFaceServiceImpl implements CallWxpayFaceService {
|
||||
|
||||
// 调用本地方法
|
||||
WxpayFaceSDKDll.Dll dll = WxpayFaceSDKDll.instance();
|
||||
int result =dll.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
||||
int result = dll.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
||||
//使用C:\Windows\System32目录下 int result = WxpayFaceSDK.INSTANCE.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
||||
|
||||
if (result == 0) {
|
||||
Pointer pointer = new Pointer(pRespBuf[0]);
|
||||
byte[] byteArray = pointer.getByteArray(0, respSize[0]);
|
||||
resStr = new String(byteArray, StandardCharsets.UTF_8);
|
||||
|
||||
System.out.println("-----------调用服务成功结果: " + resStr);
|
||||
//释放
|
||||
dll.wxpayReleaseResponse(new String[2]);
|
||||
//释放 C:\Windows\System32目录下 WxpayFaceSDK.INSTANCE.wxpayReleaseResponse(new String[2]);
|
||||
} else {
|
||||
Pointer pointer = new Pointer(pRespBuf[0]);
|
||||
byte[] byteArray = pointer.getByteArray(0, respSize[0]);
|
||||
|
||||
@@ -51,11 +51,8 @@ public class WeChatPayFaceServiceImpl implements WeChatPayFaceService {
|
||||
|
||||
|
||||
//赋值
|
||||
private static WxMpProperties wxMpProperties;
|
||||
|
||||
public static void setWxMpConfiguration(WxMpProperties wxMpProperties) {
|
||||
WeChatPayFaceServiceImpl.wxMpProperties = wxMpProperties;
|
||||
}
|
||||
@Autowired
|
||||
private WxMpProperties wxMpProperties;
|
||||
|
||||
|
||||
/**
|
||||
@@ -93,6 +90,8 @@ public class WeChatPayFaceServiceImpl implements WeChatPayFaceService {
|
||||
// 调用本地方法
|
||||
WxpayFaceSDKDll.Dll dll = WxpayFaceSDKDll.instance();
|
||||
int result = dll.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
||||
|
||||
//使用C:\Windows\System32目录下 int result = WxpayFaceSDK.INSTANCE.wxpayCallFaceService(reqPointer.getString(0), reqSize, pRespBuf, respSize);
|
||||
log.info("[WeChatPayFaceServiceImpl][doWxPayIniMethod][95] DLL 返回码: {}", result);
|
||||
if (result == 0) {
|
||||
Pointer pointer = new Pointer(pRespBuf[0]);
|
||||
@@ -102,6 +101,8 @@ public class WeChatPayFaceServiceImpl implements WeChatPayFaceService {
|
||||
System.out.println("-----------调用服务成功结果: " + resStr);
|
||||
//释放
|
||||
dll.wxpayReleaseResponse(new String[2]);
|
||||
|
||||
//释放 C:\Windows\System32目录下 WxpayFaceSDK.INSTANCE.wxpayReleaseResponse(new String[2]);
|
||||
} else {
|
||||
Pointer pointer = new Pointer(pRespBuf[0]);
|
||||
byte[] byteArray = pointer.getByteArray(0, respSize[0]);
|
||||
|
||||
Reference in New Issue
Block a user