From f13ed98e1de0ec7b85ed179212cc095f63480eed Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 25 三月 2021 18:18:20 +0800 Subject: [PATCH] 全网搜优酷兼容 --- src/test/java/com/hxh/spring/test/vip/VIPTest.java | 90 ++++++++++++++++++++++++++++++++++++--------- 1 files changed, 72 insertions(+), 18 deletions(-) diff --git a/src/test/java/com/hxh/spring/test/vip/VIPTest.java b/src/test/java/com/hxh/spring/test/vip/VIPTest.java index 8f1dcde..96922ce 100644 --- a/src/test/java/com/hxh/spring/test/vip/VIPTest.java +++ b/src/test/java/com/hxh/spring/test/vip/VIPTest.java @@ -1,26 +1,44 @@ package com.hxh.spring.test.vip; +import com.yeshi.buwan.domain.vip.UserVIPInfo; import com.yeshi.buwan.domain.vip.VIPOrderRecord; import com.yeshi.buwan.domain.vip.VIPPrice; import com.yeshi.buwan.domain.vip.VIPPriceType; import com.yeshi.buwan.exception.vip.VIPException; +import com.yeshi.buwan.pptv.PPTVVipManager; import com.yeshi.buwan.service.inter.vip.VIPPriceService; import com.yeshi.buwan.service.inter.vip.VIPService; +import com.yeshi.buwan.util.Constant; import com.yeshi.buwan.util.HttpUtil; +import com.yeshi.buwan.util.log.LoggerUtil; +import com.yeshi.buwan.util.user.VipUtil; +import com.yeshi.buwan.util.vip.VIPOrderUtil; +import net.sf.json.JSONObject; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; +import org.yeshi.utils.entity.wx.WXAPPInfo; import javax.annotation.Resource; +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.GCMParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; import java.math.BigDecimal; +import java.security.GeneralSecurityException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.Base64; import java.util.Date; import java.util.List; -//@RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 -//@ContextConfiguration(locations = {"classpath:spring.xml"}) -//@WebAppConfiguration +@RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 +@ContextConfiguration(locations = {"classpath:spring.xml"}) +@WebAppConfiguration public class VIPTest { @Resource @@ -29,9 +47,13 @@ @Resource private VIPService vipService; + @Resource + private PPTVVipManager pptvVipManager; + @Test public void addVIPPrice() { VIPPrice price = new VIPPrice(); + price.setActualPrice(new BigDecimal("8.8")); price.setPrice(new BigDecimal("14.8")); price.setType(VIPPriceType.month); price.setPptvGoodsNo("DA7559531560894"); @@ -43,6 +65,7 @@ } price = new VIPPrice(); + price.setActualPrice(new BigDecimal("22.8")); price.setPrice(new BigDecimal("37.8")); price.setType(VIPPriceType.season); price.setPptvGoodsNo("DA7559574625089"); @@ -55,6 +78,7 @@ price = new VIPPrice(); + price.setActualPrice(new BigDecimal("42")); price.setPrice(new BigDecimal("68.8")); price.setType(VIPPriceType.halfYear); price.setPptvGoodsNo("DA6989580247516"); @@ -67,6 +91,7 @@ price = new VIPPrice(); + price.setActualPrice(new BigDecimal("77.8")); price.setPrice(new BigDecimal("128.8")); price.setType(VIPPriceType.year); price.setPptvGoodsNo("DA8129574268091"); @@ -90,7 +115,7 @@ public void addOrderRecord() { VIPPrice price = vipPriceService.selectByPrimaryKey("172a8327fcd3685ab3c0f740d031da09"); VIPOrderRecord record = new VIPOrderRecord(); - record.setMoney(price.getPrice()); + record.setMoney(price.getActualPrice()); record.setType(price.getType()); record.setUid(766693 + ""); @@ -122,25 +147,54 @@ @Test public void paySuccess() { - try { - vipService.checkOrderPayState(23 + ""); - } catch (Exception e) { - e.printStackTrace(); - } +// try { +// vipService.paySuccess("",VIPOrderRecord.PAY_WAY_WX,new BigDecimal("14.8"),) +// } catch (Exception e) { +// e.printStackTrace(); +// } } public static void main(String[] args) { - for (int i = 0; i < 20; i++) { - final int p=i; - new Thread(new Runnable() { - @Override - public void run() { - HttpUtil.get("http://192.168.3.122:8080/BuWan/test/vipPay?id=27"); - System.out.println("鎵ц瀹屾垚锛�"+p); - } - }).start(); + for (int i = 0; i < 10; i++) { + final int p = i; + new Thread(new Runnable() { + @Override + public void run() { + HttpUtil.get("http://192.168.3.122:8080/BuWan/test/vipPay?id=36"); + System.out.println("鎵ц瀹屾垚锛�" + p); + } + }).start(); } } + @Test + public void list() { + Boolean vip = true; + Date minDate = null; + Date maxDate = null; + if (vip != null) { + if (vip) { + minDate = new Date(System.currentTimeMillis() + 1000 * 60 * 5); + } else { + minDate = new Date(0L); + maxDate = new Date(); + } + } + + List<UserVIPInfo> list = vipService.listVIPUser(minDate, maxDate, 1, Constant.pageCount); + long count = vipService.countVIPUser(minDate, maxDate); + System.out.println(count); + } + + + @Test + public void test3() throws Exception { + VIPOrderRecord record = vipService.getOrderRecord("82"); + pptvVipManager.buyVIP(record); + } + } + + + -- Gitblit v1.8.0