| | |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import com.github.pagehelper.PageInfo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.models.auth.In; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | }) |
| | | @PostMapping(value = "/save") |
| | | @ResponseBody |
| | | public Object save(@RequestBody StreamProxyItem param){ |
| | | public WVPResult save(@RequestBody StreamProxyItem param){ |
| | | logger.info("添加代理: " + JSONObject.toJSONString(param)); |
| | | streamProxyService.save(param); |
| | | return "success"; |
| | | String msg = streamProxyService.save(param); |
| | | WVPResult<Object> result = new WVPResult<>(); |
| | | result.setCode(0); |
| | | result.setMsg(msg); |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation("获取ffmpeg.cmd模板") |
| | | @GetMapping(value = "/ffmpeg_cmd/list") |
| | | @ResponseBody |
| | | public WVPResult getFFmpegCMDs(){ |
| | | logger.debug("获取ffmpeg.cmd模板:" ); |
| | | JSONObject data = streamProxyService.getFFmpegCMDs(); |
| | | WVPResult<JSONObject> result = new WVPResult<>(); |
| | | result.setCode(0); |
| | | result.setMsg("success"); |
| | | result.setData(data); |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation("移除代理") |
| | |
| | | }) |
| | | @DeleteMapping(value = "/del") |
| | | @ResponseBody |
| | | public Object del(String app, String stream){ |
| | | public WVPResult del(String app, String stream){ |
| | | logger.info("移除代理: " + app + "/" + stream); |
| | | streamProxyService.del(app, stream); |
| | | return "success"; |
| | | WVPResult<Object> result = new WVPResult<>(); |
| | | if (app == null || stream == null) { |
| | | result.setCode(400); |
| | | result.setMsg(app == null ?"app不能为null":"stream不能为null"); |
| | | }else { |
| | | streamProxyService.del(app, stream); |
| | | result.setCode(0); |
| | | result.setMsg("success"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation("启用代理") |
| | |
| | | public Object start(String app, String stream){ |
| | | logger.info("启用代理: " + app + "/" + stream); |
| | | boolean result = streamProxyService.start(app, stream); |
| | | return "success"; |
| | | return result?"success":"fail"; |
| | | } |
| | | |
| | | @ApiOperation("停用代理") |