From f537abe9f3646c739beaf15076246a2f71a347e9 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 20 二月 2025 16:57:55 +0800 Subject: [PATCH] IOS广告增加区域屏蔽 --- src/test/java/com/hxh/spring/test/vip/VIPTest.java | 130 ++++++++++++++++++++++++++++++++++++------- 1 files changed, 108 insertions(+), 22 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 e496ac2..908a247 100644 --- a/src/test/java/com/hxh/spring/test/vip/VIPTest.java +++ b/src/test/java/com/hxh/spring/test/vip/VIPTest.java @@ -1,32 +1,35 @@ package com.hxh.spring.test.vip; -import com.yeshi.buwan.domain.vip.UserVIPInfo; -import com.yeshi.buwan.domain.vip.OrderRecord; -import com.yeshi.buwan.domain.vip.VIPPrice; -import com.yeshi.buwan.domain.vip.VIPPriceType; +import com.yeshi.buwan.domain.vip.*; +import com.yeshi.buwan.exception.PPTVException; +import com.yeshi.buwan.exception.ParamsException; import com.yeshi.buwan.exception.order.OrderException; import com.yeshi.buwan.exception.vip.VIPException; +import com.yeshi.buwan.exception.vip.VideoBuyRecordException; import com.yeshi.buwan.job.OrderJob; -import com.yeshi.buwan.pptv.PPTVVipManager; import com.yeshi.buwan.service.inter.order.OrderService; import com.yeshi.buwan.service.inter.vip.VIPPriceService; import com.yeshi.buwan.service.inter.vip.VIPService; +import com.yeshi.buwan.service.inter.vip.VideoBuyRecordService; import com.yeshi.buwan.util.Constant; import com.yeshi.buwan.util.HttpUtil; +import com.yeshi.buwan.util.user.VipUtil; +import com.yeshi.buwan.util.vip.VIPOrderUtil; +import com.yeshi.buwan.videos.pptv.PPTVVipManager; 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.alipay.AlipayH5PayUtil; import javax.annotation.Resource; +import java.io.File; +import java.io.FileInputStream; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import java.util.Scanner; -@RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 -@ContextConfiguration(locations = {"classpath:spring.xml"}) -@WebAppConfiguration +//@RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 +//@ContextConfiguration(locations = {"classpath:spring.xml"}) +//@WebAppConfiguration public class VIPTest { @Resource @@ -44,6 +47,9 @@ @Resource private OrderJob orderJob; + + @Resource + private VideoBuyRecordService videoBuyRecordService; @Test public void addVIPPrice() { @@ -123,19 +129,19 @@ @Test public void listRecord() { - List<OrderRecord> list = orderService.listOrderRecord(null, null,null, 1, 10); - long count = orderService.countOrderRecord(null, null,null); + List<OrderRecord> list = orderService.listOrderRecord(null, null, null, 1, 10); + long count = orderService.countOrderRecord(null, null, null); - list = orderService.listOrderRecord(766693 + "", null,null, 1, 10); - count = orderService.countOrderRecord(766693 + "", null,null); + list = orderService.listOrderRecord(766693 + "", null, null, 1, 10); + count = orderService.countOrderRecord(766693 + "", null, null); - list = orderService.listOrderRecord(766693 + "", null,OrderRecord.STATE_NOT_PAY, 1, 10); - count = orderService.countOrderRecord(766693 + "", null,OrderRecord.STATE_NOT_PAY); + list = orderService.listOrderRecord(766693 + "", null, OrderRecord.STATE_NOT_PAY, 1, 10); + count = orderService.countOrderRecord(766693 + "", null, OrderRecord.STATE_NOT_PAY); - list = orderService.listOrderRecord(766693 + "", null,OrderRecord.STATE_PAY, 1, 10); - count = orderService.countOrderRecord(766693 + "",null, OrderRecord.STATE_PAY); + list = orderService.listOrderRecord(766693 + "", null, OrderRecord.STATE_PAY, 1, 10); + count = orderService.countOrderRecord(766693 + "", null, OrderRecord.STATE_PAY); System.out.println(list); } @@ -185,12 +191,12 @@ @Test public void test3() throws Exception { - OrderRecord record = orderService.getOrderRecord("82"); + OrderRecord record = orderService.getOrderRecord("1000592"); pptvVipManager.buyVIP(record); } @Test - public void cancelOrder(){ + public void cancelOrder() { try { orderJob.cancelOrder("1000140"); } catch (Exception e) { @@ -198,6 +204,86 @@ } } + @Test + public void addBuyVideoRecord() { + VideoBuyRecord record = new VideoBuyRecord(); + record.setId("123123"); + record.setGoodsNo("123123123"); + record.setStartTime(new Date()); + record.setEndTime(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24L)); + record.setLoginUid("766693"); + record.setInfoId("381072"); + record.setCid("32459137"); + try { + videoBuyRecordService.addRecord(record); + } catch (ParamsException e) { + e.printStackTrace(); + } catch (VideoBuyRecordException e) { + e.printStackTrace(); + } + } + + @Test + public void buyVideo() { + try { + pptvVipManager.buyVideo(orderService.getOrderRecord("1000155")); + } catch (PPTVException e) { + e.printStackTrace(); + } catch (OrderException e) { + e.printStackTrace(); + } catch (VideoBuyRecordException e) { + e.printStackTrace(); + } + } + + @Test + public void refoundWX() { + //閫�娆� + try { + Scanner scanner = new Scanner(new FileInputStream(new File("C:\\Users\\Administrator\\Desktop\\wx閫�娆捐鍗�.txt"))); + while (scanner.hasNextLine()) { + String st = scanner.nextLine(); + String[] sts = st.split(" "); + String line = ""; + line += "buwan_vip_" + sts[0] + ","; + line += sts[1] + ","; + line += "褰辫澶у叏VIP鏉冪泭缁堟閫�鍥�,"; + line += "buwan_vip_" + sts[0]; + System.out.println(line); + } + + scanner.close(); + } catch (Exception e) { + + } + + + } + + @Test + public void refoundAlipay() { + //閫�娆� + try { + Scanner scanner = new Scanner(new FileInputStream(new File("C:\\Users\\Administrator\\Desktop\\閫�娆綷\alipay.txt"))); + while (scanner.hasNextLine()) { + String st = scanner.nextLine(); + String[] sts = st.split(" "); + String id = sts[0]; + String money = sts[1]; + String orderId = VIPOrderUtil.getOutOrderNo(OrderType.vip, id); + AlipayH5PayUtil.refund(VipUtil.getAlipayApp(), orderId, null, new BigDecimal(money), orderId); + } + + scanner.close(); + } catch (Exception e) { + + } + + + } + + // + } -- Gitblit v1.8.0