package com.cftech.qy.api.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cftech.core.util.OKHttpUtils;
import com.cftech.qy.api.WebHttpInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.io.IOException;


@Service("webHttpInterface")
//@com.alibaba.dubbo.config.annotation.Service(interfaceClass = com.cftech.qy.api.WebHttpInterface.class, protocol = {"dubbo"}, retries = 0, timeout = 8000)
public class WebHttpInterfaceImpl implements WebHttpInterface {

//    @Autowired
//    private RedisTemplate<String, String> redisTemplate;
//
//    @Override
//    public String getValue(String url, String field) {
//        try {
//
//            String retStr = OKHttpUtils.getJSON(url);
//            JSONObject retObj = JSON.parseObject(retStr);
//            String token = retObj.getString(field);
//            return token;
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        return null;
//    }

}
