Commit cb8011658d9ad15970225014e8ad4a30104d88d9
1 parent
78a6fadf
live
Showing
3 changed files
with
193 additions
and
139 deletions
.settings/org.eclipse.wst.common.component
| @@ -9,10 +9,16 @@ | @@ -9,10 +9,16 @@ | ||
| 9 | <dependent-module archiveName="cnlive_live_model-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/cnlive_live_model/cnlive_live_model"> | 9 | <dependent-module archiveName="cnlive_live_model-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/cnlive_live_model/cnlive_live_model"> |
| 10 | <dependency-type>uses</dependency-type> | 10 | <dependency-type>uses</dependency-type> |
| 11 | </dependent-module> | 11 | </dependent-module> |
| 12 | - <dependent-module archiveName="cnlive_ks3-1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/cnlive_ks3/cnlive_ks3"> | 12 | + <dependent-module archiveName="smart-framework-4.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-framework/smart-framework"> |
| 13 | <dependency-type>uses</dependency-type> | 13 | <dependency-type>uses</dependency-type> |
| 14 | </dependent-module> | 14 | </dependent-module> |
| 15 | - <dependent-module archiveName="smart-framework-4.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-framework/smart-framework"> | 15 | + <dependent-module archiveName="smart-plugin-dbcp-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-plugin-dbcp/smart-plugin-dbcp"> |
| 16 | + <dependency-type>uses</dependency-type> | ||
| 17 | + </dependent-module> | ||
| 18 | + <dependent-module archiveName="smart-plugin-rest-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-plugin-rest/smart-plugin-rest"> | ||
| 19 | + <dependency-type>uses</dependency-type> | ||
| 20 | + </dependent-module> | ||
| 21 | + <dependent-module archiveName="smart-plugin-i18n-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-plugin-i18n/smart-plugin-i18n"> | ||
| 16 | <dependency-type>uses</dependency-type> | 22 | <dependency-type>uses</dependency-type> |
| 17 | </dependent-module> | 23 | </dependent-module> |
| 18 | <dependent-module archiveName="cnlive_mam_commons-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/cnlive_mam_commons/cnlive_mam_commons"> | 24 | <dependent-module archiveName="cnlive_mam_commons-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/cnlive_mam_commons/cnlive_mam_commons"> |
src/main/java/com/cnlive/mz/live/action/LiveAction.java
| @@ -203,13 +203,14 @@ public class LiveAction { | @@ -203,13 +203,14 @@ public class LiveAction { | ||
| 203 | boolean flag = tLiveService.addAcitvity(params); | 203 | boolean flag = tLiveService.addAcitvity(params); |
| 204 | if (flag) { | 204 | if (flag) { |
| 205 | Map<String, Object> map = new HashMap<String, Object>(); | 205 | Map<String, Object> map = new HashMap<String, Object>(); |
| 206 | - map.put("location", com.cnlive.mz.live.common.Constants.KS_HOST_UP_RTMP+channelID+"?vdoid=" + activityId); | 206 | + map.put("location", |
| 207 | + com.cnlive.mz.live.common.Constants.KS_HOST_UP_RTMP + channelID + "?vdoid=" + activityId); | ||
| 207 | rb.setData(map); | 208 | rb.setData(map); |
| 208 | rb.setErrorCode("0"); | 209 | rb.setErrorCode("0"); |
| 209 | rb.setErrorMessage("创建活动成功"); | 210 | rb.setErrorMessage("创建活动成功"); |
| 210 | log.info("创建活动成功"); | 211 | log.info("创建活动成功"); |
| 211 | - //通知cms直播 | ||
| 212 | - boolean success = tLiveService.startLive(tLive); | 212 | + // 通知cms直播 |
| 213 | + // boolean success = tLiveService.startLive(tLive); | ||
| 213 | return rb; | 214 | return rb; |
| 214 | } else { | 215 | } else { |
| 215 | Map<String, Object> map = new HashMap<String, Object>(); | 216 | Map<String, Object> map = new HashMap<String, Object>(); |
| @@ -242,23 +243,25 @@ public class LiveAction { | @@ -242,23 +243,25 @@ public class LiveAction { | ||
| 242 | @Request.Get("/live/epg/startActivity") | 243 | @Request.Get("/live/epg/startActivity") |
| 243 | public ResultBean startActivity(Params params) { | 244 | public ResultBean startActivity(Params params) { |
| 244 | ResultBean rb = new ResultBean(); | 245 | ResultBean rb = new ResultBean(); |
| 246 | + log.info(params); | ||
| 245 | String appId = params.getString("appId"); | 247 | String appId = params.getString("appId"); |
| 246 | String activityid = params.getString("activityId"); | 248 | String activityid = params.getString("activityId"); |
| 247 | if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | 249 | if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { |
| 248 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 249 | - map.put("location", ""); | ||
| 250 | - rb.setData(map); | ||
| 251 | rb.setErrorCode("500"); | 250 | rb.setErrorCode("500"); |
| 252 | - rb.setErrorMessage("启动活动失败"); | 251 | + rb.setErrorMessage("启动活动失败,参数不正确"); |
| 253 | return rb; | 252 | return rb; |
| 254 | } else { | 253 | } else { |
| 255 | TLive tLive = tLiveService.selectByParams(appId, activityid); | 254 | TLive tLive = tLiveService.selectByParams(appId, activityid); |
| 256 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 257 | - map.put("location", tLive.getLive_url()); | ||
| 258 | - rb.setData(map); | ||
| 259 | - rb.setErrorCode("0"); | ||
| 260 | - rb.setErrorMessage("启动活动成功"); | ||
| 261 | - return rb; | 255 | + if (tLive == null) { |
| 256 | + log.info("tLive为空......"); | ||
| 257 | + rb.setErrorCode("500"); | ||
| 258 | + rb.setErrorMessage("启动活动失败,活动对象为空"); | ||
| 259 | + return rb; | ||
| 260 | + } else { | ||
| 261 | + rb.setErrorCode("0"); | ||
| 262 | + rb.setErrorMessage("启动活动成功"); | ||
| 263 | + return rb; | ||
| 264 | + } | ||
| 262 | } | 265 | } |
| 263 | } | 266 | } |
| 264 | 267 | ||
| @@ -270,38 +273,42 @@ public class LiveAction { | @@ -270,38 +273,42 @@ public class LiveAction { | ||
| 270 | */ | 273 | */ |
| 271 | @Request.Get("/live/epg/stopActivity") | 274 | @Request.Get("/live/epg/stopActivity") |
| 272 | public ResultBean stopActivity(Params params) { | 275 | public ResultBean stopActivity(Params params) { |
| 276 | + log.info(params); | ||
| 273 | ResultBean rb = new ResultBean(); | 277 | ResultBean rb = new ResultBean(); |
| 274 | String appId = params.getString("appId"); | 278 | String appId = params.getString("appId"); |
| 275 | String activityid = params.getString("activityId"); | 279 | String activityid = params.getString("activityId"); |
| 276 | TLive tLive = tLiveService.selectByParams(appId, activityid); | 280 | TLive tLive = tLiveService.selectByParams(appId, activityid); |
| 281 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 277 | if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | 282 | if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { |
| 278 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 279 | map.put("location", ""); | 283 | map.put("location", ""); |
| 280 | rb.setData(map); | 284 | rb.setData(map); |
| 281 | rb.setErrorCode("500"); | 285 | rb.setErrorCode("500"); |
| 282 | rb.setErrorMessage("停止直播失败,参数不正确"); | 286 | rb.setErrorMessage("停止直播失败,参数不正确"); |
| 283 | return rb; | 287 | return rb; |
| 284 | } else { | 288 | } else { |
| 285 | - | ||
| 286 | - String live_url = tLive.getLive_url(); | ||
| 287 | - int index = live_url.lastIndexOf("/"); | ||
| 288 | - String streamName = live_url.substring(index + 1); | ||
| 289 | - System.out.println("streamName===" + streamName); | 289 | + if (tLive == null) { |
| 290 | + map.put("location", ""); | ||
| 291 | + rb.setData(map); | ||
| 292 | + rb.setErrorCode("500"); | ||
| 293 | + rb.setErrorMessage("停止直播失败,活动对象为空"); | ||
| 294 | + return rb; | ||
| 295 | + } else { | ||
| 296 | + String live_url = tLive.getLive_url(); | ||
| 297 | + int index = live_url.lastIndexOf("/"); | ||
| 298 | + String streamName = live_url.substring(index + 1); | ||
| 299 | + System.out.println("streamName===" + streamName); | ||
| 290 | // 直播断流。 | 300 | // 直播断流。 |
| 291 | - tCheckService.close(streamName, tLive.getId(), tLive.getUuid()); | ||
| 292 | - //通知cms停止直播 | ||
| 293 | - tLiveService.releaseChatRoom(tLive); | 301 | + tCheckService.close(streamName, tLive.getId(), tLive.getUuid()); |
| 294 | } | 302 | } |
| 295 | // 直播通知 | 303 | // 直播通知 |
| 296 | // tLiveService.notify(video_uuid, -1); | 304 | // tLiveService.notify(video_uuid, -1); |
| 297 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 298 | map.put("location", tLive.getLive_url()); | 305 | map.put("location", tLive.getLive_url()); |
| 299 | rb.setData(map); | 306 | rb.setData(map); |
| 300 | rb.setErrorCode("0"); | 307 | rb.setErrorCode("0"); |
| 301 | rb.setErrorMessage("停止直播成功"); | 308 | rb.setErrorMessage("停止直播成功"); |
| 302 | return rb; | 309 | return rb; |
| 303 | } | 310 | } |
| 304 | - | 311 | + } |
| 305 | 312 | ||
| 306 | /** | 313 | /** |
| 307 | * 1.6 获取直播活动列表接口.md | 314 | * 1.6 获取直播活动列表接口.md |
| @@ -320,14 +327,21 @@ public class LiveAction { | @@ -320,14 +327,21 @@ public class LiveAction { | ||
| 320 | map.put("location", ""); | 327 | map.put("location", ""); |
| 321 | rb.setData(map); | 328 | rb.setData(map); |
| 322 | rb.setErrorCode("500"); | 329 | rb.setErrorCode("500"); |
| 323 | - rb.setErrorMessage("获取活动列表失败,字段不正确"); | 330 | + rb.setErrorMessage("获取活动列表失败,参数不正确"); |
| 324 | return rb; | 331 | return rb; |
| 325 | } else { | 332 | } else { |
| 326 | Pager<TLive> tLive = tLiveService.getActivityPager(pageNo, pageSize, appId); | 333 | Pager<TLive> tLive = tLiveService.getActivityPager(pageNo, pageSize, appId); |
| 327 | - rb.setData(tLive); | ||
| 328 | - rb.setErrorCode("0"); | ||
| 329 | - rb.setErrorMessage("获取活动列表成功"); | ||
| 330 | - return rb; | 334 | + if (tLive == null) { |
| 335 | + rb.setData(""); | ||
| 336 | + rb.setErrorCode("500"); | ||
| 337 | + rb.setErrorMessage("获取活动列表失败,活动对象为空"); | ||
| 338 | + return rb; | ||
| 339 | + } else { | ||
| 340 | + rb.setData(tLive); | ||
| 341 | + rb.setErrorCode("0"); | ||
| 342 | + rb.setErrorMessage("获取活动列表成功"); | ||
| 343 | + return rb; | ||
| 344 | + } | ||
| 331 | 345 | ||
| 332 | } | 346 | } |
| 333 | } | 347 | } |
| @@ -342,21 +356,28 @@ public class LiveAction { | @@ -342,21 +356,28 @@ public class LiveAction { | ||
| 342 | ResultBean rb = new ResultBean(); | 356 | ResultBean rb = new ResultBean(); |
| 343 | String appId = params.getString("appId"); | 357 | String appId = params.getString("appId"); |
| 344 | String activityid = params.getString("activityId"); | 358 | String activityid = params.getString("activityId"); |
| 359 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 345 | if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | 360 | if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { |
| 346 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 347 | map.put("location", ""); | 361 | map.put("location", ""); |
| 348 | rb.setData(map); | 362 | rb.setData(map); |
| 349 | rb.setErrorCode("500"); | 363 | rb.setErrorCode("500"); |
| 350 | - rb.setErrorMessage("获取直播回放失败"); | 364 | + rb.setErrorMessage("获取直播回放失败,参数不正确"); |
| 351 | return rb; | 365 | return rb; |
| 352 | } else { | 366 | } else { |
| 353 | TLive tLive = tLiveService.selectByParams(appId, activityid); | 367 | TLive tLive = tLiveService.selectByParams(appId, activityid); |
| 354 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 355 | - map.put("location", tLive.getPlayback_url()); | ||
| 356 | - rb.setData(map); | ||
| 357 | - rb.setErrorCode("0"); | ||
| 358 | - rb.setErrorMessage("获取直播回放成功"); | ||
| 359 | - return rb; | 368 | + if (tLive == null) { |
| 369 | + map.put("location", ""); | ||
| 370 | + rb.setData(map); | ||
| 371 | + rb.setErrorCode("500"); | ||
| 372 | + rb.setErrorMessage("获取直播回放失败,活动对象为空"); | ||
| 373 | + return rb; | ||
| 374 | + } else { | ||
| 375 | + map.put("location", tLive.getPlayback_url()); | ||
| 376 | + rb.setData(map); | ||
| 377 | + rb.setErrorCode("0"); | ||
| 378 | + rb.setErrorMessage("获取直播回放成功"); | ||
| 379 | + return rb; | ||
| 380 | + } | ||
| 360 | } | 381 | } |
| 361 | } | 382 | } |
| 362 | 383 | ||
| @@ -367,27 +388,35 @@ public class LiveAction { | @@ -367,27 +388,35 @@ public class LiveAction { | ||
| 367 | */ | 388 | */ |
| 368 | @Request.Get("/live/epg/liveplayByAPP") | 389 | @Request.Get("/live/epg/liveplayByAPP") |
| 369 | public ResultBean liveplayByAPP(Params params) { | 390 | public ResultBean liveplayByAPP(Params params) { |
| 391 | + log.info(params); | ||
| 370 | ResultBean rb = new ResultBean(); | 392 | ResultBean rb = new ResultBean(); |
| 371 | String appId = params.getString("appId"); | 393 | String appId = params.getString("appId"); |
| 372 | String activityid = params.getString("activityId"); | 394 | String activityid = params.getString("activityId"); |
| 395 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 373 | if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | 396 | if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { |
| 374 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 375 | map.put("location", ""); | 397 | map.put("location", ""); |
| 376 | rb.setData(map); | 398 | rb.setData(map); |
| 377 | rb.setErrorCode("500"); | 399 | rb.setErrorCode("500"); |
| 378 | - rb.setErrorMessage("获取直播回放失败"); | 400 | + rb.setErrorMessage("获取直播回放失败,参数不正确"); |
| 379 | return rb; | 401 | return rb; |
| 380 | } else { | 402 | } else { |
| 381 | TLive tLive = tLiveService.selectByParams(appId, activityid); | 403 | TLive tLive = tLiveService.selectByParams(appId, activityid); |
| 382 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 383 | - map.put("location", tLive.getPlayback_url()); | ||
| 384 | - rb.setData(map); | ||
| 385 | - rb.setErrorCode("0"); | ||
| 386 | - rb.setErrorMessage("获取直播回放成功"); | ||
| 387 | - return rb; | 404 | + if (tLive == null) { |
| 405 | + map.put("location", ""); | ||
| 406 | + rb.setData(map); | ||
| 407 | + rb.setErrorCode("500"); | ||
| 408 | + rb.setErrorMessage("获取直播回放失败,活动对象为空"); | ||
| 409 | + return rb; | ||
| 410 | + } else { | ||
| 411 | + map.put("location", tLive.getPlayback_url()); | ||
| 412 | + rb.setData(map); | ||
| 413 | + rb.setErrorCode("0"); | ||
| 414 | + rb.setErrorMessage("获取直播回放成功"); | ||
| 415 | + return rb; | ||
| 416 | + } | ||
| 388 | } | 417 | } |
| 389 | } | 418 | } |
| 390 | - | 419 | + |
| 391 | /** | 420 | /** |
| 392 | * 1.8 获取APP直播URL接口.md | 421 | * 1.8 获取APP直播URL接口.md |
| 393 | * | 422 | * |
| @@ -409,26 +438,35 @@ public class LiveAction { | @@ -409,26 +438,35 @@ public class LiveAction { | ||
| 409 | return rb; | 438 | return rb; |
| 410 | } else { | 439 | } else { |
| 411 | TLive tLive = tLiveService.selectByParams(appId, activityid); | 440 | TLive tLive = tLiveService.selectByParams(appId, activityid); |
| 412 | - TChannel tchannel = tLiveService.selectChannel(tLive.getRelation_id()); | ||
| 413 | - if(tchannel!=null){ | ||
| 414 | - // 请求到app....... | ||
| 415 | - redirect(response, "http://ips.cnlive.com/IPS/liveplayByAPP.action?appId="+appId+"&channelID="+tLive.getRelation_id()); | 441 | + if (tLive == null) { |
| 416 | map.put("location", ""); | 442 | map.put("location", ""); |
| 417 | rb.setData(map); | 443 | rb.setData(map); |
| 418 | - rb.setErrorCode("0"); | ||
| 419 | - rb.setErrorMessage("302重定向到app"); | ||
| 420 | - return rb; | ||
| 421 | - }else{ | ||
| 422 | - map.put("location", tLive.getLive_url()); | ||
| 423 | - rb.setData(map); | ||
| 424 | - rb.setErrorCode("0"); | ||
| 425 | - rb.setErrorMessage("启动app活动成功"); | 444 | + rb.setErrorCode("500"); |
| 445 | + rb.setErrorMessage("启动app活动失败,活动对象为空"); | ||
| 426 | return rb; | 446 | return rb; |
| 447 | + } else { | ||
| 448 | + TChannel tchannel = tLiveService.selectChannel(tLive.getRelation_id()); | ||
| 449 | + if (tchannel != null) { | ||
| 450 | + // 请求到app....... | ||
| 451 | + redirect(response, "http://ips.cnlive.com/IPS/liveplayByAPP.action?appId=" + appId + "&channelID=" | ||
| 452 | + + tLive.getRelation_id()); | ||
| 453 | + map.put("location", ""); | ||
| 454 | + rb.setData(map); | ||
| 455 | + rb.setErrorCode("0"); | ||
| 456 | + rb.setErrorMessage("302重定向到app"); | ||
| 457 | + return rb; | ||
| 458 | + } else { | ||
| 459 | + map.put("location", tLive.getLive_url()); | ||
| 460 | + rb.setData(map); | ||
| 461 | + rb.setErrorCode("0"); | ||
| 462 | + rb.setErrorMessage("启动app活动成功"); | ||
| 463 | + return rb; | ||
| 464 | + } | ||
| 427 | } | 465 | } |
| 428 | } | 466 | } |
| 429 | - | 467 | + |
| 430 | } | 468 | } |
| 431 | - | 469 | + |
| 432 | /** | 470 | /** |
| 433 | * 1.9 获取H5直播URL接口.md | 471 | * 1.9 获取H5直播URL接口.md |
| 434 | * | 472 | * |
| @@ -450,26 +488,35 @@ public class LiveAction { | @@ -450,26 +488,35 @@ public class LiveAction { | ||
| 450 | return rb; | 488 | return rb; |
| 451 | } else { | 489 | } else { |
| 452 | TLive tLive = tLiveService.selectByParams(appId, activityid); | 490 | TLive tLive = tLiveService.selectByParams(appId, activityid); |
| 453 | - TChannel tchannel = tLiveService.selectChannel(tLive.getRelation_id()); | ||
| 454 | - if(tchannel!=null){ | ||
| 455 | - // 重定向到h5....... | ||
| 456 | - redirect(response, "http://ips.cnlive.com/IPS/liveplayByH5?appId="+appId+"&channelID="+tLive.getRelation_id()); | 491 | + if (tLive == null) { |
| 457 | map.put("location", ""); | 492 | map.put("location", ""); |
| 458 | rb.setData(map); | 493 | rb.setData(map); |
| 459 | - rb.setErrorCode("0"); | ||
| 460 | - rb.setErrorMessage("302重定向到h5"); | ||
| 461 | - return rb; | ||
| 462 | - }else{ | ||
| 463 | - map.put("location", tLive.getLive_url()); | ||
| 464 | - rb.setData(map); | ||
| 465 | - rb.setErrorCode("0"); | ||
| 466 | - rb.setErrorMessage("启动h5活动成功"); | 494 | + rb.setErrorCode("500"); |
| 495 | + rb.setErrorMessage("启动h5活动失败,活动对象为空"); | ||
| 467 | return rb; | 496 | return rb; |
| 497 | + } else { | ||
| 498 | + TChannel tchannel = tLiveService.selectChannel(tLive.getRelation_id()); | ||
| 499 | + if (tchannel != null) { | ||
| 500 | + // 重定向到h5....... | ||
| 501 | + redirect(response, "http://ips.cnlive.com/IPS/liveplayByH5?appId=" + appId + "&channelID=" | ||
| 502 | + + tLive.getRelation_id()); | ||
| 503 | + map.put("location", ""); | ||
| 504 | + rb.setData(map); | ||
| 505 | + rb.setErrorCode("0"); | ||
| 506 | + rb.setErrorMessage("302重定向到h5"); | ||
| 507 | + return rb; | ||
| 508 | + } else { | ||
| 509 | + map.put("location", tLive.getLive_url()); | ||
| 510 | + rb.setData(map); | ||
| 511 | + rb.setErrorCode("0"); | ||
| 512 | + rb.setErrorMessage("启动h5活动成功"); | ||
| 513 | + return rb; | ||
| 514 | + } | ||
| 468 | } | 515 | } |
| 469 | } | 516 | } |
| 470 | - | 517 | + |
| 471 | } | 518 | } |
| 472 | - | 519 | + |
| 473 | /** | 520 | /** |
| 474 | * 2.0 获取SWF直播URL接口.md | 521 | * 2.0 获取SWF直播URL接口.md |
| 475 | * | 522 | * |
| @@ -491,24 +538,34 @@ public class LiveAction { | @@ -491,24 +538,34 @@ public class LiveAction { | ||
| 491 | return rb; | 538 | return rb; |
| 492 | } else { | 539 | } else { |
| 493 | TLive tLive = tLiveService.selectByParams(appId, activityid); | 540 | TLive tLive = tLiveService.selectByParams(appId, activityid); |
| 494 | - TChannel tchannel = tLiveService.selectChannel(tLive.getRelation_id()); | ||
| 495 | - rb.setData(map); | ||
| 496 | - rb.setErrorCode("0"); | ||
| 497 | - if(tchannel!=null){ | ||
| 498 | - // 302重定向到swf....... | ||
| 499 | - redirect(response, "http://ips.cnlive.com/IPS/liveplayBySWF.action?appId="+appId+"&channelID="+tLive.getRelation_id()); | 541 | + if (tLive == null) { |
| 500 | map.put("location", ""); | 542 | map.put("location", ""); |
| 501 | - rb.setErrorMessage("302重定向到swf"); | ||
| 502 | - return rb; | ||
| 503 | - }else{ | ||
| 504 | - | ||
| 505 | - map.put("location", tLive.getLive_url()); | ||
| 506 | - rb.setErrorMessage("启动swf活动成功"); | 543 | + rb.setData(map); |
| 544 | + rb.setErrorCode("500"); | ||
| 545 | + rb.setErrorMessage("启动swf活动失败,活动对象为空"); | ||
| 507 | return rb; | 546 | return rb; |
| 547 | + } else { | ||
| 548 | + TChannel tchannel = tLiveService.selectChannel(tLive.getRelation_id()); | ||
| 549 | + rb.setData(map); | ||
| 550 | + rb.setErrorCode("0"); | ||
| 551 | + if (tchannel != null) { | ||
| 552 | + // 302重定向到swf....... | ||
| 553 | + redirect(response, "http://ips.cnlive.com/IPS/liveplayBySWF.action?appId=" + appId + "&channelID=" | ||
| 554 | + + tLive.getRelation_id()); | ||
| 555 | + map.put("location", ""); | ||
| 556 | + rb.setErrorMessage("302重定向到swf"); | ||
| 557 | + return rb; | ||
| 558 | + } else { | ||
| 559 | + | ||
| 560 | + map.put("location", tLive.getLive_url()); | ||
| 561 | + rb.setErrorMessage("启动swf活动成功"); | ||
| 562 | + return rb; | ||
| 563 | + } | ||
| 508 | } | 564 | } |
| 509 | } | 565 | } |
| 510 | - | 566 | + |
| 511 | } | 567 | } |
| 568 | + | ||
| 512 | /** | 569 | /** |
| 513 | * 2.1 获取推流直播播放地址.md | 570 | * 2.1 获取推流直播播放地址.md |
| 514 | * | 571 | * |
| @@ -529,14 +586,15 @@ public class LiveAction { | @@ -529,14 +586,15 @@ public class LiveAction { | ||
| 529 | return rb; | 586 | return rb; |
| 530 | } else { | 587 | } else { |
| 531 | TLive tLive = tLiveService.selectByParams(appId, activityid); | 588 | TLive tLive = tLiveService.selectByParams(appId, activityid); |
| 532 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 533 | - map.put("location", tLive.getLive_url()); | ||
| 534 | - rb.setData(map); | ||
| 535 | - rb.setErrorCode("0"); | ||
| 536 | - rb.setErrorMessage("启动活动成功"); | ||
| 537 | - return rb; | ||
| 538 | - } | 589 | + Map<String, Object> map = new HashMap<String, Object>(); |
| 590 | + map.put("location", tLive.getLive_url()); | ||
| 591 | + rb.setData(map); | ||
| 592 | + rb.setErrorCode("0"); | ||
| 593 | + rb.setErrorMessage("启动活动成功"); | ||
| 594 | + return rb; | ||
| 539 | } | 595 | } |
| 596 | + } | ||
| 597 | + | ||
| 540 | @Request.Post("/live/epg/error500") | 598 | @Request.Post("/live/epg/error500") |
| 541 | public ResultBean error(Params params) { | 599 | public ResultBean error(Params params) { |
| 542 | ResultBean rb = new ResultBean(); | 600 | ResultBean rb = new ResultBean(); |
| @@ -547,57 +605,47 @@ public class LiveAction { | @@ -547,57 +605,47 @@ public class LiveAction { | ||
| 547 | rb.setErrorMessage("失败"); | 605 | rb.setErrorMessage("失败"); |
| 548 | return rb; | 606 | return rb; |
| 549 | } | 607 | } |
| 550 | - | 608 | + |
| 551 | public static void redirect(HttpServletResponse response, String redirectUrl) { | 609 | public static void redirect(HttpServletResponse response, String redirectUrl) { |
| 552 | - try { | ||
| 553 | - response.setContentType("application/mpegurl"); | ||
| 554 | - response.setStatus(302); | ||
| 555 | - response.setHeader("Location", redirectUrl); | ||
| 556 | - response.setHeader("Connection", "close"); | ||
| 557 | - } catch (Exception e) { | ||
| 558 | - throw new RuntimeException(e); | ||
| 559 | - } | ||
| 560 | - } | 610 | + try { |
| 611 | + response.setContentType("application/mpegurl"); | ||
| 612 | + response.setStatus(302); | ||
| 613 | + response.setHeader("Location", redirectUrl); | ||
| 614 | + response.setHeader("Connection", "close"); | ||
| 615 | + } catch (Exception e) { | ||
| 616 | + throw new RuntimeException(e); | ||
| 617 | + } | ||
| 618 | + } | ||
| 619 | + | ||
| 561 | @Request.Get("/live/epg/302") | 620 | @Request.Get("/live/epg/302") |
| 562 | public void red302() { | 621 | public void red302() { |
| 563 | - HttpServletResponse response =DataContext.getResponse(); | 622 | + HttpServletResponse response = DataContext.getResponse(); |
| 564 | redirect(response, "http://ips.cnlive.com/IPS/liveplayBySWF.action?activityId=12345"); | 623 | redirect(response, "http://ips.cnlive.com/IPS/liveplayBySWF.action?activityId=12345"); |
| 565 | } | 624 | } |
| 566 | 625 | ||
| 567 | public static void main(String[] args) { | 626 | public static void main(String[] args) { |
| 568 | - | ||
| 569 | - /*NameValuePair[] nvp = new NameValuePair[6]; | ||
| 570 | - NameValuePair nv1 = new NameValuePair(); | ||
| 571 | - nv1.setName("appId"); | ||
| 572 | - nv1.setValue("123"); | ||
| 573 | - nvp[0] = nv1; | ||
| 574 | - NameValuePair nv2 = new NameValuePair(); | ||
| 575 | - nv2.setName("activityId"); | ||
| 576 | - nv2.setValue("234e"); | ||
| 577 | - nvp[1] = nv2; | ||
| 578 | - NameValuePair nv3 = new NameValuePair(); | ||
| 579 | - nv3.setName("activityName"); | ||
| 580 | - nv3.setValue("ee"); | ||
| 581 | - nvp[2] = nv3; | ||
| 582 | - NameValuePair nv4 = new NameValuePair(); | ||
| 583 | - nv4.setName("activityStatus"); | ||
| 584 | - nv4.setValue("11"); | ||
| 585 | - nvp[3] = nv4; | ||
| 586 | - NameValuePair nv5 = new NameValuePair(); | ||
| 587 | - nv5.setName("isHorizontalScreen"); | ||
| 588 | - nv5.setValue("321"); | ||
| 589 | - nvp[4] = nv5; | ||
| 590 | - NameValuePair nv6 = new NameValuePair(); | ||
| 591 | - nv6.setName("channelId"); | ||
| 592 | - nv6.setValue("ww"); | ||
| 593 | - nvp[5] = nv6; | ||
| 594 | - String ss = HttpReq.postRequestWidthResult("http://bc.cnlive.com/live/epg/createActivity", nvp); | ||
| 595 | - System.out.println(ss); | ||
| 596 | -<<<<<<< HEAD | 627 | + |
| 628 | + /* | ||
| 629 | + * NameValuePair[] nvp = new NameValuePair[6]; NameValuePair nv1 = new | ||
| 630 | + * NameValuePair(); nv1.setName("appId"); nv1.setValue("123"); nvp[0] = | ||
| 631 | + * nv1; NameValuePair nv2 = new NameValuePair(); | ||
| 632 | + * nv2.setName("activityId"); nv2.setValue("234e"); nvp[1] = nv2; | ||
| 633 | + * NameValuePair nv3 = new NameValuePair(); nv3.setName("activityName"); | ||
| 634 | + * nv3.setValue("ee"); nvp[2] = nv3; NameValuePair nv4 = new | ||
| 635 | + * NameValuePair(); nv4.setName("activityStatus"); nv4.setValue("11"); | ||
| 636 | + * nvp[3] = nv4; NameValuePair nv5 = new NameValuePair(); | ||
| 637 | + * nv5.setName("isHorizontalScreen"); nv5.setValue("321"); nvp[4] = nv5; | ||
| 638 | + * NameValuePair nv6 = new NameValuePair(); nv6.setName("channelId"); | ||
| 639 | + * nv6.setValue("ww"); nvp[5] = nv6; String ss = | ||
| 640 | + * HttpReq.postRequestWidthResult( | ||
| 641 | + * "http://bc.cnlive.com/live/epg/createActivity", nvp); | ||
| 642 | + * System.out.println(ss); <<<<<<< HEAD String aa = HttpReq | ||
| 643 | + * .getRequestWidthResult( | ||
| 644 | + * "http://bc.cnlive.com/live/epg/startActivity?appId=123&activityId=234" | ||
| 645 | + * ); System.out.println(aa); | ||
| 646 | + */ | ||
| 597 | String aa = HttpReq | 647 | String aa = HttpReq |
| 598 | .getRequestWidthResult("http://bc.cnlive.com/live/epg/startActivity?appId=123&activityId=234"); | 648 | .getRequestWidthResult("http://bc.cnlive.com/live/epg/startActivity?appId=123&activityId=234"); |
| 599 | - System.out.println(aa);*/ | ||
| 600 | - String aa = HttpReq.getRequestWidthResult("http://bc.cnlive.com/live/epg/startActivity?appId=123&activityId=234"); | ||
| 601 | System.out.println(aa); | 649 | System.out.println(aa); |
| 602 | } | 650 | } |
| 603 | } | 651 | } |
| 604 | \ No newline at end of file | 652 | \ No newline at end of file |
src/main/java/com/cnlive/mz/live/action/VideoAction.java
| @@ -115,7 +115,7 @@ public class VideoAction { | @@ -115,7 +115,7 @@ public class VideoAction { | ||
| 115 | } else { | 115 | } else { |
| 116 | tLive.setDirect(Integer.parseInt(direct)); | 116 | tLive.setDirect(Integer.parseInt(direct)); |
| 117 | } | 117 | } |
| 118 | - tLive.setLive_url(Constants.KS_HOST_RTMP + tLive.getT_user_id() + "_" + uuid); | 118 | + tLive.setLive_url(Constants.KS_HOST_RTMP + tLive.getT_user_id() ); |
| 119 | success = tLiveService.startLive(tLive); | 119 | success = tLiveService.startLive(tLive); |
| 120 | } | 120 | } |
| 121 | data.put("video_uuid", uuid); | 121 | data.put("video_uuid", uuid); |