Commit d73a1ace684751a1531411079df7d4729e78778d
update
Showing
30 changed files
with
2631 additions
and
1891 deletions
Too many changes to show.
To preserve performance only 30 of 57 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.6"> | ||
| 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.6"> | ||
| 28 | + <attributes> | ||
| 29 | + <attribute name="maven.pomderived" value="true"/> | ||
| 30 | + </attributes> | ||
| 31 | + </classpathentry> | ||
| 32 | + <classpathentry kind="output" path="target/classes"/> | ||
| 33 | +</classpath> |
.settings/org.eclipse.core.resources.prefs
.settings/org.eclipse.jdt.core.prefs
| 1 | -eclipse.preferences.version=1 | ||
| 2 | -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
| 3 | -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate | ||
| 4 | -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
| 5 | -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
| 6 | -org.eclipse.jdt.core.compiler.compliance=1.6 | ||
| 7 | -org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
| 8 | -org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
| 9 | -org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
| 10 | -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
| 11 | -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
| 12 | -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
| 13 | -org.eclipse.jdt.core.compiler.source=1.6 | 1 | +eclipse.preferences.version=1 |
| 2 | +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
| 3 | +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate | ||
| 4 | +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
| 5 | +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
| 6 | +org.eclipse.jdt.core.compiler.compliance=1.6 | ||
| 7 | +org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
| 8 | +org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
| 9 | +org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
| 10 | +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
| 11 | +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
| 12 | +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
| 13 | +org.eclipse.jdt.core.compiler.source=1.6 |
.settings/org.eclipse.wst.common.component
| 1 | <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> | 1 | <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> |
| 2 | <wb-module deploy-name="cnlive_live_web"> | 2 | <wb-module deploy-name="cnlive_live_web"> |
| 3 | +<<<<<<< HEAD | ||
| 3 | <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> | 4 | <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> |
| 4 | <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> | 5 | <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> |
| 5 | <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> | 6 | <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> |
| 6 | <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> | 7 | <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> |
| 8 | +======= | ||
| 9 | + <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> | ||
| 10 | + <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> | ||
| 11 | + <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> | ||
| 12 | + <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/> | ||
| 13 | + <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> | ||
| 14 | +>>>>>>> b4b2ebc4ecf2a7e345294fae4376bf39cbfa9732 | ||
| 7 | <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources/i18n"/> | 15 | <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources/i18n"/> |
| 8 | <dependent-module archiveName="cnlive_live_model-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/cnlive_live_model/cnlive_live_model"> | 16 | <dependent-module archiveName="cnlive_live_model-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/cnlive_live_model/cnlive_live_model"> |
| 9 | <dependency-type>uses</dependency-type> | 17 | <dependency-type>uses</dependency-type> |
| 10 | </dependent-module> | 18 | </dependent-module> |
| 19 | +<<<<<<< HEAD | ||
| 11 | <dependent-module archiveName="smart-framework-4.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-framework/smart-framework"> | 20 | <dependent-module archiveName="smart-framework-4.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-framework/smart-framework"> |
| 12 | <dependency-type>uses</dependency-type> | 21 | <dependency-type>uses</dependency-type> |
| 13 | </dependent-module> | 22 | </dependent-module> |
| 23 | +======= | ||
| 24 | + <dependent-module archiveName="cnlive_ks3-1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/cnlive_ks3/cnlive_ks3"> | ||
| 25 | + <dependency-type>uses</dependency-type> | ||
| 26 | + </dependent-module> | ||
| 27 | + <dependent-module archiveName="smart-framework-4.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-framework/smart-framework"> | ||
| 28 | + <dependency-type>uses</dependency-type> | ||
| 29 | + </dependent-module> | ||
| 30 | + <dependent-module archiveName="smart-plugin-job-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-plugin-job/smart-plugin-job"> | ||
| 31 | + <dependency-type>uses</dependency-type> | ||
| 32 | + </dependent-module> | ||
| 33 | +>>>>>>> b4b2ebc4ecf2a7e345294fae4376bf39cbfa9732 | ||
| 14 | <dependent-module archiveName="smart-plugin-dbcp-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-plugin-dbcp/smart-plugin-dbcp"> | 34 | <dependent-module archiveName="smart-plugin-dbcp-1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/smart-plugin-dbcp/smart-plugin-dbcp"> |
| 15 | <dependency-type>uses</dependency-type> | 35 | <dependency-type>uses</dependency-type> |
| 16 | </dependent-module> | 36 | </dependent-module> |
.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.6"/> | ||
| 7 | +</faceted-project> |
WebContent/META-INF/MANIFEST.MF
src/main/java/com/cnlive/mz/live/action/CheckAction.java
| 1 | package com.cnlive.mz.live.action; | 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 | import org.smart4j.framework.dao.bean.Pager; | 3 | import org.smart4j.framework.dao.bean.Pager; |
| 9 | import org.smart4j.framework.ioc.annotation.Inject; | 4 | import org.smart4j.framework.ioc.annotation.Inject; |
| 10 | import org.smart4j.framework.mvc.DataContext; | 5 | import org.smart4j.framework.mvc.DataContext; |
| @@ -15,11 +10,8 @@ import org.smart4j.framework.mvc.bean.Result; | @@ -15,11 +10,8 @@ import org.smart4j.framework.mvc.bean.Result; | ||
| 15 | import org.smart4j.framework.mvc.bean.View; | 10 | import org.smart4j.framework.mvc.bean.View; |
| 16 | import org.smart4j.framework.util.CastUtil; | 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 | import com.cnlive.mz.live.common.LiveUtils; | 13 | import com.cnlive.mz.live.common.LiveUtils; |
| 21 | import com.cnlive.mz.live.entity.TLive; | 14 | import com.cnlive.mz.live.entity.TLive; |
| 22 | -import com.cnlive.mz.live.rest.BaseUtil; | ||
| 23 | import com.cnlive.mz.live.service.TCheckService; | 15 | import com.cnlive.mz.live.service.TCheckService; |
| 24 | import com.cnlive.mz.live.service.TLiveService; | 16 | import com.cnlive.mz.live.service.TLiveService; |
| 25 | import com.cnlive.mz.live.service.TRoomService; | 17 | import com.cnlive.mz.live.service.TRoomService; |
| @@ -34,89 +26,61 @@ public class CheckAction { | @@ -34,89 +26,61 @@ public class CheckAction { | ||
| 34 | @Inject | 26 | @Inject |
| 35 | private TCheckService tCheckService; | 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 | @Request.Post("/check/close/{id}") | 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 | return new Result(flag); | 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 | * @return | 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
| 1 | -/** | ||
| 2 | - * Project Name:cnlive_live_web | ||
| 3 | - * File Name:RoomAction.java | ||
| 4 | - * Package Name:com.cnlive.mz.live.action | ||
| 5 | - * Date:2016年4月25日下午1:12:48 | ||
| 6 | - * Copyright (c) 2016, cnlive.com All Rights Reserved. | ||
| 7 | - * | ||
| 8 | - */ | ||
| 9 | - | ||
| 10 | -package com.cnlive.mz.live.action; | ||
| 11 | - | ||
| 12 | -import java.io.UnsupportedEncodingException; | ||
| 13 | -import java.util.List; | ||
| 14 | - | ||
| 15 | -import org.smart4j.framework.dao.bean.Pager; | ||
| 16 | -import org.smart4j.framework.ioc.annotation.Inject; | ||
| 17 | -import org.smart4j.framework.mvc.DataContext; | ||
| 18 | -import org.smart4j.framework.mvc.annotation.Action; | ||
| 19 | -import org.smart4j.framework.mvc.annotation.Request; | ||
| 20 | -import org.smart4j.framework.mvc.bean.Multipart; | ||
| 21 | -import org.smart4j.framework.mvc.bean.Multiparts; | ||
| 22 | -import org.smart4j.framework.mvc.bean.Params; | ||
| 23 | -import org.smart4j.framework.mvc.bean.Result; | ||
| 24 | -import org.smart4j.framework.mvc.bean.View; | ||
| 25 | -import org.smart4j.framework.util.CastUtil; | ||
| 26 | - | ||
| 27 | -import com.cnlive.mz.commons.Constants; | ||
| 28 | -import com.cnlive.mz.commons.net.HttpReq; | ||
| 29 | -import com.cnlive.mz.live.common.LiveUtils; | ||
| 30 | -import com.cnlive.mz.live.entity.TLive; | ||
| 31 | -import com.cnlive.mz.live.entity.TRoom; | ||
| 32 | -import com.cnlive.mz.live.rest.BaseUtil; | ||
| 33 | -import com.cnlive.mz.live.service.TCheckService; | ||
| 34 | -import com.cnlive.mz.live.service.TLiveService; | ||
| 35 | -import com.cnlive.mz.live.service.TRoomService; | ||
| 36 | - | ||
| 37 | -/** | ||
| 38 | - * TODO: 机构主播和个人主播发起直播活动 <br/> | ||
| 39 | - * Date: 2016年4月25日 下午1:12:48 <br/> | ||
| 40 | - * | ||
| 41 | - * @author liujicheng | ||
| 42 | - * @version V1.0 | ||
| 43 | - * @since JDK 1.6 | ||
| 44 | - */ | ||
| 45 | -@Action | ||
| 46 | -public class LiveAction { | ||
| 47 | - @Inject | ||
| 48 | - private TLiveService tLiveService; | ||
| 49 | - @Inject | ||
| 50 | - private TRoomService tRoomService; | ||
| 51 | - @Inject | ||
| 52 | - private TCheckService tCheckService; | ||
| 53 | - | ||
| 54 | - @Request.Get("/live/preload") | ||
| 55 | - public View preload() { | ||
| 56 | - int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 57 | - View view = new View("live/live_add.jsp"); | ||
| 58 | - List<TRoom> tRooms = tRoomService.getTRooms(user_id); | ||
| 59 | - view.data("tRooms", tRooms); | ||
| 60 | - return view; | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - @Request.Get("/live/list/{page_number}") | ||
| 64 | - public View list(int page_number) { | ||
| 65 | - int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 66 | - System.out.println(user_id); | ||
| 67 | - Pager<TLive> tLive = tLiveService.getTLivePager(page_number, Constants.PAGE_SIZE, user_id); | ||
| 68 | - return new View("live/live_management.jsp").data("tLive", tLive); | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - @Request.Post("/live/save") | ||
| 72 | - public Result saveLive(Params params, Multiparts multiparts) { | ||
| 73 | - System.out.println(params + "....and....." + multiparts); | ||
| 74 | - int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 75 | - Multipart multipart = multiparts.getOne(); | ||
| 76 | - tLiveService.add(user_id, params, multipart); | ||
| 77 | - return new Result(false); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - @Request.Get("/live/edit/{id}") | ||
| 81 | - public View edit(int id) { | ||
| 82 | - TLive tLive = tLiveService.getTLiveById(id); | ||
| 83 | - TRoom tRoom = tRoomService.getTRoomById(Integer.parseInt(tLive.getLive_room_id())); | ||
| 84 | - List<TRoom> list = tRoomService.getTRooms(tLive.getT_user_id()); | ||
| 85 | - View view = new View("live/live_edit.jsp"); | ||
| 86 | - view.data("tActivity", tLive); | ||
| 87 | - view.data("tRoom", tRoom); | ||
| 88 | - view.data("tRooms", list); | ||
| 89 | - return view; | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - // | ||
| 93 | - @Request.Get("/live/preview/{id}") | ||
| 94 | - public View preview(int id) { | ||
| 95 | - TLive tLive = tLiveService.getTLiveById(id); | ||
| 96 | - TRoom tRoom = tRoomService.getTRoomById(Integer.parseInt(tLive.getLive_room_id())); | ||
| 97 | - View view = new View("live/live_preview.jsp"); | ||
| 98 | - view.data("tLive", tLive); | ||
| 99 | - view.data("tRoom", tRoom); | ||
| 100 | - return view; | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - @Request.Get("/check/list/{page_number}") | ||
| 104 | - public View check(int page_number) { | ||
| 105 | - int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 106 | - Pager<TLive> tLive = tLiveService.getTCheckLivePager(page_number, 12, user_id); | ||
| 107 | - View view = new View("check/monitor.jsp"); | ||
| 108 | - view.data("tLive", tLive); | ||
| 109 | - return view; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - // 置顶 | ||
| 113 | - @Request.Get("/check/top/{id}") | ||
| 114 | - public Result top(int id) { | ||
| 115 | - tLiveService.top(id); | ||
| 116 | - return new Result(true); | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - // 切断 | ||
| 120 | - @Request.Post("/check/cut/{id}") | ||
| 121 | - public Result cut(int id, Params params) throws UnsupportedEncodingException { | ||
| 122 | - String live_url = params.getString("live_url"); | ||
| 123 | - String video_uuid = params.getString("uuid"); | ||
| 124 | - if (live_url.isEmpty()) { | ||
| 125 | - return null; | ||
| 126 | - } else { | ||
| 127 | - int index = live_url.lastIndexOf("/"); | ||
| 128 | - String streamName = live_url.substring(index + 1); | ||
| 129 | - System.out.println("streamName===" + streamName); | ||
| 130 | - String accesskey = BaseUtil.getAccessKey(); | ||
| 131 | - accesskey = java.net.URLEncoder.encode(accesskey, "utf-8"); | ||
| 132 | - String add = "add"; | ||
| 133 | - String addsignature = BaseUtil.signature(add, streamName); | ||
| 134 | - String del = "del"; | ||
| 135 | - String delsignature = BaseUtil.signature(del, streamName); | ||
| 136 | - String expire = BaseUtil.getTimestamp(); | ||
| 137 | - System.out.println(expire + "---expire---"); | ||
| 138 | - // 断流。 | ||
| 139 | - try { | ||
| 140 | - addBlackList(addsignature, accesskey, expire, streamName); | ||
| 141 | - //delBlackList(delsignature, accesskey, expire, streamName); | ||
| 142 | - } catch (UnsupportedEncodingException e) { | ||
| 143 | - e.printStackTrace(); | ||
| 144 | - } | ||
| 145 | - // 直播通知 | ||
| 146 | - //tLiveService.notify(video_uuid, -1); | ||
| 147 | - boolean flag = tCheckService.closeLive(id); | ||
| 148 | - return new Result(flag); | ||
| 149 | - } | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - // 通过审核 | ||
| 153 | - @Request.Get("/check/pass/{id}") | ||
| 154 | - public Result pass(int id) { | ||
| 155 | - tLiveService.pass(id); | ||
| 156 | - return new Result(true); | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | - @Request.Post("/check/close/{id}/{uuid}") | ||
| 160 | - public Result coseLive(int id, String uuid) { | ||
| 161 | - boolean flag = tLiveService.closeLive(id, uuid); | ||
| 162 | - return new Result(flag); | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - /** | ||
| 166 | - * 添加到黑名单 | ||
| 167 | - * | ||
| 168 | - * @param signature | ||
| 169 | - * @param accesskey | ||
| 170 | - * @param expire | ||
| 171 | - * @param streamName | ||
| 172 | - * @return | ||
| 173 | - * @throws UnsupportedEncodingException | ||
| 174 | - */ | ||
| 175 | - public String addBlackList(String signature, String accesskey, String expire, String streamName) throws UnsupportedEncodingException { | ||
| 176 | - String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=" + signature + "&accesskey=" + accesskey + "&expire=" + expire | ||
| 177 | - + "&app=live&method=add&name=" + streamName; | ||
| 178 | - String jsonArrStr = HttpReq.getRequestWidthResult(url); | ||
| 179 | - int status = HttpReq.getRequest(url); | ||
| 180 | - System.out.println(status + "......and......" + jsonArrStr); | ||
| 181 | - return jsonArrStr; | ||
| 182 | - } | ||
| 183 | - | ||
| 184 | - /** | ||
| 185 | - * 从黑名单删除 | ||
| 186 | - * | ||
| 187 | - * @param signature | ||
| 188 | - * @param accesskey | ||
| 189 | - * @param expire | ||
| 190 | - * @param streamName | ||
| 191 | - * @return | ||
| 192 | - * @throws UnsupportedEncodingException | ||
| 193 | - */ | ||
| 194 | - public Object delBlackList(String signature, String accesskey, String expire, String streamName) throws UnsupportedEncodingException { | ||
| 195 | - String url = "http://cnlive.dashboard.ks-cdn.com/blacklist?signature=" + signature + "&accesskey=" + accesskey + "&expire=" + expire | ||
| 196 | - + "&app=live&method=del&name=" + streamName; | ||
| 197 | - String jsonArrStr = HttpReq.getRequestWidthResult(url); | ||
| 198 | - return jsonArrStr; | ||
| 199 | - | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - @Request.Get("/live/alllive/{page_number}") | ||
| 203 | - public View liveList(int page_number) { | ||
| 204 | - int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 205 | - Pager<TLive> tLive = tLiveService.getAllTLivePager(page_number, Constants.PAGE_SIZE); | ||
| 206 | - return new View("live/all_live_management.jsp").data("tLive", tLive); | ||
| 207 | - } | ||
| 208 | - | ||
| 209 | - @Request.Get("/live/search/{page_number}") | ||
| 210 | - public View search(int page_number, Params params) { | ||
| 211 | - int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 212 | - String t_user_id = params.getString("search_user_id"); | ||
| 213 | - String title = params.getString("search_title"); | ||
| 214 | - | ||
| 215 | - try { | ||
| 216 | - title = new String(title.trim().getBytes("ISO-8859-1"), "utf-8"); | ||
| 217 | - } catch (UnsupportedEncodingException e) { | ||
| 218 | - e.printStackTrace(); | ||
| 219 | - } | ||
| 220 | - | ||
| 221 | - Pager<TLive> tLive = tLiveService.getTLiveAllPager(page_number, Constants.PAGE_SIZE, t_user_id, title); | ||
| 222 | - return new View("live/all_live_management.jsp").data("tLive", tLive); | ||
| 223 | - } | ||
| 224 | - | ||
| 225 | - //live/epg | ||
| 226 | - | 1 | +package com.cnlive.mz.live.action; |
| 2 | + | ||
| 3 | +import java.io.IOException; | ||
| 4 | +import java.io.UnsupportedEncodingException; | ||
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.List; | ||
| 7 | +import java.util.Map; | ||
| 8 | + | ||
| 9 | +import javax.servlet.http.HttpServletResponse; | ||
| 10 | + | ||
| 11 | +import org.apache.commons.lang.StringUtils; | ||
| 12 | +import org.apache.log4j.Logger; | ||
| 13 | +import org.smart4j.framework.dao.bean.Pager; | ||
| 14 | +import org.smart4j.framework.ioc.annotation.Inject; | ||
| 15 | +import org.smart4j.framework.mvc.DataContext; | ||
| 16 | +import org.smart4j.framework.mvc.annotation.Action; | ||
| 17 | +import org.smart4j.framework.mvc.annotation.Request; | ||
| 18 | +import org.smart4j.framework.mvc.bean.Multipart; | ||
| 19 | +import org.smart4j.framework.mvc.bean.Multiparts; | ||
| 20 | +import org.smart4j.framework.mvc.bean.Params; | ||
| 21 | +import org.smart4j.framework.mvc.bean.Redirect; | ||
| 22 | +import org.smart4j.framework.mvc.bean.Result; | ||
| 23 | +import org.smart4j.framework.mvc.bean.ResultBean; | ||
| 24 | +import org.smart4j.framework.mvc.bean.View; | ||
| 25 | +import org.smart4j.framework.util.CastUtil; | ||
| 26 | + | ||
| 27 | +import com.cnlive.mz.commons.Constants; | ||
| 28 | +import com.cnlive.mz.commons.net.HttpReq; | ||
| 29 | +import com.cnlive.mz.live.common.LiveUtils; | ||
| 30 | +import com.cnlive.mz.live.entity.TChannel; | ||
| 31 | +import com.cnlive.mz.live.entity.TLive; | ||
| 32 | +import com.cnlive.mz.live.entity.TRoom; | ||
| 33 | +import com.cnlive.mz.live.service.TCheckService; | ||
| 34 | +import com.cnlive.mz.live.service.TLiveService; | ||
| 35 | +import com.cnlive.mz.live.service.TRoomService; | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | + * TODO: 机构主播和个人主播发起直播活动 <br/> | ||
| 39 | + * Date: 2016年4月25日 下午1:12:48 <br/> | ||
| 40 | + * | ||
| 41 | + * @author liujicheng | ||
| 42 | + * @version V1.0 | ||
| 43 | + * @since JDK 1.6 | ||
| 44 | + */ | ||
| 45 | +@Action | ||
| 46 | +public class LiveAction { | ||
| 47 | + | ||
| 48 | + private Logger log = Logger.getLogger("LiveAction"); | ||
| 49 | + @Inject | ||
| 50 | + private TLiveService tLiveService; | ||
| 51 | + @Inject | ||
| 52 | + private TRoomService tRoomService; | ||
| 53 | + @Inject | ||
| 54 | + private TCheckService tCheckService; | ||
| 55 | + | ||
| 56 | + @Request.Get("/live/preload") | ||
| 57 | + public View preload() { | ||
| 58 | + int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 59 | + View view = new View("live/live_add.jsp"); | ||
| 60 | + List<TRoom> tRooms = tRoomService.getTRooms(user_id); | ||
| 61 | + view.data("tRooms", tRooms); | ||
| 62 | + return view; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Request.Get("/live/list/{page_number}") | ||
| 66 | + public View list(int page_number) { | ||
| 67 | + int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 68 | + System.out.println(user_id); | ||
| 69 | + Pager<TLive> tLive = tLiveService.getTLivePager(page_number, Constants.PAGE_SIZE, user_id); | ||
| 70 | + return new View("live/live_management.jsp").data("tLive", tLive); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @Request.Post("/live/save") | ||
| 74 | + public Result saveLive(Params params, Multiparts multiparts) { | ||
| 75 | + System.out.println(params + "....and....." + multiparts); | ||
| 76 | + int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 77 | + Multipart multipart = multiparts.getOne(); | ||
| 78 | + tLiveService.add(user_id, params, multipart); | ||
| 79 | + return new Result(false); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Request.Get("/live/edit/{id}") | ||
| 83 | + public View edit(int id) { | ||
| 84 | + TLive tLive = tLiveService.getTLiveById(id); | ||
| 85 | + TRoom tRoom = tRoomService.getTRoomById(Integer.parseInt(tLive.getLive_room_id())); | ||
| 86 | + List<TRoom> list = tRoomService.getTRooms(tLive.getT_user_id()); | ||
| 87 | + View view = new View("live/live_edit.jsp"); | ||
| 88 | + view.data("tActivity", tLive); | ||
| 89 | + view.data("tRoom", tRoom); | ||
| 90 | + view.data("tRooms", list); | ||
| 91 | + return view; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + // | ||
| 95 | + @Request.Get("/live/preview/{id}") | ||
| 96 | + public View preview(int id) { | ||
| 97 | + TLive tLive = tLiveService.getTLiveById(id); | ||
| 98 | + TRoom tRoom = tRoomService.getTRoomById(Integer.parseInt(tLive.getLive_room_id())); | ||
| 99 | + View view = new View("live/live_preview.jsp"); | ||
| 100 | + view.data("tLive", tLive); | ||
| 101 | + view.data("tRoom", tRoom); | ||
| 102 | + return view; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @Request.Get("/live/alllive/{page_number}") | ||
| 106 | + public View liveList(int page_number) { | ||
| 107 | + int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 108 | + Pager<TLive> tLive = tLiveService.getAllTLivePager(page_number, Constants.PAGE_SIZE); | ||
| 109 | + return new View("live/all_live_management.jsp").data("tLive", tLive); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @Request.Get("/live/search/{page_number}") | ||
| 113 | + public View search(int page_number, Params params) { | ||
| 114 | + int user_id = CastUtil.castInt(DataContext.getRequest().getSession().getAttribute(LiveUtils.SESSION_KEY_ID)); | ||
| 115 | + System.out.println(user_id); | ||
| 116 | + System.out.println("...parmas..." + params); | ||
| 117 | + String t_user_id = params.getString("search_user_id"); | ||
| 118 | + String title = params.getString("search_title"); | ||
| 119 | + | ||
| 120 | + try { | ||
| 121 | + title = new String(title.trim().getBytes("ISO-8859-1"), "utf-8"); | ||
| 122 | + System.out.println("...title.." + title); | ||
| 123 | + } catch (UnsupportedEncodingException e) { | ||
| 124 | + e.printStackTrace(); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + Pager<TLive> tLive = tLiveService.getTLiveAllPager(page_number, Constants.PAGE_SIZE, t_user_id, title); | ||
| 128 | + System.out.println("tLive=====" + tLive); | ||
| 129 | + return new View("live/all_live_management.jsp").data("tLive", tLive); | ||
| 130 | + } | ||
| 131 | + | ||
| 227 | } | 132 | } |
| 228 | \ No newline at end of file | 133 | \ No newline at end of file |
src/main/java/com/cnlive/mz/live/action/UgcLiveAction.java
0 → 100644
| 1 | +/** | ||
| 2 | + * Project Name:cnlive_live_web | ||
| 3 | + * File Name:RoomAction.java | ||
| 4 | + * Package Name:com.cnlive.mz.live.action | ||
| 5 | + * Date:2016年4月25日下午1:12:48 | ||
| 6 | + * Copyright (c) 2016, cnlive.com All Rights Reserved. | ||
| 7 | + * | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +package com.cnlive.mz.live.action; | ||
| 11 | + | ||
| 12 | +import java.io.IOException; | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.Map; | ||
| 15 | + | ||
| 16 | +import javax.servlet.http.HttpServletResponse; | ||
| 17 | + | ||
| 18 | +import org.apache.commons.lang.StringUtils; | ||
| 19 | +import org.apache.log4j.Logger; | ||
| 20 | +import org.smart4j.framework.dao.bean.Pager; | ||
| 21 | +import org.smart4j.framework.ioc.annotation.Inject; | ||
| 22 | +import org.smart4j.framework.mvc.DataContext; | ||
| 23 | +import org.smart4j.framework.mvc.annotation.Action; | ||
| 24 | +import org.smart4j.framework.mvc.annotation.Request; | ||
| 25 | +import org.smart4j.framework.mvc.bean.Params; | ||
| 26 | +import org.smart4j.framework.mvc.bean.Redirect; | ||
| 27 | +import org.smart4j.framework.mvc.bean.ResultBean; | ||
| 28 | + | ||
| 29 | +import com.cnlive.mz.commons.net.HttpReq; | ||
| 30 | +import com.cnlive.mz.live.entity.TChannel; | ||
| 31 | +import com.cnlive.mz.live.entity.TLive; | ||
| 32 | +import com.cnlive.mz.live.service.TCheckService; | ||
| 33 | +import com.cnlive.mz.live.service.TRoomService; | ||
| 34 | +import com.cnlive.mz.live.service.UgcLiveService; | ||
| 35 | + | ||
| 36 | +@Action | ||
| 37 | +public class UgcLiveAction { | ||
| 38 | + | ||
| 39 | + private Logger log = Logger.getLogger("UgcLiveAction"); | ||
| 40 | + @Inject | ||
| 41 | + private UgcLiveService ugcLiveService; | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 1.0 获取直播活动信息接口Server.md | ||
| 46 | + * | ||
| 47 | + * @param params | ||
| 48 | + * @return | ||
| 49 | + */ | ||
| 50 | + @Request.Get("/live/epg/getLiveActivityPlayInfo4Server") | ||
| 51 | + public ResultBean getLiveActivityPlayInfo4Server(Params params) { | ||
| 52 | + ResultBean rb = new ResultBean(); | ||
| 53 | + String appId = params.getString("appId"); | ||
| 54 | + String activityId = params.getString("activityId"); | ||
| 55 | + String timestamp = params.getString("timestamp"); | ||
| 56 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityId)) { | ||
| 57 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 58 | + map.put("location", ""); | ||
| 59 | + rb.setData(map); | ||
| 60 | + rb.setErrorCode("200"); | ||
| 61 | + log.error("参数不正确"); | ||
| 62 | + rb.setErrorMessage("启动活动失败"); | ||
| 63 | + return rb; | ||
| 64 | + } else { | ||
| 65 | + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityId); | ||
| 66 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 67 | + map.put("activityId", activityId); | ||
| 68 | + map.put("location", tLive.getLive_url()); | ||
| 69 | + rb.setData(map); | ||
| 70 | + rb.setErrorCode("0"); | ||
| 71 | + rb.setErrorMessage("启动活动成功"); | ||
| 72 | + return rb; | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 1.3 创建直播活动接口.md | ||
| 78 | + * | ||
| 79 | + * @param params | ||
| 80 | + * @return | ||
| 81 | + */ | ||
| 82 | + @Request.Post("/live/epg/createActivity") | ||
| 83 | + public ResultBean create(Params params) { | ||
| 84 | + log.info(params); | ||
| 85 | + ResultBean rb = new ResultBean(); | ||
| 86 | + String appId = params.getString("appId"); | ||
| 87 | + String activityId = params.getString("activityId"); | ||
| 88 | + int isHorizontalScreen = params.getInt("isHorizontalScreen"); | ||
| 89 | + String channelID = params.getString("channelId"); | ||
| 90 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 91 | + if (StringUtils.isNotEmpty(appId) && StringUtils.isNotEmpty(activityId) && StringUtils.isNotEmpty(channelID) | ||
| 92 | + && StringUtils.isNotEmpty("" + isHorizontalScreen)) { | ||
| 93 | + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityId); | ||
| 94 | + if (tLive != null) { | ||
| 95 | + map.put("location", ""); | ||
| 96 | + rb.setData(map); | ||
| 97 | + rb.setErrorCode("500"); | ||
| 98 | + rb.setErrorMessage("创建活动失败,活动ID已存在"); | ||
| 99 | + log.error("创建活动失败,活动ID已存在"); | ||
| 100 | + return rb; | ||
| 101 | + } else { | ||
| 102 | + boolean flag = ugcLiveService.create(params); | ||
| 103 | + if (flag) { | ||
| 104 | + map.put("location", com.cnlive.mz.live.common.Constants.KS_HOST_UP_RTMP + channelID + "?vdoid=" + activityId); | ||
| 105 | + rb.setData(map); | ||
| 106 | + rb.setErrorCode("0"); | ||
| 107 | + rb.setErrorMessage("创建活动成功"); | ||
| 108 | + log.info("创建活动成功"); | ||
| 109 | + return rb; | ||
| 110 | + } else { | ||
| 111 | + map.put("location", ""); | ||
| 112 | + rb.setData(map); | ||
| 113 | + rb.setErrorCode("500"); | ||
| 114 | + rb.setErrorMessage("创建活动失败,保存数据库失败"); | ||
| 115 | + log.error("保存数据库失败"); | ||
| 116 | + return rb; | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + } else { | ||
| 120 | + map.put("location", ""); | ||
| 121 | + rb.setData(map); | ||
| 122 | + rb.setErrorCode("500"); | ||
| 123 | + rb.setErrorMessage("创建活动失败,参数不正确"); | ||
| 124 | + log.error("参数不正确"); | ||
| 125 | + return rb; | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * 1.4 启动直播活动接口.md | ||
| 131 | + * | ||
| 132 | + * @param params | ||
| 133 | + * @return | ||
| 134 | + */ | ||
| 135 | + @Request.Get("/live/epg/startActivity") | ||
| 136 | + public ResultBean start(Params params) { | ||
| 137 | + ResultBean rb = new ResultBean(); | ||
| 138 | + log.info(params); | ||
| 139 | + String appId = params.getString("appId"); | ||
| 140 | + String activityid = params.getString("activityId"); | ||
| 141 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 142 | + rb.setErrorCode("500"); | ||
| 143 | + rb.setErrorMessage("启动活动失败,参数不正确"); | ||
| 144 | + return rb; | ||
| 145 | + } else { | ||
| 146 | + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityid); | ||
| 147 | + if (tLive == null) { | ||
| 148 | + log.info("tLive为空......"); | ||
| 149 | + rb.setErrorCode("500"); | ||
| 150 | + rb.setErrorMessage("启动活动失败,活动对象为空"); | ||
| 151 | + return rb; | ||
| 152 | + } else { | ||
| 153 | + rb.setErrorCode("0"); | ||
| 154 | + rb.setErrorMessage("启动活动成功"); | ||
| 155 | + return rb; | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * 1.5 停止直播活动接口.md | ||
| 162 | + * | ||
| 163 | + * @param params | ||
| 164 | + * @return | ||
| 165 | + */ | ||
| 166 | + @Request.Get("/live/epg/stopActivity") | ||
| 167 | + public ResultBean stop(Params params) { | ||
| 168 | + log.info(params); | ||
| 169 | + ResultBean rb = new ResultBean(); | ||
| 170 | + String appId = params.getString("appId"); | ||
| 171 | + String activityid = params.getString("activityId"); | ||
| 172 | + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityid); | ||
| 173 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 174 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 175 | + map.put("location", ""); | ||
| 176 | + rb.setData(map); | ||
| 177 | + rb.setErrorCode("500"); | ||
| 178 | + rb.setErrorMessage("停止直播失败,参数不正确"); | ||
| 179 | + return rb; | ||
| 180 | + } else { | ||
| 181 | + if (tLive == null) { | ||
| 182 | + map.put("location", ""); | ||
| 183 | + rb.setData(map); | ||
| 184 | + rb.setErrorCode("500"); | ||
| 185 | + rb.setErrorMessage("停止直播失败,活动对象为空"); | ||
| 186 | + return rb; | ||
| 187 | + } else { | ||
| 188 | + String live_url = tLive.getLive_url(); | ||
| 189 | + int index = live_url.lastIndexOf("/"); | ||
| 190 | + String streamName = live_url.substring(index + 1); | ||
| 191 | + System.out.println("streamName===" + streamName); | ||
| 192 | + // 直播断流。 | ||
| 193 | + ugcLiveService.stop(appId,activityid); | ||
| 194 | + } | ||
| 195 | + map.put("location", tLive.getLive_url()); | ||
| 196 | + rb.setData(map); | ||
| 197 | + rb.setErrorCode("0"); | ||
| 198 | + rb.setErrorMessage("停止直播成功"); | ||
| 199 | + return rb; | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + /** | ||
| 204 | + * 1.6 获取直播活动列表接口.md | ||
| 205 | + * | ||
| 206 | + * @param params | ||
| 207 | + * @return | ||
| 208 | + */ | ||
| 209 | + @Request.Get("/live/epg/getActivity") | ||
| 210 | + public ResultBean getActivities(Params params) { | ||
| 211 | + ResultBean rb = new ResultBean(); | ||
| 212 | + String appId = params.getString("appId"); | ||
| 213 | + String pageNo = params.getString("pageNo"); | ||
| 214 | + String pageSize = params.getString("pageSize"); | ||
| 215 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(pageNo) || StringUtils.isEmpty(pageSize)) { | ||
| 216 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 217 | + map.put("location", ""); | ||
| 218 | + rb.setData(map); | ||
| 219 | + rb.setErrorCode("500"); | ||
| 220 | + rb.setErrorMessage("获取活动列表失败,参数不正确"); | ||
| 221 | + return rb; | ||
| 222 | + } else { | ||
| 223 | + Pager<TLive> tLive = ugcLiveService.getActivityPager(pageNo, pageSize, appId); | ||
| 224 | + if (tLive == null) { | ||
| 225 | + rb.setData(""); | ||
| 226 | + rb.setErrorCode("500"); | ||
| 227 | + rb.setErrorMessage("获取活动列表失败,活动对象为空"); | ||
| 228 | + return rb; | ||
| 229 | + } else { | ||
| 230 | + rb.setData(tLive); | ||
| 231 | + rb.setErrorCode("0"); | ||
| 232 | + rb.setErrorMessage("获取活动列表成功"); | ||
| 233 | + return rb; | ||
| 234 | + } | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + /** | ||
| 239 | + * 1.7 获取直播回放接口.md | ||
| 240 | + * | ||
| 241 | + * @param args | ||
| 242 | + */ | ||
| 243 | + @Request.Get("/live/epg/getActivityVodInfo") | ||
| 244 | + public ResultBean getActivityVodInfo(Params params) { | ||
| 245 | + ResultBean rb = new ResultBean(); | ||
| 246 | + String appId = params.getString("appId"); | ||
| 247 | + String activityid = params.getString("activityId"); | ||
| 248 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 249 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 250 | + map.put("location", ""); | ||
| 251 | + rb.setData(map); | ||
| 252 | + rb.setErrorCode("500"); | ||
| 253 | + rb.setErrorMessage("获取直播回放失败,参数不正确"); | ||
| 254 | + return rb; | ||
| 255 | + } else { | ||
| 256 | + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityid); | ||
| 257 | + if (tLive == null) { | ||
| 258 | + map.put("location", ""); | ||
| 259 | + rb.setData(map); | ||
| 260 | + rb.setErrorCode("500"); | ||
| 261 | + rb.setErrorMessage("获取直播回放失败,活动对象为空"); | ||
| 262 | + return rb; | ||
| 263 | + } else { | ||
| 264 | + map.put("location", tLive.getPlayback_url()); | ||
| 265 | + rb.setData(map); | ||
| 266 | + rb.setErrorCode("0"); | ||
| 267 | + rb.setErrorMessage("获取直播回放成功"); | ||
| 268 | + return rb; | ||
| 269 | + } | ||
| 270 | + } | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + /** | ||
| 274 | + * 1.7 获取直播回放接口.md | ||
| 275 | + * | ||
| 276 | + * @param args | ||
| 277 | + */ | ||
| 278 | + @Request.Get("/live/epg/liveplayByAPP") | ||
| 279 | + public ResultBean liveplayByAPP(Params params) { | ||
| 280 | + log.info(params); | ||
| 281 | + ResultBean rb = new ResultBean(); | ||
| 282 | + String appId = params.getString("appId"); | ||
| 283 | + String activityid = params.getString("activityId"); | ||
| 284 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 285 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 286 | + map.put("location", ""); | ||
| 287 | + rb.setData(map); | ||
| 288 | + rb.setErrorCode("500"); | ||
| 289 | + rb.setErrorMessage("获取直播回放失败,参数不正确"); | ||
| 290 | + return rb; | ||
| 291 | + } else { | ||
| 292 | + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityid); | ||
| 293 | + if (tLive == null) { | ||
| 294 | + map.put("location", ""); | ||
| 295 | + rb.setData(map); | ||
| 296 | + rb.setErrorCode("500"); | ||
| 297 | + rb.setErrorMessage("获取直播回放失败,活动对象为空"); | ||
| 298 | + return rb; | ||
| 299 | + } else { | ||
| 300 | + map.put("location", tLive.getPlayback_url()); | ||
| 301 | + rb.setData(map); | ||
| 302 | + rb.setErrorCode("0"); | ||
| 303 | + rb.setErrorMessage("获取直播回放成功"); | ||
| 304 | + return rb; | ||
| 305 | + } | ||
| 306 | + } | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + /** | ||
| 310 | + * 1.8 获取APP直播URL接口.md | ||
| 311 | + * | ||
| 312 | + * @param params | ||
| 313 | + * @return 302 跳转播放地址 | ||
| 314 | + */ | ||
| 315 | + @Request.Get("/live/epg/play/app") | ||
| 316 | + public Redirect appURL(Params params) throws IOException { | ||
| 317 | + log.info(params); | ||
| 318 | + Redirect r = new Redirect(); | ||
| 319 | + String c = "http://wideo03.cnlive.com/video/data1/2016/0821/143844/800/8352b125fc404807851daa21d7e8f417_143844_800.m3u8"; | ||
| 320 | + String appId = params.getString("appId"); | ||
| 321 | + String activityid = params.getString("activityId"); | ||
| 322 | + String isHLS = params.getString("isHLS"); | ||
| 323 | + if (StringUtils.isEmpty(activityid)) { | ||
| 324 | + // sdk 请求 | ||
| 325 | + if (appId.isEmpty()) { | ||
| 326 | + appId = params.getString("sp_id"); | ||
| 327 | + } | ||
| 328 | + String channelID = params.getString("channelID"); | ||
| 329 | + TLive tLive = ugcLiveService.selectByRelationId(channelID); | ||
| 330 | + TChannel tchannel = ugcLiveService.selectChannel(tLive.getRelation_id()); | ||
| 331 | + if (tchannel != null) { | ||
| 332 | + // pgc直播 | ||
| 333 | + r.setRedirectUrl("http://ips.cnlive.com/IPS/liveplayByAPP.action?appId=" + appId + "&channelID=" + tLive.getRelation_id()); | ||
| 334 | + } else { | ||
| 335 | + // ugc直播 | ||
| 336 | + if (StringUtils.isNotEmpty(isHLS) && isHLS.equals("1")) { | ||
| 337 | + r.setRedirectUrl(tLive.getHls_live_url()); | ||
| 338 | + } else { | ||
| 339 | + r.setRedirectUrl(tLive.getLive_url()); | ||
| 340 | + } | ||
| 341 | + // r.setRedirectUrl(c); | ||
| 342 | + } | ||
| 343 | + } else { | ||
| 344 | + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityid); | ||
| 345 | + TChannel tchannel = ugcLiveService.selectChannel(tLive.getRelation_id()); | ||
| 346 | + if (tchannel != null) { | ||
| 347 | + // pgc直播 | ||
| 348 | + r.setRedirectUrl("http://ips.cnlive.com/IPS/liveplayByAPP.action?appId=" + appId + "&channelID=" + tLive.getRelation_id()); | ||
| 349 | + } else { | ||
| 350 | + // ugc直播 | ||
| 351 | + if (StringUtils.isNotEmpty(isHLS) && isHLS.equals("1")) { | ||
| 352 | + r.setRedirectUrl(tLive.getHls_live_url()); | ||
| 353 | + } else { | ||
| 354 | + r.setRedirectUrl(tLive.getLive_url()); | ||
| 355 | + } | ||
| 356 | + // r.setRedirectUrl(c); | ||
| 357 | + } | ||
| 358 | + } | ||
| 359 | + return r; | ||
| 360 | + } | ||
| 361 | + | ||
| 362 | + /** | ||
| 363 | + * 1.9 获取H5直播URL接口.md | ||
| 364 | + * | ||
| 365 | + * @param params | ||
| 366 | + * @return | ||
| 367 | + */ | ||
| 368 | + @Request.Get("/live/epg/play/h5") | ||
| 369 | + public ResultBean h5URL(Params params) { | ||
| 370 | + HttpServletResponse response = DataContext.getResponse(); | ||
| 371 | + ResultBean rb = new ResultBean(); | ||
| 372 | + String appId = params.getString("appId"); | ||
| 373 | + String activityid = params.getString("activityId"); | ||
| 374 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 375 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 376 | + map.put("location", ""); | ||
| 377 | + rb.setData(map); | ||
| 378 | + rb.setErrorCode("500"); | ||
| 379 | + rb.setErrorMessage("启动h5活动失败"); | ||
| 380 | + return rb; | ||
| 381 | + } else { | ||
| 382 | + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityid); | ||
| 383 | + if (tLive == null) { | ||
| 384 | + map.put("location", ""); | ||
| 385 | + rb.setData(map); | ||
| 386 | + rb.setErrorCode("500"); | ||
| 387 | + rb.setErrorMessage("启动h5活动失败,活动对象为空"); | ||
| 388 | + return rb; | ||
| 389 | + } else { | ||
| 390 | + TChannel tchannel = ugcLiveService.selectChannel(tLive.getRelation_id()); | ||
| 391 | + if (tchannel != null) { | ||
| 392 | + // 重定向到h5....... | ||
| 393 | + redirect(response, "http://ips.cnlive.com/IPS/liveplayByH5?appId=" + appId + "&channelID=" + tLive.getRelation_id()); | ||
| 394 | + map.put("location", ""); | ||
| 395 | + rb.setData(map); | ||
| 396 | + rb.setErrorCode("0"); | ||
| 397 | + rb.setErrorMessage("302重定向到h5"); | ||
| 398 | + return rb; | ||
| 399 | + } else { | ||
| 400 | + map.put("location", tLive.getLive_url()); | ||
| 401 | + rb.setData(map); | ||
| 402 | + rb.setErrorCode("0"); | ||
| 403 | + rb.setErrorMessage("启动h5活动成功"); | ||
| 404 | + return rb; | ||
| 405 | + } | ||
| 406 | + } | ||
| 407 | + } | ||
| 408 | + | ||
| 409 | + } | ||
| 410 | + | ||
| 411 | + /** | ||
| 412 | + * 2.0 获取SWF直播URL接口.md | ||
| 413 | + * | ||
| 414 | + * @param params | ||
| 415 | + * @return | ||
| 416 | + */ | ||
| 417 | + @Request.Get("/live/epg/play/swf") | ||
| 418 | + public ResultBean swfURL(Params params) { | ||
| 419 | + HttpServletResponse response = DataContext.getResponse(); | ||
| 420 | + ResultBean rb = new ResultBean(); | ||
| 421 | + String appId = params.getString("appId"); | ||
| 422 | + String activityid = params.getString("activityId"); | ||
| 423 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 424 | + if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(activityid)) { | ||
| 425 | + map.put("location", ""); | ||
| 426 | + rb.setData(map); | ||
| 427 | + rb.setErrorCode("500"); | ||
| 428 | + rb.setErrorMessage("启动swf活动失败"); | ||
| 429 | + return rb; | ||
| 430 | + } else { | ||
| 431 | + TLive tLive = ugcLiveService.getTLiveByActivityId(appId, activityid); | ||
| 432 | + if (tLive == null) { | ||
| 433 | + map.put("location", ""); | ||
| 434 | + rb.setData(map); | ||
| 435 | + rb.setErrorCode("500"); | ||
| 436 | + rb.setErrorMessage("启动swf活动失败,活动对象为空"); | ||
| 437 | + return rb; | ||
| 438 | + } else { | ||
| 439 | + TChannel tchannel = ugcLiveService.selectChannel(tLive.getRelation_id()); | ||
| 440 | + rb.setData(map); | ||
| 441 | + rb.setErrorCode("0"); | ||
| 442 | + if (tchannel != null) { | ||
| 443 | + // 302重定向到swf....... | ||
| 444 | + redirect(response, "http://ips.cnlive.com/IPS/liveplayBySWF.action?appId=" + appId + "&channelID=" + tLive.getRelation_id()); | ||
| 445 | + map.put("location", ""); | ||
| 446 | + rb.setErrorMessage("302重定向到swf"); | ||
| 447 | + return rb; | ||
| 448 | + } else { | ||
| 449 | + map.put("location", tLive.getLive_url()); | ||
| 450 | + rb.setErrorMessage("启动swf活动成功"); | ||
| 451 | + return rb; | ||
| 452 | + } | ||
| 453 | + } | ||
| 454 | + } | ||
| 455 | + } | ||
| 456 | + | ||
| 457 | + @Request.Post("/live/epg/error500") | ||
| 458 | + public ResultBean error(Params params) { | ||
| 459 | + ResultBean rb = new ResultBean(); | ||
| 460 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 461 | + map.put("location", ""); | ||
| 462 | + rb.setData(map); | ||
| 463 | + rb.setErrorCode("500"); | ||
| 464 | + rb.setErrorMessage("失败"); | ||
| 465 | + return rb; | ||
| 466 | + } | ||
| 467 | + | ||
| 468 | + public static void redirect(HttpServletResponse response, String redirectUrl) { | ||
| 469 | + try { | ||
| 470 | + response.setContentType("application/mpegurl"); | ||
| 471 | + response.setStatus(302); | ||
| 472 | + response.setHeader("Location", redirectUrl); | ||
| 473 | + response.setHeader("Connection", "close"); | ||
| 474 | + } catch (Exception e) { | ||
| 475 | + throw new RuntimeException(e); | ||
| 476 | + } | ||
| 477 | + } | ||
| 478 | + | ||
| 479 | + public static void main(String[] args) { | ||
| 480 | + | ||
| 481 | + /* | ||
| 482 | + * NameValuePair[] nvp = new NameValuePair[6]; NameValuePair nv1 = new | ||
| 483 | + * NameValuePair(); nv1.setName("appId"); nv1.setValue("123"); nvp[0] = | ||
| 484 | + * nv1; NameValuePair nv2 = new NameValuePair(); | ||
| 485 | + * nv2.setName("activityId"); nv2.setValue("234e"); nvp[1] = nv2; | ||
| 486 | + * NameValuePair nv3 = new NameValuePair(); nv3.setName("activityName"); | ||
| 487 | + * nv3.setValue("ee"); nvp[2] = nv3; NameValuePair nv4 = new | ||
| 488 | + * NameValuePair(); nv4.setName("activityStatus"); nv4.setValue("11"); | ||
| 489 | + * nvp[3] = nv4; NameValuePair nv5 = new NameValuePair(); | ||
| 490 | + * nv5.setName("isHorizontalScreen"); nv5.setValue("321"); nvp[4] = nv5; | ||
| 491 | + * NameValuePair nv6 = new NameValuePair(); nv6.setName("channelId"); | ||
| 492 | + * nv6.setValue("ww"); nvp[5] = nv6; String ss = | ||
| 493 | + * HttpReq.postRequestWidthResult( | ||
| 494 | + * "http://bc.cnlive.com/live/epg/createActivity", nvp); | ||
| 495 | + * System.out.println(ss); <<<<<<< HEAD String aa = HttpReq | ||
| 496 | + * .getRequestWidthResult( | ||
| 497 | + * "http://bc.cnlive.com/live/epg/startActivity?appId=123&activityId=234" | ||
| 498 | + * ); System.out.println(aa); | ||
| 499 | + */ | ||
| 500 | + String aa = HttpReq.getRequestWidthResult("http://bc.cnlive.com/live/epg/startActivity?appId=123&activityId=234"); | ||
| 501 | + System.out.println(aa); | ||
| 502 | + } | ||
| 503 | +} | ||
| 0 | \ No newline at end of file | 504 | \ No newline at end of file |
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,7 +115,7 @@ public class VideoAction { | ||
| 115 | } else { | 115 | } else { |
| 116 | tLive.setDirect(Integer.parseInt(direct)); | 116 | tLive.setDirect(Integer.parseInt(direct)); |
| 117 | } | 117 | } |
| 118 | - tLive.setLive_url(Constants.KS_HOST_RTMP + tLive.getT_user_id() + "_" + uuid); | 118 | + tLive.setLive_url(Constants.KS_HOST_RTMP + tLive.getT_user_id() ); |
| 119 | success = tLiveService.startLive(tLive); | 119 | success = tLiveService.startLive(tLive); |
| 120 | } | 120 | } |
| 121 | data.put("video_uuid", uuid); | 121 | data.put("video_uuid", uuid); |
src/main/java/com/cnlive/mz/live/action/VodIpsAction.java
| 1 | -package com.cnlive.mz.live.action; | ||
| 2 | - | ||
| 3 | -import java.util.HashMap; | ||
| 4 | -import java.util.Map; | ||
| 5 | - | ||
| 6 | -import org.apache.log4j.Logger; | ||
| 7 | -import org.apache.xalan.lib.Redirect; | ||
| 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 | - | ||
| 12 | - | ||
| 13 | -/** | ||
| 14 | - * 点播调度 | ||
| 15 | - * @author adm | ||
| 16 | - * | ||
| 17 | - */ | ||
| 18 | -@Action | ||
| 19 | -public class VodIpsAction { | ||
| 20 | - | ||
| 21 | - private Logger log = Logger.getLogger("VodIpsAction"); | ||
| 22 | - | ||
| 23 | - @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"); | ||
| 27 | - return r; | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - @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"); | ||
| 34 | - return r; | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - @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"); | ||
| 42 | - rb.setData(map); | ||
| 43 | - rb.setErrorCode("0"); | ||
| 44 | - rb.setErrorMessage("成功"); | ||
| 45 | - return rb; | ||
| 46 | - } | ||
| 47 | -} | 1 | +package com.cnlive.mz.live.action; |
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.apache.log4j.Logger; | ||
| 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.Redirect; | ||
| 12 | +import org.smart4j.framework.mvc.bean.ResultBean; | ||
| 13 | + | ||
| 14 | +import com.cnlive.mz.live.service.VodIpsServer; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * 点播调度 | ||
| 18 | + * | ||
| 19 | + * @author adm | ||
| 20 | + * | ||
| 21 | + */ | ||
| 22 | +@Action | ||
| 23 | +public class VodIpsAction { | ||
| 24 | + @Inject | ||
| 25 | + VodIpsServer vodIpsServer; | ||
| 26 | + | ||
| 27 | + private Logger log = Logger.getLogger("VodIpsAction"); | ||
| 28 | + | ||
| 29 | + @Request.Get("/vodips/h5/{id}") | ||
| 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); | ||
| 36 | + return r; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Request.Get("/vodips/app/{id}") | ||
| 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); | ||
| 46 | + return r; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @Request.Get("/vodips/flash/{id}") | ||
| 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); | ||
| 57 | + rb.setData(map); | ||
| 58 | + rb.setErrorCode("0"); | ||
| 59 | + rb.setErrorMessage("成功"); | ||
| 60 | + return rb; | ||
| 61 | + } | ||
| 62 | +} |
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/Client.java
0 → 100644
| 1 | +package com.cnlive.socket; | ||
| 2 | + | ||
| 3 | +import java.io.BufferedReader; | ||
| 4 | +import java.io.IOException; | ||
| 5 | +import java.io.InputStreamReader; | ||
| 6 | +import java.io.PrintWriter; | ||
| 7 | +import java.net.Socket; | ||
| 8 | +import java.net.UnknownHostException; | ||
| 9 | + | ||
| 10 | +public class Client { | ||
| 11 | + Socket client; | ||
| 12 | + PrintWriter pw; | ||
| 13 | + public Client() throws UnknownHostException, IOException { | ||
| 14 | + client=new Socket("bc.cnlive.com",65432); | ||
| 15 | + pw=new PrintWriter(client.getOutputStream()); | ||
| 16 | + BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); | ||
| 17 | + pw.write(br.readLine()); | ||
| 18 | + pw.close(); | ||
| 19 | + br.close(); | ||
| 20 | + } | ||
| 21 | + public static void main(String[] args) { | ||
| 22 | + try { | ||
| 23 | + new Client(); | ||
| 24 | + } catch (UnknownHostException e) { | ||
| 25 | + e.printStackTrace(); | ||
| 26 | + } catch (IOException e) { | ||
| 27 | + e.printStackTrace(); | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | +} | ||
| 0 | \ No newline at end of file | 31 | \ No newline at end of file |
src/main/java/com/cnlive/socket/SocketServer.java
0 → 100644
| 1 | +package com.cnlive.socket; | ||
| 2 | + | ||
| 3 | +import java.io.IOException; | ||
| 4 | +import java.io.InputStream; | ||
| 5 | +import java.io.OutputStream; | ||
| 6 | +import java.net.ServerSocket; | ||
| 7 | +import java.net.Socket; | ||
| 8 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 9 | + | ||
| 10 | +public class SocketServer { | ||
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * 要处理客户端发来的对象,并返回一个对象,可实现该接口。 | ||
| 14 | + */ | ||
| 15 | + public interface ObjectAction { | ||
| 16 | + Object doAction(Object rev); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /* | ||
| 20 | + * public static final class DefaultObjectAction implements ObjectAction{ | ||
| 21 | + * public Object doAction(Object rev) { System.out.println("处理并返回:"+rev); | ||
| 22 | + * return rev; } } | ||
| 23 | + */ | ||
| 24 | + | ||
| 25 | + public static void main(String[] args) { | ||
| 26 | + int port = 65432; | ||
| 27 | + SocketServer server = new SocketServer(port); | ||
| 28 | + server.start(); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + private int port; | ||
| 32 | + private volatile boolean running = false; | ||
| 33 | + private long receiveTimeDelay = 7000; | ||
| 34 | + private ConcurrentHashMap<Class, ObjectAction> actionMapping = new ConcurrentHashMap<Class, ObjectAction>(); | ||
| 35 | + private Thread connWatchDog; | ||
| 36 | + | ||
| 37 | + public SocketServer(int port) { | ||
| 38 | + this.port = port; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public void start() { | ||
| 42 | + if (running) | ||
| 43 | + return; | ||
| 44 | + running = true; | ||
| 45 | + connWatchDog = new Thread(new ConnWatchDog()); | ||
| 46 | + connWatchDog.start(); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @SuppressWarnings("deprecation") | ||
| 50 | + public void stop() { | ||
| 51 | + if (running) | ||
| 52 | + running = false; | ||
| 53 | + if (connWatchDog != null) | ||
| 54 | + connWatchDog.stop(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public void addActionMap(Class<Object> cls, ObjectAction action) { | ||
| 58 | + actionMapping.put(cls, action); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + class ConnWatchDog implements Runnable { | ||
| 62 | + public void run() { | ||
| 63 | + try { | ||
| 64 | + ServerSocket ss = new ServerSocket(port, 5); | ||
| 65 | + while (running) { | ||
| 66 | + System.out.println("等待客服端 请求。。。"); | ||
| 67 | + Socket s = ss.accept(); | ||
| 68 | + new Thread(new SocketAction(s)).start(); | ||
| 69 | + } | ||
| 70 | + } catch (IOException e) { | ||
| 71 | + e.printStackTrace(); | ||
| 72 | + SocketServer.this.stop(); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + class SocketAction implements Runnable { | ||
| 79 | + Socket s; | ||
| 80 | + boolean run = true; | ||
| 81 | + long lastReceiveTime = System.currentTimeMillis(); | ||
| 82 | + | ||
| 83 | + public SocketAction(Socket s) { | ||
| 84 | + this.s = s; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void run() { | ||
| 88 | + String appId = null; | ||
| 89 | + String activityId = null; | ||
| 90 | + while (running && run) { | ||
| 91 | + try { | ||
| 92 | + Thread.sleep(3000); | ||
| 93 | + } catch (InterruptedException e1) { | ||
| 94 | + e1.printStackTrace(); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + if (System.currentTimeMillis() - lastReceiveTime > receiveTimeDelay) { | ||
| 98 | + System.out.println("socket连接超过30s....."); | ||
| 99 | + } else { | ||
| 100 | + try { | ||
| 101 | + InputStream in = s.getInputStream(); | ||
| 102 | + OutputStream out = s.getOutputStream(); | ||
| 103 | + if (in.available() > 0) { | ||
| 104 | + byte[] recData = null; | ||
| 105 | + while (true) { | ||
| 106 | + recData = new byte[1024]; | ||
| 107 | + int r = in.read(recData); | ||
| 108 | + if (r > -1) { | ||
| 109 | + lastReceiveTime = System.currentTimeMillis(); | ||
| 110 | + String data = new String(recData); | ||
| 111 | + System.out.println("读取到客户端发送的来数据:" + data); | ||
| 112 | + String[] str = data.split("#"); | ||
| 113 | + String app = str[0]; | ||
| 114 | + String activity = str[1]; | ||
| 115 | + appId = app.substring(app.indexOf("=")+1); | ||
| 116 | + activityId = activity.substring(activity.indexOf("=")+1); | ||
| 117 | + System.out.println(appId+" : "+activityId); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + } catch (Exception e) { | ||
| 122 | + System.out.println(System.currentTimeMillis() - lastReceiveTime); | ||
| 123 | + e.printStackTrace(); | ||
| 124 | + overThis(); | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + private void overThis() { | ||
| 130 | + if (run) | ||
| 131 | + run = false; | ||
| 132 | + if (s != null) { | ||
| 133 | + try { | ||
| 134 | + s.close(); | ||
| 135 | + } catch (IOException e) { | ||
| 136 | + e.printStackTrace(); | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + System.out.println("关闭:" + s.getRemoteSocketAddress()); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + } | ||
| 143 | +} |
src/main/java/com/cnlive/socket/TE.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 | + | ||
| 8 | +import org.apache.commons.httpclient.Header; | ||
| 9 | +import org.apache.commons.httpclient.HttpClient; | ||
| 10 | +import org.apache.commons.httpclient.HttpException; | ||
| 11 | +import org.apache.commons.httpclient.HttpMethod; | ||
| 12 | +import org.apache.commons.httpclient.StatusLine; | ||
| 13 | +import org.apache.commons.httpclient.methods.GetMethod; | ||
| 14 | + | ||
| 15 | +public class TE { | ||
| 16 | +public static void main(String[] args) { | ||
| 17 | + new TE().doGet("http://bc.cnlive.com/live/epg/play/app?app_id=60_irg1rhs308&channelID=1471754157393"); | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +private HttpClient getHttpClient() { | ||
| 21 | + HttpClient client = new HttpClient(); | ||
| 22 | + client.getHttpConnectionManager().getParams().setConnectionTimeout(2200); | ||
| 23 | + client.getHttpConnectionManager().getParams().setSoTimeout(2200); | ||
| 24 | + return client; | ||
| 25 | +} | ||
| 26 | +public void doGet(String url) { | ||
| 27 | + BufferedReader in = null; | ||
| 28 | + HttpClient client = this.getHttpClient(); | ||
| 29 | + HttpMethod method = new GetMethod(url); | ||
| 30 | + method.setFollowRedirects(false); | ||
| 31 | + InputStream stream = null; | ||
| 32 | + try { | ||
| 33 | + int exeCode = client.executeMethod(method); | ||
| 34 | + StatusLine status = method.getStatusLine(); | ||
| 35 | + int statusCode = status.getStatusCode(); | ||
| 36 | + StringBuffer buf = new StringBuffer(); | ||
| 37 | + if (statusCode == 301 || statusCode == 302) { | ||
| 38 | + Header[] hs = method.getResponseHeaders("Location"); | ||
| 39 | + for (Header h : hs) { | ||
| 40 | + System.out.println(h.getName() + "--" + h.getValue()); | ||
| 41 | + String playUrl = h.getValue(); | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + } else { | ||
| 45 | + stream = method.getResponseBodyAsStream(); | ||
| 46 | + in = new BufferedReader(new InputStreamReader(stream, "UTF-8")); | ||
| 47 | + String line; | ||
| 48 | + while (null != (line = in.readLine())) { | ||
| 49 | + buf.append(line).append("\n"); | ||
| 50 | + } | ||
| 51 | + System.out.println(buf.toString()); | ||
| 52 | + } | ||
| 53 | + } catch (HttpException e) { | ||
| 54 | + e.printStackTrace(); | ||
| 55 | + } catch (IOException e) { | ||
| 56 | + e.printStackTrace(); | ||
| 57 | + } finally { | ||
| 58 | + if (in != null) { | ||
| 59 | + try { | ||
| 60 | + in.close(); | ||
| 61 | + } catch (Exception e) { | ||
| 62 | + e.printStackTrace(); | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + if (stream != null) { | ||
| 66 | + try { | ||
| 67 | + stream.close(); | ||
| 68 | + } catch (Exception e) { | ||
| 69 | + e.printStackTrace(); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + method.releaseConnection(); | ||
| 73 | + } | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +} |
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 | #log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%t]%C{1}.%M(%L) - %m%n | 66 | #log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%t]%C{1}.%M(%L) - %m%n |
| 67 | \ No newline at end of file | 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 | \ No newline at end of file | 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}"><上一页</button> | ||
| 20 | + </c:when> | ||
| 21 | + <c:otherwise> | ||
| 22 | + <button class="btn btn-xs btn-danger" type="button" disabled>|<首页</button> | ||
| 23 | + <button class="btn btn-xs btn-danger" type="button" disabled><上一页</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}">下一页></button> | ||
| 30 | + <button class="btn btn-xs btn-danger" type="button" onclick="next_pager(${totalPage});" data-pn="${totalPage}">最后一页>|</button> | ||
| 31 | + </c:when> | ||
| 32 | + <c:otherwise> | ||
| 33 | + <button class="btn btn-xs btn-danger" type="button" disabled>下一页></button> | ||
| 34 | + <button class="btn btn-xs btn-danger" type="button" disabled>最后一页>|</button> | ||
| 35 | + </c:otherwise> | ||
| 36 | + </c:choose> | ||
| 37 | + <span class="green middle bolder">总记录数:${totalRecord}</span> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 40 | + </div> | ||
| 41 | +</div> | ||
| 0 | \ No newline at end of file | 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" | ||
| 3 | - xmlns="http://java.sun.com/xml/ns/javaee" | ||
| 4 | - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
| 5 | - version="3.0"> | ||
| 6 | - <servlet> | ||
| 7 | - <servlet-name>init_job</servlet-name> | ||
| 8 | - <servlet-class>com.cnlive.mz.live.action.Init</servlet-class> | ||
| 9 | - <init-param> | ||
| 10 | - <param-name>shutdown-on-unload</param-name> | ||
| 11 | - <param-value>true</param-value> | ||
| 12 | - </init-param> | ||
| 13 | - <load-on-startup>2</load-on-startup> | ||
| 14 | - </servlet> | ||
| 15 | - <servlet> | ||
| 16 | - <servlet-name>TokenServlet</servlet-name> | ||
| 17 | - <servlet-class>com.cnlive.stream.servlet.TokenServlet</servlet-class> | ||
| 18 | - <load-on-startup>0</load-on-startup> | ||
| 19 | - </servlet> | ||
| 20 | - <servlet-mapping> | ||
| 21 | - <servlet-name>TokenServlet</servlet-name> | ||
| 22 | - <url-pattern>/tk</url-pattern> | ||
| 23 | - </servlet-mapping> | ||
| 24 | - <servlet> | ||
| 25 | - <servlet-name>StreamServlet</servlet-name> | ||
| 26 | - <servlet-class>com.cnlive.stream.servlet.StreamServlet</servlet-class> | ||
| 27 | - <load-on-startup>0</load-on-startup> | ||
| 28 | - </servlet> | ||
| 29 | - <servlet-mapping> | ||
| 30 | - <servlet-name>StreamServlet</servlet-name> | ||
| 31 | - <url-pattern>/upload</url-pattern> | ||
| 32 | - </servlet-mapping> | ||
| 33 | - <servlet> | ||
| 34 | - <servlet-name>FormDataServlet</servlet-name> | ||
| 35 | - <servlet-class>com.cnlive.stream.servlet.FormDataServlet</servlet-class> | ||
| 36 | - <load-on-startup>0</load-on-startup> | ||
| 37 | - </servlet> | ||
| 38 | - <servlet-mapping> | ||
| 39 | - <servlet-name>FormDataServlet</servlet-name> | ||
| 40 | - <url-pattern>/fd</url-pattern> | ||
| 41 | - </servlet-mapping> | 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> | ||
| 42 | </web-app> | 16 | </web-app> |
| 43 | \ No newline at end of file | 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">×</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">×</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 | </html> | 153 | </html> |
| 154 | \ No newline at end of file | 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 | </script> | 53 | </script> |
| 54 | \ No newline at end of file | 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 | </aside> | 68 | </aside> |
| 69 | \ No newline at end of file | 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> |