admin
2021-02-06 cad915058c3c53bf328a8ae9ca9bc7de099caba7
src/test/java/com/hxh/spring/test/PPTVTest.java
@@ -1,26 +1,36 @@
package com.hxh.spring.test;
import com.yeshi.buwan.exception.PPTVException;
import com.yeshi.buwan.pptv.PPTVApiUtil;
import com.yeshi.buwan.pptv.PPTVUtil;
import com.yeshi.buwan.pptv.entity.PPTVSeries;
import com.yeshi.buwan.service.inter.LoginUserService;
import com.yeshi.buwan.service.inter.juhe.PPTVService;
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 javax.annotation.Resource;
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 PPTVTest {
    @Resource
    private PPTVService pptvService;
    @Resource
    private LoginUserService loginUserService;
    @Test
    public void save() {
        List<PPTVSeries> list = PPTVApiUtil.getUpdateList();
//        pptvService.save(list);
        pptvService.save(list);
    }
    @Test
@@ -30,17 +40,50 @@
    }
    @Test
    public void test(){
      PPTVApiUtil.getOpenId("123");
    public void test() {
        PPTVApiUtil.getOpenId("123");
    }
    @Test
    public void getAll() {
        PPTVApiUtil.getUpdateList();
    }
    @Test
    public void getApiDetail(){
    public void getApiDetail() {
        PPTVApiUtil.getDetail("32159127,10215224,15326213");
    }
    @Test
    public void getOpenId() {
        //CODE:XefbSM0H8BC9kaEGEjHF2U7wd6Sd9ec1oSUmG1gZDTg=
//        PPTVApiUtil.login("XefbSM0H8BC9kaEGEjHF2U7wd6Sd9ec1oSUmG1gZDTg=");
        String pptvUid = PPTVUtil.decryptPPTVCode("XefbSM0H8BC9kaEGEjHF2U7wd6Sd9ec1oSUmG1gZDTg=").pptvUid;
//        String openId = PPTVApiUtil.getOpenId(pptvUid);
//        System.out.println(openId);
        try {
            loginUserService.updatePPTVOpenId("766693");
        } catch (PPTVException e) {
            e.printStackTrace();
        }
    }
    @Test
    public void getVIPPriceList() {
        PPTVApiUtil.getVIPPriceList();
    }
    @Test
    public void addVideoInfo() {
        PPTVSeries series = pptvService.getSeriesDetail("9847");
        System.out.println(series);
    }
}