package com.liangjian.dataplatform.member.controller;

import com.jfinal.weixin.sdk.utils.HttpUtils;
import com.liangjian.dataplatform.member.dao.secondary.MemIngProductRepository;
import com.liangjian.dataplatform.member.entity.po.secondary.MemIngProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: 黄子奇
 * @Date: 2019/11/14
 */
@RestController
@RequestMapping("/weixintry")
public class WeixinTryController {

    @Autowired
    private MemIngProductRepository memIngProductRepository;

    @GetMapping("/ip")
    public String getIp() {
        return HttpUtils.get("http://www.cip.cc");
    }

    @GetMapping("/try")
    @ResponseBody
    public List<MemIngProduct> trySomething() {
        List<MemIngProduct> res =  memIngProductRepository.findAll();
        res.forEach(i -> i.getProductLevel().forEach(j -> System.out.println(j.getLevel())));
        return res;
    }
}
