package com.elephant.framework.galaxy.aroad.module.common.getInterfaceData;

import com.alibaba.fastjson.JSONObject;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class HttpClient {

    public String client(String token) {
        RestTemplate template = new RestTemplate();
        String url = "http://118.24.7.48:8088/updateAccessTokenSysInterfaceEnterprise.action?refreshtoken="+token;
        ResponseEntity<String> response = template.getForEntity(url, String.class);
        return response.getBody();
    }

    public static String callOtherInterface(String propUrl, String token, String createData) {
        RestTemplate rest =new RestTemplate();
        String json = "{'createDate':"+createData+"}";
        String url = "http://118.24.7.48:8088/"+propUrl+"?access_token="+token+"&key={json}";
        ResponseEntity<String> res= rest.getForEntity(url,String.class,json);
        return  res.getBody();
    }
}
