Commit 996aa0780179816532c83e8604eeaadfff36a3b8

Authored by 张宗朋
1 parent 09df8605

checkjsp

src/main/java/com/cnlive/mz/live/action/CheckAction.java deleted 100644 → 0
1   -package com.cnlive.mz.live.action;
2   -
3   -import java.io.UnsupportedEncodingException;
4   -import java.net.URLEncoder;
5   -import java.util.List;
6   -import java.util.Map;
7   -
8   -import org.smart4j.framework.dao.bean.Pager;
9   -import org.smart4j.framework.ioc.annotation.Inject;
10   -import org.smart4j.framework.mvc.DataContext;
11   -import org.smart4j.framework.mvc.annotation.Action;
12   -import org.smart4j.framework.mvc.annotation.Request;
13   -import org.smart4j.framework.mvc.bean.Params;
14   -import org.smart4j.framework.mvc.bean.Result;
15   -import org.smart4j.framework.mvc.bean.View;
16   -import org.smart4j.framework.util.CastUtil;
17   -
18   -import com.cnlive.mz.commons.JsonUtil;
19   -import com.cnlive.mz.commons.net.HttpReq;
20   -import com.cnlive.mz.live.common.LiveUtils;
21   -import com.cnlive.mz.live.entity.TLive;
22   -import com.cnlive.mz.live.rest.BaseUtil;
23   -import com.cnlive.mz.live.service.TCheckService;
24   -import com.cnlive.mz.live.service.TLiveService;
25   -import com.cnlive.mz.live.service.TRoomService;
26   -
27   -@Action
28   -public class CheckAction {
29   -
30   - @Inject
31   - private TLiveService tLiveService;
32   - @Inject
33   - private TRoomService tRoomService;
34   - @Inject
35   - private TCheckService tCheckService;
36   -
37   - @Request.Get("/check/list/{page_number}")
38   - public View list(int page_number) {
39   - int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID));
40   - System.out.println(user_id);
41   - Pager<TLive> tLive = tCheckService.getTCheckLivePager(page_number, 9, user_id);
42   - List list = tLiveService.getLives(user_id);
43   - View view = new View("check/check_management.jsp");
44   - view.data("tLive", tLive);
45   - view.data("list", list);
46   - return view;
47   - //return new View("check/demo.html");
48   - }
49   - @Request.Post("/check/close/{id}")
50   - public Result coseLive(int id,Params params) throws UnsupportedEncodingException{
51   - String userId = params.getString("user_id");
52   - String streamName = userId+"_"+id;
53   - String accesskey = BaseUtil.getAccessKey();
54   - accesskey = java.net.URLEncoder.encode(accesskey,"utf-8");
55   - String signature = BaseUtil.signature(streamName);
56   - String del = "del";
57   - String delsignature = BaseUtil.signature(del,streamName);
58   - String expire = BaseUtil.getTimestamp();
59   - System.out.println(expire+"---expire---");
60   - //添加到黑名单。。
61   - try {
62   - addBlackList(signature,accesskey,expire,streamName);
63   - delBlackList(delsignature,accesskey,expire,streamName);
64   - } catch (UnsupportedEncodingException e) {
65   - e.printStackTrace();
66   - }
67   - boolean flag = tCheckService.closeLive(id);
68   - return new Result(flag);
69   - }
70   - /**
71   - * 添加到黑名单
72   - * @param signature
73   - * @param accesskey
74   - * @param expire
75   - * @param streamName
76   - * @return
77   - * @throws UnsupportedEncodingException
78   - */
79   - public String addBlackList(String signature, String accesskey, String expire,String streamName) throws UnsupportedEncodingException {
80   - String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature="+signature+"&accesskey="+accesskey+"&expire="+expire+"&app=live&method=add&name=" + streamName;
81   - System.out.println(url);
82   - String jsonArrStr = HttpReq.getRequestWidthResult(url);
83   - int status = HttpReq.getRequest(url);
84   - System.out.println(status+"......and......"+jsonArrStr);
85   - /*Map map = JsonUtil.getMapFromJsonObjStr(jsonArrStr);
86   - String chatRoomid = (String) map.get("Content-Length");*/
87   - return jsonArrStr;
88   - }
89   - /**
90   - * 从黑名单删除
91   - * @param signature
92   - * @param accesskey
93   - * @param expire
94   - * @param streamName
95   - * @return
96   - * @throws UnsupportedEncodingException
97   - */
98   - public Object delBlackList(String signature, String accesskey, String expire,String streamName) throws UnsupportedEncodingException {
99   - String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature="+signature+"&accesskey="+accesskey+"&expire="+expire+"&app=live&method=del&name=" + streamName;
100   - System.out.println("..url.."+url);
101   - String jsonArrStr = HttpReq.getRequestWidthResult(url);
102   - System.out.println("..jsonArrStr.."+jsonArrStr);
103   - /*Map map = JsonUtil.getMapFromJsonObjStr(jsonArrStr);
104   - String chatRoomid = (String) map.get("Content-Length");*/
105   - return jsonArrStr;
106   - }
107   -
108   -}
src/main/webapp/pages/check/check_management.jsp
... ... @@ -162,13 +162,14 @@ body {
162 162 <div id="a1_${item.id}" class="a1_class"
163 163 style="height: 150px">
164 164 <input type="hidden" value='${item.id}' name="liveid"
165   - id="liveid"> <input type="hidden"
166   - value='${item.title}' name="title" id="title"> <input
167   - type="hidden" value='${item.live_url}' name="live_url"
168   - id="live_url_${item.id}"> <input type="hidden"
169   - value='${item.start_time}' name="start_time"
170   - id="start_time"> <input type="hidden"
171   - value='${item.end_time}' name="end_time" id="end_time">
  165 + id="liveid">
  166 + <input type="hidden"value='${item.title}' name="title" id="title">
  167 + <input type="hidden" value='${item.live_url}' name="live_url"
  168 + id="live_url_${item.id}">
  169 + <input type="hidden"value='${item.start_time}' name="start_time"
  170 + id="start_time">
  171 + <input type="hidden"value='${item.end_time}' name="end_time" id="end_time">
  172 + <input type="hidden"value='${item.t_user_id}' name="t_user_id" id="t_user_${item.id}">
172 173 <%-- <h4 class="blue smaller">
173 174 <i class="icon-picture orange"></i>视频源 : ${item.title}
174 175 </h4> --%>
... ... @@ -211,7 +212,9 @@ body {
211 212  
212 213 $(".a1_class #liveid").each(function() {
213 214 var id = $(this).val();
214   - var live_url = $('#live_url_' + id).val();
  215 + var live_url = $('#live_url_' + id).val();
  216 + var t_user_id = $('#t_user_'+id).val();
  217 +
215 218 var flashvars = {
216 219 p : 1,
217 220 e : 1,
... ... @@ -220,29 +223,28 @@ body {
220 223 };
221 224 var video = [live_url ];
222 225 var support = [ 'all' ];
223   - CKobject.embedHTML5('a1_' + id, 'ckplayer_' + id,
224   - 250, 153, video, flashvars, support);
225   -
  226 + CKobject.embedHTML5('a1_' + id, 'ckplayer_' + id,250, 153, video, flashvars, support);
  227 +
226 228 //m3u8 文件播放
227   - /* var flashvars={
  229 + /* var flashvars={
228 230 f:'http://localhost:8080/cnlive_live_web/static/assets/ckplayer/m3u8.swf',
229   - a:'http://wideo01.cnlive.com/video/data1/2016/0524/124235/1500/b148a555a7984a539b56d7e17cb360f7_124235_1500.m3u8',
  231 + a:live_url,
230 232 s:4,
231 233 c:0,
232 234 p:1
233 235 };
234 236 var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
235   - var video=['http://wideo01.cnlive.com/video/data1/2016/0524/124235/1500/b148a555a7984a539b56d7e17cb360f7_124235_1500.m3u8'];
236   - CKobject.embed('http://localhost:8080/cnlive_live_web/static/assets/ckplayer/ckplayer.swf', 'a1_' + id, 'ckplayer_' + id, 250, 153,false,flashvars,video,params); */
  237 + var video=[live_url];
  238 + CKobject.embed('http://localhost:8080/cnlive_live_web/static/assets/ckplayer/ckplayer.swf', 'a1_' + id, 'ckplayer_' + id, 250, 153,false,flashvars,video,params); */
237 239 // rtmp 直播流播放。
238   - /* var flashvars = {
  240 + /* var flashvars = {
239 241 // f:'rtmp://localhost/live/livestreame',
240   - f : 'rtmp://cnlive.uplive.ks-cdn.com/live/LIVEVJ154A34CF536',
  242 + f :'http://cnlive.uplive.ks-cdn.com/live/'+t_user_id+'_'+id,
241 243 c : 0
242 244 };
243   - var video = [ 'http://cnlive.hlslive.ks-cdn.com/live/LIVEVJ154A34CF536/index.m3u8'];
  245 + var video = [ 'http://cnlive.hlslive.ks-cdn.com/live/'+t_user_id+'_'+id+'/index.m3u8'];
244 246 CKobject.embed('../../static/assets/ckplayer/ckplayer.swf','a1_' + id, 'ckplayer_' + id, 250,
245   - 153, false, flashvars, video); */
  247 + 153, false, flashvars, video); */
246 248  
247 249 });
248 250  
... ...