package com.zbkj.front.user;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.zbkj.common.model.game.Game;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.RegisterThirdUserRequest;
import com.zbkj.common.response.*;
import com.zbkj.common.vo.SystemCityTreeVo;
import com.zbkj.front.service.UserCenterService;
import com.zbkj.service.service.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@SpringBootTest
@RunWith(SpringRunner.class)
public class ActivityTest {

    @Autowired private ActivityService activityService;
    @Autowired private ActivityRegisterService activityRegisterService;
    @Autowired private UserCenterService userCenterService;
    @Autowired private TeaPlantService teaPlantService;
    @Autowired private SystemCityService systemCityService;

    @Test
    public void getListTree(){
        List<SystemCityTreeVo> listTree = systemCityService.getListTree();
        System.out.println(JSON.toJSONString(listTree));
    }

    @Test
    public void nowMoneyBillRecord(){
        String type = "all";
        PageParamRequest page = new PageParamRequest();
        page.setPage(1);
        page.setLimit(99999999);
        CommonPage<UserRechargeBillRecordResponse> list = userCenterService.nowMoneyBillRecord(type, page);
        System.out.println(JSON.toJSONString(list));
    }
    
    @Test
    public void myRegisterList(){
        String cid = "746";
        PageParamRequest page = new PageParamRequest();
        page.setPage(1);
        page.setLimit(10);
        PageInfo list= activityRegisterService.myRegisterList(cid, page);
        System.out.println(JSON.toJSONString(list));
    }

    @Test
    public void getList(){
        PageParamRequest page = new PageParamRequest();
        page.setPage(1);
        page.setLimit(10);
        PageInfo<TeaPlantResponse> list = teaPlantService.getList(page);
        System.out.println(JSON.toJSONString(list));
    }

    @Test
    public void weChatAuthorizeProgramLogin(){
        String code = "123456789";
        RegisterThirdUserRequest request = new RegisterThirdUserRequest();
        request.setOpenId("123456789");
        request.setProvince("");
        request.setCity("");
        request.setCountry("");
        userCenterService.weChatAuthorizeProgramLogin(code, request);
    }

    @Test
    public void list(){
        PageParamRequest page = new PageParamRequest();
        page.setPage(1);
        page.setLimit(10);
        PageInfo<ActivityResponse> list = activityService.getList("753", page);
        System.out.println(JSON.toJSONString(list));
    }
}