2023年9月4日 修改调用接口返回内容,定时关闭未上线直播间,同时点击按钮拉流
This commit is contained in:
parent
33d75d47ad
commit
a36e920d9a
|
@ -5,10 +5,12 @@ import cn.hutool.core.net.url.UrlBuilder;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.xkcoding.http.HttpUtil;
|
import com.xkcoding.http.HttpUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.compress.utils.Lists;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
@ -24,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 对外部访问接口
|
* @Description: 对外部访问接口
|
||||||
|
@ -44,6 +47,9 @@ public class httpController extends JeecgController<TBks, ITBksService> {
|
||||||
@ApiOperation(value="T_BKS-抓取-通过id查询", notes="T_BKS-抓取-通过id查询")
|
@ApiOperation(value="T_BKS-抓取-通过id查询", notes="T_BKS-抓取-通过id查询")
|
||||||
@GetMapping(value = "/runAvyApiByIds")
|
@GetMapping(value = "/runAvyApiByIds")
|
||||||
public Result<?> runAvyApiByIds(String ids,String type){
|
public Result<?> runAvyApiByIds(String ids,String type){
|
||||||
|
Result res = Result.OK("操作成功");
|
||||||
|
List<Map<String,String>> resultList = Lists.newArrayList();
|
||||||
|
res.setResult(resultList);
|
||||||
if(StringUtils.isNotBlank(ids)){
|
if(StringUtils.isNotBlank(ids)){
|
||||||
List<String> idList = Arrays.asList(ids.split(","));
|
List<String> idList = Arrays.asList(ids.split(","));
|
||||||
QueryWrapper<KcZhihuijiaoshi> qw = new QueryWrapper<>();
|
QueryWrapper<KcZhihuijiaoshi> qw = new QueryWrapper<>();
|
||||||
|
@ -66,12 +72,20 @@ public class httpController extends JeecgController<TBks, ITBksService> {
|
||||||
.addQuery("data", hex)
|
.addQuery("data", hex)
|
||||||
.build();
|
.build();
|
||||||
log.info("访问奥威亚接口地址"+buildUrl);
|
log.info("访问奥威亚接口地址"+buildUrl);
|
||||||
|
Map<String,String> rm = Maps.newHashMap();
|
||||||
|
resultList.add(rm);
|
||||||
|
rm.put("xm",x.getXm());
|
||||||
|
rm.put("jsmc",x.getJsmc());
|
||||||
|
rm.put("url",buildUrl);
|
||||||
try{
|
try{
|
||||||
|
String resText = HttpUtil.get(buildUrl);
|
||||||
String res = HttpUtil.get(buildUrl);
|
log.info("奥威亚返回接口内容:" + resText);//live_setParam_ret=ok
|
||||||
log.info("奥威亚返回接口内容:" + res);//live_setParam_ret=ok
|
rm.put("resText",resText);
|
||||||
|
// res.setResult(rm);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
log.error(e.getMessage(),e);
|
log.error(e.getMessage(),e);
|
||||||
|
rm.put("resText",e.getMessage());
|
||||||
|
// res.setResult(rm);
|
||||||
}
|
}
|
||||||
//解析,决定最后返回结果
|
//解析,决定最后返回结果
|
||||||
});
|
});
|
||||||
|
@ -79,20 +93,23 @@ public class httpController extends JeecgController<TBks, ITBksService> {
|
||||||
return Result.ok("操作失败");
|
return Result.ok("操作失败");
|
||||||
}
|
}
|
||||||
//URL url = new URL("www.hutool.cn")
|
//URL url = new URL("www.hutool.cn")
|
||||||
return Result.ok("操作成功");
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String hex = Convert.toHex("live_setParam_enable=1", CharsetUtil.CHARSET_UTF_8);//开始
|
String hex = Convert.toHex("live_setParam_enable=1", CharsetUtil.CHARSET_UTF_8);//开始
|
||||||
//String hex = Convert.toHex("live_setParam_enable=0", CharsetUtil.CHARSET_UTF_8);//停止
|
//String hex = Convert.toHex("live_setParam_enable=0", CharsetUtil.CHARSET_UTF_8);//停止
|
||||||
|
String ip = "10.68.100.46";
|
||||||
|
String user = "admin";
|
||||||
|
String pwd = "admin";
|
||||||
String buildUrl = UrlBuilder.create()
|
String buildUrl = UrlBuilder.create()
|
||||||
.setScheme("http")
|
.setScheme("http")
|
||||||
.setHost("10.68.100.2")
|
.setHost(ip)
|
||||||
.addPath("/cgi-bin")
|
.addPath("/cgi-bin")
|
||||||
.addPath("/plat.cgi")
|
.addPath("/plat.cgi")
|
||||||
.addQuery("action", "9")
|
.addQuery("action", "9")
|
||||||
.addQuery("user", "admin")
|
.addQuery("user", user)
|
||||||
.addQuery("pwsd", SecureUtil.md5("admin"))
|
.addQuery("pwsd", SecureUtil.md5(pwd))
|
||||||
.addQuery("command", "1")
|
.addQuery("command", "1")
|
||||||
.addQuery("data", hex)
|
.addQuery("data", hex)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.jeecg.modules.kc.grab.SynchronizationService;
|
package org.jeecg.modules.kc.grab.SynchronizationService;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.net.url.UrlBuilder;
|
||||||
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.beust.jcommander.internal.Sets;
|
import com.beust.jcommander.internal.Sets;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
@ -53,6 +57,37 @@ public class RefreshLiveServer extends BaseSync {
|
||||||
// liveOnMap.put(x.getId(),false);
|
// liveOnMap.put(x.getId(),false);
|
||||||
outList.add(x.getId());
|
outList.add(x.getId());
|
||||||
log.error(e.getMessage(),e);
|
log.error(e.getMessage(),e);
|
||||||
|
//打开推送开关
|
||||||
|
//访问。汇总结果
|
||||||
|
//http://${ip}/cgi-bin/plat.cgi?action=9&user=${user}&pwsd=${getMd5Str(pwd)}&command=1
|
||||||
|
String hex = Convert.toHex("live_setParam_enable=1", CharsetUtil.CHARSET_UTF_8);
|
||||||
|
String buildUrl = UrlBuilder.create()
|
||||||
|
.setScheme("http")
|
||||||
|
.setHost(x.getIp())
|
||||||
|
.addPath("/cgi-bin")
|
||||||
|
.addPath("/plat.cgi")
|
||||||
|
.addQuery("action", "9")
|
||||||
|
.addQuery("user", x.getUser())
|
||||||
|
.addQuery("pwsd", SecureUtil.md5(x.getMima()))
|
||||||
|
.addQuery("command", "1")
|
||||||
|
.addQuery("data", hex)
|
||||||
|
.build();
|
||||||
|
log.info("访问奥威亚接口地址"+buildUrl);
|
||||||
|
Map<String,String> rm = Maps.newHashMap();
|
||||||
|
rm.put("xm",x.getXm());
|
||||||
|
rm.put("jsmc",x.getJsmc());
|
||||||
|
rm.put("url",buildUrl);
|
||||||
|
try{
|
||||||
|
String resText = HttpUtil.get(buildUrl);
|
||||||
|
log.info("奥威亚返回接口内容:" + resText);//live_setParam_ret=ok
|
||||||
|
rm.put("resText",resText);
|
||||||
|
// res.setResult(rm);
|
||||||
|
} catch (Exception e2){
|
||||||
|
log.error(e2.getMessage(),e2);
|
||||||
|
rm.put("resText",e2.getMessage());
|
||||||
|
// res.setResult(rm);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(!onList.isEmpty()){
|
if(!onList.isEmpty()){
|
||||||
|
|
Loading…
Reference in New Issue