Commit 6c9515ae880bb6cbcf28ed5cc72634f16547996a

Authored by 刘基城
1 parent e135a207

修改获取info 接口

src/main/java/com/cnlive/mz/live/action/UgcLiveAction.java
@@ -9,7 +9,9 @@ @@ -9,7 +9,9 @@
9 9
10 package com.cnlive.mz.live.action; 10 package com.cnlive.mz.live.action;
11 11
  12 +import java.util.ArrayList;
12 import java.util.HashMap; 13 import java.util.HashMap;
  14 +import java.util.List;
13 import java.util.Map; 15 import java.util.Map;
14 16
15 import org.apache.commons.lang.StringUtils; 17 import org.apache.commons.lang.StringUtils;
@@ -33,33 +35,44 @@ public class UgcLiveAction { @@ -33,33 +35,44 @@ public class UgcLiveAction {
33 private UgcLiveService ugcLiveService; 35 private UgcLiveService ugcLiveService;
34 36
35 /** 37 /**
36 - * 1.0 获取直播活动信息接口Server.md 38 + * 获取直播活动信息接口(1.0\1.1)
37 * 39 *
38 * @param params 40 * @param params
39 * @return 41 * @return
40 */ 42 */
41 - @Request.Get("/live/epg/getLiveActivityPlayInfo4Server") 43 + @Request.Get("/live/epg/info")
42 public ResultBean getLiveActivityPlayInfo4Server(Params params) { 44 public ResultBean getLiveActivityPlayInfo4Server(Params params) {
43 ResultBean rb = new ResultBean(); 45 ResultBean rb = new ResultBean();
44 String appId = params.getString("appId"); 46 String appId = params.getString("appId");
45 String activityId = params.getString("activityId"); 47 String activityId = params.getString("activityId");
46 String timestamp = params.getString("timestamp"); 48 String timestamp = params.getString("timestamp");
47 - if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityId)) {  
48 - Map<String, Object> map = new HashMap<String, Object>();  
49 - map.put("location", ""); 49 + String platform_id = params.getString("platform_id");
  50 + Map<String, Object> map = new HashMap<String, Object>();
  51 + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityId);
  52 + if (tLive == null) {
  53 + log.error("获取直播活动信息,活动对象为空");
  54 + rb.setErrorCode("500");
  55 + rb.setErrorMessage("获取直播活动信息失败,活动对象为空");
50 rb.setData(map); 56 rb.setData(map);
51 - rb.setErrorCode("200");  
52 - log.error("参数不正确");  
53 - rb.setErrorMessage("启动活动失败");  
54 return rb; 57 return rb;
55 } else { 58 } else {
56 - TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityId);  
57 - Map<String, Object> map = new HashMap<String, Object>();  
58 map.put("activityId", activityId); 59 map.put("activityId", activityId);
  60 + map.put("activityName", tLive.getTitle());
  61 + map.put("activityStatus", tLive.getT_status_id());
  62 + map.put("isHorizontalScreen", tLive.getDirect());
  63 + map.put("channelID", tLive.getRelation_id());
  64 + map.put("createTime", tLive.getCreate_time());
  65 + map.put("startTime", tLive.getStart_time());
  66 + map.put("endTime", tLive.getEnd_time());
  67 + map.put("coverImgUrl", tLive.getPoster());
  68 + map.put("activityCategory", tLive.getCategory());
  69 + map.put("extensions", tLive.getCustom_args());
  70 + map.put("rates", "1,2,3,4");
59 map.put("location", tLive.getLive_url()); 71 map.put("location", tLive.getLive_url());
  72 + map.put("extViews", new ArrayList<Map<String, Object>>());
60 rb.setData(map); 73 rb.setData(map);
61 rb.setErrorCode("0"); 74 rb.setErrorCode("0");
62 - rb.setErrorMessage("启动活动成功"); 75 + rb.setErrorMessage("请求成功");
63 return rb; 76 return rb;
64 } 77 }
65 } 78 }
@@ -129,23 +142,10 @@ public class UgcLiveAction { @@ -129,23 +142,10 @@ public class UgcLiveAction {
129 log.info(params); 142 log.info(params);
130 String appId = params.getString("appId"); 143 String appId = params.getString("appId");
131 String activityid = params.getString("activityId"); 144 String activityid = params.getString("activityId");
132 - if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) {  
133 - rb.setErrorCode("500");  
134 - rb.setErrorMessage("启动活动失败,参数不正确");  
135 - return rb;  
136 - } else {  
137 - TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityid);  
138 - if (tLive == null) {  
139 - log.info("tLive为空......");  
140 - rb.setErrorCode("500");  
141 - rb.setErrorMessage("启动活动失败,活动对象为空");  
142 - return rb;  
143 - } else {  
144 - rb.setErrorCode("0");  
145 - rb.setErrorMessage("启动活动成功");  
146 - return rb;  
147 - }  
148 - } 145 + ugcLiveService.start(appId, activityid);
  146 + rb.setErrorCode("0");
  147 + rb.setErrorMessage("启动活动成功");
  148 + return rb;
149 } 149 }
150 150
151 /** 151 /**
@@ -352,8 +352,7 @@ public class UgcLiveAction { @@ -352,8 +352,7 @@ public class UgcLiveAction {
352 rb.setErrorMessage("失败"); 352 rb.setErrorMessage("失败");
353 return rb; 353 return rb;
354 } 354 }
355 -  
356 - 355 +
357 @Request.Get("/live/clientError") 356 @Request.Get("/live/clientError")
358 public ResultBean error404() { 357 public ResultBean error404() {
359 ResultBean rb = new ResultBean(); 358 ResultBean rb = new ResultBean();
@@ -363,5 +362,5 @@ public class UgcLiveAction { @@ -363,5 +362,5 @@ public class UgcLiveAction {
363 rb.setErrorCode("404"); 362 rb.setErrorCode("404");
364 rb.setErrorMessage("失败"); 363 rb.setErrorMessage("失败");
365 return rb; 364 return rb;
366 - } 365 + }
367 } 366 }
368 \ No newline at end of file 367 \ No newline at end of file
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 -#Thu Aug 25 14:43:25 CST 2016 2 +#Thu Aug 25 16:34:25 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