package com.tuoheng.admin.service.mqttService;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class MqHttp {

    @Value("${spring.mqtt.onlineUrl}")
    String url;
    @RequestMapping("/doGetClient")
    @ResponseBody
    public String doGetClient(){
        HttpURLConnectionUtil httpURLConnectionUtil = new HttpURLConnectionUtil();
        //String urls=url.replace("tcp","http").replace("1883","18083");
        //String urls="https://mqtt.t-aaron.com";
        String a = httpURLConnectionUtil.doGet(""+url+"/api/v4/clients?_page=1&_limit=100&_=1657249001745");
        return  a;
    }
    //http://124.223.218.130:18083/api/v4/nodes/emqx@127.0.0.1/subscriptions/001497326DAA2502?_=1657257768467
    @RequestMapping("/doGetClientById")
    @ResponseBody
    public String doGetClientById(String clientId){
        HttpURLConnectionUtil httpURLConnectionUtil = new HttpURLConnectionUtil();
        //String urls=url.replace("tcp","http").replace("1883","18083");
        //String urls="https://mqtt.t-aaron.com";
        String a = httpURLConnectionUtil.doGet(""+url+"/api/v4/clients/"+clientId+"?_=1657257768467");
        return  a;
    }
}

