Commit bda84d7df0e8b3fad7f0cb760b7dcbaa46a5e508

Authored by 刘基城
2 parents 1ac037e4 cb801165

Merge branch 'master' of http://bj.gitlab.cnlive.com/liujicheng/cnlive_live_web

# Conflicts:
#	.settings/org.eclipse.wst.common.component
#	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

Too many changes to show.

To preserve performance only 26 of 52 files are displayed.

.classpath
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<classpath>
3   - <classpathentry kind="src" output="target/classes" path="src/main/java">
4   - <attributes>
5   - <attribute name="optional" value="true"/>
6   - <attribute name="maven.pomderived" value="true"/>
7   - </attributes>
8   - </classpathentry>
9   - <classpathentry kind="src" output="target/test-classes" path="src/test/java">
10   - <attributes>
11   - <attribute name="optional" value="true"/>
12   - <attribute name="maven.pomderived" value="true"/>
13   - </attributes>
14   - </classpathentry>
15   - <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
16   - <attributes>
17   - <attribute name="maven.pomderived" value="true"/>
18   - </attributes>
19   - </classpathentry>
20   - <classpathentry kind="src" path="src/main/resources/i18n"/>
21   - <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
22   - <attributes>
23   - <attribute name="maven.pomderived" value="true"/>
24   - <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
25   - </attributes>
26   - </classpathentry>
27   - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
28   - <attributes>
29   - <attribute name="maven.pomderived" value="true"/>
30   - </attributes>
31   - </classpathentry>
32   - <classpathentry kind="output" path="target/classes"/>
33   -</classpath>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" output="target/classes" path="src/main/java">
  4 + <attributes>
  5 + <attribute name="optional" value="true"/>
  6 + <attribute name="maven.pomderived" value="true"/>
  7 + </attributes>
  8 + </classpathentry>
  9 + <classpathentry kind="src" output="target/test-classes" path="src/test/java">
  10 + <attributes>
  11 + <attribute name="optional" value="true"/>
  12 + <attribute name="maven.pomderived" value="true"/>
  13 + </attributes>
  14 + </classpathentry>
  15 + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
  16 + <attributes>
  17 + <attribute name="maven.pomderived" value="true"/>
  18 + </attributes>
  19 + </classpathentry>
  20 + <classpathentry kind="src" path="src/main/resources/i18n"/>
  21 + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
  22 + <attributes>
  23 + <attribute name="maven.pomderived" value="true"/>
  24 + <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
  25 + </attributes>
  26 + </classpathentry>
  27 + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
  28 + <attributes>
  29 + <attribute name="owner.project.facets" value="java"/>
  30 + </attributes>
  31 + </classpathentry>
  32 + <classpathentry kind="output" path="target/classes"/>
  33 +</classpath>
... ...
.settings/org.eclipse.core.resources.prefs
1 1 eclipse.preferences.version=1
2 2 encoding//src/main/java=UTF-8
3 3 encoding//src/main/resources=UTF-8
4   -encoding//src/test/java=UTF-8
5 4 encoding/<project>=UTF-8
... ...
.settings/org.eclipse.wst.common.project.facet.core.xml
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<faceted-project>
3   - <installed facet="jst.web" version="3.0"/>
4   - <installed facet="wst.jsdt.web" version="1.0"/>
5   - <installed facet="jst.jaxrs" version="1.1"/>
6   - <installed facet="java" version="1.6"/>
7   -</faceted-project>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<faceted-project>
  3 + <installed facet="jst.web" version="3.0"/>
  4 + <installed facet="wst.jsdt.web" version="1.0"/>
  5 + <installed facet="jst.jaxrs" version="1.1"/>
  6 + <installed facet="java" version="1.7"/>
  7 +</faceted-project>
... ...
WebContent/META-INF/MANIFEST.MF
1   -Manifest-Version: 1.0
2   -Class-Path:
3   -
4   -
5   -
6   -
7   -
8   -
  1 +Manifest-Version: 1.0
  2 +Class-Path:
  3 +
  4 +
  5 +
  6 +
  7 +
  8 +
