Commit 95ed1b02f7d2bcf7b42fcf1f0ab29c2c566f3383
1 parent
f50134db
live
Showing
16 changed files
with
360 additions
and
40 deletions
.classpath
| @@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
| 24 | <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> | 24 | <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> |
| 25 | </attributes> | 25 | </attributes> |
| 26 | </classpathentry> | 26 | </classpathentry> |
| 27 | - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> | 27 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> |
| 28 | <attributes> | 28 | <attributes> |
| 29 | <attribute name="maven.pomderived" value="true"/> | 29 | <attribute name="maven.pomderived" value="true"/> |
| 30 | </attributes> | 30 | </attributes> |
.settings/org.eclipse.jdt.core.prefs
| 1 | eclipse.preferences.version=1 | 1 | eclipse.preferences.version=1 |
| 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
| 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate | 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate |
| 4 | -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | 4 | +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 |
| 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve |
| 6 | -org.eclipse.jdt.core.compiler.compliance=1.6 | 6 | +org.eclipse.jdt.core.compiler.compliance=1.7 |
| 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate | 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate |
| 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate | 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate |
| 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate | 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate |
| 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
| 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
| 12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | 12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning |
| 13 | -org.eclipse.jdt.core.compiler.source=1.6 | 13 | +org.eclipse.jdt.core.compiler.source=1.7 |
.settings/org.eclipse.wst.common.component
| @@ -8,15 +8,9 @@ | @@ -8,15 +8,9 @@ | ||
| 8 | <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"> | 8 | <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 | <dependency-type>uses</dependency-type> | 9 | <dependency-type>uses</dependency-type> |
| 10 | </dependent-module> | 10 | </dependent-module> |
| 11 | - <dependent-module archiveName="cnlive_ks3-1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/cnlive_ks3/cnlive_ks3"> | ||
| 12 | - <dependency-type>uses</dependency-type> | ||
| 13 | - </dependent-module> | ||
| 14 | <dependent-module archiveName="smart-framework-4.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-framework/smart-framework"> | 11 | <dependent-module archiveName="smart-framework-4.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-framework/smart-framework"> |
| 15 | <dependency-type>uses</dependency-type> | 12 | <dependency-type>uses</dependency-type> |
| 16 | </dependent-module> | 13 | </dependent-module> |
| 17 | - <dependent-module archiveName="smart-plugin-job-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-plugin-job/smart-plugin-job"> | ||
| 18 | - <dependency-type>uses</dependency-type> | ||
| 19 | - </dependent-module> | ||
| 20 | <dependent-module archiveName="smart-plugin-dbcp-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-plugin-dbcp/smart-plugin-dbcp"> | 14 | <dependent-module archiveName="smart-plugin-dbcp-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-plugin-dbcp/smart-plugin-dbcp"> |
| 21 | <dependency-type>uses</dependency-type> | 15 | <dependency-type>uses</dependency-type> |
| 22 | </dependent-module> | 16 | </dependent-module> |
src/main/java/com/cnlive/mz/live/action/LiveAction.java
| @@ -10,8 +10,13 @@ | @@ -10,8 +10,13 @@ | ||
| 10 | package com.cnlive.mz.live.action; | 10 | package com.cnlive.mz.live.action; |
| 11 | 11 | ||
| 12 | import java.io.UnsupportedEncodingException; | 12 | import java.io.UnsupportedEncodingException; |
| 13 | +import java.util.HashMap; | ||
| 13 | import java.util.List; | 14 | import java.util.List; |
| 15 | +import java.util.Map; | ||
| 14 | 16 | ||
| 17 | +import org.apache.commons.httpclient.NameValuePair; | ||
| 18 | +import org.apache.commons.lang.StringUtils; | ||
| 19 | +import org.apache.log4j.Logger; | ||
| 15 | import org.smart4j.framework.dao.bean.Pager; | 20 | import org.smart4j.framework.dao.bean.Pager; |
| 16 | import org.smart4j.framework.ioc.annotation.Inject; | 21 | import org.smart4j.framework.ioc.annotation.Inject; |
| 17 | import org.smart4j.framework.mvc.DataContext; | 22 | import org.smart4j.framework.mvc.DataContext; |
| @@ -21,7 +26,9 @@ import org.smart4j.framework.mvc.bean.Multipart; | @@ -21,7 +26,9 @@ import org.smart4j.framework.mvc.bean.Multipart; | ||
| 21 | import org.smart4j.framework.mvc.bean.Multiparts; | 26 | import org.smart4j.framework.mvc.bean.Multiparts; |
| 22 | import org.smart4j.framework.mvc.bean.Params; | 27 | import org.smart4j.framework.mvc.bean.Params; |
| 23 | import org.smart4j.framework.mvc.bean.Result; | 28 | import org.smart4j.framework.mvc.bean.Result; |
| 29 | +import org.smart4j.framework.mvc.bean.ResultBean; | ||
| 24 | import org.smart4j.framework.mvc.bean.View; | 30 | import org.smart4j.framework.mvc.bean.View; |
| 31 | +import org.smart4j.framework.orm.DataSet; | ||
| 25 | import org.smart4j.framework.util.CastUtil; | 32 | import org.smart4j.framework.util.CastUtil; |
| 26 | 33 | ||
| 27 | import com.cnlive.mz.commons.Constants; | 34 | import com.cnlive.mz.commons.Constants; |
| @@ -44,6 +51,8 @@ import com.cnlive.mz.live.service.TRoomService; | @@ -44,6 +51,8 @@ import com.cnlive.mz.live.service.TRoomService; | ||
| 44 | */ | 51 | */ |
| 45 | @Action | 52 | @Action |
| 46 | public class LiveAction { | 53 | public class LiveAction { |
| 54 | + | ||
| 55 | + private Logger log = Logger.getLogger("LiveAction"); | ||
| 47 | @Inject | 56 | @Inject |
| 48 | private TLiveService tLiveService; | 57 | private TLiveService tLiveService; |
| 49 | @Inject | 58 | @Inject |
| @@ -120,7 +129,6 @@ public class LiveAction { | @@ -120,7 +129,6 @@ public class LiveAction { | ||
| 120 | @Request.Post("/check/cut/{id}") | 129 | @Request.Post("/check/cut/{id}") |
| 121 | public Result cut(int id, Params params) throws UnsupportedEncodingException { | 130 | public Result cut(int id, Params params) throws UnsupportedEncodingException { |
| 122 | String live_url = params.getString("live_url"); | 131 | String live_url = params.getString("live_url"); |
| 123 | - String video_uuid = params.getString("uuid"); | ||
| 124 | if (live_url.isEmpty()) { | 132 | if (live_url.isEmpty()) { |
| 125 | return null; | 133 | return null; |
| 126 | } else { | 134 | } else { |
| @@ -138,12 +146,12 @@ public class LiveAction { | @@ -138,12 +146,12 @@ public class LiveAction { | ||
| 138 | // 断流。 | 146 | // 断流。 |
| 139 | try { | 147 | try { |
| 140 | addBlackList(signature, accesskey, expire, streamName); | 148 | addBlackList(signature, accesskey, expire, streamName); |
| 141 | - //delBlackList(delsignature, accesskey, expire, streamName); | 149 | + // delBlackList(delsignature, accesskey, expire, streamName); |
| 142 | } catch (UnsupportedEncodingException e) { | 150 | } catch (UnsupportedEncodingException e) { |
| 143 | e.printStackTrace(); | 151 | e.printStackTrace(); |
| 144 | } | 152 | } |
| 145 | // 直播通知 | 153 | // 直播通知 |
| 146 | - //tLiveService.notify(video_uuid, -1); | 154 | + // tLiveService.notify(video_uuid, -1); |
| 147 | boolean flag = tCheckService.closeLive(id); | 155 | boolean flag = tCheckService.closeLive(id); |
| 148 | return new Result(flag); | 156 | return new Result(flag); |
| 149 | } | 157 | } |
| @@ -172,9 +180,10 @@ public class LiveAction { | @@ -172,9 +180,10 @@ public class LiveAction { | ||
| 172 | * @return | 180 | * @return |
| 173 | * @throws UnsupportedEncodingException | 181 | * @throws UnsupportedEncodingException |
| 174 | */ | 182 | */ |
| 175 | - public String addBlackList(String signature, String accesskey, String expire, String streamName) throws UnsupportedEncodingException { | ||
| 176 | - String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=" + signature + "&accesskey=" + accesskey + "&expire=" + expire | ||
| 177 | - + "&app=live&method=add&name=" + streamName; | 183 | + public String addBlackList(String signature, String accesskey, String expire, String streamName) |
| 184 | + throws UnsupportedEncodingException { | ||
| 185 | + String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=" + signature + "&accesskey=" + accesskey | ||
| 186 | + + "&expire=" + expire + "&app=live&method=add&name=" + streamName; | ||
| 178 | String jsonArrStr = HttpReq.getRequestWidthResult(url); | 187 | String jsonArrStr = HttpReq.getRequestWidthResult(url); |
| 179 | int status = HttpReq.getRequest(url); | 188 | int status = HttpReq.getRequest(url); |
| 180 | System.out.println(status + "......and......" + jsonArrStr); | 189 | System.out.println(status + "......and......" + jsonArrStr); |
| @@ -191,9 +200,10 @@ public class LiveAction { | @@ -191,9 +200,10 @@ public class LiveAction { | ||
| 191 | * @return | 200 | * @return |
| 192 | * @throws UnsupportedEncodingException | 201 | * @throws UnsupportedEncodingException |
| 193 | */ | 202 | */ |
| 194 | - public Object delBlackList(String signature, String accesskey, String expire, String streamName) throws UnsupportedEncodingException { | ||
| 195 | - String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=" + signature + "&accesskey=" + accesskey + "&expire=" + expire | ||
| 196 | - + "&app=live&method=del&name=" + streamName; | 203 | + public Object delBlackList(String signature, String accesskey, String expire, String streamName) |
| 204 | + throws UnsupportedEncodingException { | ||
| 205 | + String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=" + signature + "&accesskey=" + accesskey | ||
| 206 | + + "&expire=" + expire + "&app=live&method=del&name=" + streamName; | ||
| 197 | String jsonArrStr = HttpReq.getRequestWidthResult(url); | 207 | String jsonArrStr = HttpReq.getRequestWidthResult(url); |
| 198 | System.out.println("..jsonArrStr.." + jsonArrStr); | 208 | System.out.println("..jsonArrStr.." + jsonArrStr); |
| 199 | return jsonArrStr; | 209 | return jsonArrStr; |
| @@ -217,14 +227,329 @@ public class LiveAction { | @@ -217,14 +227,329 @@ public class LiveAction { | ||
| 217 | 227 | ||
| 218 | try { | 228 | try { |
| 219 | title = new String(title.trim().getBytes("ISO-8859-1"), "utf-8"); | 229 | title = new String(title.trim().getBytes("ISO-8859-1"), "utf-8"); |
| 220 | - System.out.println("...title.."+title); | 230 | + System.out.println("...title.." + title); |
| 221 | } catch (UnsupportedEncodingException e) { | 231 | } catch (UnsupportedEncodingException e) { |
| 222 | e.printStackTrace(); | 232 | e.printStackTrace(); |
| 223 | - } | 233 | + } |
| 224 | 234 | ||
| 225 | Pager<TLive> tLive = tLiveService.getTLiveAllPager(page_number, Constants.PAGE_SIZE, t_user_id, title); | 235 | Pager<TLive> tLive = tLiveService.getTLiveAllPager(page_number, Constants.PAGE_SIZE, t_user_id, title); |
| 226 | - System.out.println("tLive====="+tLive); | 236 | + System.out.println("tLive=====" + tLive); |
| 227 | return new View("live/all_live_management.jsp").data("tLive", tLive); | 237 | return new View("live/all_live_management.jsp").data("tLive", tLive); |
| 228 | } | 238 | } |
| 229 | 239 | ||
| 240 | + /** | ||
| 241 | + * 1.0 获取直播活动信息接口Server.md | ||
| 242 | + * | ||
| 243 | + * @param params | ||
| 244 | + * @return | ||
| 245 | + */ | ||
| 246 | + @Request.Get("/live/epg/getLiveActivityPlayInfo4Server") | ||
| 247 | + public ResultBean getLiveActivityPlayInfo4Server(Params params) { | ||
| 248 | + ResultBean rb = new ResultBean(); | ||
| 249 | + String appId = params.getString("appId"); | ||
| 250 | + String activityId = params.getString("activityId"); | ||
| 251 | + String timestamp = params.getString("timestamp"); | ||
| 252 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityId)) { | ||
| 253 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 254 | + map.put("location", ""); | ||
| 255 | + rb.setData(map); | ||
| 256 | + rb.setErrorCode("200"); | ||
| 257 | + log.error("参数不正确"); | ||
| 258 | + rb.setErrorMessage("启动活动失败"); | ||
| 259 | + return rb; | ||
| 260 | + } else { | ||
| 261 | + TLive tLive = tLiveService.selectByParams(appId, activityId); | ||
| 262 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 263 | + map.put("activityId", activityId); | ||
| 264 | + map.put("location", tLive.getLive_url()); | ||
| 265 | + rb.setData(map); | ||
| 266 | + rb.setErrorCode("0"); | ||
| 267 | + rb.setErrorMessage("启动活动成功"); | ||
| 268 | + return rb; | ||
| 269 | + } | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + /** | ||
| 273 | + * 1.3 创建直播活动接口.md | ||
| 274 | + * | ||
| 275 | + * @param params | ||
| 276 | + * @return | ||
| 277 | + */ | ||
| 278 | + @Request.Post("/live/epg/createActivity") | ||
| 279 | + public ResultBean createActivity(Params params) { | ||
| 280 | + log.info("打印参数开始......"); | ||
| 281 | + log.info(params); | ||
| 282 | + log.info("打印参数结束......"); | ||
| 283 | + ResultBean rb = new ResultBean(); | ||
| 284 | + String appId = params.getString("appId"); | ||
| 285 | + String activityId = params.getString("activityId"); | ||
| 286 | + int isHorizontalScreen = params.getInt("isHorizontalScreen"); | ||
| 287 | + String channelID = params.getString("channelId"); | ||
| 288 | + if (StringUtils.isNotEmpty(appId) && StringUtils.isNotEmpty(activityId) && StringUtils.isNotEmpty(channelID) | ||
| 289 | + && StringUtils.isNotEmpty("" + isHorizontalScreen)) { | ||
| 290 | + TLive tLive = tLiveService.selectByParams(appId, activityId); | ||
| 291 | + if (tLive != null) { | ||
| 292 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 293 | + map.put("location", ""); | ||
| 294 | + rb.setData(map); | ||
| 295 | + rb.setErrorCode("500"); | ||
| 296 | + rb.setErrorMessage("创建活动失败,活动ID已存在"); | ||
| 297 | + log.error("创建活动失败,活动ID已存在"); | ||
| 298 | + return rb; | ||
| 299 | + } else { | ||
| 300 | + | ||
| 301 | + boolean flag = tLiveService.addAcitvity(params); | ||
| 302 | + if (flag) { | ||
| 303 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 304 | + map.put("location", "rtmp://jsrtmp.up.cnlive.com/live/1234"); | ||
| 305 | + rb.setData(map); | ||
| 306 | + rb.setErrorCode("0"); | ||
| 307 | + rb.setErrorMessage("创建活动成功"); | ||
| 308 | + log.info("创建活动成功"); | ||
| 309 | + return rb; | ||
| 310 | + } else { | ||
| 311 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 312 | + map.put("location", ""); | ||
| 313 | + rb.setData(map); | ||
| 314 | + rb.setErrorCode("500"); | ||
| 315 | + rb.setErrorMessage("创建活动失败,保存数据库失败"); | ||
| 316 | + log.error("保存数据库失败"); | ||
| 317 | + return rb; | ||
| 318 | + } | ||
| 319 | + } | ||
| 320 | + } else { | ||
| 321 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 322 | + map.put("location", ""); | ||
| 323 | + rb.setData(map); | ||
| 324 | + rb.setErrorCode("500"); | ||
| 325 | + rb.setErrorMessage("创建活动失败,参数不正确"); | ||
| 326 | + log.error("参数不正确"); | ||
| 327 | + return rb; | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | + /** | ||
| 333 | + * 1.4 启动直播活动接口.md | ||
| 334 | + * | ||
| 335 | + * @param params | ||
| 336 | + * @return | ||
| 337 | + */ | ||
| 338 | + @Request.Get("/live/epg/startActivity") | ||
| 339 | + public ResultBean startActivity(Params params) { | ||
| 340 | + ResultBean rb = new ResultBean(); | ||
| 341 | + String appId = params.getString("appId"); | ||
| 342 | + String activityid = params.getString("activityId"); | ||
| 343 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 344 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 345 | + map.put("location", ""); | ||
| 346 | + rb.setData(map); | ||
| 347 | + rb.setErrorCode("500"); | ||
| 348 | + rb.setErrorMessage("启动活动失败"); | ||
| 349 | + return rb; | ||
| 350 | + } else { | ||
| 351 | + TLive tLive = tLiveService.selectByParams(appId, activityid); | ||
| 352 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 353 | + map.put("location", tLive.getLive_url()); | ||
| 354 | + rb.setData(map); | ||
| 355 | + rb.setErrorCode("0"); | ||
| 356 | + rb.setErrorMessage("启动活动成功"); | ||
| 357 | + return rb; | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | + /** | ||
| 362 | + * 1.5 停止直播活动接口.md | ||
| 363 | + * | ||
| 364 | + * @param params | ||
| 365 | + * @return | ||
| 366 | + */ | ||
| 367 | + @Request.Get("/live/epg/stopActivity") | ||
| 368 | + public ResultBean stopActivity(Params params) { | ||
| 369 | + ResultBean rb = new ResultBean(); | ||
| 370 | + String appId = params.getString("appId"); | ||
| 371 | + String activityid = params.getString("activityId"); | ||
| 372 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 373 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 374 | + map.put("location", ""); | ||
| 375 | + rb.setData(map); | ||
| 376 | + rb.setErrorCode("500"); | ||
| 377 | + rb.setErrorMessage("停止直播失败,参数不正确"); | ||
| 378 | + return rb; | ||
| 379 | + } else { | ||
| 380 | + TLive tLive = tLiveService.selectByParams(appId, activityid); | ||
| 381 | + String live_url = tLive.getLive_url(); | ||
| 382 | + int index = live_url.lastIndexOf("/"); | ||
| 383 | + String streamName = live_url.substring(index + 1); | ||
| 384 | + System.out.println("streamName===" + streamName); | ||
| 385 | + String accesskey = BaseUtil.getAccessKey(); | ||
| 386 | + try { | ||
| 387 | + accesskey = java.net.URLEncoder.encode(accesskey, "utf-8"); | ||
| 388 | + String add = "add"; | ||
| 389 | + String signature = BaseUtil.signature(add, streamName); | ||
| 390 | + String del = "del"; | ||
| 391 | + String delsignature = BaseUtil.signature(del, streamName); | ||
| 392 | + String expire = BaseUtil.getTimestamp(); | ||
| 393 | + System.out.println(expire + "---expire---"); | ||
| 394 | + // 断流。 | ||
| 395 | + addBlackList(signature, accesskey, expire, streamName); | ||
| 396 | + } catch (UnsupportedEncodingException e1) { | ||
| 397 | + // TODO Auto-generated catch block | ||
| 398 | + e1.printStackTrace(); | ||
| 399 | + } | ||
| 400 | + // 直播通知 | ||
| 401 | + // tLiveService.notify(video_uuid, -1); | ||
| 402 | + boolean flag = tCheckService.closeLive(Integer.parseInt(activityid)); | ||
| 403 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 404 | + map.put("location", tLive.getLive_url()); | ||
| 405 | + rb.setData(map); | ||
| 406 | + rb.setErrorCode("0"); | ||
| 407 | + rb.setErrorMessage("停止直播成功"); | ||
| 408 | + return rb; | ||
| 409 | + } | ||
| 410 | + | ||
| 411 | + } | ||
| 412 | + | ||
| 413 | + /** | ||
| 414 | + * 1.6 获取直播活动列表接口.md | ||
| 415 | + * | ||
| 416 | + * @param params | ||
| 417 | + * @return | ||
| 418 | + */ | ||
| 419 | + @Request.Get("/live/epg/getActivity") | ||
| 420 | + public ResultBean getActivities(Params params) { | ||
| 421 | + ResultBean rb = new ResultBean(); | ||
| 422 | + String appId = params.getString("appId"); | ||
| 423 | + String pageNo = params.getString("pageNo"); | ||
| 424 | + String pageSize = params.getString("pageSize"); | ||
| 425 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(pageNo) || StringUtils.isEmpty(pageSize)) { | ||
| 426 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 427 | + map.put("location", ""); | ||
| 428 | + rb.setData(map); | ||
| 429 | + rb.setErrorCode("500"); | ||
| 430 | + rb.setErrorMessage("获取活动列表失败,字段不正确"); | ||
| 431 | + return rb; | ||
| 432 | + } else { | ||
| 433 | + Pager<TLive> tLive = tLiveService.getActivityPager(pageNo, pageSize, appId); | ||
| 434 | + rb.setData(tLive); | ||
| 435 | + rb.setErrorCode("0"); | ||
| 436 | + rb.setErrorMessage("获取活动列表成功"); | ||
| 437 | + return rb; | ||
| 438 | + | ||
| 439 | + } | ||
| 440 | + } | ||
| 441 | + | ||
| 442 | + /** | ||
| 443 | + * 1.7 获取直播回放接口.md | ||
| 444 | + * | ||
| 445 | + * @param args | ||
| 446 | + */ | ||
| 447 | + @Request.Get("/live/epg/getActivityVodInfo") | ||
| 448 | + public ResultBean getActivityVodInfo(Params params) { | ||
| 449 | + ResultBean rb = new ResultBean(); | ||
| 450 | + String appId = params.getString("appId"); | ||
| 451 | + String activityid = params.getString("activityId"); | ||
| 452 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 453 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 454 | + map.put("location", ""); | ||
| 455 | + rb.setData(map); | ||
| 456 | + rb.setErrorCode("500"); | ||
| 457 | + rb.setErrorMessage("获取直播回放失败"); | ||
| 458 | + return rb; | ||
| 459 | + } else { | ||
| 460 | + TLive tLive = tLiveService.selectByParams(appId, activityid); | ||
| 461 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 462 | + map.put("location", tLive.getPlayback_url()); | ||
| 463 | + rb.setData(map); | ||
| 464 | + rb.setErrorCode("0"); | ||
| 465 | + rb.setErrorMessage("获取直播回放成功"); | ||
| 466 | + return rb; | ||
| 467 | + } | ||
| 468 | + } | ||
| 469 | + | ||
| 470 | + /** | ||
| 471 | + * 1.7 获取直播回放接口.md | ||
| 472 | + * | ||
| 473 | + * @param args | ||
| 474 | + */ | ||
| 475 | + @Request.Get("/live/epg/liveplayByAPP") | ||
| 476 | + public ResultBean liveplayByAPP(Params params) { | ||
| 477 | + ResultBean rb = new ResultBean(); | ||
| 478 | + String appId = params.getString("appId"); | ||
| 479 | + String activityid = params.getString("activityId"); | ||
| 480 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 481 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 482 | + map.put("location", ""); | ||
| 483 | + rb.setData(map); | ||
| 484 | + rb.setErrorCode("500"); | ||
| 485 | + rb.setErrorMessage("获取直播回放失败"); | ||
| 486 | + return rb; | ||
| 487 | + } else { | ||
| 488 | + TLive tLive = tLiveService.selectByParams(appId, activityid); | ||
| 489 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 490 | + map.put("location", tLive.getPlayback_url()); | ||
| 491 | + rb.setData(map); | ||
| 492 | + rb.setErrorCode("0"); | ||
| 493 | + rb.setErrorMessage("获取直播回放成功"); | ||
| 494 | + return rb; | ||
| 495 | + } | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + @Request.Post("/live/epg/error500") | ||
| 499 | + public ResultBean error(Params params) { | ||
| 500 | + ResultBean rb = new ResultBean(); | ||
| 501 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 502 | + map.put("location", ""); | ||
| 503 | + rb.setData(map); | ||
| 504 | + rb.setErrorCode("500"); | ||
| 505 | + rb.setErrorMessage("失败"); | ||
| 506 | + return rb; | ||
| 507 | + } | ||
| 508 | + public static void main(String[] args) { | ||
| 509 | + /* | ||
| 510 | + * Map<String, Object> mapFiles = new HashMap<String, Object>(); | ||
| 511 | + * mapFiles.put("app_id", null); mapFiles.put("start_time", ""); | ||
| 512 | + * mapFiles.put("end_time",""); // TODO 活动id mapFiles.put("category", | ||
| 513 | + * ""); boolean flag = DataSet.insert(TLive.class, mapFiles); | ||
| 514 | + * System.out.println(flag); | ||
| 515 | + */ | ||
| 516 | + // String appId = params.getString("appId"); | ||
| 517 | + // String activityid = params.getString("activityid"); | ||
| 518 | + // String activityname = params.getString("activityname"); | ||
| 519 | + // int activitystatus = params.getInt("activitystatus"); | ||
| 520 | + // int isHorizontalScreen = params.getInt("isHorizontalScreen"); | ||
| 521 | + // String channelID = params.getString("channelID"); | ||
| 522 | + // NameValuePair nv1 = new NameValuePair("appId", "123"); | ||
| 523 | + // NameValuePair nv2 = new NameValuePair("activityid", "234"); | ||
| 524 | + NameValuePair[] nvp = new NameValuePair[6]; | ||
| 525 | + NameValuePair nv1 = new NameValuePair(); | ||
| 526 | + nv1.setName("appId"); | ||
| 527 | + nv1.setValue("123"); | ||
| 528 | + nvp[0] = nv1; | ||
| 529 | + NameValuePair nv2 = new NameValuePair(); | ||
| 530 | + nv2.setName("activityId"); | ||
| 531 | + nv2.setValue("234e"); | ||
| 532 | + nvp[1] = nv2; | ||
| 533 | + NameValuePair nv3 = new NameValuePair(); | ||
| 534 | + nv3.setName("activityName"); | ||
| 535 | + nv3.setValue("ee"); | ||
| 536 | + nvp[2] = nv3; | ||
| 537 | + NameValuePair nv4 = new NameValuePair(); | ||
| 538 | + nv4.setName("activityStatus"); | ||
| 539 | + nv4.setValue("11"); | ||
| 540 | + nvp[3] = nv4; | ||
| 541 | + NameValuePair nv5 = new NameValuePair(); | ||
| 542 | + nv5.setName("isHorizontalScreen"); | ||
| 543 | + nv5.setValue("321"); | ||
| 544 | + nvp[4] = nv5; | ||
| 545 | + NameValuePair nv6 = new NameValuePair(); | ||
| 546 | + nv6.setName("channelId"); | ||
| 547 | + nv6.setValue("ww"); | ||
| 548 | + nvp[5] = nv6; | ||
| 549 | + String ss = HttpReq.postRequestWidthResult("http://bc.cnlive.com/live/epg/createActivity", nvp); | ||
| 550 | + System.out.println(ss); | ||
| 551 | + String aa = HttpReq | ||
| 552 | + .getRequestWidthResult("http://bc.cnlive.com/live/epg/startActivity?appId=123&activityId=234"); | ||
| 553 | + System.out.println(aa); | ||
| 554 | + } | ||
| 230 | } | 555 | } |
| 231 | \ No newline at end of file | 556 | \ No newline at end of file |
src/main/java/com/cnlive/mz/live/action/VideoAction.java
| @@ -107,7 +107,7 @@ public class VideoAction { | @@ -107,7 +107,7 @@ public class VideoAction { | ||
| 107 | tLive.setDescription(description); | 107 | tLive.setDescription(description); |
| 108 | tLive.setStart_time(new Date()); | 108 | tLive.setStart_time(new Date()); |
| 109 | tLive.setUser_uuid(params.getString("name")); | 109 | tLive.setUser_uuid(params.getString("name")); |
| 110 | - tLive.setRelation_id(relation_id); | 110 | + tLive.setRelation_id(Integer.parseInt(relation_id)); |
| 111 | tLive.setCustom_args(custom_args); | 111 | tLive.setCustom_args(custom_args); |
| 112 | uuid = tLive.getUuid(); | 112 | uuid = tLive.getUuid(); |
| 113 | if (StringUtils.isEmpty(direct)) { | 113 | if (StringUtils.isEmpty(direct)) { |
src/main/webapp/WEB-INF/web.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 3 | - xmlns="http://java.sun.com/xml/ns/javaee" | ||
| 4 | - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
| 5 | - version="3.0"> | ||
| 6 | - <servlet> | ||
| 7 | - <servlet-name>init_job</servlet-name> | ||
| 8 | - <servlet-class>com.cnlive.mz.live.action.Init</servlet-class> | ||
| 9 | - <init-param> | ||
| 10 | - <param-name>shutdown-on-unload</param-name> | ||
| 11 | - <param-value>true</param-value> | ||
| 12 | - </init-param> | ||
| 13 | - <load-on-startup>2</load-on-startup> | ||
| 14 | - </servlet> | 2 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> |
| 3 | + <servlet> | ||
| 4 | + <servlet-name>init_job</servlet-name> | ||
| 5 | + <servlet-class>com.cnlive.mz.live.servlet.InitServlet</servlet-class> | ||
| 6 | + <init-param> | ||
| 7 | + <param-name>shutdown-on-unload</param-name> | ||
| 8 | + <param-value>true</param-value> | ||
| 9 | + </init-param> | ||
| 10 | + <load-on-startup>2</load-on-startup> | ||
| 11 | + </servlet> | ||
| 12 | + <error-page> | ||
| 13 | + <error-code>500</error-code> | ||
| 14 | + <location>/live/epg/error500</location> | ||
| 15 | + </error-page> | ||
| 15 | </web-app> | 16 | </web-app> |
| 16 | \ No newline at end of file | 17 | \ No newline at end of file |
target/classes/com/cnlive/mz/live/action/ActivityAction.class
No preview for this file type
target/classes/com/cnlive/mz/live/action/ChannelAction.class
No preview for this file type
target/classes/com/cnlive/mz/live/action/IndexAction.class
No preview for this file type
target/classes/com/cnlive/mz/live/action/SignalAction.class
No preview for this file type
target/classes/com/cnlive/mz/live/action/WowzaAction.class
No preview for this file type
target/classes/com/cnlive/mz/live/aspect/ActionAspect.class
No preview for this file type
target/classes/com/cnlive/mz/live/aspect/AuthFilter.class
No preview for this file type
target/classes/com/cnlive/mz/live/rest/AjaxRest.class
No preview for this file type
target/m2e-wtp/web-resources/META-INF/MANIFEST.MF
target/m2e-wtp/web-resources/META-INF/maven/com.cnlive.mz.live.web/cnlive_live_web/pom.properties
| 1 | #Generated by Maven Integration for Eclipse | 1 | #Generated by Maven Integration for Eclipse |
| 2 | -#Tue Aug 09 08:49:54 CST 2016 | 2 | +#Thu Aug 11 09:12:27 CST 2016 |
| 3 | version=0.0.1-SNAPSHOT | 3 | version=0.0.1-SNAPSHOT |
| 4 | groupId=com.cnlive.mz.live.web | 4 | groupId=com.cnlive.mz.live.web |
| 5 | m2e.projectName=cnlive_live_web | 5 | m2e.projectName=cnlive_live_web |
| 6 | -m2e.projectLocation=D\:\\1_CNLIVE_JAVA_CODE\\cnlive_live_web | 6 | +m2e.projectLocation=C\:\\Users\\Administrator\\git\\cnlive_live_web |
| 7 | artifactId=cnlive_live_web | 7 | artifactId=cnlive_live_web |