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,10 +5,10 @@ import cn.iocoder.yudao.framework.pay.core.client.PayClient; | ||
| 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| 6 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | 6 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; |
| 7 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*; | 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 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 12 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 13 | import lombok.extern.slf4j.Slf4j; | 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,8 +9,6 @@ import javax.validation.constraints.NotBlank; | ||
| 9 | import javax.validation.constraints.NotNull; | 9 | import javax.validation.constraints.NotNull; |
| 10 | import java.util.Set; | 10 | import java.util.Set; |
| 11 | 11 | ||
| 12 | -// TODO 芋艿:参数校验 | ||
| 13 | - | ||
| 14 | /** | 12 | /** |
| 15 | * 支付宝的 PayClientConfig 实现类 | 13 | * 支付宝的 PayClientConfig 实现类 |
| 16 | * 属性主要来自 {@link com.alipay.api.AlipayConfig} 的必要属性 | 14 | * 属性主要来自 {@link com.alipay.api.AlipayConfig} 的必要属性 |
| @@ -111,7 +109,9 @@ public class AlipayPayClientConfig implements PayClientConfig { | @@ -111,7 +109,9 @@ public class AlipayPayClientConfig implements PayClientConfig { | ||
| 111 | 109 | ||
| 112 | @Override | 110 | @Override |
| 113 | public Set<ConstraintViolation<PayClientConfig>> verifyParam(Validator validator) { | 111 | public Set<ConstraintViolation<PayClientConfig>> verifyParam(Validator validator) { |
| 112 | + // TODO 芋艿:参数校验 | ||
| 114 | return validator.validate(this, | 113 | return validator.validate(this, |
| 115 | MODE_PUBLIC_KEY.equals(this.getMode()) ? ModePublicKey.class : ModeCertificate.class); | 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 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | import cn.hutool.core.date.DateUtil; | 4 | import cn.hutool.core.date.DateUtil; |
| @@ -9,7 +9,6 @@ import cn.hutool.core.util.StrUtil; | @@ -9,7 +9,6 @@ import cn.hutool.core.util.StrUtil; | ||
| 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; | 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 10 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO; | 10 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO; |
| 11 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; | 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 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | 12 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 14 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO; | 13 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO; |
| 15 | import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | 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 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | import cn.hutool.core.date.DateUtil; | 4 | import cn.hutool.core.date.DateUtil; |
| @@ -8,7 +8,6 @@ import cn.hutool.core.util.StrUtil; | @@ -8,7 +8,6 @@ import cn.hutool.core.util.StrUtil; | ||
| 8 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; | 8 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 9 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO; | 9 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO; |
| 10 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; | 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 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | 11 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 13 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO; | 12 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO; |
| 14 | import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | 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
| 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 | import cn.hutool.core.io.IoUtil; | 3 | import cn.hutool.core.io.IoUtil; |
| 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
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 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | import cn.hutool.core.date.LocalDateTimeUtil; | 4 | import cn.hutool.core.date.LocalDateTimeUtil; |
| @@ -7,6 +7,7 @@ import cn.hutool.core.lang.Assert; | @@ -7,6 +7,7 @@ import cn.hutool.core.lang.Assert; | ||
| 7 | import cn.hutool.core.map.MapUtil; | 7 | import cn.hutool.core.map.MapUtil; |
| 8 | import cn.hutool.core.util.StrUtil; | 8 | import cn.hutool.core.util.StrUtil; |
| 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; | 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 10 | +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | ||
| 10 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO; | 11 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO; |
| 11 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; | 12 | import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; |
| 12 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | 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,6 +16,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReq | ||
| 15 | import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; | 16 | import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; |
| 16 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; | 17 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; |
| 17 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 18 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 19 | +import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum; | ||
| 18 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; | 20 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; |
| 19 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result; | 21 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result; |
| 20 | import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; | 22 | import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; |
| @@ -33,6 +35,8 @@ import java.time.LocalDateTime; | @@ -33,6 +35,8 @@ import java.time.LocalDateTime; | ||
| 33 | import java.time.ZoneId; | 35 | import java.time.ZoneId; |
| 34 | import java.util.Objects; | 36 | import java.util.Objects; |
| 35 | 37 | ||
| 38 | +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; | ||
| 39 | + | ||
| 36 | /** | 40 | /** |
| 37 | * 微信支付(公众号)的 PayClient 实现类 | 41 | * 微信支付(公众号)的 PayClient 实现类 |
| 38 | * | 42 | * |
| @@ -70,29 +74,29 @@ public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> { | @@ -70,29 +74,29 @@ public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> { | ||
| 70 | 74 | ||
| 71 | @Override | 75 | @Override |
| 72 | public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) { | 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 | // return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"), | 94 | // return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"), |
| 93 | // ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()),null, codeMapping); | 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,7 +194,8 @@ public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> { | ||
| 190 | } | 194 | } |
| 191 | 195 | ||
| 192 | private static String formatDate(LocalDateTime time) { | 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,7 +3,7 @@ package cn.iocoder.yudao.framework.pay.core.enums; | ||
| 3 | import cn.hutool.core.util.ArrayUtil; | 3 | import cn.hutool.core.util.ArrayUtil; |
| 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| 5 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | 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 | import lombok.AllArgsConstructor; | 7 | import lombok.AllArgsConstructor; |
| 8 | import lombok.Getter; | 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,12 +13,13 @@ import lombok.Getter; | ||
| 13 | public enum PayDisplayModeEnum { | 13 | public enum PayDisplayModeEnum { |
| 14 | 14 | ||
| 15 | URL("url"), // Redirect 跳转链接的方式 | 15 | URL("url"), // Redirect 跳转链接的方式 |
| 16 | - IFRAME("iframe"), // IFrame 内嵌链接的方式 | 16 | + IFRAME("iframe"), // IFrame 内嵌链接的方式【目前暂时用不到】 |
| 17 | FORM("form"), // HTML 表单提交 | 17 | FORM("form"), // HTML 表单提交 |
| 18 | QR_CODE("qr_code"), // 二维码的文字内容 | 18 | QR_CODE("qr_code"), // 二维码的文字内容 |
| 19 | - QR_CODE_URL("qr_code_url"), // 二维码的图片链接 | 19 | + QR_CODE_URL("qr_code_url"), // 二维码的图片链接【目前暂时用不到】 |
| 20 | BAR_CODE("bar_code"), // 条形码 | 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,17 +2,14 @@ package cn.iocoder.yudao.framework.pay.core.client.impl; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.io.IoUtil; | 3 | import cn.hutool.core.io.IoUtil; |
| 4 | import cn.hutool.core.util.RandomUtil; | 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 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; |
| 8 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | 6 | import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 9 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | 7 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; |
| 10 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient; | 8 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient; |
| 11 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient; | 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 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 12 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 15 | -import com.alipay.api.response.AlipayTradePrecreateResponse; | ||
| 16 | import org.junit.jupiter.api.Disabled; | 13 | import org.junit.jupiter.api.Disabled; |
| 17 | import org.junit.jupiter.api.Test; | 14 | import org.junit.jupiter.api.Test; |
| 18 | 15 |
yudao-module-member/yudao-module-member-biz/pom.xml
| @@ -41,11 +41,11 @@ | @@ -41,11 +41,11 @@ | ||
| 41 | </dependency> | 41 | </dependency> |
| 42 | <dependency> | 42 | <dependency> |
| 43 | <groupId>cn.iocoder.boot</groupId> | 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 | </dependency> | 45 | </dependency> |
| 46 | <dependency> | 46 | <dependency> |
| 47 | <groupId>cn.iocoder.boot</groupId> | 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 | </dependency> | 49 | </dependency> |
| 50 | 50 | ||
| 51 | <!-- Web 相关 --> | 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,6 +125,7 @@ public class MemberAuthServiceImpl implements MemberAuthService { | ||
| 125 | @Override | 125 | @Override |
| 126 | public AppAuthLoginRespVO weixinMiniAppLogin(AppAuthWeixinMiniAppLoginReqVO reqVO) { | 126 | public AppAuthLoginRespVO weixinMiniAppLogin(AppAuthWeixinMiniAppLoginReqVO reqVO) { |
| 127 | // 获得对应的手机号信息 | 127 | // 获得对应的手机号信息 |
| 128 | + // TODO @芋艿:需要弱化微信小程序的依赖,通过 system 获取手机号 | ||
| 128 | WxMaPhoneNumberInfo phoneNumberInfo; | 129 | WxMaPhoneNumberInfo phoneNumberInfo; |
| 129 | try { | 130 | try { |
| 130 | phoneNumberInfo = wxMaService.getUserService().getNewPhoneNoInfo(reqVO.getPhoneCode()); | 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,7 +94,7 @@ public interface PayOrderConvert { | ||
| 94 | @Mapping(target = "id", ignore = true) | 94 | @Mapping(target = "id", ignore = true) |
| 95 | PayOrderExtensionDO convert(PayOrderSubmitReqVO bean, String userIp); | 95 | PayOrderExtensionDO convert(PayOrderSubmitReqVO bean, String userIp); |
| 96 | 96 | ||
| 97 | - PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO); | 97 | + PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO, String userIp); |
| 98 | 98 | ||
| 99 | PayOrderSubmitRespVO convert(PayOrderUnifiedRespDTO bean); | 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,7 +141,7 @@ public class PayOrderServiceImpl implements PayOrderService { | ||
| 141 | orderExtensionMapper.insert(orderExtension); | 141 | orderExtensionMapper.insert(orderExtension); |
| 142 | 142 | ||
| 143 | // 3. 调用三方接口 | 143 | // 3. 调用三方接口 |
| 144 | - PayOrderUnifiedReqDTO unifiedOrderReqDTO = PayOrderConvert.INSTANCE.convert2(reqVO) | 144 | + PayOrderUnifiedReqDTO unifiedOrderReqDTO = PayOrderConvert.INSTANCE.convert2(reqVO, userIp) |
| 145 | // 商户相关的字段 | 145 | // 商户相关的字段 |
| 146 | .setMerchantOrderId(orderExtension.getNo()) // 注意,此处使用的是 PayOrderExtensionDO.no 属性! | 146 | .setMerchantOrderId(orderExtension.getNo()) // 注意,此处使用的是 PayOrderExtensionDO.no 属性! |
| 147 | .setSubject(order.getSubject()).setBody(order.getBody()) | 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 | package cn.iocoder.yudao.module.pay.dal.dataobject.merchant; | 1 | package cn.iocoder.yudao.module.pay.dal.dataobject.merchant; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 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 | import org.junit.jupiter.api.Test; | 5 | import org.junit.jupiter.api.Test; |
| 6 | 6 | ||
| 7 | public class PayChannelDOTest { | 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,7 +4,7 @@ import cn.hutool.core.io.IoUtil; | ||
| 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; | 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO; |
| 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 5 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 6 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | 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 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 8 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 9 | import cn.iocoder.yudao.module.pay.test.BaseDbIntegrationTest; | 9 | import cn.iocoder.yudao.module.pay.test.BaseDbIntegrationTest; |
| 10 | import org.junit.jupiter.api.Test; | 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,7 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; |
| 6 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | 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 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 8 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 10 | import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelCreateReqVO; | 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,6 +58,10 @@ | ||
| 58 | <groupId>cn.iocoder.boot</groupId> | 58 | <groupId>cn.iocoder.boot</groupId> |
| 59 | <artifactId>yudao-spring-boot-starter-biz-ip</artifactId> | 59 | <artifactId>yudao-spring-boot-starter-biz-ip</artifactId> |
| 60 | </dependency> | 60 | </dependency> |
| 61 | + <dependency> | ||
| 62 | + <groupId>cn.iocoder.boot</groupId> | ||
| 63 | + <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId> | ||
| 64 | + </dependency> | ||
| 61 | 65 | ||
| 62 | <!-- Web 相关 --> | 66 | <!-- Web 相关 --> |
| 63 | <dependency> | 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 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import io.swagger.v3.oas.annotations.tags.Tag; | 4 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -19,7 +19,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | @@ -19,7 +19,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 19 | 19 | ||
| 20 | @Tag(name = "微信公众号") | 20 | @Tag(name = "微信公众号") |
| 21 | @RestController | 21 | @RestController |
| 22 | -@RequestMapping("/member/wx-mp") | 22 | +@RequestMapping("/system/wx-mp") |
| 23 | @Validated | 23 | @Validated |
| 24 | @Slf4j | 24 | @Slf4j |
| 25 | public class AppWxMpController { | 25 | public class AppWxMpController { |
| @@ -27,6 +27,7 @@ public class AppWxMpController { | @@ -27,6 +27,7 @@ public class AppWxMpController { | ||
| 27 | @Resource | 27 | @Resource |
| 28 | private WxMpService mpService; | 28 | private WxMpService mpService; |
| 29 | 29 | ||
| 30 | + // TODO @芋艿:需要额外考虑个问题;多租户下,如果每个小程序一个微信公众号,则会存在多个 appid; | ||
| 30 | @PostMapping("/create-jsapi-signature") | 31 | @PostMapping("/create-jsapi-signature") |
| 31 | @Operation(summary = "创建微信 JS SDK 初始化所需的签名", | 32 | @Operation(summary = "创建微信 JS SDK 初始化所需的签名", |
| 32 | description = "参考 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html 文档") | 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,8 +16,8 @@ | ||
| 16 | <script> | 16 | <script> |
| 17 | let shopOrderId = undefined; | 17 | let shopOrderId = undefined; |
| 18 | let payOrderId = undefined; | 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 | // TODO openid | 21 | // TODO openid |
| 22 | let openid = "ockUAwIZ-0OeMZl9ogcZ4ILrGba0"; | 22 | let openid = "ockUAwIZ-0OeMZl9ogcZ4ILrGba0"; |
| 23 | $(function() { | 23 | $(function() { |
| @@ -26,6 +26,9 @@ | @@ -26,6 +26,9 @@ | ||
| 26 | $.ajax({ | 26 | $.ajax({ |
| 27 | url: server + "/app-api/wx/mp/create-jsapi-signature?url=" + document.location.href, | 27 | url: server + "/app-api/wx/mp/create-jsapi-signature?url=" + document.location.href, |
| 28 | method: 'POST', | 28 | method: 'POST', |
| 29 | + headers: { | ||
| 30 | + 'tenant-id': 1 | ||
| 31 | + }, | ||
| 29 | success: function( result ) { | 32 | success: function( result ) { |
| 30 | if (result.code !== 0) { | 33 | if (result.code !== 0) { |
| 31 | alert('获取 JsapiTicket 失败,原因:' + result.msg) | 34 | alert('获取 JsapiTicket 失败,原因:' + result.msg) |
yudao-ui-admin/src/views/mall/promotion/seckill/seckillActivity/index.vue
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | </el-form-item> | 17 | </el-form-item> |
| 18 | <el-form-item label="参与场次" prop="timeId"> | 18 | <el-form-item label="参与场次" prop="timeId"> |
| 19 | <el-select v-model="queryParams.timeId" placeholder="请选择参与场次" clearable size="small"> | 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 | </el-select> | 21 | </el-select> |
| 22 | </el-form-item> | 22 | </el-form-item> |
| 23 | <el-form-item label="创建时间" prop="createTime"> | 23 | <el-form-item label="创建时间" prop="createTime"> |
| @@ -38,9 +38,8 @@ | @@ -38,9 +38,8 @@ | ||
| 38 | v-hasPermi="['promotion:seckill-activity:create']">新增秒杀活动</el-button> | 38 | v-hasPermi="['promotion:seckill-activity:create']">新增秒杀活动</el-button> |
| 39 | </el-col> | 39 | </el-col> |
| 40 | <el-col :span="1.5"> | 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 | </el-col> | 43 | </el-col> |
| 45 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | 44 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| 46 | </el-row> | 45 | </el-row> |
| @@ -55,8 +54,8 @@ | @@ -55,8 +54,8 @@ | ||
| 55 | </el-table-column> | 54 | </el-table-column> |
| 56 | <el-table-column label="参与场次" prop="timeIds" width="250"> | 55 | <el-table-column label="参与场次" prop="timeIds" width="250"> |
| 57 | <template v-slot="scope"> | 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 | <el-tag style="margin:4px;" size="small">{{ item.name }}</el-tag> | 59 | <el-tag style="margin:4px;" size="small">{{ item.name }}</el-tag> |
| 61 | </span> | 60 | </span> |
| 62 | </template> | 61 | </template> |
| @@ -111,13 +110,12 @@ | @@ -111,13 +110,12 @@ | ||
| 111 | <el-form-item label="场次选择"> | 110 | <el-form-item label="场次选择"> |
| 112 | <el-select v-model="form.timeIds" placeholder="请选择参与场次" clearable size="small" multiple filterable | 111 | <el-select v-model="form.timeIds" placeholder="请选择参与场次" clearable size="small" multiple filterable |
| 113 | style="width: 880px"> | 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 | </el-select> | 119 | </el-select> |
| 122 | </el-form-item> | 120 | </el-form-item> |
| 123 | <el-form-item label="商品选择"> | 121 | <el-form-item label="商品选择"> |
| @@ -188,17 +186,10 @@ | @@ -188,17 +186,10 @@ | ||
| 188 | </template> | 186 | </template> |
| 189 | 187 | ||
| 190 | <script> | 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 | export default { | 194 | export default { |
| 204 | name: "PromotionSeckillActivity", | 195 | name: "PromotionSeckillActivity", |
| @@ -206,26 +197,26 @@ export default { | @@ -206,26 +197,26 @@ export default { | ||
| 206 | }, | 197 | }, |
| 207 | data() { | 198 | data() { |
| 208 | return { | 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 | timeId: null, | 220 | timeId: null, |
| 230 | createTime: [], | 221 | createTime: [], |
| 231 | }, | 222 | }, |
| @@ -270,18 +261,18 @@ export default { | @@ -270,18 +261,18 @@ export default { | ||
| 270 | this.total = response.data.total; | 261 | this.total = response.data.total; |
| 271 | this.loading = false; | 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 | cancel() { | 278 | cancel() { |
| @@ -315,10 +306,10 @@ export default { | @@ -315,10 +306,10 @@ export default { | ||
| 315 | this.resetForm("queryForm"); | 306 | this.resetForm("queryForm"); |
| 316 | this.handleQuery(); | 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 | handleAdd() { | 314 | handleAdd() { |
| 324 | this.reset(); | 315 | this.reset(); |
yudao-ui-admin/src/views/mall/promotion/seckill/seckillTime/index.vue
| @@ -63,19 +63,14 @@ | @@ -63,19 +63,14 @@ | ||
| 63 | </template> | 63 | </template> |
| 64 | 64 | ||
| 65 | <script> | 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 | import router from "@/router"; | 67 | import router from "@/router"; |
| 74 | -import {deepClone} from "@/utils"; | 68 | +import { deepClone } from "@/utils"; |
| 75 | 69 | ||
| 76 | export default { | 70 | export default { |
| 77 | - name: "PromotionSeckillConfig", | ||
| 78 | - components: {}, | 71 | + name: "PromotionSeckillTime", |
| 72 | + components: { | ||
| 73 | + }, | ||
| 79 | data() { | 74 | data() { |
| 80 | return { | 75 | return { |
| 81 | // 遮罩层 | 76 | // 遮罩层 |
| @@ -109,7 +104,7 @@ export default { | @@ -109,7 +104,7 @@ export default { | ||
| 109 | getList() { | 104 | getList() { |
| 110 | this.loading = true; | 105 | this.loading = true; |
| 111 | // 执行查询 | 106 | // 执行查询 |
| 112 | - getSeckillConfigList().then(response => { | 107 | + getSeckillTimeList().then(response => { |
| 113 | this.list = response.data; | 108 | this.list = response.data; |
| 114 | this.loading = false; | 109 | this.loading = false; |
| 115 | }); | 110 | }); |
| @@ -153,7 +148,7 @@ export default { | @@ -153,7 +148,7 @@ export default { | ||
| 153 | handleUpdate(row) { | 148 | handleUpdate(row) { |
| 154 | this.reset(); | 149 | this.reset(); |
| 155 | const id = row.id; | 150 | const id = row.id; |
| 156 | - getSeckillConfig(id).then(response => { | 151 | + getSeckillTime(id).then(response => { |
| 157 | response.data.startAndEndTime = [response.data.startTime, response.data.endTime] | 152 | response.data.startAndEndTime = [response.data.startTime, response.data.endTime] |
| 158 | this.form = response.data; | 153 | this.form = response.data; |
| 159 | this.open = true; | 154 | this.open = true; |
| @@ -173,7 +168,7 @@ export default { | @@ -173,7 +168,7 @@ export default { | ||
| 173 | data.endTime = this.form.startAndEndTime[1]; | 168 | data.endTime = this.form.startAndEndTime[1]; |
| 174 | // 修改的提交 | 169 | // 修改的提交 |
| 175 | if (this.form.id != null) { | 170 | if (this.form.id != null) { |
| 176 | - updateSeckillConfig(data).then(response => { | 171 | + updateSeckillTime(data).then(response => { |
| 177 | this.$modal.msgSuccess("修改成功"); | 172 | this.$modal.msgSuccess("修改成功"); |
| 178 | this.open = false; | 173 | this.open = false; |
| 179 | this.getList(); | 174 | this.getList(); |
| @@ -181,7 +176,7 @@ export default { | @@ -181,7 +176,7 @@ export default { | ||
| 181 | return; | 176 | return; |
| 182 | } | 177 | } |
| 183 | // 添加的提交 | 178 | // 添加的提交 |
| 184 | - createSeckillConfig(data).then(response => { | 179 | + createSeckillTime(data).then(response => { |
| 185 | this.$modal.msgSuccess("新增成功"); | 180 | this.$modal.msgSuccess("新增成功"); |
| 186 | this.open = false; | 181 | this.open = false; |
| 187 | this.getList(); | 182 | this.getList(); |
| @@ -192,7 +187,7 @@ export default { | @@ -192,7 +187,7 @@ export default { | ||
| 192 | handleDelete(row) { | 187 | handleDelete(row) { |
| 193 | const id = row.id; | 188 | const id = row.id; |
| 194 | this.$modal.confirm('是否确认删除秒杀时段编号为"' + id + '"的数据项?').then(function () { | 189 | this.$modal.confirm('是否确认删除秒杀时段编号为"' + id + '"的数据项?').then(function () { |
| 195 | - return deleteSeckillConfig(id); | 190 | + return deleteSeckillTime(id); |
| 196 | }).then(() => { | 191 | }).then(() => { |
| 197 | this.getList(); | 192 | this.getList(); |
| 198 | this.$modal.msgSuccess("删除成功"); | 193 | this.$modal.msgSuccess("删除成功"); |