... ...
src/main/java/com/cnlive/mz/live/action/CheckAction.java
1 1 package com.cnlive.mz.live.action;
2 2  
3   -import java.io.UnsupportedEncodingException;
4   -import java.net.URLEncoder;
5   -import java.util.List;
6   -import java.util.Map;
7   -
8 3 import org.smart4j.framework.dao.bean.Pager;
9 4 import org.smart4j.framework.ioc.annotation.Inject;
10 5 import org.smart4j.framework.mvc.DataContext;
... ... @@ -15,11 +10,8 @@ import org.smart4j.framework.mvc.bean.Result;
15 10 import org.smart4j.framework.mvc.bean.View;
16 11 import org.smart4j.framework.util.CastUtil;
17 12  
18   -import com.cnlive.mz.commons.JsonUtil;
19   -import com.cnlive.mz.commons.net.HttpReq;
20 13 import com.cnlive.mz.live.common.LiveUtils;
21 14 import com.cnlive.mz.live.entity.TLive;
22   -import com.cnlive.mz.live.rest.BaseUtil;
23 15 import com.cnlive.mz.live.service.TCheckService;
24 16 import com.cnlive.mz.live.service.TLiveService;
25 17 import com.cnlive.mz.live.service.TRoomService;
... ... @@ -34,89 +26,61 @@ public class CheckAction {
34 26 @Inject
35 27 private TCheckService tCheckService;
36 28  
37   - // @Request.Get("/check/list/{page_number}")
38   - // public View list(int page_number) {
39   - // int user_id =
40   - // CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID));
41   - // System.out.println(user_id);
42   - // Pager<TLive> tLive = tCheckService.getTCheckLivePager(page_number, 9,
43   - // user_id);
44   - // List list = tLiveService.getLives(user_id);
45   - // View view = new View("check/check_management.jsp");
46   - // view.data("tLive", tLive);
47   - // view.data("list", list);
48   - // return view;
49   - // //return new View("check/demo.html");
50   - // }
  29 + /**
  30 + * 切断直播流
  31 + * @param id
  32 + * @param params
  33 + * @return
  34 + */
51 35 @Request.Post("/check/close/{id}")
52   - public Result coseLive(int id, Params params) throws UnsupportedEncodingException {
53   - String userId = params.getString("user_id");
54   - String streamName = userId + "_" + id;
55   - String accesskey = BaseUtil.getAccessKey();
56   - accesskey = java.net.URLEncoder.encode(accesskey, "utf-8");
57   - String signature = BaseUtil.signature(streamName);
58   - String del = "del";
59   - String delsignature = BaseUtil.signature(del, streamName);
60   - String expire = BaseUtil.getTimestamp();
61   - System.out.println(expire + "---expire---");
62   - // ��ӵ�������
63   - try {
64   - addBlackList(signature, accesskey, expire, streamName);
65   - delBlackList(delsignature, accesskey, expire, streamName);
66   - } catch (UnsupportedEncodingException e) {
67   - e.printStackTrace();
68   - }
69   - boolean flag = tCheckService.closeLive(id);
  36 + public Result cose(int id, Params params) {
  37 + String streamName = params.getString("user_id");
  38 + String uuid = params.getString("uuid");
  39 + boolean flag = tCheckService.close(streamName,id,uuid);
70 40 return new Result(flag);
71 41 }
72 42  
73 43 /**
74   - * ��ӵ�����
75   - *
76   - * @param signature
77   - * @param accesskey
78   - * @param expire
79   - * @param streamName
  44 + * 回复黑名单
  45 + * @param id
  46 + * @param params
80 47 * @return
81   - * @throws UnsupportedEncodingException
82 48 */
83   - public String addBlackList(String signature, String accesskey, String expire, String streamName)
84   - throws UnsupportedEncodingException {
85   - String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=" + signature + "&accesskey=" + accesskey
86   - + "&expire=" + expire + "&app=live&method=add&name=" + streamName;
87   - System.out.println(url);
88   - String jsonArrStr = HttpReq.getRequestWidthResult(url);
89   - int status = HttpReq.getRequest(url);
90   - System.out.println(status + "......and......" + jsonArrStr);
91   - /*
92   - * Map map = JsonUtil.getMapFromJsonObjStr(jsonArrStr); String
93   - * chatRoomid = (String) map.get("Content-Length");
94   - */
95   - return jsonArrStr;
  49 + @Request.Post("/check/resume/{id}")
  50 + public Result resume(int id, Params params){
  51 + String streamName = params.getString("user_id");
  52 + boolean flag = tCheckService.resume(streamName,id);
  53 + return new Result(flag);
96 54 }
  55 +
97 56  
98   - /**
99   - * �Ӻ���ɾ��
100   - *
101   - * @param signature
102   - * @param accesskey
103   - * @param expire
104   - * @param streamName
105   - * @return
106   - * @throws UnsupportedEncodingException
107   - */
108   - public Object delBlackList(String signature, String accesskey, String expire, String streamName)
109   - throws UnsupportedEncodingException {
110   - String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=" + signature + "&accesskey=" + accesskey
111   - + "&expire=" + expire + "&app=live&method=del&name=" + streamName;
112   - System.out.println("..url.." + url);
113   - String jsonArrStr = HttpReq.getRequestWidthResult(url);
114   - System.out.println("..jsonArrStr.." + jsonArrStr);
115   - /*
116   - * Map map = JsonUtil.getMapFromJsonObjStr(jsonArrStr); String
117   - * chatRoomid = (String) map.get("Content-Length");
118   - */
119   - return jsonArrStr;
  57 + @Request.Get("/check/list/{page_number}")
  58 + public View check(int page_number) {
  59 + int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID));
  60 + Pager<TLive> tLive = tLiveService.getTCheckLivePager(page_number, 12, user_id);
  61 + View view = new View("check/monitor.jsp");
  62 + view.data("tLive", tLive);
  63 + return view;
  64 + }
  65 +
  66 + // 置顶
  67 + @Request.Get("/check/top/{id}")
  68 + public Result top(int id) {
  69 + tLiveService.top(id);
  70 + return new Result(true);
  71 + }
  72 +
  73 + // 通过审核
  74 + @Request.Get("/check/pass/{id}")
  75 + public Result pass(int id) {
  76 + tLiveService.pass(id);
  77 + return new Result(true);
  78 + }
  79 +
  80 + @Request.Post("/check/close/{id}/{uuid}")
  81 + public Result coseLive(int id, String uuid) {
  82 + boolean flag = tLiveService.closeLive(id, uuid);
  83 + return new Result(flag);
120 84 }
121 85  
122 86 }
... ...
src/main/java/com/cnlive/mz/live/action/HttpPostArgumentTest2.java
1   -package com.cnlive.mz.live.action;
2   -
3   -import java.io.File;
4   -import java.io.IOException;
5   -
6   -import org.apache.commons.httpclient.NameValuePair;
7   -import org.apache.commons.httpclient.params.HttpMethodParams;
8   -import org.apache.http.HttpEntity;
9   -import org.apache.http.HttpResponse;
10   -import org.apache.http.HttpStatus;
11   -import org.apache.http.ParseException;
12   -import org.apache.http.client.HttpClient;
13   -import org.apache.http.client.methods.HttpPost;
14   -import org.apache.http.entity.mime.MultipartEntity;
15   -import org.apache.http.entity.mime.content.FileBody;
16   -import org.apache.http.entity.mime.content.StringBody;
17   -import org.apache.http.impl.client.DefaultHttpClient;
18   -import org.apache.http.util.EntityUtils;
19   -
20   -import com.cnlive.mz.commons.net.HttpReq;
21   -
22   -public class HttpPostArgumentTest2 {
23   -
24   - private static String user_access_key = "cf34f28db21b46678237bfa849e239ea";
25   - private static String app_access_key = "7338ebf9cab441c0843e437a18d85549";
26   -
27   - public void SubmitPost(String url, String filepath) {
28   - HttpClient httpclient = new DefaultHttpClient();
29   - try {
30   - HttpPost httppost = new HttpPost(url);
31   - FileBody bin = new FileBody(new File(filepath));
32   - MultipartEntity reqEntity = new MultipartEntity();
33   - // reqEntity.addPart("file", bin);
34   - reqEntity.addPart("app_access_key", new StringBody("7338ebf9cab441c0843e437a18d85549"));
35   - reqEntity.addPart("user_access_key", new StringBody("cf34f28db21b46678237bfa849e239ea"));
36   - reqEntity.addPart("direct", new StringBody("0"));
37   - reqEntity.addPart("upload_type", new StringBody("1"));
38   - reqEntity.addPart("md5", new StringBody("liujicheng"));
39   - reqEntity.addPart("title", new StringBody("title"));
40   - reqEntity.addPart("name", new StringBody("中投视频宣传片熊猫test"));
41   - reqEntity.addPart("server_access_key", new StringBody("3830ce241dad4b9f844d131c890231ae"));
42   -
43   - httppost.setEntity(reqEntity);
44   - HttpResponse response = httpclient.execute(httppost);
45   - int statusCode = response.getStatusLine().getStatusCode();
46   - System.out.println(statusCode);
47   - System.out.println("服务器正常响应.....");
48   - HttpEntity resEntity = response.getEntity();
49   - System.out.println(EntityUtils.toString(resEntity));
50   - System.out.println(resEntity.getContent());
51   - EntityUtils.consume(resEntity);
52   -
53   - } catch (ParseException e) {
54   - e.printStackTrace();
55   - } catch (IOException e) {
56   - e.printStackTrace();
57   - } finally {
58   - try {
59   - httpclient.getConnectionManager().shutdown();
60   - } catch (Exception ignore) {
61   - ignore.printStackTrace();
62   - }
63   - }
64   - }
65   -
66   - public static void redirect() {
67   - NameValuePair[] param = { new NameValuePair("relation_id", "283645"), new NameValuePair("video_type", "3"),
68   - new NameValuePair("user_access_key", user_access_key),
69   - new NameValuePair("app_access_key", app_access_key) };
70   - String c = HttpReq.postRequestWidthResult("http://bc.cnlive.com/api/video/redirect", param);
71   - System.out.println(c);
72   - }
73   -
74   - public static void delete() {
75   - NameValuePair[] param = { new NameValuePair("video_type", "2"),
76   - new NameValuePair("app_access_key", "7338ebf9cab441c0843e437a18d85549"),
77   - new NameValuePair("user_access_key", "cf34f28db21b46678237bfa849e239ea"),
78   - new NameValuePair("video_uuid", "a8794762b3e92c7d6589a6157cf1ef27,7e26dee78a584f8c5ab1d93a9c878f1d") };
79   - String c = HttpReq.postRequestWidthResult("http://bc.cnlive.com/api/video/delete", param);
80   - System.out.println(c);
81   - }
82   -
83   - private static String md5 = "ffa699fb66750acab30b71b8ceb0172d1";
84   -
85   - public static void supload() {
86   - NameValuePair[] param = { new NameValuePair("app_access_key", app_access_key),
87   - new NameValuePair("user_access_key", user_access_key), new NameValuePair("video_type", "3"),
88   - new NameValuePair("upload_type", "0"), new NameValuePair("direct", "1"), new NameValuePair("md5", md5),
89   - new NameValuePair("title", "tit三道恩le1"), new NameValuePair("relation_id", "615207"),
90   - new NameValuePair("custom_args", "custom_args1"), new NameValuePair("name", "VID_20151224_105421.mp4"),
91   - new NameValuePair("server_access_key", "3830ce241dad4b9f844d131c890231ae") };
92   - String c = HttpReq.postRequestWidthResult("http://localhost:8080/cnlive_live_web/api/video/supload", param);
93   - System.out.println(c);
94   - }
95   -
96   - public static void uploadNotify() {
97   - NameValuePair[] param = { new NameValuePair("app_access_key", app_access_key),
98   - new NameValuePair("user_access_key", user_access_key), new NameValuePair("upload_type", "1"),
99   - new NameValuePair("video_type", "2"), new NameValuePair("state", "200"),
100   - new NameValuePair("video_uuid", md5) };
101   - String c = HttpReq
102   - .postRequestWidthResult("http://localhost:8080/cnlive_live_web/api/video/uploadNotify", param);
103   - System.out.println(c);
104   - }
105   -
106   - public static void all() {
107   - NameValuePair[] param = { new NameValuePair("app_access_key", app_access_key),
108   - new NameValuePair("relation_id", "498122"),
109   -
110   - new NameValuePair("user_access_key", user_access_key), new NameValuePair("upload_type", "1"),
111   - new NameValuePair("video_type", "2"), new NameValuePair("page_no", "1"),
112   - new NameValuePair("video_uuid", md5) };
113   - String c = HttpReq.postRequestWidthResult("http://localhost:8080/cnlive_live_web/api/video/all", param);
114   - System.out.println(c);
115   - }
116   -
117   - public static void main(String[] args) {
118   - // new HttpPostArgumentTest2().delete();
119   - //HttpPostArgumentTest2.all();
120   - HttpPostArgumentTest2.redirect();
121   - // HttpReq.postRequestWidthResult("http://120.132.76.51:9696/cnlive_encoding_job/task",
122   - // "json", "jsonjsonjsonjson");r
123   - }
124   -
125   -}
  1 +package com.cnlive.mz.live.action;
  2 +
  3 +import java.io.File;
  4 +import java.io.IOException;
  5 +
  6 +import org.apache.commons.httpclient.NameValuePair;
  7 +import org.apache.commons.httpclient.params.HttpMethodParams;
  8 +import org.apache.http.HttpEntity;
  9 +import org.apache.http.HttpResponse;
  10 +import org.apache.http.HttpStatus;
  11 +import org.apache.http.ParseException;
  12 +import org.apache.http.client.HttpClient;
  13 +import org.apache.http.client.methods.HttpPost;
  14 +import org.apache.http.entity.mime.MultipartEntity;
  15 +import org.apache.http.entity.mime.content.FileBody;
  16 +import org.apache.http.entity.mime.content.StringBody;
  17 +import org.apache.http.impl.client.DefaultHttpClient;
  18 +import org.apache.http.util.EntityUtils;
  19 +
  20 +import com.cnlive.mz.commons.net.HttpReq;
  21 +
  22 +public class HttpPostArgumentTest2 {
  23 +
  24 + private static String user_access_key = "cf34f28db21b46678237bfa849e239ea";
  25 + private static String app_access_key = "7338ebf9cab441c0843e437a18d85549";
  26 +
  27 + public void SubmitPost(String url, String filepath) {
  28 + HttpClient httpclient = new DefaultHttpClient();
  29 + try {
  30 + HttpPost httppost = new HttpPost(url);
  31 + FileBody bin = new FileBody(new File(filepath));
  32 + MultipartEntity reqEntity = new MultipartEntity();
  33 + // reqEntity.addPart("file", bin);
  34 + reqEntity.addPart("app_access_key", new StringBody("7338ebf9cab441c0843e437a18d85549"));
  35 + reqEntity.addPart("user_access_key", new StringBody("cf34f28db21b46678237bfa849e239ea"));
  36 + reqEntity.addPart("direct", new StringBody("0"));
  37 + reqEntity.addPart("upload_type", new StringBody("1"));
  38 + reqEntity.addPart("md5", new StringBody("liujicheng"));
  39 + reqEntity.addPart("title", new StringBody("title"));
  40 + reqEntity.addPart("name", new StringBody("中投视频宣传片熊猫test"));
  41 + reqEntity.addPart("server_access_key", new StringBody("3830ce241dad4b9f844d131c890231ae"));
  42 +
  43 + httppost.setEntity(reqEntity);
  44 + HttpResponse response = httpclient.execute(httppost);
  45 + int statusCode = response.getStatusLine().getStatusCode();
  46 + System.out.println(statusCode);
  47 + System.out.println("服务器正常响应.....");
  48 + HttpEntity resEntity = response.getEntity();
  49 + System.out.println(EntityUtils.toString(resEntity));
  50 + System.out.println(resEntity.getContent());
  51 + EntityUtils.consume(resEntity);
  52 +
  53 + } catch (ParseException e) {
  54 + e.printStackTrace();
  55 + } catch (IOException e) {
  56 + e.printStackTrace();
  57 + } finally {
  58 + try {
  59 + httpclient.getConnectionManager().shutdown();
  60 + } catch (Exception ignore) {
  61 + ignore.printStackTrace();
  62 + }
  63 + }
  64 + }
  65 +
  66 + public static void redirect() {
  67 + NameValuePair[] param = { new NameValuePair("relation_id", "283645"), new NameValuePair("video_type", "3"),
  68 + new NameValuePair("user_access_key", user_access_key),
  69 + new NameValuePair("app_access_key", app_access_key) };
  70 + String c = HttpReq.postRequestWidthResult("http://bc.cnlive.com/api/video/redirect", param);
  71 + System.out.println(c);
  72 + }
  73 +
  74 + public static void delete() {
  75 + NameValuePair[] param = { new NameValuePair("video_type", "2"),
  76 + new NameValuePair("app_access_key", "7338ebf9cab441c0843e437a18d85549"),
  77 + new NameValuePair("user_access_key", "cf34f28db21b46678237bfa849e239ea"),
  78 + new NameValuePair("video_uuid", "a8794762b3e92c7d6589a6157cf1ef27,7e26dee78a584f8c5ab1d93a9c878f1d") };
  79 + String c = HttpReq.postRequestWidthResult("http://bc.cnlive.com/api/video/delete", param);
  80 + System.out.println(c);
  81 + }
  82 +
  83 + private static String md5 = "ffa699fb66750acab30b71b8ceb0172d1";
  84 +
  85 + public static void supload() {
  86 + NameValuePair[] param = { new NameValuePair("app_access_key", app_access_key),
  87 + new NameValuePair("user_access_key", user_access_key), new NameValuePair("video_type", "3"),
  88 + new NameValuePair("upload_type", "0"), new NameValuePair("direct", "1"), new NameValuePair("md5", md5),
  89 + new NameValuePair("title", "tit三道恩le1"), new NameValuePair("relation_id", "615207"),
  90 + new NameValuePair("custom_args", "custom_args1"), new NameValuePair("name", "VID_20151224_105421.mp4"),
  91 + new NameValuePair("server_access_key", "3830ce241dad4b9f844d131c890231ae") };
  92 + String c = HttpReq.postRequestWidthResult("http://localhost:8080/cnlive_live_web/api/video/supload", param);
  93 + System.out.println(c);
  94 + }
  95 +
  96 + public static void uploadNotify() {
  97 + NameValuePair[] param = { new NameValuePair("app_access_key", app_access_key),
  98 + new NameValuePair("user_access_key", user_access_key), new NameValuePair("upload_type", "1"),
  99 + new NameValuePair("video_type", "2"), new NameValuePair("state", "200"),
  100 + new NameValuePair("video_uuid", md5) };
  101 + String c = HttpReq
  102 + .postRequestWidthResult("http://localhost:8080/cnlive_live_web/api/video/uploadNotify", param);
  103 + System.out.println(c);
  104 + }
  105 +
  106 + public static void all() {
  107 + NameValuePair[] param = { new NameValuePair("app_access_key", app_access_key),
  108 + new NameValuePair("relation_id", "498122"),
  109 +
  110 + new NameValuePair("user_access_key", user_access_key), new NameValuePair("upload_type", "1"),
  111 + new NameValuePair("video_type", "2"), new NameValuePair("page_no", "1"),
  112 + new NameValuePair("video_uuid", md5) };
  113 + String c = HttpReq.postRequestWidthResult("http://localhost:8080/cnlive_live_web/api/video/all", param);
  114 + System.out.println(c);
  115 + }
  116 +
  117 + public static void main(String[] args) {
  118 + // new HttpPostArgumentTest2().delete();
  119 + //HttpPostArgumentTest2.all();
  120 + HttpPostArgumentTest2.redirect();
  121 + // HttpReq.postRequestWidthResult("http://120.132.76.51:9696/cnlive_encoding_job/task",
  122 + // "json", "jsonjsonjsonjson");r
  123 + }
  124 +
  125 +}
... ...
src/main/java/com/cnlive/mz/live/action/LiveAction.java
... ... @@ -9,11 +9,15 @@
9 9  
10 10 package com.cnlive.mz.live.action;
11 11  
  12 +import java.io.IOException;
12 13 import java.io.UnsupportedEncodingException;
13 14 import java.util.HashMap;
14 15 import java.util.List;
15 16 import java.util.Map;
16 17  
  18 +import javax.servlet.http.HttpServletRequest;
  19 +import javax.servlet.http.HttpServletResponse;
  20 +
17 21 import org.apache.commons.httpclient.NameValuePair;
18 22 import org.apache.commons.lang.StringUtils;
19 23 import org.apache.log4j.Logger;
... ... @@ -28,12 +32,12 @@ import org.smart4j.framework.mvc.bean.Params;
28 32 import org.smart4j.framework.mvc.bean.Result;
29 33 import org.smart4j.framework.mvc.bean.ResultBean;
30 34 import org.smart4j.framework.mvc.bean.View;
31   -import org.smart4j.framework.orm.DataSet;
32 35 import org.smart4j.framework.util.CastUtil;
33 36  
34 37 import com.cnlive.mz.commons.Constants;
35 38 import com.cnlive.mz.commons.net.HttpReq;
36 39 import com.cnlive.mz.live.common.LiveUtils;
  40 +import com.cnlive.mz.live.entity.TChannel;
37 41 import com.cnlive.mz.live.entity.TLive;
38 42 import com.cnlive.mz.live.entity.TRoom;
39 43 import com.cnlive.mz.live.rest.BaseUtil;
... ... @@ -109,107 +113,6 @@ public class LiveAction {
109 113 return view;
110 114 }
111 115  
112   - @Request.Get("/check/list/{page_number}")
113   - public View check(int page_number) {
114   - int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID));
115   - Pager<TLive> tLive = tLiveService.getTCheckLivePager(page_number, 12, user_id);
116   - View view = new View("check/monitor.jsp");
117   - view.data("tLive", tLive);
118   - return view;
119   - }
120   -
121   - // 置顶
122   - @Request.Get("/check/top/{id}")
123   - public Result top(int id) {
124   - tLiveService.top(id);
125   - return new Result(true);
126   - }
127   -
128   - // 切断
129   - @Request.Post("/check/cut/{id}")
130   - public Result cut(int id, Params params) throws UnsupportedEncodingException {
131   - String live_url = params.getString("live_url");
132   - if (live_url.isEmpty()) {
133   - return null;
134   - } else {
135   - int index = live_url.lastIndexOf("/");
136   - String streamName = live_url.substring(index + 1);
137   - System.out.println("streamName===" + streamName);
138   - String accesskey = BaseUtil.getAccessKey();
139   - accesskey = java.net.URLEncoder.encode(accesskey, "utf-8");
140   - String add = "add";
141   - String signature = BaseUtil.signature(add, streamName);
142   - String del = "del";
143   - String delsignature = BaseUtil.signature(del, streamName);
144   - String expire = BaseUtil.getTimestamp();
145   - System.out.println(expire + "---expire---");
146   - // 断流。
147   - try {
148   - addBlackList(signature, accesskey, expire, streamName);
149   - // delBlackList(delsignature, accesskey, expire, streamName);
150   - } catch (UnsupportedEncodingException e) {
151   - e.printStackTrace();
152   - }
153   - // 直播通知
154   - // tLiveService.notify(video_uuid, -1);
155   - boolean flag = tCheckService.closeLive(id);
156   - return new Result(flag);
157   - }
158   - }
159   -
160   - // 通过审核
161   - @Request.Get("/check/pass/{id}")
162   - public Result pass(int id) {
163   - tLiveService.pass(id);
164   - return new Result(true);
165   - }
166   -
167   - @Request.Post("/check/close/{id}/{uuid}")
168   - public Result coseLive(int id, String uuid) {
169   - boolean flag = tLiveService.closeLive(id, uuid);
170   - return new Result(flag);
171   - }
172   -
173   - /**
174   - * 添加到黑名单
175   - *
176   - * @param signature
177   - * @param accesskey
178   - * @param expire
179   - * @param streamName
180   - * @return
181   - * @throws UnsupportedEncodingException
182   - */
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;
187   - String jsonArrStr = HttpReq.getRequestWidthResult(url);
188   - int status = HttpReq.getRequest(url);
189   - System.out.println(status + "......and......" + jsonArrStr);
190   - return jsonArrStr;
191   - }
192   -
193   - /**
194   - * 从黑名单删除
195   - *
196   - * @param signature
197   - * @param accesskey
198   - * @param expire
199   - * @param streamName
200   - * @return
201   - * @throws UnsupportedEncodingException
202   - */
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;
207   - String jsonArrStr = HttpReq.getRequestWidthResult(url);
208   - System.out.println("..jsonArrStr.." + jsonArrStr);
209   - return jsonArrStr;
210   -
211   - }
212   -
213 116 @Request.Get("/live/alllive/{page_number}")
214 117 public View liveList(int page_number) {
215 118 int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID));
... ... @@ -297,15 +200,17 @@ public class LiveAction {
297 200 log.error("创建活动失败,活动ID已存在");
298 201 return rb;
299 202 } else {
300   -
301 203 boolean flag = tLiveService.addAcitvity(params);
302 204 if (flag) {
303 205 Map<String, Object> map = new HashMap<String, Object>();
304   - map.put("location", "rtmp://jsrtmp.up.cnlive.com/live/1234");
  206 + map.put("location",
  207 + com.cnlive.mz.live.common.Constants.KS_HOST_UP_RTMP + channelID + "?vdoid=" + activityId);
305 208 rb.setData(map);
306 209 rb.setErrorCode("0");
307 210 rb.setErrorMessage("创建活动成功");
308 211 log.info("创建活动成功");
  212 + // 通知cms直播
  213 + // boolean success = tLiveService.startLive(tLive);
309 214 return rb;
310 215 } else {
311 216 Map<String, Object> map = new HashMap<String, Object>();
... ... @@ -338,23 +243,25 @@ public class LiveAction {
338 243 @Request.Get("/live/epg/startActivity")
339 244 public ResultBean startActivity(Params params) {
340 245 ResultBean rb = new ResultBean();
  246 + log.info(params);
341 247 String appId = params.getString("appId");
342 248 String activityid = params.getString("activityId");
343 249 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 250 rb.setErrorCode("500");
348   - rb.setErrorMessage("启动活动失败");
  251 + rb.setErrorMessage("启动活动失败,参数不正确");
349 252 return rb;
350 253 } else {
351 254 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;
  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 + }
358 265 }
359 266 }
360 267  
... ... @@ -366,48 +273,41 @@ public class LiveAction {
366 273 */
367 274 @Request.Get("/live/epg/stopActivity")
368 275 public ResultBean stopActivity(Params params) {
  276 + log.info(params);
369 277 ResultBean rb = new ResultBean();
370 278 String appId = params.getString("appId");
371 279 String activityid = params.getString("activityId");
  280 + TLive tLive = tLiveService.selectByParams(appId, activityid);
  281 + Map<String, Object> map = new HashMap<String, Object>();
372 282 if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) {
373   - Map<String, Object> map = new HashMap<String, Object>();
374 283 map.put("location", "");
375 284 rb.setData(map);
376 285 rb.setErrorCode("500");
377 286 rb.setErrorMessage("停止直播失败,参数不正确");
378 287 return rb;
379 288 } 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();
  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);
  300 + // 直播断流。
  301 + tCheckService.close(streamName, tLive.getId(), tLive.getUuid());
399 302 }
400 303 // 直播通知
401 304 // tLiveService.notify(video_uuid, -1);
402   - boolean flag = tCheckService.closeLive(Integer.parseInt(activityid));
403   - Map<String, Object> map = new HashMap<String, Object>();
404 305 map.put("location", tLive.getLive_url());
405 306 rb.setData(map);
406 307 rb.setErrorCode("0");
407 308 rb.setErrorMessage("停止直播成功");
408 309 return rb;
409 310 }
410   -
411 311 }
412 312  
413 313 /**
... ... @@ -427,14 +327,21 @@ public class LiveAction {
427 327 map.put("location", "");
428 328 rb.setData(map);
429 329 rb.setErrorCode("500");
430   - rb.setErrorMessage("获取活动列表失败,字段不正确");
  330 + rb.setErrorMessage("获取活动列表失败,参数不正确");
431 331 return rb;
432 332 } else {
433 333 Pager<TLive> tLive = tLiveService.getActivityPager(pageNo, pageSize, appId);
434   - rb.setData(tLive);
435   - rb.setErrorCode("0");
436   - rb.setErrorMessage("获取活动列表成功");
437   - 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 + }
438 345  
439 346 }
440 347 }
... ... @@ -449,21 +356,28 @@ public class LiveAction {
449 356 ResultBean rb = new ResultBean();
450 357 String appId = params.getString("appId");
451 358 String activityid = params.getString("activityId");
  359 + Map<String, Object> map = new HashMap<String, Object>();
452 360 if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) {
453   - Map<String, Object> map = new HashMap<String, Object>();
454 361 map.put("location", "");
455 362 rb.setData(map);
456 363 rb.setErrorCode("500");
457   - rb.setErrorMessage("获取直播回放失败");
  364 + rb.setErrorMessage("获取直播回放失败,参数不正确");
458 365 return rb;
459 366 } else {
460 367 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;
  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 + }
467 381 }
468 382 }
469 383  
... ... @@ -474,6 +388,192 @@ public class LiveAction {
474 388 */
475 389 @Request.Get("/live/epg/liveplayByAPP")
476 390 public ResultBean liveplayByAPP(Params params) {
  391 + log.info(params);
  392 + ResultBean rb = new ResultBean();
  393 + String appId = params.getString("appId");
  394 + String activityid = params.getString("activityId");
  395 + Map<String, Object> map = new HashMap<String, Object>();
  396 + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) {
  397 + map.put("location", "");
  398 + rb.setData(map);
  399 + rb.setErrorCode("500");
  400 + rb.setErrorMessage("获取直播回放失败,参数不正确");
  401 + return rb;
  402 + } else {
  403 + TLive tLive = tLiveService.selectByParams(appId, activityid);
  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 + }
  417 + }
  418 + }
  419 +
  420 + /**
  421 + * 1.8 获取APP直播URL接口.md
  422 + *
  423 + * @param params
  424 + * @return
  425 + */
  426 + @Request.Get("/live/epg/play/app")
  427 + public ResultBean appURL(Params params) throws IOException {
  428 + HttpServletResponse response = DataContext.getResponse();
  429 + ResultBean rb = new ResultBean();
  430 + String appId = params.getString("appId");
  431 + String activityid = params.getString("activityId");
  432 + Map<String, Object> map = new HashMap<String, Object>();
  433 + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) {
  434 + map.put("location", "");
  435 + rb.setData(map);
  436 + rb.setErrorCode("500");
  437 + rb.setErrorMessage("启动app活动失败");
  438 + return rb;
  439 + } else {
  440 + TLive tLive = tLiveService.selectByParams(appId, activityid);
  441 + if (tLive == null) {
  442 + map.put("location", "");
  443 + rb.setData(map);
  444 + rb.setErrorCode("500");
  445 + rb.setErrorMessage("启动app活动失败,活动对象为空");
  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 + }
  465 + }
  466 + }
  467 +
  468 + }
  469 +
  470 + /**
  471 + * 1.9 获取H5直播URL接口.md
  472 + *
  473 + * @param params
  474 + * @return
  475 + */
  476 + @Request.Get("/live/epg/play/h5")
  477 + public ResultBean h5URL(Params params) {
  478 + HttpServletResponse response = DataContext.getResponse();
  479 + ResultBean rb = new ResultBean();
  480 + String appId = params.getString("appId");
  481 + String activityid = params.getString("activityId");
  482 + Map<String, Object> map = new HashMap<String, Object>();
  483 + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) {
  484 + map.put("location", "");
  485 + rb.setData(map);
  486 + rb.setErrorCode("500");
  487 + rb.setErrorMessage("启动h5活动失败");
  488 + return rb;
  489 + } else {
  490 + TLive tLive = tLiveService.selectByParams(appId, activityid);
  491 + if (tLive == null) {
  492 + map.put("location", "");
  493 + rb.setData(map);
  494 + rb.setErrorCode("500");
  495 + rb.setErrorMessage("启动h5活动失败,活动对象为空");
  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 + }
  515 + }
  516 + }
  517 +
  518 + }
  519 +
  520 + /**
  521 + * 2.0 获取SWF直播URL接口.md
  522 + *
  523 + * @param params
  524 + * @return
  525 + */
  526 + @Request.Get("/live/epg/play/swf")
  527 + public ResultBean swfURL(Params params) {
  528 + HttpServletResponse response = DataContext.getResponse();
  529 + ResultBean rb = new ResultBean();
  530 + String appId = params.getString("appId");
  531 + String activityid = params.getString("activityId");
  532 + Map<String, Object> map = new HashMap<String, Object>();
  533 + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) {
  534 + map.put("location", "");
  535 + rb.setData(map);
  536 + rb.setErrorCode("500");
  537 + rb.setErrorMessage("启动swf活动失败");
  538 + return rb;
  539 + } else {
  540 + TLive tLive = tLiveService.selectByParams(appId, activityid);
  541 + if (tLive == null) {
  542 + map.put("location", "");
  543 + rb.setData(map);
  544 + rb.setErrorCode("500");
  545 + rb.setErrorMessage("启动swf活动失败,活动对象为空");
  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 + }
  564 + }
  565 + }
  566 +
  567 + }
  568 +
  569 + /**
  570 + * 2.1 获取推流直播播放地址.md
  571 + *
  572 + * @param params
  573 + * @return
  574 + */
  575 + @Request.Get("/live/epg/play")
  576 + public ResultBean startLiveActivity(Params params) {
477 577 ResultBean rb = new ResultBean();
478 578 String appId = params.getString("appId");
479 579 String activityid = params.getString("activityId");
... ... @@ -482,15 +582,15 @@ public class LiveAction {
482 582 map.put("location", "");
483 583 rb.setData(map);
484 584 rb.setErrorCode("500");
485   - rb.setErrorMessage("获取直播回放失败");
  585 + rb.setErrorMessage("启动活动失败");
486 586 return rb;
487 587 } else {
488 588 TLive tLive = tLiveService.selectByParams(appId, activityid);
489 589 Map<String, Object> map = new HashMap<String, Object>();
490   - map.put("location", tLive.getPlayback_url());
  590 + map.put("location", tLive.getLive_url());
491 591 rb.setData(map);
492 592 rb.setErrorCode("0");
493   - rb.setErrorMessage("获取直播回放成功");
  593 + rb.setErrorMessage("启动活动成功");
494 594 return rb;
495 595 }
496 596 }
... ... @@ -505,49 +605,45 @@ public class LiveAction {
505 605 rb.setErrorMessage("失败");
506 606 return rb;
507 607 }
  608 +
  609 + public static void redirect(HttpServletResponse response, String redirectUrl) {
  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 +
  620 + @Request.Get("/live/epg/302")
  621 + public void red302() {
  622 + HttpServletResponse response = DataContext.getResponse();
  623 + redirect(response, "http://ips.cnlive.com/IPS/liveplayBySWF.action?activityId=12345");
  624 + }
  625 +
508 626 public static void main(String[] args) {
  627 +
509 628 /*
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);
  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);
515 646 */
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 647 String aa = HttpReq
552 648 .getRequestWidthResult("http://bc.cnlive.com/live/epg/startActivity?appId=123&activityId=234");
553 649 System.out.println(aa);
... ...
src/main/java/com/cnlive/mz/live/action/UserAction.java
1   -package com.cnlive.mz.live.action;
2   -
3   -import org.smart4j.framework.dao.bean.Pager;
4   -import org.smart4j.framework.ioc.annotation.Inject;
5   -import org.smart4j.framework.mvc.annotation.Action;
6   -import org.smart4j.framework.mvc.annotation.Request;
7   -import org.smart4j.framework.mvc.bean.Result;
8   -import org.smart4j.framework.mvc.bean.View;
9   -
10   -import com.cnlive.mz.live.entity.TLive;
11   -import com.cnlive.mz.live.entity.TUser;
12   -import com.cnlive.mz.live.service.TUserService;
13   -
14   -@Action
15   -public class UserAction {
16   -
17   - @Inject
18   - private TUserService tUserService;
19   -
20   - /**
21   - * 获取用户列表页
22   - *
23   - * @param pageNumber
24   - * @return
25   - */
26   - @Request.Get("/user/list/{pageNumber}")
27   - public View list(int pageNumber) {
28   - Pager<TUser> userPage = tUserService.getTUserPage(pageNumber);
29   - return new View("user/user_list.jsp").data("userPage", userPage);
30   - }
31   -
32   - @Request.Get("/user/live/{userId}/{pageNumber}")
33   - public View livelist(int userId, int pageNumber) {
34   - Pager<TLive> userPage = tUserService.getTLivePage(userId, pageNumber);
35   - return new View("user/user_live_list.jsp").data("userPage", userPage);
36   - }
37   -
38   - @Request.Get("/user/report/{userId}/{type}")
39   - public Result report(int userId,String type) {
40   - return new Result(tUserService.addReport(userId,type));
41   - }
42   -}
  1 +package com.cnlive.mz.live.action;
  2 +
  3 +import org.smart4j.framework.dao.bean.Pager;
  4 +import org.smart4j.framework.ioc.annotation.Inject;
  5 +import org.smart4j.framework.mvc.annotation.Action;
  6 +import org.smart4j.framework.mvc.annotation.Request;
  7 +import org.smart4j.framework.mvc.bean.Result;
  8 +import org.smart4j.framework.mvc.bean.View;
  9 +
  10 +import com.cnlive.mz.live.entity.TLive;
  11 +import com.cnlive.mz.live.entity.TUser;
  12 +import com.cnlive.mz.live.service.TUserService;
  13 +
  14 +@Action
  15 +public class UserAction {
  16 +
  17 + @Inject
  18 + private TUserService tUserService;
  19 +
  20 + /**
  21 + * 获取用户列表页
  22 + *
  23 + * @param pageNumber
  24 + * @return
  25 + */
  26 + @Request.Get("/user/list/{pageNumber}")
  27 + public View list(int pageNumber) {
  28 + Pager<TUser> userPage = tUserService.getTUserPage(pageNumber);
  29 + return new View("user/user_list.jsp").data("userPage", userPage);
  30 + }
  31 +
  32 + @Request.Get("/user/live/{userId}/{pageNumber}")
  33 + public View livelist(int userId, int pageNumber) {
  34 + Pager<TLive> userPage = tUserService.getTLivePage(userId, pageNumber);
  35 + return new View("user/user_live_list.jsp").data("userPage", userPage);
  36 + }
  37 +
  38 + @Request.Get("/user/report/{userId}/{type}")
  39 + public Result report(int userId,String type) {
  40 + return new Result(tUserService.addReport(userId,type));
  41 + }
  42 +}
... ...
src/main/java/com/cnlive/mz/live/action/VideoAction.java
... ... @@ -115,7 +115,7 @@ public class VideoAction {
115 115 } else {
116 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 119 success = tLiveService.startLive(tLive);
120 120 }
121 121 data.put("video_uuid", uuid);
... ...
src/main/java/com/cnlive/mz/live/action/VodIpsAction.java
... ... @@ -4,41 +4,56 @@ import java.util.HashMap;
4 4 import java.util.Map;
5 5  
6 6 import org.apache.log4j.Logger;
  7 +import org.smart4j.framework.ioc.annotation.Inject;
7 8 import org.smart4j.framework.mvc.annotation.Action;
8 9 import org.smart4j.framework.mvc.annotation.Request;
9 10 import org.smart4j.framework.mvc.bean.Params;
10 11 import org.smart4j.framework.mvc.bean.Redirect;
11 12 import org.smart4j.framework.mvc.bean.ResultBean;
12 13  
  14 +import com.cnlive.mz.live.service.VodIpsServer;
  15 +
13 16 /**
14 17 * 点播调度
  18 + *
15 19 * @author adm
16 20 *
17 21 */
18 22 @Action
19 23 public class VodIpsAction {
  24 + @Inject
  25 + VodIpsServer vodIpsServer;
20 26  
21 27 private Logger log = Logger.getLogger("VodIpsAction");
22   -
  28 +
23 29 @Request.Get("/vodips/h5/{id}")
24   - public Redirect h5(int id,Params params) {
25   - Redirect r=new Redirect();
26   - r.setRedirectUrl("http://wideo03.cnlive.com/video/data1/2016/0808/141118/1500/878e13fc40754c2caf1476f7cad5f7b9_141118_1500.m3u8");
  30 + public Redirect h5(int id, Params params) {
  31 + String vId=params.getString("vId");
  32 + int rate=params.getInt("rate");
  33 + Redirect r = new Redirect();
  34 + String url=vodIpsServer.getH5PlayUrl(vId, rate);
  35 + r.setRedirectUrl(url);
27 36 return r;
28 37 }
29   -
  38 +
30 39 @Request.Get("/vodips/app/{id}")
31   - public Redirect app(int id,Params params) {
32   - Redirect r=new Redirect();
33   - r.setRedirectUrl("http://wideo03.cnlive.com/video/data1/2016/0808/141118/1500/878e13fc40754c2caf1476f7cad5f7b9_141118_1500.m3u8");
  40 + public Redirect app(int id, Params params) {
  41 + String vId=params.getString("vId");
  42 + int rate=params.getInt("rate");
  43 + String url=vodIpsServer.getAppPlayUrl(vId, rate);
  44 + Redirect r = new Redirect();
  45 + r.setRedirectUrl(url);
34 46 return r;
35 47 }
36   -
  48 +
37 49 @Request.Get("/vodips/flash/{id}")
38   - public ResultBean flash(int id,Params params) {
39   - ResultBean rb =new ResultBean();
40   - Map map =new HashMap();
41   - map.put("\"location\"", "http://wideo01.cnlive.com/video/data1/2016/0524/124025/800/b7e34cfee140449f9e04c5e85b66aa56_124025_800.mp4");
  50 + public ResultBean flash(int id, Params params) {
  51 + String vId=params.getString("vId");
  52 + int rate=params.getInt("rate");
  53 + String url=vodIpsServer.getFlashPlayUrl(vId, rate);
  54 + ResultBean rb = new ResultBean();
  55 + Map map = new HashMap();
  56 + map.put("location",url);
42 57 rb.setData(map);
43 58 rb.setErrorCode("0");
44 59 rb.setErrorMessage("成功");
... ...
src/main/java/com/cnlive/mz/live/action/WordAction.java
1   -package com.cnlive.mz.live.action;
2   -
3   -import java.util.List;
4   -import java.util.Map;
5   -import java.util.Map.Entry;
6   -
7   -import org.smart4j.framework.ioc.annotation.Inject;
8   -import org.smart4j.framework.mvc.annotation.Action;
9   -import org.smart4j.framework.mvc.annotation.Request;
10   -import org.smart4j.framework.mvc.bean.Params;
11   -import org.smart4j.framework.mvc.bean.Result;
12   -import org.smart4j.framework.mvc.bean.View;
13   -
14   -import com.cnlive.mz.live.entity.TRoom;
15   -import com.cnlive.mz.live.service.SensitiveWordService;
16   -
17   -@Action
18   -public class WordAction {
19   -
20   - @Inject
21   - private SensitiveWordService sensitiveWord;
22   -
23   - @Request.Post("/word/add")
24   - public Result add(Params params){
25   - Map map = params.getFieldMap();
26   - String str = (String) map.get("words");
27   - str=str.replace(",", ",3.");
28   - str=str+",3.";
29   - return new Result(sensitiveWord.add(str));
30   - }
31   -
32   - @Request.Get("/word/list")
33   - public View list(){
34   - View view = new View("word/word_management.jsp");
35   - List<String> str = sensitiveWord.list();
36   - view.data("str", str);
37   - return view;
38   - }
39   -}
  1 +package com.cnlive.mz.live.action;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +import java.util.Map.Entry;
  6 +
  7 +import org.smart4j.framework.ioc.annotation.Inject;
  8 +import org.smart4j.framework.mvc.annotation.Action;
  9 +import org.smart4j.framework.mvc.annotation.Request;
  10 +import org.smart4j.framework.mvc.bean.Params;
  11 +import org.smart4j.framework.mvc.bean.Result;
  12 +import org.smart4j.framework.mvc.bean.View;
  13 +
  14 +import com.cnlive.mz.live.entity.TRoom;
  15 +import com.cnlive.mz.live.service.SensitiveWordService;
  16 +
  17 +@Action
  18 +public class WordAction {
  19 +
  20 + @Inject
  21 + private SensitiveWordService sensitiveWord;
  22 +
  23 + @Request.Post("/word/add")
  24 + public Result add(Params params){
  25 + Map map = params.getFieldMap();
  26 + String str = (String) map.get("words");
  27 + str=str.replace(",", ",3.");
  28 + str=str+",3.";
  29 + return new Result(sensitiveWord.add(str));
  30 + }
  31 +
  32 + @Request.Get("/word/list")
  33 + public View list(){
  34 + View view = new View("word/word_management.jsp");
  35 + List<String> str = sensitiveWord.list();
  36 + view.data("str", str);
  37 + return view;
  38 + }
  39 +}
... ...
src/main/java/com/cnlive/mz/live/aspect/AuthFilter.java
1   -package com.cnlive.mz.live.aspect;
2   -
3   -import java.io.IOException;
4   -
5   -import javax.servlet.Filter;
6   -import javax.servlet.FilterChain;
7   -import javax.servlet.FilterConfig;
8   -import javax.servlet.ServletException;
9   -import javax.servlet.ServletRequest;
10   -import javax.servlet.ServletResponse;
11   -import javax.servlet.annotation.WebFilter;
12   -import javax.servlet.http.HttpServletRequest;
13   -import javax.servlet.http.HttpServletResponse;
14   -import javax.servlet.http.HttpSession;
15   -
16   -import org.smart4j.framework.core.ConfigHelper;
17   -
18   -import com.cnlive.mz.live.common.LiveUtils;
19   -
20   -/*
21   - *
22   -
23   - 属性 是否必须 说明
24   - asyncSupported 否 该Filter是否支持异步操作模式
25   - dispatcherType 否 指定Filter对那种dispatcher模式进行过滤 该属性支持 Async,Error Forward,include,request
26   - displayName 否 File 显示的名称
27   - filterName 是 Filter的名称
28   - initParams 否 Filter的配置参数
29   - servletNames 否 可以指定多个,表示对这几个特定的的serlet 进行过滤
30   - urlPatterns/value 否 指定 Filter拦截的 URL
31   -
32   -
33   -
34   -
35   - @WebFilter(filterName="log",urlPatterns={"/*"})*/
36   -@WebFilter(filterName = "AuthFilter", urlPatterns = { "/activity/*", "/channel/*", "/signal/*", "/index/*",
37   - "/switch/*", "/doswitch/*", "/wowza/*" })
38   -public class AuthFilter implements Filter {
39   -
40   - private FilterConfig config;
41   -
42   - @Override
43   - public void destroy() {
44   - this.config = null;
45   - }
46   -
47   - @Override
48   - public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain chain) throws IOException,
49   - ServletException {
50   - HttpServletRequest request = (HttpServletRequest) arg0;
51   - HttpServletResponse response = (HttpServletResponse) arg1;
52   - String requestUrl = request.getRequestURI();
53   - HttpSession session = request.getSession();
54   - String webUrl = ConfigHelper.getString("website.url");
55   - String a=(String) session.getAttribute(LiveUtils.SESSION_KEY_NAME) ;
56   - if (a== null) {
57   - boolean authEnable = ConfigHelper.getBoolean("auth.enable");
58   - String loginUrl = ConfigHelper.getString("auth.login.url");
59   - if (authEnable) {
60   - //去登录认证
61   - String url=loginUrl + webUrl+"/login/success";
62   - response.sendRedirect(url);
63   - return;
64   - } else {
65   - String userName = "liujicheng";
66   - request.getSession().setAttribute(LiveUtils.SESSION_KEY_NAME, userName);
67   - request.getSession().setAttribute(LiveUtils.SESSION_KEY_ID, 1);
68   - }
69   - } else {
70   - chain.doFilter(arg0, arg1);
71   - }
72   - // 验证用户是否是退出,进行sessioin销毁
73   - if (requestUrl.contains("logout")) {
74   - String logoutUrl = ConfigHelper.getString("auth.logout.url");
75   - session.removeAttribute(LiveUtils.SESSION_KEY_NAME);
76   - session.removeAttribute(LiveUtils.SESSION_KEY_ID);
77   - session.invalidate();
78   - response.sendRedirect(logoutUrl);
79   - }
80   - }
81   -
82   - @Override
83   - public void init(FilterConfig config) throws ServletException {
84   - this.config = config;
85   - }
86   -
87   -}
  1 +package com.cnlive.mz.live.aspect;
  2 +
  3 +import java.io.IOException;
  4 +
  5 +import javax.servlet.Filter;
  6 +import javax.servlet.FilterChain;
  7 +import javax.servlet.FilterConfig;
  8 +import javax.servlet.ServletException;
  9 +import javax.servlet.ServletRequest;
  10 +import javax.servlet.ServletResponse;
  11 +import javax.servlet.annotation.WebFilter;
  12 +import javax.servlet.http.HttpServletRequest;
  13 +import javax.servlet.http.HttpServletResponse;
  14 +import javax.servlet.http.HttpSession;
  15 +
  16 +import org.smart4j.framework.core.ConfigHelper;
  17 +
  18 +import com.cnlive.mz.live.common.LiveUtils;
  19 +
  20 +/*
  21 + *
  22 +
  23 + 属性 是否必须 说明
  24 + asyncSupported 否 该Filter是否支持异步操作模式
  25 + dispatcherType 否 指定Filter对那种dispatcher模式进行过滤 该属性支持 Async,Error Forward,include,request
  26 + displayName 否 File 显示的名称
  27 + filterName 是 Filter的名称
  28 + initParams 否 Filter的配置参数
  29 + servletNames 否 可以指定多个,表示对这几个特定的的serlet 进行过滤
  30 + urlPatterns/value 否 指定 Filter拦截的 URL
  31 +
  32 +
  33 +
  34 +
  35 + @WebFilter(filterName="log",urlPatterns={"/*"})*/
  36 +@WebFilter(filterName = "AuthFilter", urlPatterns = { "/activity/*", "/channel/*", "/signal/*", "/index/*",
  37 + "/switch/*", "/doswitch/*", "/wowza/*" })
  38 +public class AuthFilter implements Filter {
  39 +
  40 + private FilterConfig config;
  41 +
  42 + @Override
  43 + public void destroy() {
  44 + this.config = null;
  45 + }
  46 +
  47 + @Override
  48 + public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain chain) throws IOException,
  49 + ServletException {
  50 + HttpServletRequest request = (HttpServletRequest) arg0;
  51 + HttpServletResponse response = (HttpServletResponse) arg1;
  52 + String requestUrl = request.getRequestURI();
  53 + HttpSession session = request.getSession();
  54 + String webUrl = ConfigHelper.getString("website.url");
  55 + String a=(String) session.getAttribute(LiveUtils.SESSION_KEY_NAME) ;
  56 + if (a== null) {
  57 + boolean authEnable = ConfigHelper.getBoolean("auth.enable");
  58 + String loginUrl = ConfigHelper.getString("auth.login.url");
  59 + if (authEnable) {
  60 + //去登录认证
  61 + String url=loginUrl + webUrl+"/login/success";
  62 + response.sendRedirect(url);
  63 + return;
  64 + } else {
  65 + String userName = "liujicheng";
  66 + request.getSession().setAttribute(LiveUtils.SESSION_KEY_NAME, userName);
  67 + request.getSession().setAttribute(LiveUtils.SESSION_KEY_ID, 1);
  68 + }
  69 + } else {
  70 + chain.doFilter(arg0, arg1);
  71 + }
  72 + // 验证用户是否是退出,进行sessioin销毁
  73 + if (requestUrl.contains("logout")) {
  74 + String logoutUrl = ConfigHelper.getString("auth.logout.url");
  75 + session.removeAttribute(LiveUtils.SESSION_KEY_NAME);
  76 + session.removeAttribute(LiveUtils.SESSION_KEY_ID);
  77 + session.invalidate();
  78 + response.sendRedirect(logoutUrl);
  79 + }
  80 + }
  81 +
  82 + @Override
  83 + public void init(FilterConfig config) throws ServletException {
  84 + this.config = config;
  85 + }
  86 +
  87 +}
... ...
src/main/java/com/cnlive/mz/live/rest/BaseUtil.java
1   -package com.cnlive.mz.live.rest;
2   -
3   -import java.io.BufferedReader;
4   -import java.io.IOException;
5   -import java.io.InputStreamReader;
6   -import java.io.PrintWriter;
7   -import java.io.UnsupportedEncodingException;
8   -import java.net.URL;
9   -import java.net.URLConnection;
10   -import java.security.MessageDigest;
11   -import java.text.DateFormat;
12   -import java.text.ParseException;
13   -import java.text.SimpleDateFormat;
14   -import java.util.Calendar;
15   -import java.util.Date;
16   -import java.util.Locale;
17   -import java.util.UUID;
18   -
19   -import javax.crypto.Mac;
20   -import javax.crypto.spec.SecretKeySpec;
21   -
22   -import org.apache.commons.codec.binary.Base64;
23   -
24   -import com.cnlive.mz.commons.net.HttpReq;
25   -
26   -import sun.misc.BASE64Encoder;
27   -
28   -public class BaseUtil {
29   -
30   - private static final String ENCODING = "UTF-8";
31   -
32   - // AccessKey、SecretKey
33   - private static final String SECRET_KEY = "UIWPYVeaV8kq2vWImDkLBvWs/pwmTJVF9MCNHDsC";
34   - private static final String ACCESS_KEY = "fWUN8KDtJZJGo0ArQ4qo";
35   -
36   - /*
37   - * 计算MD5+BASE64
38   - */
39   - public static String MD5Base64(String s) {
40   - if (s == null)
41   - return null;
42   - String encodeStr = "";
43   - byte[] utfBytes = s.getBytes();
44   - MessageDigest mdTemp;
45   - try {
46   - mdTemp = MessageDigest.getInstance("MD5");
47   - mdTemp.update(utfBytes);
48   - byte[] md5Bytes = mdTemp.digest();
49   - BASE64Encoder b64Encoder = new BASE64Encoder();
50   - encodeStr = b64Encoder.encode(md5Bytes);
51   - } catch (Exception e) {
52   - throw new Error("Failed to generate MD5 : " + e.getMessage());
53   - }
54   - return encodeStr;
55   - }
56   -
57   - /*
58   - * 哈希计算 HMAC-SHA1 base64
59   - */
60   - public static String HMACSha1(String data, String key) {
61   - String result;
62   - try {
63   - SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA1");
64   - Mac mac = Mac.getInstance("HmacSHA1");
65   - mac.init(signingKey);
66   - byte[] rawHmac = mac.doFinal(data.getBytes());
67   - // result = new String(Base64.encodeBase64(rawHmac, false), ENCODING);
68   - // result = (new BASE64Encoder()).encode(rawHmac);
69   - result = new String(Base64.encodeBase64(rawHmac), ENCODING);
70   - } catch (Exception e) {
71   - throw new Error("Failed to generate HMAC : " + e.getMessage());
72   - }
73   - return result;
74   - }
75   -
76   - /**
77   - * 获取当前前一天的时间戳
78   - *
79   - * @return
80   - */
81   - public static String getTimestamp() {
82   - DateFormat df = new SimpleDateFormat("yyyyMMdd");
83   - Date date = null;
84   - try {
85   - Calendar calendar = Calendar.getInstance();
86   - calendar.add(Calendar.DATE, +1);
87   - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
88   - String motoday = sdf.format(calendar.getTime());
89   - date = df.parse(motoday);
90   - } catch (ParseException e) {
91   - e.printStackTrace();
92   - }
93   - Calendar cal = Calendar.getInstance();
94   - cal.setTime(date);
95   - long timestamp = cal.getTimeInMillis();
96   - System.out.println("------timestamp-----" + timestamp);
97   - return String.valueOf(timestamp);
98   -
99   - }
100   -
101   - /**
102   - * 签名算法:signature 字符串格式,由三部分组成:GET+”\n”+Expire+”\n”+Resource 2016 0602171212
103   - *
104   - * @return
105   - * @throws UnsupportedEncodingException
106   - */
107   - public static String signature(String streamName) throws UnsupportedEncodingException {
108   -
109   - String method = "GET";
110   - String expire = BaseUtil.getTimestamp();
111   - String app = "live";
112   - String methodadd = "add";
113   - String name = streamName;
114   - app = java.net.URLEncoder.encode(app, "utf-8");
115   - methodadd = java.net.URLEncoder.encode(methodadd, "utf-8");
116   - name = java.net.URLEncoder.encode(name, "utf-8");
117   - System.out.println(expire + "---expire----");
118   - String Resource = "app=" + app + "&method=" + methodadd + "&name=" + name;
119   - // Resource = java.net.URLEncoder.encode(Resource, "utf-8");
120   - String stringToSign = method + "\n" + expire + "\n" + Resource;
121   - System.out.println("--stringToSign--" + stringToSign);
122   - // 2.计算 HMAC-SHA1
123   - String signature = HMACSha1(stringToSign, SECRET_KEY);
124   - System.out.println("---signature---" + signature);
125   - signature = java.net.URLEncoder.encode(signature, "utf-8");
126   - return signature;
127   - }
128   -
129   - public static String signature(String methodName, String streamName) throws UnsupportedEncodingException {
130   -
131   - String method = "GET";
132   - String expire = BaseUtil.getTimestamp();
133   - String app = "live";
134   - app = java.net.URLEncoder.encode(app, "utf-8");
135   - methodName = java.net.URLEncoder.encode(methodName, "utf-8");
136   - streamName = java.net.URLEncoder.encode(streamName, "utf-8");
137   - System.out.println(expire + "---expire----");
138   - String Resource = "app=" + app + "&method=" + methodName + "&name=" + streamName;
139   - // Resource = java.net.URLEncoder.encode(Resource, "utf-8");
140   - String stringToSign = method + "\n" + expire + "\n" + Resource;
141   - System.out.println("--stringToSign--" + stringToSign);
142   - // 2.计算 HMAC-SHA1
143   - String signature = HMACSha1(stringToSign, SECRET_KEY);
144   - System.out.println("---signature---" + signature);
145   - signature = java.net.URLEncoder.encode(signature, "utf-8");
146   - return signature;
147   - }
148   -
149   - public static String UUid() {
150   -
151   - String uuid = UUID.randomUUID().toString();
152   - uuid = uuid.replaceAll("-", "");
153   - return uuid;
154   - }
155   -
156   - public static String getAccessKey() {
157   - return ACCESS_KEY;
158   - }
159   -
160   - public static int random_7(int number) {
161   - int x = (int) (Math.random() * 10);
162   - for (int i = 0; i < number; i++) {
163   - String num = Math.random() * 10 + "";
164   - }
165   - return x;
166   - }
167   -
168   - /*
169   - * 等同于javaScript中的 new Date().toUTCString();
170   - */
171   - public static String toGMTString(Date date) {
172   - SimpleDateFormat df = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z", Locale.UK);
173   - df.setTimeZone(new java.util.SimpleTimeZone(0, "GMT"));
174   - return df.format(date);
175   - }
176   -
177   - /*
178   - * 发送POST请求
179   - */
180   - public static String sendPost(String url, String body, String ak_id, String ak_secret) {
181   - PrintWriter out = null;
182   - BufferedReader in = null;
183   - String result = "";
184   - try {
185   - URL realUrl = new URL(url);
186   -
187   - /*
188   - * http header 参数
189   - */
190   - String method = "POST";
191   - String accept = "json";
192   - String content_type = "application/json";
193   - String path = realUrl.getFile();
194   - String date = toGMTString(new Date());
195   -
196   - // 1.对body做MD5+BASE64加密
197   - String bodyMd5 = MD5Base64(body);
198   - String stringToSign = method + "\n" + accept + "\n" + bodyMd5 + "\n" + content_type + "\n" + date + "\n"
199   - + path;
200   - // 2.计算 HMAC-SHA1
201   - String signature = HMACSha1(stringToSign, ak_secret);
202   - // 3.得到 authorization header
203   - String authHeader = "Dataplus " + ak_id + ":" + signature;
204   -
205   - // 打开和URL之间的连接
206   - URLConnection conn = realUrl.openConnection();
207   - // 设置通用的请求属性
208   - conn.setRequestProperty("accept", accept);
209   - conn.setRequestProperty("content-type", content_type);
210   - conn.setRequestProperty("date", date);
211   - conn.setRequestProperty("Authorization", authHeader);
212   - // 发送POST请求必须设置如下两行
213   - conn.setDoOutput(true);
214   - conn.setDoInput(true);
215   - // 获取URLConnection对象对应的输出流
216   - out = new PrintWriter(conn.getOutputStream());
217   - // 发送请求参数
218   - out.print(body);
219   - // flush输出流的缓冲
220   - out.flush();
221   - // 定义BufferedReader输入流来读取URL的响应
222   - in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
223   - String line;
224   - while ((line = in.readLine()) != null) {
225   - result += line;
226   - }
227   - } catch (Exception e) {
228   - System.out.println("发送 POST 请求出现异常!" + e);
229   - e.printStackTrace();
230   - }
231   - // 使用finally块来关闭输出流、输入流
232   - finally {
233   - try {
234   - if (out != null) {
235   - out.close();
236   - }
237   - if (in != null) {
238   - in.close();
239   - }
240   - } catch (IOException ex) {
241   - ex.printStackTrace();
242   - }
243   - }
244   - return result;
245   - }
246   -
247   - /*
248   - * GET请求
249   - */
250   -
251   - public static String sendGet(String url, String ak_id, String ak_secret) {
252   - String result = "";
253   - BufferedReader in = null;
254   - try {
255   - URL realUrl = new URL(url);
256   - /*
257   - * http header 参数
258   - */
259   - // String method = "GET";
260   - // String Expire = "1436976000";
261   - // String Resource =
262   - // "nonce=4e1f2519c626cbfbab1520c255830c26&public=0&vdoid=12345";
263   - // String content_type = "application/json";
264   - // String path = realUrl.getFile();
265   - // String date = toGMTString(new Date());
266   - // // 1.对body做MD5+BASE64加密
267   - // // String bodyMd5 = MD5Base64(body);
268   - // String stringToSign = method + "\n" + Expire + "\n" + Resource;
269   - // // 2.计算 HMAC-SHA1
270   - // String signature = HMACSha1(stringToSign, ak_secret);
271   - // // 3.得到 authorization header
272   - // String authHeader = "Dataplus " + ak_id + ":" + signature;
273   - // 打开和URL之间的连接
274   - URLConnection connection = realUrl.openConnection();
275   - // 设置通用的请求属性
276   - // connection.setRequestProperty("accept", "json");
277   - // connection.setRequestProperty("content-type", content_type);
278   - // connection.setRequestProperty("date", date);
279   - // connection.setRequestProperty("Authorization", authHeader);
280   - // 建立实际的连接
281   - connection.connect();
282   - // 定义 BufferedReader输入流来读取URL的响应
283   - in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
284   - String line;
285   - while ((line = in.readLine()) != null) {
286   - result += line;
287   - }
288   - } catch (Exception e) {
289   - System.out.println("发送GET请求出现异常!" + e);
290   - e.printStackTrace();
291   - }
292   - // 使用finally块来关闭输入流
293   - finally {
294   - try {
295   - if (in != null) {
296   - in.close();
297   - }
298   - } catch (Exception e) {
299   - e.printStackTrace();
300   - }
301   - }
302   - return result;
303   - }
304   -
305   - public static void main(String[] args) throws Exception {
306   - // 发送POST请求示例
307   - /*
308   - * String ak_id = "fWUN8KDtJZJGo0ArQ4qo"; // 用户ak String ak_secret =
309   - * "UIWPYVeaV8kq2vWImDkLBvWs/pwmTJVF9MCNHDsC"; // 用户ak_secret String url
310   - * = "https://kmr-cn-beijing.ksyun.com"; String body =
311   - * "{\"param1\": \"GET\n1436976000\nnonce=4e1f2519c626cbfbab1520c255830c26&public=0&vdoid=12345\", \"param2\":\"fWUN8KDtJZJGo0ArQ4qo\"}"
312   - * ; System.out.println("response body:" + sendPost(url, body, AK_ID,
313   - * AK_SECRET));
314   - */
315   -
316   - Date date = new Date();
317   - System.out.println(toGMTString(date));
318   - String hh = HMACSha1("GET\n1436976124\nnonce=4e1f2519c626cbfbab1520c255830c26&public=1&vdoid=1",
319   - "fWUN8KDtJZJGo0ArQ4qo");
320   - String hhhh = MD5Base64(hh);
321   - System.out.println(hh);
322   - System.out.println("..............");
323   -
324   - // String str = signature();
325   - // System.out.println(str);//L2muBoImPzyvwyzfBtGXEu+wRNE=
326   -
327   - // 发送GET请求
328   - String url1 = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=iDPKaesXXW3A26CScNyjpNkzxZs%3D&accesskey=I3TC8a4xboPUMe5xlp22&expire=1483200000&app=live&method=add&stream=310166_863";
329   - System.out.println("response body:" + sendGet(url1, ACCESS_KEY, SECRET_KEY));
330   -
331   - // long d = getTimestamp();
332   - // System.out.println(d);
333   -
334   - // String str = signature();
335   - // System.out.println(str);//L2muBoImPzyvwyzfBtGXEu+wRNE=
336   - /*
337   - * // 发送GET请求 String ak_id1 = "fWUN8KDtJZJGo0ArQ4qo"; //用户ak String
338   - * ak_secret1 = "UIWPYVeaV8kq2vWImDkLBvWs/pwmTJVF9MCNHDsC"; //
339   - * 用户ak_secret String url1 =
340   - * "http://cnlive.uplive.ks-cdn.com?signature=L2muBoImPzyvwyzfBtGXEu+wRNE=&accesskey=fWUN8KDtJZJGo0ArQ4qo&expire=1436976000&method=add&app=live&name=498122_57";
341   - * System.out.println("response body:" +sendGet(url1, ak_id1,
342   - * ak_secret1));
343   - */
344   - // long d = getTimestamp();
345   - // System.out.println(d);
346   -
347   - }
348   -}
  1 +package com.cnlive.mz.live.rest;
  2 +
  3 +import java.io.BufferedReader;
  4 +import java.io.IOException;
  5 +import java.io.InputStreamReader;
  6 +import java.io.PrintWriter;
  7 +import java.io.UnsupportedEncodingException;
  8 +import java.net.URL;
  9 +import java.net.URLConnection;
  10 +import java.security.MessageDigest;
  11 +import java.text.DateFormat;
  12 +import java.text.ParseException;
  13 +import java.text.SimpleDateFormat;
  14 +import java.util.Calendar;
  15 +import java.util.Date;
  16 +import java.util.Locale;
  17 +import java.util.UUID;
  18 +
  19 +import javax.crypto.Mac;
  20 +import javax.crypto.spec.SecretKeySpec;
  21 +
  22 +import org.apache.commons.codec.binary.Base64;
  23 +
  24 +import com.cnlive.mz.commons.net.HttpReq;
  25 +
  26 +import sun.misc.BASE64Encoder;
  27 +
  28 +public class BaseUtil {
  29 +
  30 + private static final String ENCODING = "UTF-8";
  31 +
  32 + // AccessKey、SecretKey
  33 + private static final String SECRET_KEY = "UIWPYVeaV8kq2vWImDkLBvWs/pwmTJVF9MCNHDsC";
  34 + private static final String ACCESS_KEY = "fWUN8KDtJZJGo0ArQ4qo";
  35 +
  36 + /*
  37 + * 计算MD5+BASE64
  38 + */
  39 + public static String MD5Base64(String s) {
  40 + if (s == null)
  41 + return null;
  42 + String encodeStr = "";
  43 + byte[] utfBytes = s.getBytes();
  44 + MessageDigest mdTemp;
  45 + try {
  46 + mdTemp = MessageDigest.getInstance("MD5");
  47 + mdTemp.update(utfBytes);
  48 + byte[] md5Bytes = mdTemp.digest();
  49 + BASE64Encoder b64Encoder = new BASE64Encoder();
  50 + encodeStr = b64Encoder.encode(md5Bytes);
  51 + } catch (Exception e) {
  52 + throw new Error("Failed to generate MD5 : " + e.getMessage());
  53 + }
  54 + return encodeStr;
  55 + }
  56 +
  57 + /*
  58 + * 哈希计算 HMAC-SHA1 base64
  59 + */
  60 + public static String HMACSha1(String data, String key) {
  61 + String result;
  62 + try {
  63 + SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA1");
  64 + Mac mac = Mac.getInstance("HmacSHA1");
  65 + mac.init(signingKey);
  66 + byte[] rawHmac = mac.doFinal(data.getBytes());
  67 + // result = new String(Base64.encodeBase64(rawHmac, false), ENCODING);
  68 + // result = (new BASE64Encoder()).encode(rawHmac);
  69 + result = new String(Base64.encodeBase64(rawHmac), ENCODING);
  70 + } catch (Exception e) {
  71 + throw new Error("Failed to generate HMAC : " + e.getMessage());
  72 + }
  73 + return result;
  74 + }
  75 +
  76 + /**
  77 + * 获取当前前一天的时间戳
  78 + *
  79 + * @return
  80 + */
  81 + public static String getTimestamp() {
  82 + DateFormat df = new SimpleDateFormat("yyyyMMdd");
  83 + Date date = null;
  84 + try {
  85 + Calendar calendar = Calendar.getInstance();
  86 + calendar.add(Calendar.DATE, +1);
  87 + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
  88 + String motoday = sdf.format(calendar.getTime());
  89 + date = df.parse(motoday);
  90 + } catch (ParseException e) {
  91 + e.printStackTrace();
  92 + }
  93 + Calendar cal = Calendar.getInstance();
  94 + cal.setTime(date);
  95 + long timestamp = cal.getTimeInMillis();
  96 + System.out.println("------timestamp-----" + timestamp);
  97 + return String.valueOf(timestamp);
  98 +
  99 + }
  100 +
  101 + /**
  102 + * 签名算法:signature 字符串格式,由三部分组成:GET+”\n”+Expire+”\n”+Resource 2016 0602171212
  103 + *
  104 + * @return
  105 + * @throws UnsupportedEncodingException
  106 + */
  107 + public static String signature(String streamName) throws UnsupportedEncodingException {
  108 +
  109 + String method = "GET";
  110 + String expire = BaseUtil.getTimestamp();
  111 + String app = "live";
  112 + String methodadd = "add";
  113 + String name = streamName;
  114 + app = java.net.URLEncoder.encode(app, "utf-8");
  115 + methodadd = java.net.URLEncoder.encode(methodadd, "utf-8");
  116 + name = java.net.URLEncoder.encode(name, "utf-8");
  117 + System.out.println(expire + "---expire----");
  118 + String Resource = "app=" + app + "&method=" + methodadd + "&name=" + name;
  119 + // Resource = java.net.URLEncoder.encode(Resource, "utf-8");
  120 + String stringToSign = method + "\n" + expire + "\n" + Resource;
  121 + System.out.println("--stringToSign--" + stringToSign);
  122 + // 2.计算 HMAC-SHA1
  123 + String signature = HMACSha1(stringToSign, SECRET_KEY);
  124 + System.out.println("---signature---" + signature);
  125 + signature = java.net.URLEncoder.encode(signature, "utf-8");
  126 + return signature;
  127 + }
  128 +
  129 + public static String signature(String methodName, String streamName) throws UnsupportedEncodingException {
  130 +
  131 + String method = "GET";
  132 + String expire = BaseUtil.getTimestamp();
  133 + String app = "live";
  134 + app = java.net.URLEncoder.encode(app, "utf-8");
  135 + methodName = java.net.URLEncoder.encode(methodName, "utf-8");
  136 + streamName = java.net.URLEncoder.encode(streamName, "utf-8");
  137 + System.out.println(expire + "---expire----");
  138 + String Resource = "app=" + app + "&method=" + methodName + "&name=" + streamName;
  139 + // Resource = java.net.URLEncoder.encode(Resource, "utf-8");
  140 + String stringToSign = method + "\n" + expire + "\n" + Resource;
  141 + System.out.println("--stringToSign--" + stringToSign);
  142 + // 2.计算 HMAC-SHA1
  143 + String signature = HMACSha1(stringToSign, SECRET_KEY);
  144 + System.out.println("---signature---" + signature);
  145 + signature = java.net.URLEncoder.encode(signature, "utf-8");
  146 + return signature;
  147 + }
  148 +
  149 + public static String UUid() {
  150 +
  151 + String uuid = UUID.randomUUID().toString();
  152 + uuid = uuid.replaceAll("-", "");
  153 + return uuid;
  154 + }
  155 +
  156 + public static String getAccessKey() {
  157 + return ACCESS_KEY;
  158 + }
  159 +
  160 + public static int random_7(int number) {
  161 + int x = (int) (Math.random() * 10);
  162 + for (int i = 0; i < number; i++) {
  163 + String num = Math.random() * 10 + "";
  164 + }
  165 + return x;
  166 + }
  167 +
  168 + /*
  169 + * 等同于javaScript中的 new Date().toUTCString();
  170 + */
  171 + public static String toGMTString(Date date) {
  172 + SimpleDateFormat df = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z", Locale.UK);
  173 + df.setTimeZone(new java.util.SimpleTimeZone(0, "GMT"));
  174 + return df.format(date);
  175 + }
  176 +
  177 + /*
  178 + * 发送POST请求
  179 + */
  180 + public static String sendPost(String url, String body, String ak_id, String ak_secret) {
  181 + PrintWriter out = null;
  182 + BufferedReader in = null;
  183 + String result = "";
  184 + try {
  185 + URL realUrl = new URL(url);
  186 +
  187 + /*
  188 + * http header 参数
  189 + */
  190 + String method = "POST";
  191 + String accept = "json";
  192 + String content_type = "application/json";
  193 + String path = realUrl.getFile();
  194 + String date = toGMTString(new Date());
  195 +
  196 + // 1.对body做MD5+BASE64加密
  197 + String bodyMd5 = MD5Base64(body);
  198 + String stringToSign = method + "\n" + accept + "\n" + bodyMd5 + "\n" + content_type + "\n" + date + "\n"
  199 + + path;
  200 + // 2.计算 HMAC-SHA1
  201 + String signature = HMACSha1(stringToSign, ak_secret);
  202 + // 3.得到 authorization header
  203 + String authHeader = "Dataplus " + ak_id + ":" + signature;
  204 +
  205 + // 打开和URL之间的连接
  206 + URLConnection conn = realUrl.openConnection();
  207 + // 设置通用的请求属性
  208 + conn.setRequestProperty("accept", accept);
  209 + conn.setRequestProperty("content-type", content_type);
  210 + conn.setRequestProperty("date", date);
  211 + conn.setRequestProperty("Authorization", authHeader);
  212 + // 发送POST请求必须设置如下两行
  213 + conn.setDoOutput(true);
  214 + conn.setDoInput(true);
  215 + // 获取URLConnection对象对应的输出流
  216 + out = new PrintWriter(conn.getOutputStream());
  217 + // 发送请求参数
  218 + out.print(body);
  219 + // flush输出流的缓冲
  220 + out.flush();
  221 + // 定义BufferedReader输入流来读取URL的响应
  222 + in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
  223 + String line;
  224 + while ((line = in.readLine()) != null) {
  225 + result += line;
  226 + }
  227 + } catch (Exception e) {
  228 + System.out.println("发送 POST 请求出现异常!" + e);
  229 + e.printStackTrace();
  230 + }
  231 + // 使用finally块来关闭输出流、输入流
  232 + finally {
  233 + try {
  234 + if (out != null) {
  235 + out.close();
  236 + }
  237 + if (in != null) {
  238 + in.close();
  239 + }
  240 + } catch (IOException ex) {
  241 + ex.printStackTrace();
  242 + }
  243 + }
  244 + return result;
  245 + }
  246 +
  247 + /*
  248 + * GET请求
  249 + */
  250 +
  251 + public static String sendGet(String url, String ak_id, String ak_secret) {
  252 + String result = "";
  253 + BufferedReader in = null;
  254 + try {
  255 + URL realUrl = new URL(url);
  256 + /*
  257 + * http header 参数
  258 + */
  259 + // String method = "GET";
  260 + // String Expire = "1436976000";
  261 + // String Resource =
  262 + // "nonce=4e1f2519c626cbfbab1520c255830c26&public=0&vdoid=12345";
  263 + // String content_type = "application/json";
  264 + // String path = realUrl.getFile();
  265 + // String date = toGMTString(new Date());
  266 + // // 1.对body做MD5+BASE64加密
  267 + // // String bodyMd5 = MD5Base64(body);
  268 + // String stringToSign = method + "\n" + Expire + "\n" + Resource;
  269 + // // 2.计算 HMAC-SHA1
  270 + // String signature = HMACSha1(stringToSign, ak_secret);
  271 + // // 3.得到 authorization header
  272 + // String authHeader = "Dataplus " + ak_id + ":" + signature;
  273 + // 打开和URL之间的连接
  274 + URLConnection connection = realUrl.openConnection();
  275 + // 设置通用的请求属性
  276 + // connection.setRequestProperty("accept", "json");
  277 + // connection.setRequestProperty("content-type", content_type);
  278 + // connection.setRequestProperty("date", date);
  279 + // connection.setRequestProperty("Authorization", authHeader);
  280 + // 建立实际的连接
  281 + connection.connect();
  282 + // 定义 BufferedReader输入流来读取URL的响应
  283 + in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  284 + String line;
  285 + while ((line = in.readLine()) != null) {
  286 + result += line;
  287 + }
  288 + } catch (Exception e) {
  289 + System.out.println("发送GET请求出现异常!" + e);
  290 + e.printStackTrace();
  291 + }
  292 + // 使用finally块来关闭输入流
  293 + finally {
  294 + try {
  295 + if (in != null) {
  296 + in.close();
  297 + }
  298 + } catch (Exception e) {
  299 + e.printStackTrace();
  300 + }
  301 + }
  302 + return result;
  303 + }
  304 +
  305 + public static void main(String[] args) throws Exception {
  306 + // 发送POST请求示例
  307 + /*
  308 + * String ak_id = "fWUN8KDtJZJGo0ArQ4qo"; // 用户ak String ak_secret =
  309 + * "UIWPYVeaV8kq2vWImDkLBvWs/pwmTJVF9MCNHDsC"; // 用户ak_secret String url
  310 + * = "https://kmr-cn-beijing.ksyun.com"; String body =
  311 + * "{\"param1\": \"GET\n1436976000\nnonce=4e1f2519c626cbfbab1520c255830c26&public=0&vdoid=12345\", \"param2\":\"fWUN8KDtJZJGo0ArQ4qo\"}"
  312 + * ; System.out.println("response body:" + sendPost(url, body, AK_ID,
  313 + * AK_SECRET));
  314 + */
  315 +
  316 + Date date = new Date();
  317 + System.out.println(toGMTString(date));
  318 + String hh = HMACSha1("GET\n1436976124\nnonce=4e1f2519c626cbfbab1520c255830c26&public=1&vdoid=1",
  319 + "fWUN8KDtJZJGo0ArQ4qo");
  320 + String hhhh = MD5Base64(hh);
  321 + System.out.println(hh);
  322 + System.out.println("..............");
  323 +
  324 + // String str = signature();
  325 + // System.out.println(str);//L2muBoImPzyvwyzfBtGXEu+wRNE=
  326 +
  327 + // 发送GET请求
  328 + String url1 = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=iDPKaesXXW3A26CScNyjpNkzxZs%3D&accesskey=I3TC8a4xboPUMe5xlp22&expire=1483200000&app=live&method=add&stream=310166_863";
  329 + System.out.println("response body:" + sendGet(url1, ACCESS_KEY, SECRET_KEY));
  330 +
  331 + // long d = getTimestamp();
  332 + // System.out.println(d);
  333 +
  334 + // String str = signature();
  335 + // System.out.println(str);//L2muBoImPzyvwyzfBtGXEu+wRNE=
  336 + /*
  337 + * // 发送GET请求 String ak_id1 = "fWUN8KDtJZJGo0ArQ4qo"; //用户ak String
  338 + * ak_secret1 = "UIWPYVeaV8kq2vWImDkLBvWs/pwmTJVF9MCNHDsC"; //
  339 + * 用户ak_secret String url1 =
  340 + * "http://cnlive.uplive.ks-cdn.com?signature=L2muBoImPzyvwyzfBtGXEu+wRNE=&accesskey=fWUN8KDtJZJGo0ArQ4qo&expire=1436976000&method=add&app=live&name=498122_57";
  341 + * System.out.println("response body:" +sendGet(url1, ak_id1,
  342 + * ak_secret1));
  343 + */
  344 + // long d = getTimestamp();
  345 + // System.out.println(d);
  346 +
  347 + }
  348 +}
... ...
src/main/java/com/cnlive/mz/live/servlet/InitServlet.java 0 → 100644
  1 +package com.cnlive.mz.live.servlet;
  2 +
  3 +import java.io.IOException;
  4 +
  5 +import javax.servlet.Servlet;
  6 +import javax.servlet.ServletConfig;
  7 +import javax.servlet.ServletException;
  8 +import javax.servlet.annotation.WebServlet;
  9 +import javax.servlet.http.HttpServlet;
  10 +import javax.servlet.http.HttpServletRequest;
  11 +import javax.servlet.http.HttpServletResponse;
  12 +
  13 +import com.cnlive.socket.SocketServer;
  14 +
  15 +/**
  16 + * Servlet implementation class InitServlet
  17 + */
  18 +@WebServlet(name = "initServlet", urlPatterns = { "/initServlet" })
  19 +public class InitServlet extends HttpServlet {
  20 + private static final long serialVersionUID = 1L;
  21 +
  22 + /**
  23 + * @see HttpServlet#HttpServlet()
  24 + */
  25 + public InitServlet() {
  26 + super();
  27 + // TODO Auto-generated constructor stub
  28 + }
  29 +
  30 + /**
  31 + * @see Servlet#init(ServletConfig)
  32 + */
  33 + public void init(ServletConfig config) throws ServletException {
  34 + System.out.println("kaishi.......init");
  35 + int port = 65432;
  36 + SocketServer server = new SocketServer(port);
  37 + server.start();
  38 + }
  39 +
  40 + /**
  41 + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
  42 + */
  43 + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  44 + // TODO Auto-generated method stub
  45 + response.getWriter().append("Served at: ").append(request.getContextPath());
  46 + }
  47 +
  48 + /**
  49 + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
  50 + */
  51 + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  52 + // TODO Auto-generated method stub
  53 + doGet(request, response);
  54 + }
  55 +
  56 +}
... ...
src/main/java/com/cnlive/socket/SocketServer.java 0 → 100644
  1 +package com.cnlive.socket;
  2 +
  3 +import java.io.BufferedReader;
  4 +import java.io.IOException;
  5 +import java.io.InputStream;
  6 +import java.io.InputStreamReader;
  7 +import java.io.ObjectInputStream;
  8 +import java.io.ObjectOutputStream;
  9 +import java.io.OutputStream;
  10 +import java.net.ServerSocket;
  11 +import java.net.Socket;
  12 +import java.util.concurrent.ConcurrentHashMap;
  13 +
  14 +public class SocketServer {
  15 +
  16 + /**
  17 + * 要处理客户端发来的对象,并返回一个对象,可实现该接口。
  18 + */
  19 + public interface ObjectAction{
  20 + Object doAction(Object rev);
  21 + }
  22 +
  23 + /*public static final class DefaultObjectAction implements ObjectAction{
  24 + public Object doAction(Object rev) {
  25 + System.out.println("处理并返回:"+rev);
  26 + return rev;
  27 + }
  28 + } */
  29 +
  30 + public static void main(String[] args) {
  31 + int port = 65432;
  32 + SocketServer server = new SocketServer(port);
  33 + server.start();
  34 + }
  35 +
  36 + private int port;
  37 + private volatile boolean running=false;
  38 + private long receiveTimeDelay=7000;
  39 + private ConcurrentHashMap<Class, ObjectAction> actionMapping = new ConcurrentHashMap<Class,ObjectAction>();
  40 + private Thread connWatchDog;
  41 +
  42 + public SocketServer(int port) {
  43 + this.port = port;
  44 + }
  45 +
  46 + public void start(){
  47 + if(running)return;
  48 + running=true;
  49 + connWatchDog = new Thread(new ConnWatchDog());
  50 + connWatchDog.start();
  51 + }
  52 +
  53 + @SuppressWarnings("deprecation")
  54 + public void stop(){
  55 + if(running)running=false;
  56 + if(connWatchDog!=null)connWatchDog.stop();
  57 + }
  58 +
  59 + public void addActionMap(Class<Object> cls,ObjectAction action){
  60 + actionMapping.put(cls, action);
  61 + }
  62 +
  63 + class ConnWatchDog implements Runnable{
  64 + public void run(){
  65 + try {
  66 + ServerSocket ss = new ServerSocket(port,5);
  67 + while(running){
  68 + System.out.println("等待客服端。。。");
  69 + Socket s = ss.accept();
  70 + new Thread(new SocketAction(s)).start();
  71 + }
  72 + } catch (IOException e) {
  73 + e.printStackTrace();
  74 + SocketServer.this.stop();
  75 + }
  76 +
  77 + }
  78 + }
  79 +
  80 + class SocketAction implements Runnable{
  81 + Socket s;
  82 + boolean run=true;
  83 + long lastReceiveTime = System.currentTimeMillis();
  84 + public SocketAction(Socket s) {
  85 + this.s = s;
  86 + }
  87 + public void run() {
  88 + while(running && run){
  89 + try {
  90 + Thread.sleep(3000);
  91 + } catch (InterruptedException e1) {
  92 + // TODO Auto-generated catch block
  93 + e1.printStackTrace();
  94 + }
  95 + try {
  96 + InputStream in = s.getInputStream();
  97 + OutputStream out = s.getOutputStream();
  98 + byte[] recData = null;
  99 + while(true) {
  100 + recData = new byte[1024];
  101 + int r = in.read(recData);
  102 + if(r>-1) {
  103 + String data = new String(recData);
  104 + /* if(data.trim().equals("over")) {
  105 + s.close();
  106 + break;
  107 + }*/
  108 + System.out.println("读取到客户端发送的来数据:"+data);
  109 + }
  110 + }
  111 + /* if(in.available()>0){
  112 + BufferedReader br = new BufferedReader(new InputStreamReader(in));
  113 + //out = new PrintWriter(socket.getOutputStream(), true);
  114 + String line = br.readLine();
  115 + System.out.println("you input is : " + line);
  116 + //out.println("you input is :" + line);
  117 + //out.close();
  118 + // in.close();
  119 + }*/
  120 + /*ObjectInputStream ois = new ObjectInputStream(in);
  121 + Object obj = ois.readObject();
  122 + lastReceiveTime = System.currentTimeMillis();
  123 + System.out.println("接收:\t"+obj);
  124 + ObjectAction oa = actionMapping.get(obj.getClass());
  125 + oa = oa==null?new DefaultObjectAction():oa;
  126 + Object out = oa.doAction(obj);
  127 + if(out!=null){
  128 + ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream());
  129 + oos.writeObject(out);
  130 + oos.flush();
  131 + } */
  132 + } catch (Exception e) {
  133 + System.out.println(System.currentTimeMillis()-lastReceiveTime);
  134 + e.printStackTrace();
  135 + overThis();
  136 + }
  137 + }
  138 + }
  139 +
  140 + private void overThis() {
  141 + if(run)run=false;
  142 + if(s!=null){
  143 + try {
  144 + s.close();
  145 + } catch (IOException e) {
  146 + e.printStackTrace();
  147 + }
  148 + }
  149 + System.out.println("关闭:"+s.getRemoteSocketAddress());
  150 + }
  151 +
  152 + }
  153 +}
... ...
src/main/resources/log4j.properties
1   -log4j.rootLogger=INFO,console,file,action,content,video,httpreq
2   -#Console
3   -log4j.appender.console.Target=System.out
4   -log4j.appender.console=org.apache.log4j.ConsoleAppender
5   -log4j.appender.console.layout=org.apache.log4j.PatternLayout
6   -log4j.appender.console.layout.ConversionPattern=%m%n
7   -
8   -
9   -log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
10   -log4j.appender.file.File=${catalina.home}/logs/cnlive_live_web/log
11   -log4j.appender.file.DatePattern='_'yyyyMMdd
12   -log4j.appender.file.encoding=UTF-8
13   -log4j.appender.file.layout=org.apache.log4j.PatternLayout
14   -log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %c (%L) - %m%n
15   -
16   -#log4j.logger.org.apache=ERROR
17   -log4j.logger.org.smart4j=DEBUG
18   -
19   -
20   -#action
21   -
22   -log4j.appender.action=org.apache.log4j.DailyRollingFileAppender
23   -log4j.appender.action.File=${catalina.home}/logs/action.log
24   -log4j.appender.action.layout=org.apache.log4j.PatternLayout
25   -log4j.appender.action.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n
26   -log4j.appender.action.DatePattern='.'yyyy-MM-dd
27   -log4j.appender.action.Encoding=UTF-8
28   -
29   -#content
30   -log4j.appender.content=org.apache.log4j.DailyRollingFileAppender
31   -log4j.appender.content.File=${catalina.home}/logs/content.log
32   -log4j.appender.content.layout=org.apache.log4j.PatternLayout
33   -log4j.appender.content.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n
34   -log4j.appender.content.DatePattern='.'yyyy-MM-dd
35   -log4j.appender.content.Encoding=UTF-8
36   -
37   -
38   -
39   -#video
40   -log4j.appender.video=org.apache.log4j.DailyRollingFileAppender
41   -log4j.appender.video.File=${catalina.home}/logs/video.log
42   -log4j.appender.video.layout=org.apache.log4j.PatternLayout
43   -log4j.appender.video.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n
44   -log4j.appender.video.DatePattern='.'yyyy-MM-dd
45   -log4j.appender.video.Encoding=UTF-8
46   -
47   -
48   -
49   -#httpreq
50   -log4j.appender.httpreq=org.apache.log4j.DailyRollingFileAppender
51   -log4j.appender.httpreq.File=${catalina.home}/logs/httpreq.log
52   -log4j.appender.httpreq.layout=org.apache.log4j.PatternLayout
53   -log4j.appender.httpreq.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n
54   -log4j.appender.httpreq.DatePattern='.'yyyy-MM-dd
55   -log4j.appender.httpreq.Encoding=UTF-8
56   -
57   -
58   -#log4j.logger.com.ksyun.ks3=DEBUG,stdout
59   -#log4j.logger.org.apache.http=DEBUG,stdout
60   -#log4j.logger.org.apache.http.wire=ERROR,stdout
61   -
62   -#log4j.addivity.org.apache=true
63   -#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
64   -#log4j.appender.stdout.Target=System.out
65   -#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
  1 +log4j.rootLogger=INFO,console,file,action,content,video,httpreq
  2 +#Console
  3 +log4j.appender.console.Target=System.out
  4 +log4j.appender.console=org.apache.log4j.ConsoleAppender
  5 +log4j.appender.console.layout=org.apache.log4j.PatternLayout
  6 +log4j.appender.console.layout.ConversionPattern=%m%n
  7 +
  8 +
  9 +log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
  10 +log4j.appender.file.File=${catalina.home}/logs/cnlive_live_web/log
  11 +log4j.appender.file.DatePattern='_'yyyyMMdd
  12 +log4j.appender.file.encoding=UTF-8
  13 +log4j.appender.file.layout=org.apache.log4j.PatternLayout
  14 +log4j.appender.file.layout.ConversionPattern=%d{HH:mm:ss,SSS} %p %c (%L) - %m%n
  15 +
  16 +#log4j.logger.org.apache=ERROR
  17 +log4j.logger.org.smart4j=DEBUG
  18 +
  19 +
  20 +#action
  21 +
  22 +log4j.appender.action=org.apache.log4j.DailyRollingFileAppender
  23 +log4j.appender.action.File=${catalina.home}/logs/action.log
  24 +log4j.appender.action.layout=org.apache.log4j.PatternLayout
  25 +log4j.appender.action.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n
  26 +log4j.appender.action.DatePattern='.'yyyy-MM-dd
  27 +log4j.appender.action.Encoding=UTF-8
  28 +
  29 +#content
  30 +log4j.appender.content=org.apache.log4j.DailyRollingFileAppender
  31 +log4j.appender.content.File=${catalina.home}/logs/content.log
  32 +log4j.appender.content.layout=org.apache.log4j.PatternLayout
  33 +log4j.appender.content.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n
  34 +log4j.appender.content.DatePattern='.'yyyy-MM-dd
  35 +log4j.appender.content.Encoding=UTF-8
  36 +
  37 +
  38 +
  39 +#video
  40 +log4j.appender.video=org.apache.log4j.DailyRollingFileAppender
  41 +log4j.appender.video.File=${catalina.home}/logs/video.log
  42 +log4j.appender.video.layout=org.apache.log4j.PatternLayout
  43 +log4j.appender.video.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n
  44 +log4j.appender.video.DatePattern='.'yyyy-MM-dd
  45 +log4j.appender.video.Encoding=UTF-8
  46 +
  47 +
  48 +
  49 +#httpreq
  50 +log4j.appender.httpreq=org.apache.log4j.DailyRollingFileAppender
  51 +log4j.appender.httpreq.File=${catalina.home}/logs/httpreq.log
  52 +log4j.appender.httpreq.layout=org.apache.log4j.PatternLayout
  53 +log4j.appender.httpreq.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %5p [%t] %C{1} - %m%n
  54 +log4j.appender.httpreq.DatePattern='.'yyyy-MM-dd
  55 +log4j.appender.httpreq.Encoding=UTF-8
  56 +
  57 +
  58 +#log4j.logger.com.ksyun.ks3=DEBUG,stdout
  59 +#log4j.logger.org.apache.http=DEBUG,stdout
  60 +#log4j.logger.org.apache.http.wire=ERROR,stdout
  61 +
  62 +#log4j.addivity.org.apache=true
  63 +#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
  64 +#log4j.appender.stdout.Target=System.out
  65 +#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
66 66 #log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%t]%C{1}.%M(%L) - %m%n
67 67 \ No newline at end of file
... ...
src/main/resources/smart.properties
1   -smart.framework.app.base_package=com.cnlive.mz.live
2   -smart.framework.app.home_page=/index
3   -smart.framework.app.www_path=/static/
4   -smart.framework.app.jsp_path=/pages/
5   -smart.framework.custom.ds_factory=org.smart4j.plugin.dbcp.DbcpDataSourceFactory
6   -
7   -
8   -smart.framework.jdbc.type=mysql
9   -smart.framework.jdbc.driver=com.mysql.jdbc.Driver
10   -#smart.framework.jdbc.url=jdbc:mysql://124.193.218.90:3306/cnlive_live?autoReconnect=true&failOverReadOnly=false
11   -#smart.framework.jdbc.username=cnlive_oa
12   -#smart.framework.jdbc.password=H8rf#_3@ccx9(
13   -
14   -smart.framework.jdbc.url=jdbc:mysql://123.59.27.186:23306/cnlive_live?autoReconnect=true&failOverReadOnly=false
15   -smart.framework.jdbc.username=ugc
16   -smart.framework.jdbc.password=liujicheng@cnlive.COM
17   -
18   -
19   -#smart.framework.jdbc.url=jdbc:mysql://localhost:3306/cnlive_live?autoReconnect=true&failOverReadOnly=false
20   -#smart.framework.jdbc.username=root
21   -#smart.framework.jdbc.password=root
22   -
23   -#
24   -smart.plugin.i18n.reloadable=true
25   -smart.plugin.rest.log=true
26   -smart.plugin.rest.jsonp=true
27   -smart.plugin.rest.jsonp.function=callback
28   -
29   -#smart.plugin.security.realms=custom
30   -#smart.plugin.security.custom.class=org.smart4j.sample.CustomSmartSecurity
31   -#smart.plugin.security.cacheable=true
32   -
33   -sample.upload_path=/www/upload/
34   -
35   -mail.template_path=D:/apache-tomcat-7.0.61/webapps/cnlive_live_web/pages/mail.html
36   -website.url=http://localhost:8080/cnlive_live_web/
37   -auth.enable=true
38   -auth.login.url=http://sso.staff.cnlive.com/CnliveSSO/login?from=mam-live&callbackUrl=
39   -auth.logout.url=http://sso.staff.cnlive.com/CnliveSSO/logOut?from=mam-live&callbackUrl=
40   -auth.userinfo.url=http://sso.staff.cnlive.com/CnliveSSO/getUserInfo?username=
41   -
  1 +smart.framework.app.base_package=com.cnlive.mz.live
  2 +smart.framework.app.home_page=/index
  3 +smart.framework.app.www_path=/static/
  4 +smart.framework.app.jsp_path=/pages/
  5 +smart.framework.custom.ds_factory=org.smart4j.plugin.dbcp.DbcpDataSourceFactory
  6 +
  7 +
  8 +smart.framework.jdbc.type=mysql
  9 +smart.framework.jdbc.driver=com.mysql.jdbc.Driver
  10 +#smart.framework.jdbc.url=jdbc:mysql://124.193.218.90:3306/cnlive_live?autoReconnect=true&failOverReadOnly=false
  11 +#smart.framework.jdbc.username=cnlive_oa
  12 +#smart.framework.jdbc.password=H8rf#_3@ccx9(
  13 +
  14 +smart.framework.jdbc.url=jdbc:mysql://123.59.27.186:23306/cnlive_live?autoReconnect=true&failOverReadOnly=false
  15 +smart.framework.jdbc.username=ugc
  16 +smart.framework.jdbc.password=liujicheng@cnlive.COM
  17 +
  18 +
  19 +#smart.framework.jdbc.url=jdbc:mysql://localhost:3306/cnlive_live?autoReconnect=true&failOverReadOnly=false
  20 +#smart.framework.jdbc.username=root
  21 +#smart.framework.jdbc.password=root
  22 +
  23 +#
  24 +smart.plugin.i18n.reloadable=true
  25 +smart.plugin.rest.log=true
  26 +smart.plugin.rest.jsonp=true
  27 +smart.plugin.rest.jsonp.function=callback
  28 +
  29 +#smart.plugin.security.realms=custom
  30 +#smart.plugin.security.custom.class=org.smart4j.sample.CustomSmartSecurity
  31 +#smart.plugin.security.cacheable=true
  32 +
  33 +sample.upload_path=/www/upload/
  34 +
  35 +mail.template_path=D:/apache-tomcat-7.0.61/webapps/cnlive_live_web/pages/mail.html
  36 +website.url=http://localhost:8080/cnlive_live_web/
  37 +auth.enable=true
  38 +auth.login.url=http://sso.staff.cnlive.com/CnliveSSO/login?from=mam-live&callbackUrl=
  39 +auth.logout.url=http://sso.staff.cnlive.com/CnliveSSO/logOut?from=mam-live&callbackUrl=
  40 +auth.userinfo.url=http://sso.staff.cnlive.com/CnliveSSO/getUserInfo?username=
  41 +
42 42  
43 43 \ No newline at end of file
... ...
src/main/resources/stream-config.properties 0 → 100644
  1 +# file stored repository (Chinese words need ASCII, help tool @http://tool.oschina.net/encode?type=3)
  2 +STREAM_FILE_REPOSITORY=
  3 +
  4 +# when the file has uploaded, whether delete it.
  5 +STREAM_DELETE_FINISH=false
  6 +
  7 +# this server whether allow other different domain[s] upload file to this server
  8 +STREAM_IS_CROSS=false
  9 +
  10 +# allowed domain (PS: flash method need modifying the `crossdomain.xml`)
  11 +STREAM_CROSS_ORIGIN=*
  12 +
  13 +# when Browser @http:www.A.com, the file will upload to @STREAM_CROSS_SERVER
  14 +STREAM_CROSS_SERVER=http://customers.duapp.com
... ...
src/main/webapp/WEB-INF/tags/pager3.tag 0 → 100644
  1 +<%@ tag pageEncoding="UTF-8"%>
  2 +<%@ include file="/pages/common/taglib.jsp"%>
  3 +<%@ attribute name="id" required="true" type="java.lang.String"%>
  4 +<%@ attribute name="pager" required="true" type="org.smart4j.framework.dao.bean.Pager"%>
  5 +<c:set var="pageNumber" value="${pager.pageNumber}" />
  6 +<c:set var="pageSize" value="${pager.pageSize}" />
  7 +<c:set var="totalRecord" value="${pager.totalRecord}" />
  8 +<c:set var="totalPage" value="${pager.totalPage}" />
  9 +
  10 +<div class="css-row">
  11 + <div class="css-right">
  12 + <div id="${id}">
  13 + <!-- <span>每页记录数:</span>
  14 + ${pageSize} -->
  15 + <div class="css-button-group ext-pager-button">
  16 + <c:choose>
  17 + <c:when test="${pageNumber > 1 && pageNumber <= totalPage}">
  18 + <button class="btn btn-xs btn-danger" type="button" onclick="next_pager(1);" data-pn="1">|第一页</button>
  19 + <button class="btn btn-xs btn-danger" type="button" onclick="next_pager(${pageNumber - 1});" data-pn="${pageNumber - 1}">&lt;上一页</button>
  20 + </c:when>
  21 + <c:otherwise>
  22 + <button class="btn btn-xs btn-danger" type="button" disabled>|&lt;首页</button>
  23 + <button class="btn btn-xs btn-danger" type="button" disabled>&lt;上一页</button>
  24 + </c:otherwise>
  25 + </c:choose>
  26 + <span class="green middle bolder">${pageNumber}/${totalPage}</span>
  27 + <c:choose>
  28 + <c:when test="${pageNumber < totalPage}">
  29 + <button class="btn btn-xs btn-danger" type="button" onclick="next_pager(${pageNumber + 1});" data-pn="${pageNumber + 1}">下一页&gt;</button>
  30 + <button class="btn btn-xs btn-danger" type="button" onclick="next_pager(${totalPage});" data-pn="${totalPage}">最后一页&gt;|</button>
  31 + </c:when>
  32 + <c:otherwise>
  33 + <button class="btn btn-xs btn-danger" type="button" disabled>下一页&gt;</button>
  34 + <button class="btn btn-xs btn-danger" type="button" disabled>最后一页&gt;|</button>
  35 + </c:otherwise>
  36 + </c:choose>
  37 + <span class="green middle bolder">总记录数:${totalRecord}</span>
  38 + </div>
  39 + </div>
  40 + </div>
  41 +</div>
0 42 \ No newline at end of file
... ...
src/main/webapp/WEB-INF/web.xml
1   -<?xml version="1.0" encoding="UTF-8"?>
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>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  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>
16 16 </web-app>
17 17 \ No newline at end of file
... ...
src/main/webapp/pages/check/check_management.jsp
1   -<%@ page language="java" pageEncoding="UTF-8"
2   - deferredSyntaxAllowedAsLiteral="true"%>
3   -<%@ include file="/pages/common/taglib.jsp"%>
4   -<!DOCTYPE html>
5   -<html>
6   -<head>
7   -<meta charset="UTF-8">
8   -<title>监审管理 | <f:message key="common.title" /></title>
9   -<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
10   - name='viewport'>
11   -<%@ include file="/pages/common/css.jsp"%>
12   -<style type="text/css">
13   -body {
14   - font-family: Verdana, Arial, Helvetica, sans-serif;
15   - font-size: 12px;
16   - line-height: 20px;
17   - color: #000000;
18   -}
19   -
20   -#main_box {
21   - /*正文区大容器*/
22   - width: 770px;
23   - margin-right: auto;
24   - margin-left: auto;
25   -}
26   -
27   -.row {
28   - /*定义每行*/
29   - width: 100%;
30   - clear: both;
31   -}
32   -
33   -.left3 {
34   - /*用在五列布局上*/
35   - border: 1px solid #00ff00;
36   - width: 25%;
37   - height: 150px;
38   - float: left;
39   -}
40   -
41   -.divleft {
42   - width: 24%;
43   - height: 600px;
44   - float: left;
45   -}
46   -
47   -.divright {
48   - width: 74%;
49   - height: 600px;
50   - float: right;
51   -}
52   -
53   -.leftTop {
54   - width: 100%;
55   - height: 340px;
56   - float: right;
57   -}
58   -
59   -.leftBootom {
60   - width: 100%;
61   - height: 250px;
62   - float: right;
63   -}
64   -</style>
65   -</head>
66   -<body class="skin-blue fixed ">
67   - <div class="wrapper">
68   - <%@ include file="/pages/common/top.jsp"%>
69   - <%@ include file="/pages/common/left.jsp"%>
70   - <div class="content-wrapper">
71   - <!-- Content Header (Page header) -->
72   - <section class="content-header">
73   - <h1>
74   - 监审管理<small><a href="../../live/preload"><i
75   - class="fa fa-plus"></i>直播监审</a> </small> <small class="label label-warning"
76   - style="display: none" id="info_tab_span"><i
77   - class="fa fa-bell-o"></i></small>
78   - </h1>
79   -
80   - <ol class="breadcrumb">
81   - <li><a><i class="fa fa-dashboard"></i> 首页</a></li>
82   - <li class="active">监审管理</li>
83   - </ol>
84   - </section>
85   - <!-- Main content -->
86   - <section class="content">
87   - <div class="row">
88   - <div class="col-xs-12">
89   - <div class="box box-warning">
90   - <div class="box-header with-border">
91   - <h3 class="box-title"></h3>
92   - <div class="box-tools">
93   - <div class="input-group">
94   - <div class="box-footer clearfix">
95   - <center>
96   - <tag:pager3 id="product_pager" pager="${tLive}" />
97   - </center>
98   - </div>
99   - </div>
100   - </div>
101   - </div>
102   - <!-- /.box-header -->
103   - <div class="box-body">
104   -
105   - <div class="divleft">
106   - <div class="leftTop" id="leftTopPlay"></div>
107   - <div class="leftBootom">
108   -
109   - <table class="table table-bordered">
110   -
111   - <h4>直播活动详情:</h4>
112   -
113   - <tr>
114   - <th width="30%">活动名称</th>
115   - <th id="live_name"></th>
116   -
117   - </tr>
118   - <tr>
119   - <th width="30%">开始时间</th>
120   - <th id="start_time"></th>
121   - </tr>
122   - <tr>
123   - <th width="30%">结束时间</th>
124   - <th id="end_time"></th>
125   - </tr>
126   - <tr>
127   - <th width="30%">活动简述</th>
128   - <th id="live_desper"></th>
129   - </tr>
130   - <tr>
131   - <th width="30%">live_url</th>
132   - <th id="live_url"></th>
133   - </tr>
134   - <tr>
135   - <th width="30%">活动简述</th>
136   - <th id=""></th>
137   - </tr>
138   -
139   - </table>
140   - </div>
141   - </div>
142   - <div class="divright">
143   - <!--五列开始-->
144   - <div class="row">
145   - <c:forEach var="item" items="${tLive.recordList}"
146   - varStatus="stat">
147   - <!-- <div style="border: 1px solid #00ff00; width: 33%; height: 200px; background: #888; float: left;"> -->
148   - <div class="warp"
149   - style="border: 1px solid #00ff00; width: 33%; height: 203px; float: left;"
150   - id="divShow_${item.id}"
151   - onclick="getParam('${item.id}','${item.title}','${item.live_url}','${item.start_time}','${item.end_time}')">
152   - <!-- <div class="warp" style="height: 24px; background: #;"> -->
153   - <button type="button" class="close" data-dismiss="modal"
154   - id="colseLive" onclick="coseLive(event,'${item.id}','${item.t_user_id}')">
155   - <span aria-hidden="true">&times;</span><span
156   - class="sr-only">Close</span>
157   - </button>
158   - <h5 class="modal-title" id="myModalLabel">正在直播:${item.title}</h5>
159   - <!-- </div> -->
160   - <div id="a1_${item.id}" class="a1_class"
161   - style="height: 150px">
162   - <input type="hidden" value='${item.id}' name="liveid"
163   - id="liveid">
164   - <input type="hidden"value='${item.title}' name="title" id="title">
165   - <input type="hidden" value='${item.live_url}' name="live_url"
166   - id="live_url_${item.id}">
167   - <input type="hidden"value='${item.start_time}' name="start_time"
168   - id="start_time">
169   - <input type="hidden"value='${item.end_time}' name="end_time" id="end_time">
170   - <input type="hidden"value='${item.t_user_id}' name="t_user_id" id="t_user_${item.id}">
171   - <%-- <h4 class="blue smaller">
172   - <i class="icon-picture orange"></i>视频源 : ${item.title}
173   - </h4> --%>
174   - </div>
175   - <div class="" style="height: 30px;">
176   - <input type="button" value="置顶" id="makeTop"
177   - onclick="makeTop(event,'${item.id}',this)"> <input
178   - type="button" value="关闭活动" id="closeLive"
179   - onclick="coseLive(event,'${item.id}','${item.t_user_id}')">
180   - </div>
181   - </div>
182   - <!-- </div> -->
183   - </c:forEach>
184   - </div>
185   - </div>
186   - </div>
187   -
188   - </div>
189   - <!-- /.box-body -->
190   - </div>
191   - </div>
192   - </section>
193   - </div>
194   - </div>
195   - <%@ include file="/pages/common/bottom.jsp"%>
196   - <%@ include file="/pages/common/js.jsp"%>
197   - <script type="text/javascript" src="../../pages/check/js/ckplayer.js" charset="utf-8"></script>
198   - <script type="text/javascript" src="../../pages/check/js/offlights.js" charset="utf-8"></script>
199   - <script type="text/javascript">
200   - var flashvars = {
201   - p : 1,
202   - e : 1,
203   - hl : '',
204   - ht : '20',
205   - };
206   - var video = [ '' ];
207   - var support = [ 'all' ];
208   - CKobject.embedHTML5('leftTopPlay', 'ckplayer_leftTopPlay', 250, 290,
209   - video, flashvars, support);
210   -
211   - $(".a1_class #liveid").each(function() {
212   - var id = $(this).val();
213   - var live_url = $('#live_url_' + id).val();
214   - var t_user_id = $('#t_user_'+id).val();
215   -
216   - var flashvars = {
217   - p : 1,
218   - e : 1,
219   - hl : live_url,
220   - ht : '20'
221   - };
222   - var video = [live_url ];
223   - var support = [ 'all' ];
224   - CKobject.embedHTML5('a1_' + id, 'ckplayer_' + id,250, 153, video, flashvars, support);
225   -
226   - //m3u8 文件播放
227   - /* var flashvars={
228   - f:'http://localhost:8080/cnlive_live_web/static/assets/ckplayer/m3u8.swf',
229   - a:live_url,
230   - s:4,
231   - c:0,
232   - p:1
233   - };
234   - var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
235   - var video=[live_url];
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   - // rtmp 直播流播放。
238   - /* var flashvars = {
239   - // f:'rtmp://localhost/live/livestreame',
240   - f :'http://cnlive.uplive.ks-cdn.com/live/'+t_user_id+'_'+id,
241   - c : 0
242   - };
243   - var video = [ 'http://cnlive.hlslive.ks-cdn.com/live/'+t_user_id+'_'+id+'/index.m3u8'];
244   - CKobject.embed('../../static/assets/ckplayer/ckplayer.swf','a1_' + id, 'ckplayer_' + id, 250,
245   - 153, false, flashvars, video); */
246   -
247   - });
248   -
249   - function getParam(id, name, live_url, start_time, end_time) {
250   -
251   - $("#live_name").html(name);
252   - $("#start_time").html(start_time);
253   - $("#end_time").html(end_time);
254   - $("#live_url").html(live_url);
255   - var flashvars = {
256   - p : 1,
257   - e : 1,
258   - hl : 'http://movie.ks.js.cn/flv/other/1_0.mp4',
259   - };
260   - var video = [ live_url ];
261   - var support = [ 'all' ];
262   - CKobject.embedHTML5('leftTopPlay', 'ckplayer_leftTopPlay', 250,
263   - 290, video, flashvars, support);
264   - }
265   - function coseLive(e, id,user_id) {
266   - e.cancelBubble = true;
267   - $.ajax({
268   - url : '../../check/close/' + id,
269   - type : 'post',
270   - datatype : "json",
271   - async : true,
272   - data:{"user_id":user_id},
273   - error : function() {
274   - alert('关闭时发生错误!');
275   - },
276   - success : function(data) {
277   - location.href = '../../check/list/1';
278   - alert("关闭成功");
279   - }
280   - });
281   - }
282   - /**
283   - 置顶 。。。
284   - */
285   -
286   - function makeTop(event, id, obj) {
287   - event.cancelBubble = true;
288   - $(obj.parentElement.parentElement).insertBefore($('.warp').first())
289   - alert(obj.parentElement.parentElement);
290   - };
291   - </script>
292   -</body>
293   -</html>
  1 +<%@ page language="java" pageEncoding="UTF-8"
  2 + deferredSyntaxAllowedAsLiteral="true"%>
  3 +<%@ include file="/pages/common/taglib.jsp"%>
  4 +<!DOCTYPE html>
  5 +<html>
  6 +<head>
  7 +<meta charset="UTF-8">
  8 +<title>监审管理 | <f:message key="common.title" /></title>
  9 +<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
  10 + name='viewport'>
  11 +<%@ include file="/pages/common/css.jsp"%>
  12 +<style type="text/css">
  13 +body {
  14 + font-family: Verdana, Arial, Helvetica, sans-serif;
  15 + font-size: 12px;
  16 + line-height: 20px;
  17 + color: #000000;
  18 +}
  19 +
  20 +#main_box {
  21 + /*正文区大容器*/
  22 + width: 770px;
  23 + margin-right: auto;
  24 + margin-left: auto;
  25 +}
  26 +
  27 +.row {
  28 + /*定义每行*/
  29 + width: 100%;
  30 + clear: both;
  31 +}
  32 +
  33 +.left3 {
  34 + /*用在五列布局上*/
  35 + border: 1px solid #00ff00;
  36 + width: 25%;
  37 + height: 150px;
  38 + float: left;
  39 +}
  40 +
  41 +.divleft {
  42 + width: 24%;
  43 + height: 600px;
  44 + float: left;
  45 +}
  46 +
  47 +.divright {
  48 + width: 74%;
  49 + height: 600px;
  50 + float: right;
  51 +}
  52 +
  53 +.leftTop {
  54 + width: 100%;
  55 + height: 340px;
  56 + float: right;
  57 +}
  58 +
  59 +.leftBootom {
  60 + width: 100%;
  61 + height: 250px;
  62 + float: right;
  63 +}
  64 +</style>
  65 +</head>
  66 +<body class="skin-blue fixed ">
  67 + <div class="wrapper">
  68 + <%@ include file="/pages/common/top.jsp"%>
  69 + <%@ include file="/pages/common/left.jsp"%>
  70 + <div class="content-wrapper">
  71 + <!-- Content Header (Page header) -->
  72 + <section class="content-header">
  73 + <h1>
  74 + 监审管理<small><a href="../../live/preload"><i
  75 + class="fa fa-plus"></i>直播监审</a> </small> <small class="label label-warning"
  76 + style="display: none" id="info_tab_span"><i
  77 + class="fa fa-bell-o"></i></small>
  78 + </h1>
  79 +
  80 + <ol class="breadcrumb">
  81 + <li><a><i class="fa fa-dashboard"></i> 首页</a></li>
  82 + <li class="active">监审管理</li>
  83 + </ol>
  84 + </section>
  85 + <!-- Main content -->
  86 + <section class="content">
  87 + <div class="row">
  88 + <div class="col-xs-12">
  89 + <div class="box box-warning">
  90 + <div class="box-header with-border">
  91 + <h3 class="box-title"></h3>
  92 + <div class="box-tools">
  93 + <div class="input-group">
  94 + <div class="box-footer clearfix">
  95 + <center>
  96 + <tag:pager3 id="product_pager" pager="${tLive}" />
  97 + </center>
  98 + </div>
  99 + </div>
  100 + </div>
  101 + </div>
  102 + <!-- /.box-header -->
  103 + <div class="box-body">
  104 +
  105 + <div class="divleft">
  106 + <div class="leftTop" id="leftTopPlay"></div>
  107 + <div class="leftBootom">
  108 +
  109 + <table class="table table-bordered">
  110 +
  111 + <h4>直播活动详情:</h4>
  112 +
  113 + <tr>
  114 + <th width="30%">活动名称</th>
  115 + <th id="live_name"></th>
  116 +
  117 + </tr>
  118 + <tr>
  119 + <th width="30%">开始时间</th>
  120 + <th id="start_time"></th>
  121 + </tr>
  122 + <tr>
  123 + <th width="30%">结束时间</th>
  124 + <th id="end_time"></th>
  125 + </tr>
  126 + <tr>
  127 + <th width="30%">活动简述</th>
  128 + <th id="live_desper"></th>
  129 + </tr>
  130 + <tr>
  131 + <th width="30%">live_url</th>
  132 + <th id="live_url"></th>
  133 + </tr>
  134 + <tr>
  135 + <th width="30%">活动简述</th>
  136 + <th id=""></th>
  137 + </tr>
  138 +
  139 + </table>
  140 + </div>
  141 + </div>
  142 + <div class="divright">
  143 + <!--五列开始-->
  144 + <div class="row">
  145 + <c:forEach var="item" items="${tLive.recordList}"
  146 + varStatus="stat">
  147 + <!-- <div style="border: 1px solid #00ff00; width: 33%; height: 200px; background: #888; float: left;"> -->
  148 + <div class="warp"
  149 + style="border: 1px solid #00ff00; width: 33%; height: 203px; float: left;"
  150 + id="divShow_${item.id}"
  151 + onclick="getParam('${item.id}','${item.title}','${item.live_url}','${item.start_time}','${item.end_time}')">
  152 + <!-- <div class="warp" style="height: 24px; background: #;"> -->
  153 + <button type="button" class="close" data-dismiss="modal"
  154 + id="colseLive" onclick="coseLive(event,'${item.id}','${item.t_user_id}')">
  155 + <span aria-hidden="true">&times;</span><span
  156 + class="sr-only">Close</span>
  157 + </button>
  158 + <h5 class="modal-title" id="myModalLabel">正在直播:${item.title}</h5>
  159 + <!-- </div> -->
  160 + <div id="a1_${item.id}" class="a1_class"
  161 + style="height: 150px">
  162 + <input type="hidden" value='${item.id}' name="liveid"
  163 + id="liveid">
  164 + <input type="hidden"value='${item.title}' name="title" id="title">
  165 + <input type="hidden" value='${item.live_url}' name="live_url"
  166 + id="live_url_${item.id}">
  167 + <input type="hidden"value='${item.start_time}' name="start_time"
  168 + id="start_time">
  169 + <input type="hidden"value='${item.end_time}' name="end_time" id="end_time">
  170 + <input type="hidden"value='${item.t_user_id}' name="t_user_id" id="t_user_${item.id}">
  171 + <%-- <h4 class="blue smaller">
  172 + <i class="icon-picture orange"></i>视频源 : ${item.title}
  173 + </h4> --%>
  174 + </div>
  175 + <div class="" style="height: 30px;">
  176 + <input type="button" value="置顶" id="makeTop"
  177 + onclick="makeTop(event,'${item.id}',this)"> <input
  178 + type="button" value="关闭活动" id="closeLive"
  179 + onclick="coseLive(event,'${item.id}','${item.t_user_id}')">
  180 + </div>
  181 + </div>
  182 + <!-- </div> -->
  183 + </c:forEach>
  184 + </div>
  185 + </div>
  186 + </div>
  187 +
  188 + </div>
  189 + <!-- /.box-body -->
  190 + </div>
  191 + </div>
  192 + </section>
  193 + </div>
  194 + </div>
  195 + <%@ include file="/pages/common/bottom.jsp"%>
  196 + <%@ include file="/pages/common/js.jsp"%>
  197 + <script type="text/javascript" src="../../pages/check/js/ckplayer.js" charset="utf-8"></script>
  198 + <script type="text/javascript" src="../../pages/check/js/offlights.js" charset="utf-8"></script>
  199 + <script type="text/javascript">
  200 + var flashvars = {
  201 + p : 1,
  202 + e : 1,
  203 + hl : '',
  204 + ht : '20',
  205 + };
  206 + var video = [ '' ];
  207 + var support = [ 'all' ];
  208 + CKobject.embedHTML5('leftTopPlay', 'ckplayer_leftTopPlay', 250, 290,
  209 + video, flashvars, support);
  210 +
  211 + $(".a1_class #liveid").each(function() {
  212 + var id = $(this).val();
  213 + var live_url = $('#live_url_' + id).val();
  214 + var t_user_id = $('#t_user_'+id).val();
  215 +
  216 + var flashvars = {
  217 + p : 1,
  218 + e : 1,
  219 + hl : live_url,
  220 + ht : '20'
  221 + };
  222 + var video = [live_url ];
  223 + var support = [ 'all' ];
  224 + CKobject.embedHTML5('a1_' + id, 'ckplayer_' + id,250, 153, video, flashvars, support);
  225 +
  226 + //m3u8 文件播放
  227 + /* var flashvars={
  228 + f:'http://localhost:8080/cnlive_live_web/static/assets/ckplayer/m3u8.swf',
  229 + a:live_url,
  230 + s:4,
  231 + c:0,
  232 + p:1
  233 + };
  234 + var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
  235 + var video=[live_url];
  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 + // rtmp 直播流播放。
  238 + /* var flashvars = {
  239 + // f:'rtmp://localhost/live/livestreame',
  240 + f :'http://cnlive.uplive.ks-cdn.com/live/'+t_user_id+'_'+id,
  241 + c : 0
  242 + };
  243 + var video = [ 'http://cnlive.hlslive.ks-cdn.com/live/'+t_user_id+'_'+id+'/index.m3u8'];
  244 + CKobject.embed('../../static/assets/ckplayer/ckplayer.swf','a1_' + id, 'ckplayer_' + id, 250,
  245 + 153, false, flashvars, video); */
  246 +
  247 + });
  248 +
  249 + function getParam(id, name, live_url, start_time, end_time) {
  250 +
  251 + $("#live_name").html(name);
  252 + $("#start_time").html(start_time);
  253 + $("#end_time").html(end_time);
  254 + $("#live_url").html(live_url);
  255 + var flashvars = {
  256 + p : 1,
  257 + e : 1,
  258 + hl : 'http://movie.ks.js.cn/flv/other/1_0.mp4',
  259 + };
  260 + var video = [ live_url ];
  261 + var support = [ 'all' ];
  262 + CKobject.embedHTML5('leftTopPlay', 'ckplayer_leftTopPlay', 250,
  263 + 290, video, flashvars, support);
  264 + }
  265 + function coseLive(e, id,user_id) {
  266 + e.cancelBubble = true;
  267 + $.ajax({
  268 + url : '../../check/close/' + id,
  269 + type : 'post',
  270 + datatype : "json",
  271 + async : true,
  272 + data:{"user_id":user_id},
  273 + error : function() {
  274 + alert('关闭时发生错误!');
  275 + },
  276 + success : function(data) {
  277 + location.href = '../../check/list/1';
  278 + alert("关闭成功");
  279 + }
  280 + });
  281 + }
  282 + /**
  283 + 置顶 。。。
  284 + */
  285 +
  286 + function makeTop(event, id, obj) {
  287 + event.cancelBubble = true;
  288 + $(obj.parentElement.parentElement).insertBefore($('.warp').first())
  289 + alert(obj.parentElement.parentElement);
  290 + };
  291 + </script>
  292 +</body>
  293 +</html>
... ...
src/main/webapp/pages/check/monitor.jsp
1   -<%@ page language="java" pageEncoding="UTF-8"%>
2   -<%@ include file="/pages/common/taglib.jsp"%>
3   -<!DOCTYPE html>
4   -<html>
5   -<head>
6   -<style type="text/css">
7   -.text-overflow {
8   - display: block; /*内联对象需加*/
9   - width: 31em;
10   - word-break: keep-all; /* 不换行 */
11   - white-space: nowrap; /* 不换行 */
12   - overflow: hidden; /* 内容超出宽度时隐藏超出部分的内容 */
13   - text-overflow: ellipsis;
14   - /* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
15   -}
16   -</style>
17   -<meta charset="UTF-8">
18   -<title>监审管理 |<f:message key="common.title" /></title>
19   -<meta
20   - content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
21   - name='viewport'>
22   -<%@ include file="/pages/common/css.jsp"%>
23   -<script src="${BASE}/static/assets/cnlive/js/check.js"></script>
24   -<script src="${BASE}/static/assets/jwplayer/jwplayer.js"></script>
25   -<script src="${BASE}/static/assets/jwplayer/jwplayer.html5.js"></script>
26   -<script type="text/javascript">jwplayer.key="MGAzpXRYxGnaVXhH8jSdKXzDe7ucAAvZGWggIA==";</script>
27   -
28   -</head>
29   -<body class="skin-blue sidebar-collapse sidebar-mini">
30   - <div class="wrapper">
31   - <%@ include file="/pages/common/top.jsp"%>
32   - <%@ include file="/pages/common/left.jsp"%>
33   - <!-- Content Wrapper. Contains page content -->
34   - <div class="content-wrapper">
35   - <!-- Content Header (Page header) -->
36   - <section class="content-header">
37   - <h1>
38   - 监审管理 <small>monitor panel</small>
39   - </h1>
40   - <ol class="breadcrumb">
41   - <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
42   - <li class="active">监审管理</li>
43   - </ol>
44   - </section>
45   - <section class="content">
46   - <div class="row">
47   - <div class="col-md-4">
48   - <div class="box box-solid">
49   - <div class="box-header with-border">
50   - <h3 class="box-title">监控平台</h3>
51   - </div>
52   - <div class="box-body no-padding">
53   - <div class="col-md-12" id="divShow_${item.id}">
54   - <div class="box box-success box-solid">
55   - <div class="box-header with-border">
56   - <div class="text-overflow">
57   - <h3 class="box-title" id="hidId">${item.title}</h3>
58   - </div>
59   - <div class="box-tools pull-right">
60   - <button class="btn btn-sm" id="play_button_${item.id}"
61   - onclick="play(${item.id});">重新载入</button>
62   - </div>
63   - </div>
64   - <div id="playId" class="box-body">
65   - <%-- <input type="hidden" name="play_url_${item.id}"
66   - id="play_url_${item.id}" value="${item.live_url}" /> <span
67   - class="mailbox-attachment-icon has-img"
68   - id="player_span_${item.id}"> <img
69   - src="../../static/assets/dist/img/photo2.png"
70   - alt="Attachment">
71   - </span> --%>
72   - </div>
73   - </div>
74   - </div>
75   - </div>
76   - </div>
77   - <div class="box-header with-border">
78   - <h3 class="box-title">直播信息:</h3>
79   - </div>
80   - <div class="box-body no-padding">
81   - <ul class="nav nav-pills nav-stacked">
82   - <li id="userId"><a><i class="fa fa-file-text-o"></i>用户ID:</a></li>
83   - <li id="title"><a><i class="fa fa-file-text-o"></i>TITLE:
84   - </a></li>
85   - <li id="startTime"><a><i class="fa fa-file-text-o"></i>开播时间:
86   - </a></li>
87   - </ul>
88   - </div>
89   - </div>
90   - <div class="col-md-8">
91   - <div class="box box-primary">
92   - <div class="box-header with-border">
93   - <h3 class="box-title">监控</h3>
94   - <tag:pager id="product_pager" pager="${tLive}" />
95   - </div>
96   - <div class="box-body no-padding">
97   - <div class="row">
98   - <c:forEach var="item" items="${tLive.recordList}"
99   - varStatus="stat">
100   - <div class="col-md-3" id="divShow_${item.id}">
101   - <div
102   - class="box ${item.check_sort eq null ? 'box-warning':'box-success'} box-solid">
103   - <div class="box-header with-border">
104   - <div class="text-overflow">
105   - <h3 class="box-title">${item.title}</h3>
106   - </div>
107   - <div class="box-tools pull-right">
108   - <button class="btn btn-sm btn-danger"
109   - onclick="changePlay('${item.id}','${item.live_url}','${item.t_user_id}','${item.title}','${item.start_time}');">左</button>
110   - <button class="btn btn-sm btn-danger"
111   - onclick="to_pass(${item.id});">过</button>
112   - <button class="btn btn-sm btn-danger"
113   - onclick="to_top(${item.id});">顶</button>
114   - <button class="btn btn-sm btn-danger"
115   - onclick="play_close('${item.id}','${item.live_url}','${item.uuid}');">断</button>
116   - </div>
117   - </div>
118   - <div class="box-body">
119   - <input type="hidden" name="play_url_${item.id}"
120   - id="play_url_${item.id}" value="${item.live_url}" /> <span
121   - class="mailbox-attachment-icon has-img"
122   - id="player_span_${item.id}"> <img
123   - src="../../static/assets/dist/img/photo2.png"
124   - alt="Attachment">
125   - </span>
126   - </div>
127   - </div>
128   - </div>
129   - </c:forEach>
130   - </div>
131   - </div>
132   - </div>
133   - </div>
134   - </div>
135   - <%@ include file="/pages/common/js.jsp"%>
136   - <script src="${BASE}/static/assets/cnlive/js/player_m3u8.js"></script>
137   - </section>
138   - </div>
139   - </div>
140   -</body>
141   -<script type="text/javascript">
142   -jwplayer("playId").setup({
143   - file: "",
144   - height: 260,
145   - image: "/assets/myVideo.jpg",
146   - autostart:true,
147   - rtmp: {
148   - bufferlength: 0.1
149   - },
150   - width: 370
151   -});
152   -</script>
  1 +<%@ page language="java" pageEncoding="UTF-8"%>
  2 +<%@ include file="/pages/common/taglib.jsp"%>
  3 +<!DOCTYPE html>
  4 +<html>
  5 +<head>
  6 +<style type="text/css">
  7 +.text-overflow {
  8 + display: block; /*内联对象需加*/
  9 + width: 31em;
  10 + word-break: keep-all; /* 不换行 */
  11 + white-space: nowrap; /* 不换行 */
  12 + overflow: hidden; /* 内容超出宽度时隐藏超出部分的内容 */
  13 + text-overflow: ellipsis;
  14 + /* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
  15 +}
  16 +</style>
  17 +<meta charset="UTF-8">
  18 +<title>监审管理 |<f:message key="common.title" /></title>
  19 +<meta
  20 + content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
  21 + name='viewport'>
  22 +<%@ include file="/pages/common/css.jsp"%>
  23 +<script src="${BASE}/static/assets/cnlive/js/check.js"></script>
  24 +<script src="${BASE}/static/assets/jwplayer/jwplayer.js"></script>
  25 +<script src="${BASE}/static/assets/jwplayer/jwplayer.html5.js"></script>
  26 +<script type="text/javascript">jwplayer.key="MGAzpXRYxGnaVXhH8jSdKXzDe7ucAAvZGWggIA==";</script>
  27 +
  28 +</head>
  29 +<body class="skin-blue sidebar-collapse sidebar-mini">
  30 + <div class="wrapper">
  31 + <%@ include file="/pages/common/top.jsp"%>
  32 + <%@ include file="/pages/common/left.jsp"%>
  33 + <!-- Content Wrapper. Contains page content -->
  34 + <div class="content-wrapper">
  35 + <!-- Content Header (Page header) -->
  36 + <section class="content-header">
  37 + <h1>
  38 + 监审管理 <small>monitor panel</small>
  39 + </h1>
  40 + <ol class="breadcrumb">
  41 + <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
  42 + <li class="active">监审管理</li>
  43 + </ol>
  44 + </section>
  45 + <section class="content">
  46 + <div class="row">
  47 + <div class="col-md-4">
  48 + <div class="box box-solid">
  49 + <div class="box-header with-border">
  50 + <h3 class="box-title">监控平台</h3>
  51 + </div>
  52 + <div class="box-body no-padding">
  53 + <div class="col-md-12" id="divShow_${item.id}">
  54 + <div class="box box-success box-solid">
  55 + <div class="box-header with-border">
  56 + <div class="text-overflow">
  57 + <h3 class="box-title" id="hidId">${item.title}</h3>
  58 + </div>
  59 + <div class="box-tools pull-right">
  60 + <button class="btn btn-sm" id="play_button_${item.id}"
  61 + onclick="play(${item.id});">重新载入</button>
  62 + </div>
  63 + </div>
  64 + <div id="playId" class="box-body">
  65 + <%-- <input type="hidden" name="play_url_${item.id}"
  66 + id="play_url_${item.id}" value="${item.live_url}" /> <span
  67 + class="mailbox-attachment-icon has-img"
  68 + id="player_span_${item.id}"> <img
  69 + src="../../static/assets/dist/img/photo2.png"
  70 + alt="Attachment">
  71 + </span> --%>
  72 + </div>
  73 + </div>
  74 + </div>
  75 + </div>
  76 + </div>
  77 + <div class="box-header with-border">
  78 + <h3 class="box-title">直播信息:</h3>
  79 + </div>
  80 + <div class="box-body no-padding">
  81 + <ul class="nav nav-pills nav-stacked">
  82 + <li id="userId"><a><i class="fa fa-file-text-o"></i>用户ID:</a></li>
  83 + <li id="title"><a><i class="fa fa-file-text-o"></i>TITLE:
  84 + </a></li>
  85 + <li id="startTime"><a><i class="fa fa-file-text-o"></i>开播时间:
  86 + </a></li>
  87 + </ul>
  88 + </div>
  89 + </div>
  90 + <div class="col-md-8">
  91 + <div class="box box-primary">
  92 + <div class="box-header with-border">
  93 + <h3 class="box-title">监控</h3>
  94 + <tag:pager id="product_pager" pager="${tLive}" />
  95 + </div>
  96 + <div class="box-body no-padding">
  97 + <div class="row">
  98 + <c:forEach var="item" items="${tLive.recordList}"
  99 + varStatus="stat">
  100 + <div class="col-md-3" id="divShow_${item.id}">
  101 + <div
  102 + class="box ${item.check_sort eq null ? 'box-warning':'box-success'} box-solid">
  103 + <div class="box-header with-border">
  104 + <div class="text-overflow">
  105 + <h3 class="box-title">${item.title}</h3>
  106 + </div>
  107 + <div class="box-tools pull-right">
  108 + <button class="btn btn-sm btn-danger"
  109 + onclick="changePlay('${item.id}','${item.live_url}','${item.t_user_id}','${item.title}','${item.start_time}');">左</button>
  110 + <button class="btn btn-sm btn-danger"
  111 + onclick="to_pass(${item.id});">过</button>
  112 + <button class="btn btn-sm btn-danger"
  113 + onclick="to_top(${item.id});">顶</button>
  114 + <button class="btn btn-sm btn-danger"
  115 + onclick="play_close('${item.id}','${item.live_url}','${item.uuid}');">断</button>
  116 + </div>
  117 + </div>
  118 + <div class="box-body">
  119 + <input type="hidden" name="play_url_${item.id}"
  120 + id="play_url_${item.id}" value="${item.live_url}" /> <span
  121 + class="mailbox-attachment-icon has-img"
  122 + id="player_span_${item.id}"> <img
  123 + src="../../static/assets/dist/img/photo2.png"
  124 + alt="Attachment">
  125 + </span>
  126 + </div>
  127 + </div>
  128 + </div>
  129 + </c:forEach>
  130 + </div>
  131 + </div>
  132 + </div>
  133 + </div>
  134 + </div>
  135 + <%@ include file="/pages/common/js.jsp"%>
  136 + <script src="${BASE}/static/assets/cnlive/js/player_m3u8.js"></script>
  137 + </section>
  138 + </div>
  139 + </div>
  140 +</body>
  141 +<script type="text/javascript">
  142 +jwplayer("playId").setup({
  143 + file: "",
  144 + height: 260,
  145 + image: "/assets/myVideo.jpg",
  146 + autostart:true,
  147 + rtmp: {
  148 + bufferlength: 0.1
  149 + },
  150 + width: 370
  151 +});
  152 +</script>
153 153 </html>
154 154 \ No newline at end of file
... ...
src/main/webapp/pages/common/js.jsp
1   -<%@ page language="java" pageEncoding="utf-8"%>
2   -
3   -<script src="${BASE}/static/assets/plugins/jQuery/jQuery-2.1.4.min.js"></script>
4   -<!-- Bootstrap 3.3.2 JS -->
5   -<script src="${BASE}/static/assets/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
6   -<!-- Slimscroll -->
7   -<script src="${BASE}/static/assets/plugins/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script>
8   -<!-- FastClick -->
9   -<script src='${BASE}/static/assets/plugins/fastclick/fastclick.min.js'></script>
10   -<!-- AdminLTE App -->
11   -<script src="${BASE}/static/assets/dist/js/app.min.js" type="text/javascript"></script>
12   -<!-- AdminLTE for demo purposes -->
13   -<script src="${BASE}/static/assets/dist/js/demo.js" type="text/javascript"></script>
14   -<script src="${BASE}/static/assets/plugins/iCheck/1.0.2/icheck.js?v=1.0.2"></script>
15   -<!-- InputMask -->
16   -<script src="${BASE}/static/assets/plugins/input-mask/jquery.inputmask.js" type="text/javascript"></script>
17   -<script src="${BASE}/static/assets/plugins/input-mask/jquery.inputmask.date.extensions.js" type="text/javascript"></script>
18   -<script src="${BASE}/static/assets/plugins/input-mask/jquery.inputmask.extensions.js" type="text/javascript"></script>
19   -<!-- date-range-picker -->
20   -<script src="${BASE}/static/assets/third-party/moment.min.js" type="text/javascript"></script>
21   -<script src="${BASE}/static/assets/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
22   -<!-- bootstrap time picker -->
23   -<script src="${BASE}/static/assets/plugins/timepicker/bootstrap-timepicker.min.js" type="text/javascript"></script>
24   -<!-- iCheck 1.0.1 -->
25   -<script src="${BASE}/static/assets/plugins/iCheck/icheck.min.js" type="text/javascript"></script>
26   -<script src="${BASE}/static/assets/plugins/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script>
27   -
28   -<link rel="stylesheet" href="${BASE}/static/assets/plugins/fileinput/fileinput.css" />
29   -<link rel="stylesheet" href="${BASE}/static/assets/plugins/fileinput/fileinput.min.css" />
30   -<script src="${BASE}/static/assets/plugins/fileinput/fileinput.js"></script>
31   -<script src="${BASE}/static/assets/plugins/fileinput/fileinput.min.js"></script>
32   -<script src="${BASE}/static/assets/plugins/fileinput/fileinput_locale_zh.js"></script>
33   -
34   -<!-------直播系统所需 js 文件-->
35   -<script src="${BASE}/static/assets/cnlive/js/all_live.js" type="text/javascript"></script>
36   -<script src="${BASE}/static/assets/cnlive/js/live.js" type="text/javascript"></script>
37   -<script src="${BASE}/static/assets/cnlive/js/room.js" type="text/javascript"></script>
38   -<script src="${BASE}/static/assets/cnlive/js/channel.js" type="text/javascript"></script>
39   -<script src="${BASE}/static/assets/cnlive/js/signal.js" type="text/javascript"></script>
40   -<script src="${BASE}/static/assets/cnlive/js/wowza.js" type="text/javascript"></script>
41   -<script src="${BASE}/static/assets/cnlive/js/activity.js" type="text/javascript"></script>
42   -<script src="${BASE}/static/assets/cnlive/js/ajax_rest.js" type="text/javascript"></script>
43   -<!-- cnlive validate -->
44   -<script src="${BASE}/static/assets/plugins/validate/jquery.form.js"></script>
45   -<script src="${BASE}/static/assets/plugins/validate/jquery.metadata.js"></script>
46   -<script src="${BASE}/static/assets/plugins/validate/jquery.validate.js"></script>
47   -
48   -<script src="${BASE}/static/assets/plugins/easytree/easyTree.js"></script>
49   -<script src="${BASE}/static/assets/cnlive/js/common.js"></script>
50   -<script src="${BASE}/static/assets/cnlive/js/global.js"></script>
51   -<script type="text/javascript">
52   - BASE = '${BASE}';
  1 +<%@ page language="java" pageEncoding="utf-8"%>
  2 +
  3 +<script src="${BASE}/static/assets/plugins/jQuery/jQuery-2.1.4.min.js"></script>
  4 +<!-- Bootstrap 3.3.2 JS -->
  5 +<script src="${BASE}/static/assets/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
  6 +<!-- Slimscroll -->
  7 +<script src="${BASE}/static/assets/plugins/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script>
  8 +<!-- FastClick -->
  9 +<script src='${BASE}/static/assets/plugins/fastclick/fastclick.min.js'></script>
  10 +<!-- AdminLTE App -->
  11 +<script src="${BASE}/static/assets/dist/js/app.min.js" type="text/javascript"></script>
  12 +<!-- AdminLTE for demo purposes -->
  13 +<script src="${BASE}/static/assets/dist/js/demo.js" type="text/javascript"></script>
  14 +<script src="${BASE}/static/assets/plugins/iCheck/1.0.2/icheck.js?v=1.0.2"></script>
  15 +<!-- InputMask -->
  16 +<script src="${BASE}/static/assets/plugins/input-mask/jquery.inputmask.js" type="text/javascript"></script>
  17 +<script src="${BASE}/static/assets/plugins/input-mask/jquery.inputmask.date.extensions.js" type="text/javascript"></script>
  18 +<script src="${BASE}/static/assets/plugins/input-mask/jquery.inputmask.extensions.js" type="text/javascript"></script>
  19 +<!-- date-range-picker -->
  20 +<script src="${BASE}/static/assets/third-party/moment.min.js" type="text/javascript"></script>
  21 +<script src="${BASE}/static/assets/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
  22 +<!-- bootstrap time picker -->
  23 +<script src="${BASE}/static/assets/plugins/timepicker/bootstrap-timepicker.min.js" type="text/javascript"></script>
  24 +<!-- iCheck 1.0.1 -->
  25 +<script src="${BASE}/static/assets/plugins/iCheck/icheck.min.js" type="text/javascript"></script>
  26 +<script src="${BASE}/static/assets/plugins/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script>
  27 +
  28 +<link rel="stylesheet" href="${BASE}/static/assets/plugins/fileinput/fileinput.css" />
  29 +<link rel="stylesheet" href="${BASE}/static/assets/plugins/fileinput/fileinput.min.css" />
  30 +<script src="${BASE}/static/assets/plugins/fileinput/fileinput.js"></script>
  31 +<script src="${BASE}/static/assets/plugins/fileinput/fileinput.min.js"></script>
  32 +<script src="${BASE}/static/assets/plugins/fileinput/fileinput_locale_zh.js"></script>
  33 +
  34 +<!-------直播系统所需 js 文件-->
  35 +<script src="${BASE}/static/assets/cnlive/js/all_live.js" type="text/javascript"></script>
  36 +<script src="${BASE}/static/assets/cnlive/js/live.js" type="text/javascript"></script>
  37 +<script src="${BASE}/static/assets/cnlive/js/room.js" type="text/javascript"></script>
  38 +<script src="${BASE}/static/assets/cnlive/js/channel.js" type="text/javascript"></script>
  39 +<script src="${BASE}/static/assets/cnlive/js/signal.js" type="text/javascript"></script>
  40 +<script src="${BASE}/static/assets/cnlive/js/wowza.js" type="text/javascript"></script>
  41 +<script src="${BASE}/static/assets/cnlive/js/activity.js" type="text/javascript"></script>
  42 +<script src="${BASE}/static/assets/cnlive/js/ajax_rest.js" type="text/javascript"></script>
  43 +<!-- cnlive validate -->
  44 +<script src="${BASE}/static/assets/plugins/validate/jquery.form.js"></script>
  45 +<script src="${BASE}/static/assets/plugins/validate/jquery.metadata.js"></script>
  46 +<script src="${BASE}/static/assets/plugins/validate/jquery.validate.js"></script>
  47 +
  48 +<script src="${BASE}/static/assets/plugins/easytree/easyTree.js"></script>
  49 +<script src="${BASE}/static/assets/cnlive/js/common.js"></script>
  50 +<script src="${BASE}/static/assets/cnlive/js/global.js"></script>
  51 +<script type="text/javascript">
  52 + BASE = '${BASE}';
53 53 </script>
54 54 \ No newline at end of file
... ...
src/main/webapp/pages/common/left.jsp
1   -<%@ page language="java" pageEncoding="utf-8"%>
2   -<%@ include file="/pages/common/taglib.jsp"%>
3   -<aside class="main-sidebar">
4   - <section class="sidebar">
5   - <div class="user-panel">
6   - <div class="pull-left image">
7   - <img src="${BASE}/static/assets/dist/img/user2-160x160.jpg"
8   - class="img-circle" alt="User Image" />
9   - </div>
10   - <div class="pull-left info">
11   - <p>
12   - <a href="${BASE}/index">刘基城</a>
13   - </p>
14   - <i class="fa fa-circle text-success"></i>
15   - <c:if test="${sessionScope.roleId=='1'}">超级管理员</c:if>
16   - <c:if test="${sessionScope.roleId=='0'}">普通用户</c:if>
17   - <c:if test="${sessionScope.roleId=='2'}">总编室用户</c:if>
18   - </div>
19   - </div>
20   - <ul class="sidebar-menu">
21   - <c:if test="${sessionScope.roleId=='1'}">
22   - <li class="header">导航栏</li>
23   - <li>
24   - <a href="${BASE}/switch"><i class="fa fa-circle-o text-blue"></i>全局切换</a>
25   - </li>
26   - <li>
27   - <a href="${BASE}/channel/monitor/1"><i class="fa fa-circle-o text-yellow"></i>直播监控</a>
28   - </li>
29   - <li>
30   - <a href="${BASE}/activity/preload"><i class="fa fa-circle-o"></i>新增活动</a>
31   - </li>
32   - <li>
33   - <a href="${BASE}/activity/list/1"><i class="fa fa-circle-o text-red"></i>活动管理</a>
34   - </li>
35   -
36   - <li class="header">系统设置</li>
37   - <li>
38   - <a href="${BASE}/channel/list/1"><i class="fa fa-circle-o text-green"></i>频道管理</a>
39   - </li>
40   - <li>
41   - <a href="${BASE}/wowza/list/1"><i class="fa fa-circle-o text-blue"></i>播出服务管理</a>
42   - </li>
43   - <li>
44   - <a href="${BASE}/signal/list/1"><i class="fa fa-circle-o text-red"></i>信源管理</a>
45   - </li>
46   - </c:if>
47   - <c:if test="${sessionScope.roleId=='2'}">
48   - <li class="header">UGC直播审查</li>
49   - <li>
50   - <a href="${BASE}/user/list/1"><i class="fa fa-circle-o text-yellow"></i>主播管理</a>
51   - </li>
52   - <li>
53   - <a href="${BASE}/check/list/1"><i class="fa fa-circle-o text-red"></i>直播审查</a>
54   - </li>
55   - <li>
56   - <a href="${BASE}/video/check/1"><i class="fa fa-circle-o text-green"></i>点播审查</a>
57   - </li>
58   - <li>
59   - <a href="${BASE}/live/alllive/1"><i class="fa fa-circle-o text-yellow"></i>直播管理</a>
60   - </li>
61   - <li>
62   - <a href="${BASE}/word/list"><i class="fa fa-circle-o text-yellow"></i>敏感词管理</a>
63   - </li>
64   - </c:if>
65   - </ul>
66   - </section>
67   - <!-- /.sidebar -->
  1 +<%@ page language="java" pageEncoding="utf-8"%>
  2 +<%@ include file="/pages/common/taglib.jsp"%>
  3 +<aside class="main-sidebar">
  4 + <section class="sidebar">
  5 + <div class="user-panel">
  6 + <div class="pull-left image">
  7 + <img src="${BASE}/static/assets/dist/img/user2-160x160.jpg"
  8 + class="img-circle" alt="User Image" />
  9 + </div>
  10 + <div class="pull-left info">
  11 + <p>
  12 + <a href="${BASE}/index">刘基城</a>
  13 + </p>
  14 + <i class="fa fa-circle text-success"></i>
  15 + <c:if test="${sessionScope.roleId=='1'}">超级管理员</c:if>
  16 + <c:if test="${sessionScope.roleId=='0'}">普通用户</c:if>
  17 + <c:if test="${sessionScope.roleId=='2'}">总编室用户</c:if>
  18 + </div>
  19 + </div>
  20 + <ul class="sidebar-menu">
  21 + <c:if test="${sessionScope.roleId=='1'}">
  22 + <li class="header">导航栏</li>
  23 + <li>
  24 + <a href="${BASE}/switch"><i class="fa fa-circle-o text-blue"></i>全局切换</a>
  25 + </li>
  26 + <li>
  27 + <a href="${BASE}/channel/monitor/1"><i class="fa fa-circle-o text-yellow"></i>直播监控</a>
  28 + </li>
  29 + <li>
  30 + <a href="${BASE}/activity/preload"><i class="fa fa-circle-o"></i>新增活动</a>
  31 + </li>
  32 + <li>
  33 + <a href="${BASE}/activity/list/1"><i class="fa fa-circle-o text-red"></i>活动管理</a>
  34 + </li>
  35 +
  36 + <li class="header">系统设置</li>
  37 + <li>
  38 + <a href="${BASE}/channel/list/1"><i class="fa fa-circle-o text-green"></i>频道管理</a>
  39 + </li>
  40 + <li>
  41 + <a href="${BASE}/wowza/list/1"><i class="fa fa-circle-o text-blue"></i>播出服务管理</a>
  42 + </li>
  43 + <li>
  44 + <a href="${BASE}/signal/list/1"><i class="fa fa-circle-o text-red"></i>信源管理</a>
  45 + </li>
  46 + </c:if>
  47 + <c:if test="${sessionScope.roleId=='2'}">
  48 + <li class="header">UGC直播审查</li>
  49 + <li>
  50 + <a href="${BASE}/user/list/1"><i class="fa fa-circle-o text-yellow"></i>主播管理</a>
  51 + </li>
  52 + <li>
  53 + <a href="${BASE}/check/list/1"><i class="fa fa-circle-o text-red"></i>直播审查</a>
  54 + </li>
  55 + <li>
  56 + <a href="${BASE}/video/check/1"><i class="fa fa-circle-o text-green"></i>点播审查</a>
  57 + </li>
  58 + <li>
  59 + <a href="${BASE}/live/alllive/1"><i class="fa fa-circle-o text-yellow"></i>直播管理</a>
  60 + </li>
  61 + <li>
  62 + <a href="${BASE}/word/list"><i class="fa fa-circle-o text-yellow"></i>敏感词管理</a>
  63 + </li>
  64 + </c:if>
  65 + </ul>
  66 + </section>
  67 + <!-- /.sidebar -->
68 68 </aside>
69 69 \ No newline at end of file
... ...
src/main/webapp/pages/live/all_live_management.jsp
1   -<%@ page language="java" pageEncoding="UTF-8"%>
2   -<%@ include file="/pages/common/taglib.jsp"%>
3   -<!DOCTYPE html>
4   -<html>
5   -<head>
6   -<meta charset="UTF-8">
7   -<title>直播管理 | <f:message key="common.title" /></title>
8   -<meta
9   - content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
10   - name='viewport'>
11   -<%@ include file="/pages/common/css.jsp"%>
12   -</head>
13   -<body class="skin-blue fixed ">
14   - <div class="wrapper">
15   - <%@ include file="/pages/common/top.jsp"%>
16   - <%@ include file="/pages/common/left.jsp"%>
17   - <div class="content-wrapper">
18   - <!-- Content Header (Page header) -->
19   - <section class="content-header">
20   - <h1>
21   - 直播管理<small class="label label-warning" style="display: none"
22   - id="info_tab_span"><i class="fa fa-bell-o"></i></small>
23   - </h1>
24   -
25   - <ol class="breadcrumb">
26   - <li><a><i class="fa fa-dashboard"></i> 首页</a></li>
27   - <li class="active">直播管理</li>
28   - </ol>
29   - </section>
30   - <!-- Main content -->
31   - <section class="content">
32   - <div class="row">
33   - <div class="col-xs-12">
34   - <div class="box box-warning">
35   - <div class="box-header with-border">
36   - <h3 class="box-title"></h3>
37   - <div class="box-tools">
38   - <div class="input-group">
39   - <form role="form" action="../../live/search/1" method="get">
40   - <div class="input-group">
41   - <input type="text" name="search_user_id" id="search_user_id"
42   - class="form-control input-sm" style="width: 150px;"
43   - placeholder="用户id" /> <input type="text"
44   - name="search_title" id="search_title"
45   - class="form-control input-sm" style="width: 150px;"
46   - placeholder="活动名称" />
47   - <button type="submit" class="btn btn-sm btn-default">
48   - <i class="fa fa-search"></i>搜索
49   - </button>
50   - </div>
51   - </form>
52   - </div>
53   - </div>
54   - </div>
55   - <!-- /.box-header -->
56   - <div class="box-body">
57   - <table class="table table-bordered">
58   - <tr>
59   - <th>活动ID</th>
60   - <th>stream_name</th>
61   - <th>活动名称</th>
62   - <th>开始时间</th>
63   - <th>结束时间</th>
64   - <th>状态</th>
65   - <th>下线</th>
66   - </tr>
67   - <c:forEach var="item" items="${tLive.recordList}"
68   - varStatus="stat">
69   - <tr>
70   - <td>${item.id}</td>
71   - <td>${item.t_user_id}_${item.uuid}</td>
72   - <td>${item.title}</td>
73   - <td><fmt:formatDate value="${item.start_time}"
74   - pattern="yyyy-MM-dd HH:mm" /></td>
75   - <td>${item.end_time}</td>
76   - <td><c:if test="${item.t_status_id==0}">
77   - <span class="badge bg-green">未开始</span>
78   - </c:if> <c:if test="${item.t_status_id==2}">
79   - <span class="badge bg-green">正常结束</span>
80   - </c:if> <c:if test="${item.t_status_id==1}">
81   - <span class="badge bg-yellow">直播中</span>
82   - </c:if> <c:if test="${item.t_status_id==-2}">
83   - <span class="badge bg-red">异常结束</span>
84   - </c:if>
85   -
86   - <c:if test="${item.t_status_id==-3}">
87   - <span class="badge bg-yellow">已经下线</span>
88   - </c:if>
89   -
90   - </td>
91   -
92   - <td>
93   - <%-- <button type="button" class="btn btn-xs btn-success" id="down" onclick="t_live_close('${item.id}','${item.uuid}');">
94   - <i class="icon-upload"></i>下线
95   - </button> --%>
96   -
97   - <button class="btn btn-danger btn-sm"
98   - onclick="t_live_close('${item.id}','${item.uuid}');">
99   - <i class="fa fa-close"></i>
100   - </button>
101   - </td>
102   - </tr>
103   - </c:forEach>
104   - </table>
105   - </div>
106   - <!-- /.box-body -->
107   - <div class="box-footer clearfix">
108   - <center>
109   - <tag:pager id="product_pager" pager="${tLive}" />
110   - </center>
111   - </div>
112   - </div>
113   - </div>
114   - </div>
115   - </section>
116   - </div>
117   - <%@ include file="/pages/common/bottom.jsp"%>
118   - </div>
119   - <%@ include file="/pages/common/js.jsp"%>
120   -</body>
121   -</html>
  1 +<%@ page language="java" pageEncoding="UTF-8"%>
  2 +<%@ include file="/pages/common/taglib.jsp"%>
  3 +<!DOCTYPE html>
  4 +<html>
  5 +<head>
  6 +<meta charset="UTF-8">
  7 +<title>直播管理 | <f:message key="common.title" /></title>
  8 +<meta
  9 + content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
  10 + name='viewport'>
  11 +<%@ include file="/pages/common/css.jsp"%>
  12 +</head>
  13 +<body class="skin-blue fixed ">
  14 + <div class="wrapper">
  15 + <%@ include file="/pages/common/top.jsp"%>
  16 + <%@ include file="/pages/common/left.jsp"%>
  17 + <div class="content-wrapper">
  18 + <!-- Content Header (Page header) -->
  19 + <section class="content-header">
  20 + <h1>
  21 + 直播管理<small class="label label-warning" style="display: none"
  22 + id="info_tab_span"><i class="fa fa-bell-o"></i></small>
  23 + </h1>
  24 +
  25 + <ol class="breadcrumb">
  26 + <li><a><i class="fa fa-dashboard"></i> 首页</a></li>
  27 + <li class="active">直播管理</li>
  28 + </ol>
  29 + </section>
  30 + <!-- Main content -->
  31 + <section class="content">
  32 + <div class="row">
  33 + <div class="col-xs-12">
  34 + <div class="box box-warning">
  35 + <div class="box-header with-border">
  36 + <h3 class="box-title"></h3>
  37 + <div class="box-tools">
  38 + <div class="input-group">
  39 + <form role="form" action="../../live/search/1" method="get">
  40 + <div class="input-group">
  41 + <input type="text" name="search_user_id" id="search_user_id"
  42 + class="form-control input-sm" style="width: 150px;"
  43 + placeholder="用户id" /> <input type="text"
  44 + name="search_title" id="search_title"
  45 + class="form-control input-sm" style="width: 150px;"
  46 + placeholder="活动名称" />
  47 + <button type="submit" class="btn btn-sm btn-default">
  48 + <i class="fa fa-search"></i>搜索
  49 + </button>
  50 + </div>
  51 + </form>
  52 + </div>
  53 + </div>
  54 + </div>
  55 + <!-- /.box-header -->
  56 + <div class="box-body">
  57 + <table class="table table-bordered">
  58 + <tr>
  59 + <th>活动ID</th>
  60 + <th>stream_name</th>
  61 + <th>活动名称</th>
  62 + <th>开始时间</th>
  63 + <th>结束时间</th>
  64 + <th>状态</th>
  65 + <th>下线</th>
  66 + </tr>
  67 + <c:forEach var="item" items="${tLive.recordList}"
  68 + varStatus="stat">
  69 + <tr>
  70 + <td>${item.id}</td>
  71 + <td>${item.t_user_id}_${item.uuid}</td>
  72 + <td>${item.title}</td>
  73 + <td><fmt:formatDate value="${item.start_time}"
  74 + pattern="yyyy-MM-dd HH:mm" /></td>
  75 + <td>${item.end_time}</td>
  76 + <td><c:if test="${item.t_status_id==0}">
  77 + <span class="badge bg-green">未开始</span>
  78 + </c:if> <c:if test="${item.t_status_id==2}">
  79 + <span class="badge bg-green">正常结束</span>
  80 + </c:if> <c:if test="${item.t_status_id==1}">
  81 + <span class="badge bg-yellow">直播中</span>
  82 + </c:if> <c:if test="${item.t_status_id==-2}">
  83 + <span class="badge bg-red">异常结束</span>
  84 + </c:if>
  85 +
  86 + <c:if test="${item.t_status_id==-3}">
  87 + <span class="badge bg-yellow">已经下线</span>
  88 + </c:if>
  89 +
  90 + </td>
  91 +
  92 + <td>
  93 + <%-- <button type="button" class="btn btn-xs btn-success" id="down" onclick="t_live_close('${item.id}','${item.uuid}');">
  94 + <i class="icon-upload"></i>下线
  95 + </button> --%>
  96 +
  97 + <button class="btn btn-danger btn-sm"
  98 + onclick="t_live_close('${item.id}','${item.uuid}');">
  99 + <i class="fa fa-close"></i>
  100 + </button>
  101 + </td>
  102 + </tr>
  103 + </c:forEach>
  104 + </table>
  105 + </div>
  106 + <!-- /.box-body -->
  107 + <div class="box-footer clearfix">
  108 + <center>
  109 + <tag:pager id="product_pager" pager="${tLive}" />
  110 + </center>
  111 + </div>
  112 + </div>
  113 + </div>
  114 + </div>
  115 + </section>
  116 + </div>
  117 + <%@ include file="/pages/common/bottom.jsp"%>
  118 + </div>
  119 + <%@ include file="/pages/common/js.jsp"%>
  120 +</body>
  121 +</html>
... ...
src/main/webapp/pages/live/live_add.jsp
1   -<%@ page language="java" pageEncoding="UTF-8"%>
2   -<%@ include file="/pages/common/taglib.jsp"%>
3   -<!DOCTYPE html>
4   -<html>
5   -<head>
6   -<meta charset="UTF-8">
7   -<title>新建活动 | <f:message key="common.title" /></title>
8   -<meta
9   - content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
10   - name='viewport'>
11   -<%@ include file="/pages/common/css.jsp"%>
12   -
13   -<style type="text/css">
14   - span.error{
15   - padding-left: 15px;
16   - color: red;
17   - }
18   - </style>
19   -<link
20   - href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
21   - rel="stylesheet">
22   - <script type="text/javascript" charset="utf-8" src="${BASE}/static/assets/ueditor/ueditor.config.js"></script>
23   - <script type="text/javascript" charset="utf-8" src="${BASE}/static/assets/ueditor/ueditor.all.min.js"> </script>
24   - <script type="text/javascript" charset="utf-8" src="${BASE}/static/assets/ueditor/lang/zh-cn/zh-cn.js"></script>
25   -
26   -</head>
27   -<body class="skin-blue fixed ">
28   - <div class="wrapper">
29   - <%@ include file="/pages/common/top.jsp"%>
30   - <%@ include file="/pages/common/left.jsp"%>
31   - <div class="content-wrapper">
32   - <section class="content-header">
33   - <h1>${empty tActivity.id ? '新建活动':'编辑活动'}
34   - <small>${tActivity.name}</small> <small class="label label-warning"
35   - style="display: none" id="info_tab_span"><i
36   - class="fa fa-bell-o"></i>保存成功</small>
37   - </h1>
38   - <ol class="breadcrumb">
39   - <li><a><i class="fa fa-dashboard"></i> 首页</a></li>
40   - <li class="active">新增活动</li>
41   - </ol>
42   - </section>
43   - <!-- Main content -->
44   - <section class="content">
45   -
46   - <form id="create_form" enctype="multipart/form-data" method="post" >
47   -
48   - <div class="row">
49   - <!-- right column -->
50   - <div class="col-md-12">
51   - <!-- general form elements disabled -->
52   - <div class="box box-warning">
53   - <div class="box-body">
54   - <div class="form-group">
55   - <label> 活动名称 </label>
56   - <div class="input-group">
57   - <span class="input-group-addon"><i class="fa fa-font"></i>
58   - </span> <input type="text" value="${tActivity.name }" name="name"
59   - id="name" class="form-control">
60   - <input type="text" id="activity_id" name="activity_id" value="${tActivity.id}" hidden="">
61   - </div>
62   - </div>
63   - <div class="form-group">
64   - <label> 直播时间 </label>
65   - <div class="row">
66   - <div class="col-lg-6">
67   - <div class="input-group">
68   - <span class="input-group-addon"> 开始时间 </span> <input
69   - type="text" class="form-control form_datetime"
70   - value="<fmt:formatDate value="${tActivity.start_time}" pattern="yyyy-MM-dd HH:mm"/>"
71   - name="start_time" id="start_time"
72   - data-inputmask="'alias': 'yyyy-MM-dd HH:mm'" data-mask="" />
73   - </div>
74   - </div>
75   - <div class="col-lg-6">
76   - <div class="input-group">
77   - <span class="input-group-addon"> 结束时间</span> <input
78   - type="text" class="form-control form_datetime"
79   - value="<fmt:formatDate value="${tActivity.end_time}" pattern="yyyy-MM-dd HH:mm"/>"
80   - name="end_time" id="end_time"
81   - data-inputmask="'alias': 'yyyy-MM-dd HH:mm'" data-mask="">
82   - </div>
83   - </div>
84   - </div>
85   - </div>
86   - <div class="form-group">
87   -
88   - <label>封面海报 </label>
89   - <div class="input-group">
90   - <span class="input-group-addon"><i
91   - class="fa fa-file-word-o"></i> </span> <input id="input-22" type="file" name="input-22" accept="image/*" class="file-loading">
92   -
93   - </div>
94   - </div>
95   - <div class="form-group">
96   - <label> 播出直播间 </label>
97   - <div class="box box-warning">
98   - <div class="box-body">
99   - <div class="form-group">
100   -
101   - <select class="form-control" name="t_default_video_id"
102   - id="t_default_video_id">
103   -
104   - <c:forEach var="item" items="${tRooms}"
105   - varStatus="stat">
106   - <option id="t_room_id_${item.id}" ${item.id==tLive.t_room_id ? 'selected="selected"':''} value="${item.id}">${item.name}</option>
107   - </c:forEach>
108   - </select>
109   - </div>
110   - </div>
111   - </div>
112   - </div>
113   -
114   - <div class="form-group">
115   -
116   - <label>活动简述 </label>
117   -
118   - <div class="input-group">
119   - <span class="input-group-addon"><i
120   - class="fa fa-file-word-o"></i> </span> <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
121   - </div>
122   - </div>
123   - <div class="box-footer">
124   - <button type="submit" id="t_activity_save_btn"
125   - name="t_activity_save_btn" class="btn btn-success">
126   - <i class="fa fa-save "></i> 保存
127   - </button>
128   - </div>
129   - </div>
130   - </div>
131   - </div>
132   - </div>
133   - </form>
134   - </div>
135   - </section>
136   - </div>
137   - </div>
138   - <%@ include file="/pages/common/bottom.jsp"%>
139   -</div>
140   - <!-- 信号选择结束 -->
141   - <%@ include file="/pages/common/js.jsp"%>
142   -
143   - <script type="text/javascript">
144   -
145   -
146   - $(function () {
147   - //Money Euro
148   - $("[data-mask]").inputmask();
149   - });
150   -
151   - $(function () {
152   - $("#datemask").inputmask("dd/mm/yyyy", {"placeholder": "dd/mm/yyyy"});
153   - //Datemask2 mm/dd/yyyy
154   - $("#datemask2").inputmask("mm/dd/yyyy", {"placeholder": "mm/dd/yyyy"});
155   - //Money Euro
156   - $("[data-mask]").inputmask();
157   -
158   - //Date range picker
159   - $('#reservation').daterangepicker();
160   - //Date range picker with time picker
161   - $('#reservationtime').daterangepicker({timePicker: true, timePickerIncrement: 30, format: 'MM/DD/YYYY h:mm A'});
162   - //Date range as a button
163   - $('#daterange-btn').daterangepicker(
164   - {
165   - ranges: {
166   - 'Today': [moment(), moment()],
167   - 'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
168   - 'Last 7 Days': [moment().subtract('days', 6), moment()],
169   - 'Last 30 Days': [moment().subtract('days', 29), moment()],
170   - 'This Month': [moment().startOf('month'), moment().endOf('month')],
171   - 'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
172   - },
173   - startDate: moment().subtract('days', 29),
174   - endDate: moment()
175   - },
176   - function (start, end) {
177   - $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
178   - }
179   - );
180   - });
181   - </script>
182   -
183   -
184   - <!-- Le javascript
185   - ================================================== -->
186   - <script
187   - src="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
188   -
189   - <script type="text/javascript">
190   - $(".form_datetime").datetimepicker({
191   - //format: "dd MM yyyy - hh:ii",
192   - format: "yyyy-mm-dd hh:ii",
193   - autoclose: true,
194   - todayBtn: true,
195   - pickerPosition: "bottom-right"
196   - });
197   -</script>
198   -
199   -<script type="text/javascript">
200   -
201   - //实例化编辑器
202   - //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
203   - var ue = UE.getEditor('editor',{
204   - autoHeightEnabled: true,
205   - autoFloatEnabled: true
206   - });
207   -
208   -
209   - function isFocus(e){
210   - alert(UE.getEditor('editor').isFocus());
211   - UE.dom.domUtils.preventDefault(e)
212   - }
213   - function setblur(e){
214   - UE.getEditor('editor').blur();
215   - UE.dom.domUtils.preventDefault(e)
216   - }
217   - function insertHtml() {
218   - var value = prompt('插入html代码', '');
219   - UE.getEditor('editor').execCommand('insertHtml', value)
220   - }
221   - function createEditor() {
222   - enableBtn();
223   - UE.getEditor('editor');
224   - }
225   - function getAllHtml() {
226   - alert(UE.getEditor('editor').getAllHtml())
227   - }
228   - function getContent() {
229   - var arr = [];
230   - arr.push("使用editor.getContent()方法可以获得编辑器的内容");
231   - arr.push("内容为:");
232   - arr.push(UE.getEditor('editor').getContent());
233   - alert(arr.join("\n"));
234   - }
235   - function getPlainTxt() {
236   - var arr = [];
237   - arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
238   - arr.push("内容为:");
239   - arr.push(UE.getEditor('editor').getPlainTxt());
240   - alert(arr.join('\n'))
241   - }
242   - function setContent(isAppendTo) {
243   - var arr = [];
244   - arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
245   - UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
246   - alert(arr.join("\n"));
247   - }
248   - function setDisabled() {
249   - UE.getEditor('editor').setDisabled('fullscreen');
250   - disableBtn("enable");
251   - }
252   -
253   - function setEnabled() {
254   - UE.getEditor('editor').setEnabled();
255   - enableBtn();
256   - }
257   -
258   - function getText() {
259   - //当你点击按钮时编辑区域已经失去了焦点,如果直接用getText将不会得到内容,所以要在选回来,然后取得内容
260   - var range = UE.getEditor('editor').selection.getRange();
261   - range.select();
262   - var txt = UE.getEditor('editor').selection.getText();
263   - alert(txt)
264   - }
265   -
266   - function getContentTxt() {
267   - var arr = [];
268   - arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
269   - arr.push("编辑器的纯文本内容为:");
270   - arr.push(UE.getEditor('editor').getContentTxt());
271   - alert(arr.join("\n"));
272   - }
273   - function hasContent() {
274   - var arr = [];
275   - arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
276   - arr.push("判断结果为:");
277   - arr.push(UE.getEditor('editor').hasContents());
278   - alert(arr.join("\n"));
279   - }
280   - function setFocus() {
281   - UE.getEditor('editor').focus();
282   - }
283   - function deleteEditor() {
284   - disableBtn();
285   - UE.getEditor('editor').destroy();
286   - }
287   - function disableBtn(str) {
288   - var div = document.getElementById('btns');
289   - var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
290   - for (var i = 0, btn; btn = btns[i++];) {
291   - if (btn.id == str) {
292   - UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
293   - } else {
294   - btn.setAttribute("disabled", "true");
295   - }
296   - }
297   - }
298   - function enableBtn() {
299   - var div = document.getElementById('btns');
300   - var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
301   - for (var i = 0, btn; btn = btns[i++];) {
302   - UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
303   - }
304   - }
305   -
306   - function getLocalData () {
307   - alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
308   - }
309   -
310   - function clearLocalData () {
311   - UE.getEditor('editor').execCommand( "clearlocaldata" );
312   - alert("已清空草稿箱")
313   - }
314   -
315   - $(document).on('ready', function() {
316   - $("#input-22").fileinput({
317   - previewFileType : "image",
318   - browseClass : "btn btn-success",
319   - browseLabel : "Pick Image",
320   - browseIcon : "<i class=\"glyphicon glyphicon-picture\"></i> ",
321   - removeClass : "btn btn-danger",
322   - removeLabel : "Delete",
323   - removeIcon : "<i class=\"glyphicon glyphicon-trash\"></i> ",
324   - uploadClass : "btn btn-info",
325   - uploadLabel : "Upload",
326   - uploadIcon : "<i class=\"glyphicon glyphicon-upload\"></i> "
327   - });
328   -
329   - $(function() {
330   - $('#create_form').ajaxForm({
331   - type : 'post',
332   - url : '../live/save',
333   - enctype : 'multipart/form-data',
334   - beforeSubmit : function() {
335   - return true;
336   - },
337   - error : function(XMLHttpRequest, textStatus, errorThrown) {
338   - alert("错误");
339   - },
340   - success : function(result) {
341   - location.href = '../live/list/1';
342   - }
343   - });
344   - });
345   - });
346   -
347   - /* $(function() {
348   - $('#create_form').ajaxForm({
349   - type : 'post',
350   - url : '../live/save',
351   - enctype : 'multipart/form-data',
352   - beforeSubmit : function() {
353   - var cms_column_ref_id=$("#input-22").val();
354   - if(cms_column_ref_id==''){
355   - alert("请输入栏目名称,点击获取,然后选择!");
356   - return false;
357   - }
358   - },
359   - error : function(XMLHttpRequest, textStatus, errorThrown) {
360   - alert("错误");
361   - },
362   - success : function(result) {
363   - location.href = '../live/list/1';
364   - }
365   - });
366   - });
367   - */
368   -
369   -</script>
370   -</body>
371   -</html>
  1 +<%@ page language="java" pageEncoding="UTF-8"%>
  2 +<%@ include file="/pages/common/taglib.jsp"%>
  3 +<!DOCTYPE html>
  4 +<html>
  5 +<head>
  6 +<meta charset="UTF-8">
  7 +<title>新建活动 | <f:message key="common.title" /></title>
  8 +<meta
  9 + content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
  10 + name='viewport'>
  11 +<%@ include file="/pages/common/css.jsp"%>
  12 +
  13 +<style type="text/css">
  14 + span.error{
  15 + padding-left: 15px;
  16 + color: red;
  17 + }
  18 + </style>
  19 +<link
  20 + href="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/css/datetimepicker.css"
  21 + rel="stylesheet">
  22 + <script type="text/javascript" charset="utf-8" src="${BASE}/static/assets/ueditor/ueditor.config.js"></script>
  23 + <script type="text/javascript" charset="utf-8" src="${BASE}/static/assets/ueditor/ueditor.all.min.js"> </script>
  24 + <script type="text/javascript" charset="utf-8" src="${BASE}/static/assets/ueditor/lang/zh-cn/zh-cn.js"></script>
  25 +
  26 +</head>
  27 +<body class="skin-blue fixed ">
  28 + <div class="wrapper">
  29 + <%@ include file="/pages/common/top.jsp"%>
  30 + <%@ include file="/pages/common/left.jsp"%>
  31 + <div class="content-wrapper">
  32 + <section class="content-header">
  33 + <h1>${empty tActivity.id ? '新建活动':'编辑活动'}
  34 + <small>${tActivity.name}</small> <small class="label label-warning"
  35 + style="display: none" id="info_tab_span"><i
  36 + class="fa fa-bell-o"></i>保存成功</small>
  37 + </h1>
  38 + <ol class="breadcrumb">
  39 + <li><a><i class="fa fa-dashboard"></i> 首页</a></li>
  40 + <li class="active">新增活动</li>
  41 + </ol>
  42 + </section>
  43 + <!-- Main content -->
  44 + <section class="content">
  45 +
  46 + <form id="create_form" enctype="multipart/form-data" method="post" >
  47 +
  48 + <div class="row">
  49 + <!-- right column -->
  50 + <div class="col-md-12">
  51 + <!-- general form elements disabled -->
  52 + <div class="box box-warning">
  53 + <div class="box-body">
  54 + <div class="form-group">
  55 + <label> 活动名称 </label>
  56 + <div class="input-group">
  57 + <span class="input-group-addon"><i class="fa fa-font"></i>
  58 + </span> <input type="text" value="${tActivity.name }" name="name"
  59 + id="name" class="form-control">
  60 + <input type="text" id="activity_id" name="activity_id" value="${tActivity.id}" hidden="">
  61 + </div>
  62 + </div>
  63 + <div class="form-group">
  64 + <label> 直播时间 </label>
  65 + <div class="row">
  66 + <div class="col-lg-6">
  67 + <div class="input-group">
  68 + <span class="input-group-addon"> 开始时间 </span> <input
  69 + type="text" class="form-control form_datetime"
  70 + value="<fmt:formatDate value="${tActivity.start_time}" pattern="yyyy-MM-dd HH:mm"/>"
  71 + name="start_time" id="start_time"
  72 + data-inputmask="'alias': 'yyyy-MM-dd HH:mm'" data-mask="" />
  73 + </div>
  74 + </div>
  75 + <div class="col-lg-6">
  76 + <div class="input-group">
  77 + <span class="input-group-addon"> 结束时间</span> <input
  78 + type="text" class="form-control form_datetime"
  79 + value="<fmt:formatDate value="${tActivity.end_time}" pattern="yyyy-MM-dd HH:mm"/>"
  80 + name="end_time" id="end_time"
  81 + data-inputmask="'alias': 'yyyy-MM-dd HH:mm'" data-mask="">
  82 + </div>
  83 + </div>
  84 + </div>
  85 + </div>
  86 + <div class="form-group">
  87 +
  88 + <label>封面海报 </label>
  89 + <div class="input-group">
  90 + <span class="input-group-addon"><i
  91 + class="fa fa-file-word-o"></i> </span> <input id="input-22" type="file" name="input-22" accept="image/*" class="file-loading">
  92 +
  93 + </div>
  94 + </div>
  95 + <div class="form-group">
  96 + <label> 播出直播间 </label>
  97 + <div class="box box-warning">
  98 + <div class="box-body">
  99 + <div class="form-group">
  100 +
  101 + <select class="form-control" name="t_default_video_id"
  102 + id="t_default_video_id">
  103 +
  104 + <c:forEach var="item" items="${tRooms}"
  105 + varStatus="stat">
  106 + <option id="t_room_id_${item.id}" ${item.id==tLive.t_room_id ? 'selected="selected"':''} value="${item.id}">${item.name}</option>
  107 + </c:forEach>
  108 + </select>
  109 + </div>
  110 + </div>
  111 + </div>
  112 + </div>
  113 +
  114 + <div class="form-group">
  115 +
  116 + <label>活动简述 </label>
  117 +
  118 + <div class="input-group">
  119 + <span class="input-group-addon"><i
  120 + class="fa fa-file-word-o"></i> </span> <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
  121 + </div>
  122 + </div>
  123 + <div class="box-footer">
  124 + <button type="submit" id="t_activity_save_btn"
  125 + name="t_activity_save_btn" class="btn btn-success">
  126 + <i class="fa fa-save "></i> 保存
  127 + </button>
  128 + </div>
  129 + </div>
  130 + </div>
  131 + </div>
  132 + </div>
  133 + </form>
  134 + </div>
  135 + </section>
  136 + </div>
  137 + </div>
  138 + <%@ include file="/pages/common/bottom.jsp"%>
  139 +</div>
  140 + <!-- 信号选择结束 -->
  141 + <%@ include file="/pages/common/js.jsp"%>
  142 +
  143 + <script type="text/javascript">
  144 +
  145 +
  146 + $(function () {
  147 + //Money Euro
  148 + $("[data-mask]").inputmask();
  149 + });
  150 +
  151 + $(function () {
  152 + $("#datemask").inputmask("dd/mm/yyyy", {"placeholder": "dd/mm/yyyy"});
  153 + //Datemask2 mm/dd/yyyy
  154 + $("#datemask2").inputmask("mm/dd/yyyy", {"placeholder": "mm/dd/yyyy"});
  155 + //Money Euro
  156 + $("[data-mask]").inputmask();
  157 +
  158 + //Date range picker
  159 + $('#reservation').daterangepicker();
  160 + //Date range picker with time picker
  161 + $('#reservationtime').daterangepicker({timePicker: true, timePickerIncrement: 30, format: 'MM/DD/YYYY h:mm A'});
  162 + //Date range as a button
  163 + $('#daterange-btn').daterangepicker(
  164 + {
  165 + ranges: {
  166 + 'Today': [moment(), moment()],
  167 + 'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
  168 + 'Last 7 Days': [moment().subtract('days', 6), moment()],
  169 + 'Last 30 Days': [moment().subtract('days', 29), moment()],
  170 + 'This Month': [moment().startOf('month'), moment().endOf('month')],
  171 + 'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
  172 + },
  173 + startDate: moment().subtract('days', 29),
  174 + endDate: moment()
  175 + },
  176 + function (start, end) {
  177 + $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
  178 + }
  179 + );
  180 + });
  181 + </script>
  182 +
  183 +
  184 + <!-- Le javascript
  185 + ================================================== -->
  186 + <script
  187 + src="http://www.bootcss.com/p/bootstrap-datetimepicker/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  188 +
  189 + <script type="text/javascript">
  190 + $(".form_datetime").datetimepicker({
  191 + //format: "dd MM yyyy - hh:ii",
  192 + format: "yyyy-mm-dd hh:ii",
  193 + autoclose: true,
  194 + todayBtn: true,
  195 + pickerPosition: "bottom-right"
  196 + });
  197 +</script>
  198 +
  199 +<script type="text/javascript">
  200 +
  201 + //实例化编辑器
  202 + //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
  203 + var ue = UE.getEditor('editor',{
  204 + autoHeightEnabled: true,
  205 + autoFloatEnabled: true
  206 + });
  207 +
  208 +
  209 + function isFocus(e){
  210 + alert(UE.getEditor('editor').isFocus());
  211 + UE.dom.domUtils.preventDefault(e)
  212 + }
  213 + function setblur(e){
  214 + UE.getEditor('editor').blur();
  215 + UE.dom.domUtils.preventDefault(e)
  216 + }
  217 + function insertHtml() {
  218 + var value = prompt('插入html代码', '');
  219 + UE.getEditor('editor').execCommand('insertHtml', value)
  220 + }
  221 + function createEditor() {
  222 + enableBtn();
  223 + UE.getEditor('editor');
  224 + }
  225 + function getAllHtml() {
  226 + alert(UE.getEditor('editor').getAllHtml())
  227 + }
  228 + function getContent() {
  229 + var arr = [];
  230 + arr.push("使用editor.getContent()方法可以获得编辑器的内容");
  231 + arr.push("内容为:");
  232 + arr.push(UE.getEditor('editor').getContent());
  233 + alert(arr.join("\n"));
  234 + }
  235 + function getPlainTxt() {
  236 + var arr = [];
  237 + arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
  238 + arr.push("内容为:");
  239 + arr.push(UE.getEditor('editor').getPlainTxt());
  240 + alert(arr.join('\n'))
  241 + }
  242 + function setContent(isAppendTo) {
  243 + var arr = [];
  244 + arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
  245 + UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
  246 + alert(arr.join("\n"));
  247 + }
  248 + function setDisabled() {
  249 + UE.getEditor('editor').setDisabled('fullscreen');
  250 + disableBtn("enable");
  251 + }
  252 +
  253 + function setEnabled() {
  254 + UE.getEditor('editor').setEnabled();
  255 + enableBtn();
  256 + }
  257 +
  258 + function getText() {
  259 + //当你点击按钮时编辑区域已经失去了焦点,如果直接用getText将不会得到内容,所以要在选回来,然后取得内容
  260 + var range = UE.getEditor('editor').selection.getRange();
  261 + range.select();
  262 + var txt = UE.getEditor('editor').selection.getText();
  263 + alert(txt)
  264 + }
  265 +
  266 + function getContentTxt() {
  267 + var arr = [];
  268 + arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
  269 + arr.push("编辑器的纯文本内容为:");
  270 + arr.push(UE.getEditor('editor').getContentTxt());
  271 + alert(arr.join("\n"));
  272 + }
  273 + function hasContent() {
  274 + var arr = [];
  275 + arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
  276 + arr.push("判断结果为:");
  277 + arr.push(UE.getEditor('editor').hasContents());
  278 + alert(arr.join("\n"));
  279 + }
  280 + function setFocus() {
  281 + UE.getEditor('editor').focus();
  282 + }
  283 + function deleteEditor() {
  284 + disableBtn();
  285 + UE.getEditor('editor').destroy();
  286 + }
  287 + function disableBtn(str) {
  288 + var div = document.getElementById('btns');
  289 + var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
  290 + for (var i = 0, btn; btn = btns[i++];) {
  291 + if (btn.id == str) {
  292 + UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
  293 + } else {
  294 + btn.setAttribute("disabled", "true");
  295 + }
  296 + }
  297 + }
  298 + function enableBtn() {
  299 + var div = document.getElementById('btns');
  300 + var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
  301 + for (var i = 0, btn; btn = btns[i++];) {
  302 + UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
  303 + }
  304 + }
  305 +
  306 + function getLocalData () {
  307 + alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
  308 + }
  309 +
  310 + function clearLocalData () {
  311 + UE.getEditor('editor').execCommand( "clearlocaldata" );
  312 + alert("已清空草稿箱")
  313 + }
  314 +
  315 + $(document).on('ready', function() {
  316 + $("#input-22").fileinput({
  317 + previewFileType : "image",
  318 + browseClass : "btn btn-success",
  319 + browseLabel : "Pick Image",
  320 + browseIcon : "<i class=\"glyphicon glyphicon-picture\"></i> ",
  321 + removeClass : "btn btn-danger",
  322 + removeLabel : "Delete",
  323 + removeIcon : "<i class=\"glyphicon glyphicon-trash\"></i> ",
  324 + uploadClass : "btn btn-info",
  325 + uploadLabel : "Upload",
  326 + uploadIcon : "<i class=\"glyphicon glyphicon-upload\"></i> "
  327 + });
  328 +
  329 + $(function() {
  330 + $('#create_form').ajaxForm({
  331 + type : 'post',
  332 + url : '../live/save',
  333 + enctype : 'multipart/form-data',
  334 + beforeSubmit : function() {
  335 + return true;
  336 + },
  337 + error : function(XMLHttpRequest, textStatus, errorThrown) {
  338 + alert("错误");
  339 + },
  340 + success : function(result) {
  341 + location.href = '../live/list/1';
  342 + }
  343 + });
  344 + });
  345 + });
  346 +
  347 + /* $(function() {
  348 + $('#create_form').ajaxForm({
  349 + type : 'post',
  350 + url : '../live/save',
  351 + enctype : 'multipart/form-data',
  352 + beforeSubmit : function() {
  353 + var cms_column_ref_id=$("#input-22").val();
  354 + if(cms_column_ref_id==''){
  355 + alert("请输入栏目名称,点击获取,然后选择!");
  356 + return false;
  357 + }
  358 + },
  359 + error : function(XMLHttpRequest, textStatus, errorThrown) {
  360 + alert("错误");
  361 + },
  362 + success : function(result) {
  363 + location.href = '../live/list/1';
  364 + }
  365 + });
  366 + });
  367 + */
  368 +
  369 +</script>
  370 +</body>
  371 +</html>
... ...