From eb7f3343af839a7c71f16e8ada2b25d5e2201c08 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 19 四月 2021 19:27:52 +0800 Subject: [PATCH] bug修复 --- src/test/java/com/hxh/spring/test/PPTVTest.java | 40 ++++++++++++++++++++++++++++++++-------- 1 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/hxh/spring/test/PPTVTest.java b/src/test/java/com/hxh/spring/test/PPTVTest.java index 6df14b1..aa22cfd 100644 --- a/src/test/java/com/hxh/spring/test/PPTVTest.java +++ b/src/test/java/com/hxh/spring/test/PPTVTest.java @@ -19,6 +19,7 @@ import org.junit.runner.RunWith; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; @@ -75,14 +76,14 @@ @Test public void update() { - try { - pptvVideoUpdate.updateLatestVideo(""); - } catch (Exception e) { - e.printStackTrace(); - } +// try { +// pptvVideoUpdate.updateLatestVideo(""); +// } catch (Exception e) { +// e.printStackTrace(); +// } -// List<PPTVSeries> list = PPTVApiUtil.getUpdateList(); -// System.out.println(list); + List<PPTVSeries> list = PPTVApiUtil.getUpdateList(); + System.out.println(list); } @Test @@ -102,7 +103,8 @@ @Test public void getApiDetail() { - PPTVApiUtil.getDetail("32159127,10215224,15326213"); + PPTVSeries series = PPTVApiUtil.getDetail("28544897"); + System.out.println(series); } @@ -279,4 +281,26 @@ } + @Test + public void buy() { + PPTVApiUtil.buyGoods("257dfd950c20ad25dee9f99ef926c0f8", "danpian-1", "AB5574873120458", new Date()); + } + + @Test + public void updateGoodsInfo() { + Query query = new Query(); + query.addCriteria(new Criteria("goodsInfo").is(null).andOperator(Criteria.where("free").is("1"))); + query.limit(400); + List<PPTVSeries> list = pptvSeriesDao.findList(query); + for (PPTVSeries series : list) { + PPTVSeries detail = PPTVApiUtil.getDetail(series.getSeriesCode()); + query = new Query(); + query.addCriteria(Criteria.where("_id").is(detail.getInfoID())); + Update update = new Update(); + update.set("goodsInfo", detail.getGoodsInfo()); + pptvSeriesDao.update(query, update); + } + } + + } -- Gitblit v1.8.0