移除流程中的支付相关和会员卡相关

This commit was merged in pull request #48.
This commit is contained in:
2026-07-14 18:49:15 +08:00
parent 593f6f13e7
commit cacc8997ec
22 changed files with 594 additions and 754 deletions
@@ -16,6 +16,9 @@ import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "wechat")
public class WechatProperties {
// Mock模式:true=使用模拟数据,false=调用真实微信API
private Boolean mockEnabled;
// 小程序配置
private MiniApp miniapp = new MiniApp();
@@ -43,12 +43,25 @@ public class WechatApiServiceImpl implements WechatApiService {
@Override
public Mono<Map<String, String>> jsCode2Session(String code) {
log.info("微信jsCode2Session API");
log.info("信息 - AppID: {}, AppSecret {}",
log.info("微信jsCode2Session API, code: {}", code);
// Mock模式:返回模拟数据
if (wechatProperties.getMockEnabled() != null && wechatProperties.getMockEnabled()) {
log.info("Mock模式已启用,返回模拟微信登录数据");
Map<String, String> mockResult = new HashMap<>();
// 使用 code 的哈希生成唯一的 openid,确保每次登录创建不同用户
String mockOpenId = "mock_openid_" + Math.abs(code.hashCode() % 1000000);
mockResult.put("openid", mockOpenId);
mockResult.put("session_key", "mock_session_key");
mockResult.put("unionid", "mock_unionid_" + Math.abs(code.hashCode() % 1000000));
log.info("Mock微信API响应成功, openid: {}, unionid: {}", mockOpenId, mockResult.get("unionid"));
return Mono.just(mockResult);
}
log.info("真实微信API调用 - AppID: {}, AppSecret {}",
wechatProperties.getMiniapp().getAppId(),
wechatProperties.getMiniapp().getAppSecret() != null ?
wechatProperties.getMiniapp().getAppSecret().substring(0, Math.min(4, wechatProperties.getMiniapp().getAppSecret().length())) + "***" : "null");
log.info(" - code: {}", code);
return webClient.get()
.uri(uriBuilder -> uriBuilder
@@ -152,6 +165,12 @@ public class WechatApiServiceImpl implements WechatApiService {
public Mono<String> getAccessToken(String appType) {
log.debug("获取access_token, appType: {}", appType);
// Mock模式:返回模拟access_token
if (wechatProperties.getMockEnabled() != null && wechatProperties.getMockEnabled()) {
log.debug("Mock模式已启用,返回模拟access_token");
return Mono.just("mock_access_token");
}
String cacheKey = ACCESS_TOKEN_CACHE_PREFIX + appType;
return redisUtil.get(cacheKey, String.class)