Commit 67d60e32f856014f6510b9ffa7c1b008ae526e41
1 parent
20eb0a2a
mall + pay:
1、调整微信支付,修复 v2 传递的时间不正确 2、调整 mp js ticket 接口到 system 模块
Showing
23 changed files
with
129 additions
and
131 deletions
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java
| ... | ... | @@ -5,10 +5,10 @@ import cn.iocoder.yudao.framework.pay.core.client.PayClient; |
| 5 | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| 6 | 6 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; |
| 7 | 7 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*; |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXLitePayClient; | |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXNativePayClient; | |
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; | |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPubPayClient; | |
| 8 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXLitePayClient; | |
| 9 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXNativePayClient; | |
| 10 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPayClientConfig; | |
| 11 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPubPayClient; | |
| 12 | 12 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 13 | 13 | import lombok.extern.slf4j.Slf4j; |
| 14 | 14 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPayClientConfig.java
| ... | ... | @@ -9,8 +9,6 @@ import javax.validation.constraints.NotBlank; |
| 9 | 9 | import javax.validation.constraints.NotNull; |
| 10 | 10 | import java.util.Set; |
| 11 | 11 | |
| 12 | -// TODO 芋艿:参数校验 | |
| 13 | - | |
| 14 | 12 | /** |
| 15 | 13 | * 支付宝的 PayClientConfig 实现类 |
| 16 | 14 | * 属性主要来自 {@link com.alipay.api.AlipayConfig} 的必要属性 |
| ... | ... | @@ -111,7 +109,9 @@ public class AlipayPayClientConfig implements PayClientConfig { |
| 111 | 109 | |
| 112 | 110 | @Override |
| 113 | 111 | public Set<ConstraintViolation<PayClientConfig>> verifyParam(Validator validator) { |
| 112 | + // TODO 芋艿:参数校验 | |
| 114 | 113 | return validator.validate(this, |
| 115 | 114 | MODE_PUBLIC_KEY.equals(this.getMode()) ? ModePublicKey.class : ModeCertificate.class); |
| 116 | 115 | } |
| 116 | + | |
| 117 | 117 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WXLitePayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.wx; | |
| 1 | +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | 4 | import cn.hutool.core.date.DateUtil; |
| ... | ... | @@ -9,7 +9,6 @@ import cn.hutool.core.util.StrUtil; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 10 | 10 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO; |
| 11 | 11 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO; | |
| 13 | 12 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 14 | 13 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO; |
| 15 | 14 | import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WXNativePayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.wx; | |
| 1 | +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | 4 | import cn.hutool.core.date.DateUtil; |
| ... | ... | @@ -8,7 +8,6 @@ import cn.hutool.core.util.StrUtil; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 9 | 9 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO; |
| 10 | 10 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO; | |
| 12 | 11 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 13 | 12 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO; |
| 14 | 13 | import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPayClientConfig.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WXPayClientConfig.java
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WXPubPayClient.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.wx; | |
| 1 | +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | 4 | import cn.hutool.core.date.LocalDateTimeUtil; |
| ... | ... | @@ -7,6 +7,7 @@ import cn.hutool.core.lang.Assert; |
| 7 | 7 | import cn.hutool.core.map.MapUtil; |
| 8 | 8 | import cn.hutool.core.util.StrUtil; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 10 | +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | |
| 10 | 11 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO; |
| 11 | 12 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; |
| 12 | 13 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| ... | ... | @@ -15,6 +16,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReq |
| 15 | 16 | import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; |
| 16 | 17 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; |
| 17 | 18 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 19 | +import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum; | |
| 18 | 20 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; |
| 19 | 21 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result; |
| 20 | 22 | import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; |
| ... | ... | @@ -33,6 +35,8 @@ import java.time.LocalDateTime; |
| 33 | 35 | import java.time.ZoneId; |
| 34 | 36 | import java.util.Objects; |
| 35 | 37 | |
| 38 | +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; | |
| 39 | + | |
| 36 | 40 | /** |
| 37 | 41 | * 微信支付(公众号)的 PayClient 实现类 |
| 38 | 42 | * |
| ... | ... | @@ -70,29 +74,29 @@ public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> { |
| 70 | 74 | |
| 71 | 75 | @Override |
| 72 | 76 | public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) { |
| 73 | - throw new UnsupportedOperationException(); | |
| 74 | -// | |
| 75 | -// WxPayMpOrderResult response; | |
| 76 | -// try { | |
| 77 | -// switch (config.getApiVersion()) { | |
| 78 | -// case WXPayClientConfig.API_VERSION_V2: | |
| 79 | -// response = this.unifiedOrderV2(reqDTO); | |
| 80 | -// break; | |
| 81 | -// case WXPayClientConfig.API_VERSION_V3: | |
| 82 | -// WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO); | |
| 83 | -// // 将 V3 的结果,统一转换成 V2。返回的字段是一致的 | |
| 84 | -// response = new WxPayMpOrderResult(); | |
| 85 | -// BeanUtil.copyProperties(responseV3, response, true); | |
| 86 | -// break; | |
| 87 | -// default: | |
| 88 | -// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion())); | |
| 89 | -// } | |
| 90 | -// } catch (WxPayException e) { | |
| 91 | -// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e); | |
| 77 | + WxPayMpOrderResult response = null; | |
| 78 | + try { | |
| 79 | + switch (config.getApiVersion()) { | |
| 80 | + case WXPayClientConfig.API_VERSION_V2: | |
| 81 | + response = this.unifiedOrderV2(reqDTO); | |
| 82 | + break; | |
| 83 | + case WXPayClientConfig.API_VERSION_V3: | |
| 84 | + WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO); | |
| 85 | + // 将 V3 的结果,统一转换成 V2。返回的字段是一致的 | |
| 86 | + response = new WxPayMpOrderResult(); | |
| 87 | + BeanUtil.copyProperties(responseV3, response, true); | |
| 88 | + break; | |
| 89 | + default: | |
| 90 | + throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion())); | |
| 91 | + } | |
| 92 | + } catch (WxPayException e) { | |
| 93 | + log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e); | |
| 92 | 94 | // return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"), |
| 93 | 95 | // ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()),null, codeMapping); |
| 94 | -// } | |
| 95 | -// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping); | |
| 96 | + System.out.println(); | |
| 97 | + } | |
| 98 | + return new PayOrderUnifiedRespDTO().setDisplayMode(PayDisplayModeEnum.CUSTOM.getMode()) | |
| 99 | + .setDisplayContent(JsonUtils.toJsonString(response)); | |
| 96 | 100 | } |
| 97 | 101 | |
| 98 | 102 | |
| ... | ... | @@ -190,7 +194,8 @@ public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> { |
| 190 | 194 | } |
| 191 | 195 | |
| 192 | 196 | private static String formatDate(LocalDateTime time) { |
| 193 | - return TemporalAccessorUtil.format(time.atZone(ZoneId.systemDefault()), "yyyy-MM-dd'T'HH:mm:ssXXX"); | |
| 197 | +// return TemporalAccessorUtil.format(time.atZone(ZoneId.systemDefault()), "yyyy-MM-dd'T'HH:mm:ssXXX"); | |
| 198 | + return TemporalAccessorUtil.format(time.atZone(ZoneId.systemDefault()), "yyyyMMddHHmmss"); | |
| 194 | 199 | } |
| 195 | 200 | |
| 196 | 201 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayChannelEnum.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.pay.core.enums; |
| 3 | 3 | import cn.hutool.core.util.ArrayUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| 5 | 5 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; | |
| 6 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPayClientConfig; | |
| 7 | 7 | import lombok.AllArgsConstructor; |
| 8 | 8 | import lombok.Getter; |
| 9 | 9 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayDisplayModeEnum.java
| ... | ... | @@ -13,12 +13,13 @@ import lombok.Getter; |
| 13 | 13 | public enum PayDisplayModeEnum { |
| 14 | 14 | |
| 15 | 15 | URL("url"), // Redirect 跳转链接的方式 |
| 16 | - IFRAME("iframe"), // IFrame 内嵌链接的方式 | |
| 16 | + IFRAME("iframe"), // IFrame 内嵌链接的方式【目前暂时用不到】 | |
| 17 | 17 | FORM("form"), // HTML 表单提交 |
| 18 | 18 | QR_CODE("qr_code"), // 二维码的文字内容 |
| 19 | - QR_CODE_URL("qr_code_url"), // 二维码的图片链接 | |
| 19 | + QR_CODE_URL("qr_code_url"), // 二维码的图片链接【目前暂时用不到】 | |
| 20 | 20 | BAR_CODE("bar_code"), // 条形码 |
| 21 | - APP("app"), // 应用 | |
| 21 | + APP("app"), // 应用【目前暂时用不到】 | |
| 22 | + CUSTOM("custom"), // 自定义:每种支付方式,做个性化处理;例如说,微信公众号支付时,调用 JSAPI 接口 | |
| 22 | 23 | ; |
| 23 | 24 | |
| 24 | 25 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java
| ... | ... | @@ -2,17 +2,14 @@ package cn.iocoder.yudao.framework.pay.core.client.impl; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.io.IoUtil; |
| 4 | 4 | import cn.hutool.core.util.RandomUtil; |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 6 | -import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | |
| 7 | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; |
| 8 | 6 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 9 | 7 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; |
| 10 | 8 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient; |
| 11 | 9 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient; |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; | |
| 13 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPubPayClient; | |
| 10 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPayClientConfig; | |
| 11 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPubPayClient; | |
| 14 | 12 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 15 | -import com.alipay.api.response.AlipayTradePrecreateResponse; | |
| 16 | 13 | import org.junit.jupiter.api.Disabled; |
| 17 | 14 | import org.junit.jupiter.api.Test; |
| 18 | 15 | ... | ... |
yudao-module-member/yudao-module-member-biz/pom.xml
| ... | ... | @@ -41,11 +41,11 @@ |
| 41 | 41 | </dependency> |
| 42 | 42 | <dependency> |
| 43 | 43 | <groupId>cn.iocoder.boot</groupId> |
| 44 | - <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId> | |
| 44 | + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | |
| 45 | 45 | </dependency> |
| 46 | 46 | <dependency> |
| 47 | 47 | <groupId>cn.iocoder.boot</groupId> |
| 48 | - <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | |
| 48 | + <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId> | |
| 49 | 49 | </dependency> |
| 50 | 50 | |
| 51 | 51 | <!-- Web 相关 --> | ... | ... |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/weixin/AppWxMpController.http deleted
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
| ... | ... | @@ -125,6 +125,7 @@ public class MemberAuthServiceImpl implements MemberAuthService { |
| 125 | 125 | @Override |
| 126 | 126 | public AppAuthLoginRespVO weixinMiniAppLogin(AppAuthWeixinMiniAppLoginReqVO reqVO) { |
| 127 | 127 | // 获得对应的手机号信息 |
| 128 | + // TODO @芋艿:需要弱化微信小程序的依赖,通过 system 获取手机号 | |
| 128 | 129 | WxMaPhoneNumberInfo phoneNumberInfo; |
| 129 | 130 | try { |
| 130 | 131 | phoneNumberInfo = wxMaService.getUserService().getNewPhoneNoInfo(reqVO.getPhoneCode()); | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/order/PayOrderConvert.java
| ... | ... | @@ -94,7 +94,7 @@ public interface PayOrderConvert { |
| 94 | 94 | @Mapping(target = "id", ignore = true) |
| 95 | 95 | PayOrderExtensionDO convert(PayOrderSubmitReqVO bean, String userIp); |
| 96 | 96 | |
| 97 | - PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO); | |
| 97 | + PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO, String userIp); | |
| 98 | 98 | |
| 99 | 99 | PayOrderSubmitRespVO convert(PayOrderUnifiedRespDTO bean); |
| 100 | 100 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
| ... | ... | @@ -141,7 +141,7 @@ public class PayOrderServiceImpl implements PayOrderService { |
| 141 | 141 | orderExtensionMapper.insert(orderExtension); |
| 142 | 142 | |
| 143 | 143 | // 3. 调用三方接口 |
| 144 | - PayOrderUnifiedReqDTO unifiedOrderReqDTO = PayOrderConvert.INSTANCE.convert2(reqVO) | |
| 144 | + PayOrderUnifiedReqDTO unifiedOrderReqDTO = PayOrderConvert.INSTANCE.convert2(reqVO, userIp) | |
| 145 | 145 | // 商户相关的字段 |
| 146 | 146 | .setMerchantOrderId(orderExtension.getNo()) // 注意,此处使用的是 PayOrderExtensionDO.no 属性! |
| 147 | 147 | .setSubject(order.getSubject()).setBody(order.getBody()) | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDOTest.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.dal.dataobject.merchant; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; | |
| 4 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPayClientConfig; | |
| 5 | 5 | import org.junit.jupiter.api.Test; |
| 6 | 6 | |
| 7 | 7 | public class PayChannelDOTest { | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/test-integration/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapperIntegrationTest.java
| ... | ... | @@ -4,7 +4,7 @@ import cn.hutool.core.io.IoUtil; |
| 4 | 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | 6 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; | |
| 7 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPayClientConfig; | |
| 8 | 8 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 9 | 9 | import cn.iocoder.yudao.module.pay.test.BaseDbIntegrationTest; |
| 10 | 10 | import org.junit.jupiter.api.Test; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/test/java/cn/iocoder/yudao/module/pay/service/merchant/PayChannelServiceTest.java
| ... | ... | @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; |
| 6 | 6 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; | |
| 7 | +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WXPayClientConfig; | |
| 8 | 8 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 9 | 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 10 | 10 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelCreateReqVO; | ... | ... |
yudao-module-system/yudao-module-system-biz/pom.xml
| ... | ... | @@ -58,6 +58,10 @@ |
| 58 | 58 | <groupId>cn.iocoder.boot</groupId> |
| 59 | 59 | <artifactId>yudao-spring-boot-starter-biz-ip</artifactId> |
| 60 | 60 | </dependency> |
| 61 | + <dependency> | |
| 62 | + <groupId>cn.iocoder.boot</groupId> | |
| 63 | + <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId> | |
| 64 | + </dependency> | |
| 61 | 65 | |
| 62 | 66 | <!-- Web 相关 --> |
| 63 | 67 | <dependency> | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/weixin/AppWxMpController.http
0 → 100644
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/weixin/AppWxMpController.java renamed to yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/weixin/AppWxMpController.java
| 1 | -package cn.iocoder.yudao.module.member.controller.app.weixin; | |
| 1 | +package cn.iocoder.yudao.module.system.controller.app.weixin; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -19,7 +19,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 19 | 19 | |
| 20 | 20 | @Tag(name = "微信公众号") |
| 21 | 21 | @RestController |
| 22 | -@RequestMapping("/member/wx-mp") | |
| 22 | +@RequestMapping("/system/wx-mp") | |
| 23 | 23 | @Validated |
| 24 | 24 | @Slf4j |
| 25 | 25 | public class AppWxMpController { |
| ... | ... | @@ -27,6 +27,7 @@ public class AppWxMpController { |
| 27 | 27 | @Resource |
| 28 | 28 | private WxMpService mpService; |
| 29 | 29 | |
| 30 | + // TODO @芋艿:需要额外考虑个问题;多租户下,如果每个小程序一个微信公众号,则会存在多个 appid; | |
| 30 | 31 | @PostMapping("/create-jsapi-signature") |
| 31 | 32 | @Operation(summary = "创建微信 JS SDK 初始化所需的签名", |
| 32 | 33 | description = "参考 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html 文档") | ... | ... |
yudao-server/src/main/resources/static/pay_wx_pub.html
| ... | ... | @@ -16,8 +16,8 @@ |
| 16 | 16 | <script> |
| 17 | 17 | let shopOrderId = undefined; |
| 18 | 18 | let payOrderId = undefined; |
| 19 | - // let server = 'http://127.0.0.1:48080'; | |
| 20 | - let server = 'http://niubi.natapp1.cc'; | |
| 19 | + let server = 'http://127.0.0.1:48080'; | |
| 20 | + // let server = 'http://niubi.natapp1.cc'; | |
| 21 | 21 | // TODO openid |
| 22 | 22 | let openid = "ockUAwIZ-0OeMZl9ogcZ4ILrGba0"; |
| 23 | 23 | $(function() { |
| ... | ... | @@ -26,6 +26,9 @@ |
| 26 | 26 | $.ajax({ |
| 27 | 27 | url: server + "/app-api/wx/mp/create-jsapi-signature?url=" + document.location.href, |
| 28 | 28 | method: 'POST', |
| 29 | + headers: { | |
| 30 | + 'tenant-id': 1 | |
| 31 | + }, | |
| 29 | 32 | success: function( result ) { |
| 30 | 33 | if (result.code !== 0) { |
| 31 | 34 | alert('获取 JsapiTicket 失败,原因:' + result.msg) | ... | ... |
yudao-ui-admin/src/views/mall/promotion/seckill/seckillActivity/index.vue
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | </el-form-item> |
| 18 | 18 | <el-form-item label="参与场次" prop="timeId"> |
| 19 | 19 | <el-select v-model="queryParams.timeId" placeholder="请选择参与场次" clearable size="small"> |
| 20 | - <el-option v-for="item in SeckillConfigList" :key="item.id" :label="item.name" :value="item.id"/> | |
| 20 | + <el-option v-for="item in seckillTimeList" :key="item.id" :label="item.name" :value="item.id" /> | |
| 21 | 21 | </el-select> |
| 22 | 22 | </el-form-item> |
| 23 | 23 | <el-form-item label="创建时间" prop="createTime"> |
| ... | ... | @@ -38,9 +38,8 @@ |
| 38 | 38 | v-hasPermi="['promotion:seckill-activity:create']">新增秒杀活动</el-button> |
| 39 | 39 | </el-col> |
| 40 | 40 | <el-col :span="1.5"> |
| 41 | - <el-button v-hasPermi="['promotion:seckill-activity:create']" icon="el-icon-menu" plain size="mini" type="primary" | |
| 42 | - @click="openSeckillConfig">管理参与场次 | |
| 43 | - </el-button> | |
| 41 | + <el-button type="primary" plain icon="el-icon-menu" size="mini" @click="openSeckillTime" | |
| 42 | + v-hasPermi="['promotion:seckill-activity:create']">管理参与场次</el-button> | |
| 44 | 43 | </el-col> |
| 45 | 44 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| 46 | 45 | </el-row> |
| ... | ... | @@ -55,8 +54,8 @@ |
| 55 | 54 | </el-table-column> |
| 56 | 55 | <el-table-column label="参与场次" prop="timeIds" width="250"> |
| 57 | 56 | <template v-slot="scope"> |
| 58 | - <span v-for="item in SeckillConfigList" v-if="scope.row.timeIds.includes(item.id)" | |
| 59 | - :key="item.id"> | |
| 57 | + <span v-for="item in seckillTimeList" :key="item.id" | |
| 58 | + v-if="scope.row.timeIds.includes(item.id)"> | |
| 60 | 59 | <el-tag style="margin:4px;" size="small">{{ item.name }}</el-tag> |
| 61 | 60 | </span> |
| 62 | 61 | </template> |
| ... | ... | @@ -111,13 +110,12 @@ |
| 111 | 110 | <el-form-item label="场次选择"> |
| 112 | 111 | <el-select v-model="form.timeIds" placeholder="请选择参与场次" clearable size="small" multiple filterable |
| 113 | 112 | style="width: 880px"> |
| 114 | - <el-option v-for="item in SeckillConfigList" :key="item.id" :label="item.name" :value="item.id"> | |
| 115 | - <span style="float: left">{{ item.name + ': { ' }} {{ item.startTime }} -- {{ | |
| 116 | - item.endTime + | |
| 117 | - ' }' | |
| 118 | - }}</span> | |
| 119 | - <span style="float: right; color: #8492a6; font-size: 13px"></span> | |
| 120 | - </el-option> | |
| 113 | + <el-option v-for="item in seckillTimeList" :key="item.id" :label="item.name" :value="item.id"> | |
| 114 | + <span style="float: left">{{ item.name + ': { ' }} {{ item.startTime }} -- {{ item.endTime + | |
| 115 | + ' }' | |
| 116 | + }}</span> | |
| 117 | + <span style="float: right; color: #8492a6; font-size: 13px"></span> | |
| 118 | + </el-option> | |
| 121 | 119 | </el-select> |
| 122 | 120 | </el-form-item> |
| 123 | 121 | <el-form-item label="商品选择"> |
| ... | ... | @@ -188,17 +186,10 @@ |
| 188 | 186 | </template> |
| 189 | 187 | |
| 190 | 188 | <script> |
| 191 | -import {getSkuOptionList} from "@/api/mall/product/sku"; | |
| 192 | -import { | |
| 193 | - closeSeckillActivity, | |
| 194 | - createSeckillActivity, | |
| 195 | - deleteSeckillActivity, | |
| 196 | - getSeckillActivity, | |
| 197 | - getSeckillActivityPage, | |
| 198 | - updateSeckillActivity | |
| 199 | -} from "@/api/mall/promotion/seckillActivity"; | |
| 200 | -import {getSeckillConfigList} from "@/api/mall/promotion/SeckillConfig"; | |
| 201 | -import {deepClone} from "@/utils"; | |
| 189 | +import { getSkuOptionList } from "@/api/mall/product/sku"; | |
| 190 | +import { createSeckillActivity, updateSeckillActivity, closeSeckillActivity, deleteSeckillActivity, getSeckillActivity, getSeckillActivityPage, exportSeckillActivityExcel } from "@/api/mall/promotion/seckillActivity"; | |
| 191 | +import { getSeckillTimeList } from "@/api/mall/promotion/seckillTime"; | |
| 192 | +import { deepClone } from "@/utils"; | |
| 202 | 193 | |
| 203 | 194 | export default { |
| 204 | 195 | name: "PromotionSeckillActivity", |
| ... | ... | @@ -206,26 +197,26 @@ export default { |
| 206 | 197 | }, |
| 207 | 198 | data() { |
| 208 | 199 | return { |
| 209 | - // 遮罩层 | |
| 210 | - loading: true, | |
| 211 | - // 显示搜索条件 | |
| 212 | - showSearch: true, | |
| 213 | - // 总条数 | |
| 214 | - total: 0, | |
| 215 | - // 秒杀活动列表 | |
| 216 | - list: [], | |
| 217 | - // 秒杀场次列表 | |
| 218 | - SeckillConfigList: [], | |
| 219 | - // 弹出层标题 | |
| 220 | - title: "", | |
| 221 | - // 是否显示弹出层 | |
| 222 | - open: false, | |
| 223 | - // 查询参数 | |
| 224 | - queryParams: { | |
| 225 | - pageNo: 1, | |
| 226 | - pageSize: 10, | |
| 227 | - name: null, | |
| 228 | - status: null, | |
| 200 | + // 遮罩层 | |
| 201 | + loading: true, | |
| 202 | + // 显示搜索条件 | |
| 203 | + showSearch: true, | |
| 204 | + // 总条数 | |
| 205 | + total: 0, | |
| 206 | + // 秒杀活动列表 | |
| 207 | + list: [], | |
| 208 | + // 秒杀场次列表 | |
| 209 | + seckillTimeList: [], | |
| 210 | + // 弹出层标题 | |
| 211 | + title: "", | |
| 212 | + // 是否显示弹出层 | |
| 213 | + open: false, | |
| 214 | + // 查询参数 | |
| 215 | + queryParams: { | |
| 216 | + pageNo: 1, | |
| 217 | + pageSize: 10, | |
| 218 | + name: null, | |
| 219 | + status: null, | |
| 229 | 220 | timeId: null, |
| 230 | 221 | createTime: [], |
| 231 | 222 | }, |
| ... | ... | @@ -270,18 +261,18 @@ export default { |
| 270 | 261 | this.total = response.data.total; |
| 271 | 262 | this.loading = false; |
| 272 | 263 | }); |
| 273 | - if (timeId) { | |
| 274 | - //查询完成后设置为空 | |
| 275 | - this.$route.params.timeId = undefined | |
| 276 | - } | |
| 277 | - // 获得 SKU 商品列表 | |
| 278 | - getSkuOptionList().then(response => { | |
| 279 | - this.productSkus = response.data; | |
| 280 | - }); | |
| 281 | - // 获取参与场次列表 | |
| 282 | - getSeckillConfigList().then(response => { | |
| 283 | - this.SeckillConfigList = response.data; | |
| 284 | - }); | |
| 264 | + if (timeId) { | |
| 265 | + //查询完成后设置为空 | |
| 266 | + this.$route.params.timeId = undefined | |
| 267 | + } | |
| 268 | + // 获得 SKU 商品列表 | |
| 269 | + getSkuOptionList().then(response => { | |
| 270 | + this.productSkus = response.data; | |
| 271 | + }); | |
| 272 | + // 获取参与场次列表 | |
| 273 | + getSeckillTimeList().then(response => { | |
| 274 | + this.seckillTimeList = response.data; | |
| 275 | + }); | |
| 285 | 276 | }, |
| 286 | 277 | /** 取消按钮 */ |
| 287 | 278 | cancel() { |
| ... | ... | @@ -315,10 +306,10 @@ export default { |
| 315 | 306 | this.resetForm("queryForm"); |
| 316 | 307 | this.handleQuery(); |
| 317 | 308 | }, |
| 318 | - /**打开秒杀场次管理页面 */ | |
| 319 | - openSeckillConfig() { | |
| 320 | - this.$tab.openPage("秒杀场次管理", "/promotion/seckill-time"); | |
| 321 | - }, | |
| 309 | + /**打开秒杀场次管理页面 */ | |
| 310 | + openSeckillTime() { | |
| 311 | + this.$tab.openPage("秒杀场次管理", "/promotion/seckill-time"); | |
| 312 | + }, | |
| 322 | 313 | /** 新增按钮操作 */ |
| 323 | 314 | handleAdd() { |
| 324 | 315 | this.reset(); | ... | ... |
yudao-ui-admin/src/views/mall/promotion/seckill/seckillTime/index.vue
| ... | ... | @@ -63,19 +63,14 @@ |
| 63 | 63 | </template> |
| 64 | 64 | |
| 65 | 65 | <script> |
| 66 | -import { | |
| 67 | - createSeckillConfig, | |
| 68 | - deleteSeckillConfig, | |
| 69 | - getSeckillConfig, | |
| 70 | - getSeckillConfigList, | |
| 71 | - updateSeckillConfig | |
| 72 | -} from "@/api/mall/promotion/SeckillConfig"; | |
| 66 | +import { createSeckillTime, updateSeckillTime, deleteSeckillTime, getSeckillTime, getSeckillTimePage, exportSeckillTimeExcel, getSeckillTimeList } from "@/api/mall/promotion/seckillTime"; | |
| 73 | 67 | import router from "@/router"; |
| 74 | -import {deepClone} from "@/utils"; | |
| 68 | +import { deepClone } from "@/utils"; | |
| 75 | 69 | |
| 76 | 70 | export default { |
| 77 | - name: "PromotionSeckillConfig", | |
| 78 | - components: {}, | |
| 71 | + name: "PromotionSeckillTime", | |
| 72 | + components: { | |
| 73 | + }, | |
| 79 | 74 | data() { |
| 80 | 75 | return { |
| 81 | 76 | // 遮罩层 |
| ... | ... | @@ -109,7 +104,7 @@ export default { |
| 109 | 104 | getList() { |
| 110 | 105 | this.loading = true; |
| 111 | 106 | // 执行查询 |
| 112 | - getSeckillConfigList().then(response => { | |
| 107 | + getSeckillTimeList().then(response => { | |
| 113 | 108 | this.list = response.data; |
| 114 | 109 | this.loading = false; |
| 115 | 110 | }); |
| ... | ... | @@ -153,7 +148,7 @@ export default { |
| 153 | 148 | handleUpdate(row) { |
| 154 | 149 | this.reset(); |
| 155 | 150 | const id = row.id; |
| 156 | - getSeckillConfig(id).then(response => { | |
| 151 | + getSeckillTime(id).then(response => { | |
| 157 | 152 | response.data.startAndEndTime = [response.data.startTime, response.data.endTime] |
| 158 | 153 | this.form = response.data; |
| 159 | 154 | this.open = true; |
| ... | ... | @@ -173,7 +168,7 @@ export default { |
| 173 | 168 | data.endTime = this.form.startAndEndTime[1]; |
| 174 | 169 | // 修改的提交 |
| 175 | 170 | if (this.form.id != null) { |
| 176 | - updateSeckillConfig(data).then(response => { | |
| 171 | + updateSeckillTime(data).then(response => { | |
| 177 | 172 | this.$modal.msgSuccess("修改成功"); |
| 178 | 173 | this.open = false; |
| 179 | 174 | this.getList(); |
| ... | ... | @@ -181,7 +176,7 @@ export default { |
| 181 | 176 | return; |
| 182 | 177 | } |
| 183 | 178 | // 添加的提交 |
| 184 | - createSeckillConfig(data).then(response => { | |
| 179 | + createSeckillTime(data).then(response => { | |
| 185 | 180 | this.$modal.msgSuccess("新增成功"); |
| 186 | 181 | this.open = false; |
| 187 | 182 | this.getList(); |
| ... | ... | @@ -192,7 +187,7 @@ export default { |
| 192 | 187 | handleDelete(row) { |
| 193 | 188 | const id = row.id; |
| 194 | 189 | this.$modal.confirm('是否确认删除秒杀时段编号为"' + id + '"的数据项?').then(function () { |
| 195 | - return deleteSeckillConfig(id); | |
| 190 | + return deleteSeckillTime(id); | |
| 196 | 191 | }).then(() => { |
| 197 | 192 | this.getList(); |
| 198 | 193 | this.$modal.msgSuccess("删除成功"); | ... | ... |