| | |
| | | if (startGetMedia == null) startGetMedia = new HashMap<>(); |
| | | startGetMedia.put(mediaServerItem.getId(), true); |
| | | new Thread(() -> { |
| | | |
| | | ZLMServerConfig zlmServerConfig = getMediaServerConfig(mediaServerItem); |
| | | if (zlmServerConfig != null) { |
| | | zlmServerConfig.setIp(mediaServerItem.getIp()); |
| | |
| | | startGetMedia.remove(mediaServerItem.getId()); |
| | | mediaServerService.handLeZLMServerConfig(zlmServerConfig); |
| | | } |
| | | |
| | | }).start(); |
| | | } |
| | | Timer timer = new Timer(); |
| | |
| | | |
| | | public ZLMServerConfig getMediaServerConfig(MediaServerItem mediaServerItem) { |
| | | if (startGetMedia == null) { return null;} |
| | | if (mediaServerService.getOne(mediaServerItem.getId()) == null) { |
| | | return null; |
| | | } |
| | | if ( startGetMedia.get(mediaServerItem.getId()) == null || !startGetMedia.get(mediaServerItem.getId())) { |
| | | return null; |
| | | } |
| | |
| | | WVPResult<MediaServerItem> checkMediaServer(String ip, int port, String secret); |
| | | |
| | | boolean checkMediaRecordServer(String ip, int port); |
| | | |
| | | void delete(String id); |
| | | } |
| | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | redisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX, id); |
| | | String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + id; |
| | | redisUtil.del(key); |
| | | mediaServerMapper.delOne(id); |
| | | } |
| | | } |
| | |
| | | }) |
| | | @PostMapping(value = "/media_server/save") |
| | | @ResponseBody |
| | | public WVPResult<String> checkMediaServer(@RequestBody MediaServerItem mediaServerItem){ |
| | | public WVPResult<String> saveMediaServer(@RequestBody MediaServerItem mediaServerItem){ |
| | | if (mediaServerService.getOne(mediaServerItem.getId()) != null) { |
| | | mediaServerService.update(mediaServerItem); |
| | | }else { |
| | |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation("移除流媒体服务") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="id", value = "流媒体ID", dataTypeClass = String.class) |
| | | }) |
| | | @DeleteMapping(value = "/media_server/delete") |
| | | @ResponseBody |
| | | public WVPResult<String> deleteMediaServer(@RequestParam String id){ |
| | | if (mediaServerService.getOne(id) != null) { |
| | | mediaServerService.delete(id); |
| | | }else { |
| | | WVPResult<String> result = new WVPResult<>(); |
| | | result.setCode(-1); |
| | | result.setMsg("未找到此节点"); |
| | | return result; |
| | | } |
| | | WVPResult<String> result = new WVPResult<>(); |
| | | result.setCode(0); |
| | | result.setMsg("success"); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("重启服务") |
| | |
| | | <div class="card-img-zlm"></div> |
| | | <div style="padding: 14px;text-align: left"> |
| | | <span style="font-size: 16px">{{item.id}}</span> |
| | | <el-button icon="el-icon-edit" style="padding: 0;float: right;" type="text" @click="edit(item)">编辑</el-button> |
| | | <el-button icon="el-icon-delete" style="margin-right: 10px;padding: 0;float: right;" type="text" @click="del(item)">移除</el-button> |
| | | <div style="margin-top: 13px; line-height: 12px; "> |
| | | <span style="font-size: 14px; color: #999; margin-top: 5px">创建时间: {{item.createTime}}</span> |
| | | <el-button icon="el-icon-edit" style="padding: 0;float: right;" type="text" @click="edit(item)">编辑</el-button> |
| | | </div> |
| | | </div> |
| | | <i v-if="item.status" class="iconfont icon-online server-card-status-online" title="在线"></i> |
| | |
| | | edit: function (row){ |
| | | this.$refs.mediaServerEdit.openDialog(row, this.initData) |
| | | }, |
| | | del: function (row){ |
| | | this.$confirm('确认删除此节点?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.mediaServerObj.delete(row.id, (data)=>{ |
| | | if (data.code === 0) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '删除成功!' |
| | | }); |
| | | } |
| | | }) |
| | | |
| | | }).catch(() => { |
| | | }); |
| | | |
| | | }, |
| | | getNumberByWidth(){ |
| | | let candidateNums = [1, 2, 3, 4, 6, 8, 12, 24] |
| | | let clientWidth = window.innerWidth - 30; |
| | |
| | | console.log(error); |
| | | }); |
| | | } |
| | | |
| | | delete(id, callback) { |
| | | this.$axios({ |
| | | method: 'delete', |
| | | url:`/api/server/media_server/delete`, |
| | | params: { |
| | | id: id |
| | | } |
| | | }).then(function (res) { |
| | | if (typeof (callback) == "function") callback(res.data) |
| | | }).catch(function (error) { |
| | | console.log(error); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | export default MediaServer; |