├── .gitattributes ├── .gitignore ├── README.md ├── biubiu.sql ├── pom.xml └── src ├── main ├── java │ └── com │ │ ├── Interceptor │ │ ├── Check_islogined.java │ │ ├── Check_videoId.java │ │ └── OSIVFilter.java │ │ ├── action │ │ ├── BarragesAction.java │ │ ├── DemandAction.java │ │ ├── HomeAction.java │ │ ├── JsonActionSupport.java │ │ ├── LiveAction.java │ │ ├── LiveHallAction.java │ │ ├── LoginAction.java │ │ ├── LogoutAction.java │ │ ├── Page_AjaxAction.java │ │ ├── RegisterAction.java │ │ ├── ServiceSupport.java │ │ ├── SosoAction.java │ │ ├── UploadAction.java │ │ ├── UserInfoAction.java │ │ ├── VideoAjax_Page.java │ │ └── VideoSubmitAction.java │ │ ├── dao │ │ ├── BarrageDao.java │ │ ├── BaseDao.java │ │ ├── UserDao.java │ │ ├── VideoDao.java │ │ ├── VideoFavDao.java │ │ ├── VideoLikeDao.java │ │ └── impl │ │ │ ├── BarrageDaoImpl.java │ │ │ ├── BaseDaoImpl.java │ │ │ ├── UserDaoImpl.java │ │ │ ├── VideoDaoImpl.java │ │ │ ├── VideoFavDaoImpl.java │ │ │ └── VideoLikeDaoImpl.java │ │ ├── entity │ │ ├── Barrages.java │ │ ├── Users.java │ │ ├── VideoFavlist.java │ │ ├── VideoFavlistPK.java │ │ ├── VideoLike.java │ │ ├── VideoLikePK.java │ │ ├── Videos.java │ │ └── modelBeans │ │ │ └── PageModel.java │ │ ├── listen │ │ └── ApplicationListener.java │ │ ├── service │ │ ├── BarrageService.java │ │ ├── BaseServices.java │ │ ├── UploadService.java │ │ ├── UserService.java │ │ └── VideoService.java │ │ ├── utils │ │ ├── COSUtil.java │ │ ├── CreateId.java │ │ ├── DaoFactory.java │ │ ├── HibernateUtils.java │ │ ├── IDGenerator.java │ │ ├── JsonDateValueProcessor.java │ │ ├── Json_format.java │ │ ├── PropertiesUtil.java │ │ └── VideoUtils.java │ │ └── web_socket │ │ ├── GetHttpSessionConfigurator.java │ │ ├── LiveRoom.java │ │ └── LiveWebSocket.java ├── resources │ ├── biubiu.e.g.properties │ ├── dao.properties │ ├── hbm │ │ ├── Barrages.hbm.xml │ │ ├── Users.hbm.xml │ │ ├── VideoFavlist.hbm.xml │ │ ├── VideoLike.hbm.xml │ │ └── Videos.hbm.xml │ ├── hibernate.cfg.xml │ ├── logback.xml │ ├── proxool.e.g.xml │ └── struts.xml └── webapp │ ├── 404.jsp │ ├── WEB-INF │ └── web.xml │ ├── classify.jsp │ ├── css │ ├── home.css │ ├── modal_login_resign.css │ ├── nav.css │ └── res_soso.css │ ├── error.jsp │ ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 │ ├── homepage.jsp │ ├── img │ ├── 404.png │ ├── check.png │ ├── head_img.jpg │ ├── icon3.png │ ├── icons.png │ ├── icons2.png │ ├── loading-sm.gif │ └── loading.gif │ ├── inclued_page │ ├── base_js_css.jsp │ ├── model_login.jsp │ └── nav.jsp │ ├── js │ ├── classify.js │ ├── login.js │ ├── logout.js │ ├── modal_login_resign.js │ ├── page_.js │ ├── register.js │ ├── soso.js │ └── util.js │ ├── live.jsp │ ├── live_hall.jsp │ ├── not_login.jsp │ ├── param.json │ ├── soso.jsp │ ├── video │ ├── css │ │ └── mycss.css │ ├── demand.jsp │ ├── img │ │ ├── bg_live.jpg │ │ ├── cannotfind.jpg │ │ ├── colorpicker.png │ │ └── zhibo.jpg │ └── js │ │ ├── demand_Barrage.js │ │ ├── format_date.js │ │ ├── full_screen.js │ │ ├── jquery.colorpicker.js │ │ ├── live_socket.js │ │ ├── send_Barrage.js │ │ ├── ui.js │ │ └── web_RTC.js │ └── vip │ ├── css │ ├── app.css │ ├── fileinput.min.css │ └── zclc2.css │ ├── img │ ├── bg.jpg │ ├── icons_m.png │ ├── rl_top2.jpg │ └── rl_topbg.png │ ├── js │ ├── ajax_upload.js │ ├── fileinput.min.js │ ├── fileinput_locale_zh.js │ ├── upload_video.js │ └── userinfo_setting.js │ ├── security-list.jsp │ ├── upload_video.jsp │ ├── user_face.jsp │ └── user_info.jsp └── test └── java └── HibnerateTest.java /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=java 2 | *.css linguist-language=java 3 | *.html linguist-language=java -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | #package file 4 | *.war 5 | *.ear 6 | 7 | #maven file 8 | target/ 9 | 10 | #idea 11 | .idea/ 12 | /.idea/ 13 | *.ipr 14 | *.iml 15 | *.iws 16 | 17 | # temp file 18 | *.log 19 | *.cache 20 | *.diff 21 | *.patch 22 | *.tmp 23 | 24 | # system file 25 | .DS_Store 26 | Thumbs.db 27 | /src/main/resources/proxool.xml 28 | /src/main/resources/biubiu.properties 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # biubiu 2 | 弹幕视频与直播网站 3 | 4 | 测试账户: 5 | 用户名:小美     密码:123 6 | 7 | 项目演示地址(已关闭):[https://biubiu.zcdev.xyz](https://biubiu.zcdev.xyz) 8 | 9 | 项目功能介绍: 10 | 11 | 1.视频分享、按类别上传视频、按类别与关键字搜索 12 | 13 | 2.视频点播弹幕(与内容相关持久化的评论) 14 | 15 | 3.通过WebSocket实现的实时弹幕系统 16 | 17 | 4.基于WebRTC的直播系统、多房间制、多主播同时在线 18 | 19 | 20 | ############################################################# 21 | 22 | 直播兼容性(已经测试): 23 | 24 | 电脑端:chrome53+ 、safari11+ 25 | 26 | Android端:微信、chrome、qq浏览器(连接不通) 27 | 28 | iOS:iOS11+ 29 | 30 | 还有很奇怪的是Android端chrome与电脑safari不通,但是电脑端chrome与(safari/Android端chrome)都能连通 31 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com 5 | biubiu 6 | war 7 | 1.0-SNAPSHOT 8 | biubiu Maven Webapp 9 | http://maven.apache.org 10 | 11 | UTF-8 12 | UTF-8 13 | UTF-8 14 | UTF-8 15 | 8.5.15 16 | 4.3.8.Final 17 | 18 | 19 | 20 | org.apache.tomcat 21 | tomcat-servlet-api 22 | ${org.apache.tomcat} 23 | provided 24 | 25 | 26 | 27 | org.apache.tomcat 28 | tomcat-jsp-api 29 | ${org.apache.tomcat} 30 | provided 31 | 32 | 33 | 34 | org.apache.tomcat 35 | tomcat-websocket 36 | ${org.apache.tomcat} 37 | provided 38 | 39 | 40 | 41 | org.apache.tomcat 42 | tomcat-websocket-api 43 | ${org.apache.tomcat} 44 | provided 45 | 46 | 47 | 48 | javax.servlet 49 | jstl 50 | 1.2 51 | 52 | 53 | 54 | org.apache.struts 55 | struts2-core 56 | 2.3.34 57 | 58 | 59 | javassist 60 | javassist 61 | 62 | 63 | 64 | 65 | 66 | net.sf.json-lib 67 | json-lib 68 | 2.4 69 | jdk15 70 | 71 | 72 | 73 | org.apache.struts 74 | struts2-json-plugin 75 | 2.3.24 76 | 77 | 78 | 79 | org.hibernate 80 | hibernate-core 81 | ${org.hibernate} 82 | 83 | 84 | 85 | org.hibernate 86 | hibernate-proxool 87 | ${org.hibernate} 88 | 89 | 90 | 91 | org.slf4j 92 | slf4j-api 93 | 1.7.7 94 | 95 | 96 | 97 | ch.qos.logback 98 | logback-classic 99 | 1.2.0 100 | compile 101 | 102 | 103 | 104 | ch.qos.logback 105 | logback-core 106 | 1.2.0 107 | compile 108 | 109 | 110 | 111 | 112 | mysql 113 | mysql-connector-java 114 | 8.0.16 115 | 116 | 117 | 118 | 119 | com.qcloud 120 | cos_api 121 | 4.4 122 | 123 | 124 | log4j 125 | log4j 126 | 127 | 128 | org.slf4j 129 | slf4j-api 130 | 131 | 132 | org.slf4j 133 | slf4j-log4j12 134 | 135 | 136 | 137 | 138 | 139 | 140 | biubiu 141 | 142 | 143 | org.apache.maven.plugins 144 | maven-compiler-plugin 145 | 146 | 1.8 147 | 1.8 148 | UTF-8 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /src/main/java/com/Interceptor/Check_islogined.java: -------------------------------------------------------------------------------- 1 | package com.Interceptor; 2 | 3 | import com.entity.Users; 4 | import com.opensymphony.xwork2.ActionInvocation; 5 | import com.opensymphony.xwork2.interceptor.AbstractInterceptor; 6 | import org.apache.struts2.ServletActionContext; 7 | 8 | import javax.servlet.http.HttpSession; 9 | 10 | /** 11 | * Created by zc on 2016/12/19. 12 | */ 13 | public class Check_islogined extends AbstractInterceptor { 14 | 15 | @Override 16 | public String intercept(ActionInvocation actionInvocation) throws Exception { 17 | HttpSession session = ServletActionContext.getRequest().getSession(); 18 | 19 | Users user = (Users) session.getAttribute("user"); 20 | if (user != null) {//已经登陆 21 | return actionInvocation.invoke(); 22 | } else { 23 | return "login";//返回登录 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/Interceptor/Check_videoId.java: -------------------------------------------------------------------------------- 1 | package com.Interceptor; 2 | 3 | import com.opensymphony.xwork2.ActionInvocation; 4 | import com.opensymphony.xwork2.interceptor.AbstractInterceptor; 5 | import org.apache.struts2.ServletActionContext; 6 | 7 | /** 8 | * Created by zc on 2016/12/18. 9 | */ 10 | public class Check_videoId extends AbstractInterceptor { 11 | @Override 12 | public String intercept(ActionInvocation actionInvocation) throws Exception { 13 | String video_id = ServletActionContext.getRequest().getParameter("video_id"); 14 | if (video_id == null) { 15 | return "re_video"; 16 | } 17 | return actionInvocation.invoke(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/Interceptor/OSIVFilter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.Interceptor; 5 | 6 | import com.utils.HibernateUtils; 7 | import org.hibernate.HibernateException; 8 | import org.hibernate.Session; 9 | import org.hibernate.Transaction; 10 | 11 | import javax.servlet.*; 12 | import java.io.IOException; 13 | 14 | 15 | 16 | /** 17 | * @author slw 18 | * 通过过滤器实现OSIV模式 19 | */ 20 | public class OSIVFilter implements Filter{ 21 | 22 | @Override 23 | public void destroy() { 24 | // TODO Auto-generated method stub 25 | 26 | } 27 | 28 | @Override 29 | public void doFilter(ServletRequest arg0, ServletResponse arg1, 30 | FilterChain arg2) throws IOException, ServletException { 31 | // TODO Auto-generated method stub 32 | Session session=null; 33 | Transaction tx=null; 34 | 35 | try{ 36 | session= HibernateUtils.getCurrentSession(); 37 | 38 | tx=session.beginTransaction(); 39 | 40 | arg2.doFilter(arg0, arg1); 41 | 42 | tx.commit(); 43 | 44 | }catch(HibernateException ce){ 45 | tx.rollback(); 46 | throw ce; 47 | } 48 | 49 | 50 | } 51 | 52 | @Override 53 | public void init(FilterConfig arg0) throws ServletException { 54 | // TODO Auto-generated method stub 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/action/BarragesAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.entity.Barrages; 4 | import com.entity.Users; 5 | import com.opensymphony.xwork2.ModelDriven; 6 | 7 | /** 8 | * Created by zc on 2016/12/18. 9 | */ 10 | public class BarragesAction extends JsonActionSupport implements ModelDriven, ServiceSupport { 11 | 12 | public Barrages barrage = new Barrages(); 13 | 14 | 15 | //插入弹幕 16 | public String insert_Barr() { 17 | Users user_login = ((Users) request.getSession().getAttribute("user")); 18 | barrage.setBarr_user(user_login); 19 | 20 | if (BARRAGE_SERVICE.save(barrage)) { 21 | success = true; 22 | } else { 23 | success = false; 24 | } 25 | 26 | put_issuccess(); 27 | 28 | return SUCCESS; 29 | } 30 | 31 | 32 | @Override 33 | public Barrages getModel() { 34 | return barrage; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/action/DemandAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.entity.Barrages; 4 | import com.entity.Videos; 5 | import com.opensymphony.xwork2.ActionSupport; 6 | import com.utils.Json_format; 7 | import com.utils.PropertiesUtil; 8 | import net.sf.json.JSONArray; 9 | import org.apache.struts2.ServletActionContext; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by zc on 2016/12/18. 15 | */ 16 | public class DemandAction extends ActionSupport implements ServiceSupport { 17 | 18 | private Videos video_info; 19 | private JSONArray barrage_jsonArray; 20 | 21 | public Videos getVideo_info() { 22 | return video_info; 23 | } 24 | 25 | public void setVideo_info(Videos video_info) { 26 | this.video_info = video_info; 27 | } 28 | 29 | public JSONArray getBarrage_jsonArray() { 30 | return barrage_jsonArray; 31 | } 32 | 33 | public void setBarrage_jsonArray(JSONArray barrage_jsonArray) { 34 | this.barrage_jsonArray = barrage_jsonArray; 35 | } 36 | 37 | @Override 38 | public String execute() throws Exception { 39 | 40 | String video_id = ServletActionContext.getRequest().getParameter("video_id"); 41 | 42 | //返回videos和Set 43 | video_info = VIDEO_SERVICE.getVideo_info(video_id); 44 | 45 | if (video_info != null) { 46 | 47 | if (VIDEO_SERVICE.addWatchCount(video_info)) { 48 | // System.out.println("视频观看次数增加成功!"); 49 | } 50 | 51 | video_info.setVideoPath(PropertiesUtil.getProperty("cos.server.http.prefix") + video_info.getVideoPath()); 52 | video_info.setVideoCoverPath(PropertiesUtil.getProperty("cos.server.http.prefix") + video_info.getVideoCoverPath()); 53 | 54 | 55 | // System.out.println(video_info.getVideoPath()); 56 | List barrage_list = BARRAGE_SERVICE.queryByVideo(video_id); 57 | 58 | //拼接成json 59 | if (barrage_list != null && !barrage_list.isEmpty()) { 60 | 61 | barrage_jsonArray = JSONArray.fromObject(barrage_list, new Json_format("barrage")); 62 | } else { 63 | barrage_jsonArray=new JSONArray(); 64 | System.out.println("我空了"); 65 | } 66 | 67 | return SUCCESS; 68 | 69 | } else { 70 | return "404"; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/action/JsonActionSupport.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.opensymphony.xwork2.ActionSupport; 4 | import net.sf.json.JSONObject; 5 | import org.apache.struts2.ServletActionContext; 6 | 7 | import javax.servlet.ServletContext; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | /** 12 | * Created by zc on 2016/12/18. 13 | */ 14 | public abstract class JsonActionSupport extends ActionSupport { 15 | 16 | HttpServletRequest request = ServletActionContext.getRequest(); 17 | HttpServletResponse response = ServletActionContext.getResponse(); 18 | ServletContext appliaction = ServletActionContext.getServletContext(); 19 | 20 | //ajax 返回的json对象 21 | protected JSONObject resp_json = new JSONObject(); 22 | 23 | //ajax 返回结果是否成功 默认false 24 | protected boolean success = false; 25 | //失败返回信息 26 | protected String error_msg; 27 | 28 | 29 | public JSONObject getResp_json() { 30 | return resp_json; 31 | } 32 | 33 | public void setResp_json(JSONObject resp_json) { 34 | this.resp_json = resp_json; 35 | } 36 | 37 | //加入是否成功标识 38 | protected void put_issuccess() { 39 | resp_json.put("success", success); 40 | } 41 | 42 | //加入错误信息 43 | protected void put_errormsg() { 44 | resp_json.put("error_msg", error_msg); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/action/LiveAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.entity.Users; 4 | import com.utils.CreateId; 5 | import com.web_socket.LiveRoom; 6 | import com.opensymphony.xwork2.ActionSupport; 7 | import org.apache.struts2.ServletActionContext; 8 | 9 | import java.util.regex.Matcher; 10 | import java.util.regex.Pattern; 11 | 12 | public class LiveAction extends ActionSupport implements ServiceSupport { 13 | LiveRoom liveRoom; 14 | boolean is_liver; 15 | Users user_my; 16 | String myRoomId = "-1"; 17 | 18 | public LiveRoom getLiveRoom() { 19 | return liveRoom; 20 | } 21 | 22 | public void setLiveRoom(LiveRoom liveRoom) { 23 | this.liveRoom = liveRoom; 24 | } 25 | 26 | public boolean isIs_liver() { 27 | return is_liver; 28 | } 29 | 30 | public void setIs_liver(boolean is_liver) { 31 | this.is_liver = is_liver; 32 | } 33 | 34 | public String getMyRoomId() { 35 | return myRoomId; 36 | } 37 | 38 | @Override 39 | public String execute() throws Exception { 40 | user_my=((Users) ServletActionContext.getRequest().getSession().getAttribute("user")); 41 | String room_id0 = ServletActionContext.getRequest().getParameter("roomId"); 42 | if (room_id0 == null || room_id0.length() <= 0) {//房间号错误 43 | return "hall"; 44 | } 45 | 46 | if (user_my != null) { 47 | myRoomId = CreateId.getNumZero(user_my.getRoomId()); 48 | } 49 | Integer room_id; 50 | try { 51 | room_id = Integer.valueOf(room_id0); 52 | 53 | if (room_id.equals(0)) { 54 | return "my"; 55 | } 56 | if (room_id.equals(-1)) { 57 | return "login"; 58 | } 59 | Users user_login = (Users) ServletActionContext.getRequest().getSession().getAttribute("user"); 60 | 61 | liveRoom = LiveRoom.getRoom(room_id); 62 | if (liveRoom == null) {//没有该房间,进入大厅 63 | return "hall"; 64 | } 65 | 66 | is_liver = LiveRoom.isLiver(room_id, user_login); 67 | 68 | return SUCCESS; 69 | 70 | } catch (NumberFormatException e) { 71 | return "hall"; 72 | } 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/action/LiveHallAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.opensymphony.xwork2.ActionSupport; 4 | import com.web_socket.LiveRoom; 5 | 6 | import java.util.List; 7 | 8 | public class LiveHallAction extends ActionSupport{ 9 | private List roomList; 10 | 11 | public List getRoomList() { 12 | return roomList; 13 | } 14 | 15 | public void setRoomList(List roomList) { 16 | this.roomList = roomList; 17 | } 18 | 19 | @Override 20 | public String execute() throws Exception { 21 | roomList=LiveRoom.getRoomsList(); 22 | return SUCCESS; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/action/LoginAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | 4 | import com.entity.Users; 5 | import com.opensymphony.xwork2.ModelDriven; 6 | 7 | import org.apache.struts2.ServletActionContext; 8 | 9 | /** 10 | * Created by zc on 2016/12/18. 11 | */ 12 | public class LoginAction extends JsonActionSupport implements ModelDriven ,ServiceSupport { 13 | 14 | public Users user = new Users();//表单模型 15 | 16 | //登录验证 17 | public String login() { 18 | 19 | String username = null;//返回的user_name 20 | String user_id = null;//返回的user_id 21 | boolean is_logined = false;//是否已经登录 22 | 23 | //正式提交登录 24 | Users user_return = USER_SERVICE.loginservice(user); 25 | 26 | if (user_return != null) {//登录是否成功 27 | username = user_return.getUserName();//返回用户姓名 28 | if (true) {//重复登录检验 29 | 30 | request.getSession().setAttribute("user", user_return);//将登陆信息加入session中 31 | 32 | success = true; 33 | user_id = user_return.getUserId();//返回用户id 34 | } else { 35 | success = false; 36 | is_logined = true; 37 | } 38 | } else { 39 | success = false; 40 | } 41 | 42 | //拼接成生成json字符串 43 | resp_json.put("username", username); 44 | resp_json.put("islogined", is_logined); 45 | resp_json.put("user_id", user_id); 46 | resp_json.put("userPicPath",user_return.getUserPicPath()); 47 | resp_json.put("roomId",user_return.getRoomId()); 48 | put_issuccess(); 49 | 50 | return SUCCESS; 51 | } 52 | 53 | 54 | //用户存在检验(手机/用户名) 55 | public String exist_user() throws Exception { 56 | String user_pre = ServletActionContext.getRequest().getParameter("user_pre"); 57 | if (user_pre != null) { 58 | if (USER_SERVICE.exit_userId(user_pre) || USER_SERVICE.exit_userName(user_pre)) { 59 | success = true; 60 | } else { 61 | success = false; 62 | } 63 | put_issuccess(); 64 | } 65 | return SUCCESS; 66 | } 67 | 68 | 69 | //用户id(手机号)存在检验 70 | public String exist_user_id() throws Exception { 71 | String user_id_pre = ServletActionContext.getRequest().getParameter("user_id_pre"); 72 | 73 | 74 | System.out.println(user_id_pre); 75 | if (user_id_pre != null) { 76 | 77 | if (USER_SERVICE.exit_userId(user_id_pre)) { 78 | success = true; 79 | } else { 80 | success = false; 81 | } 82 | put_issuccess(); 83 | } 84 | return SUCCESS; 85 | } 86 | 87 | 88 | //用户名字存在检验 89 | public String exist_username() throws Exception { 90 | String user_name_pre = ServletActionContext.getRequest().getParameter("user_name_pre"); 91 | if (user_name_pre != null) { 92 | 93 | if (USER_SERVICE.exit_userName(user_name_pre)) { 94 | success = true; 95 | } else { 96 | success = false; 97 | } 98 | put_issuccess(); 99 | } 100 | return SUCCESS; 101 | } 102 | 103 | @Override 104 | public Users getModel() { 105 | return user; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/action/LogoutAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | 4 | import com.entity.Users; 5 | 6 | /** 7 | * Created by zc on 2016/12/18. 8 | */ 9 | public class LogoutAction extends JsonActionSupport { 10 | 11 | public String logout(){ 12 | String logout_id=request.getParameter("logout_id"); 13 | 14 | Users user = (Users) request.getSession().getAttribute("user"); 15 | 16 | if(user!=null&&user.getUserId().equals(logout_id)){//可以下线 17 | request.getSession().removeAttribute("user"); 18 | 19 | success=true; 20 | } 21 | else { 22 | success=false; 23 | } 24 | 25 | put_issuccess(); 26 | 27 | return SUCCESS; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/action/Page_AjaxAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.entity.modelBeans.PageModel; 4 | import com.opensymphony.xwork2.ActionSupport; 5 | import com.opensymphony.xwork2.ModelDriven; 6 | 7 | /** 8 | * Created by zc on 2016/12/23. 9 | */ 10 | public abstract class Page_AjaxAction extends JsonActionSupport { 11 | 12 | protected PageModel pageModel = new PageModel(); 13 | 14 | public PageModel getPageModel() { 15 | return pageModel; 16 | } 17 | 18 | public void setPageModel(PageModel pageModel) { 19 | this.pageModel = pageModel; 20 | } 21 | 22 | protected int init_pageSize; 23 | 24 | public void setInit_pageSize(int init_pageSize) { 25 | this.init_pageSize = init_pageSize; 26 | pageModel.setPageSize(init_pageSize); 27 | } 28 | 29 | public int getInit_pageSize() { 30 | 31 | return init_pageSize; 32 | } 33 | 34 | protected boolean page_volatile_after() { 35 | if (pageModel.getPageNo() > pageModel.getPageCount()) { 36 | error_msg = "last_"; 37 | put_errormsg(); 38 | return false; 39 | } 40 | if (pageModel.getDatas() == null || pageModel.getDatas().isEmpty()) { 41 | error_msg = "empty"; 42 | put_errormsg(); 43 | return false; 44 | } 45 | return true; 46 | } 47 | 48 | protected boolean page_volatile_before() { 49 | if (pageModel.getPageNo() <= 0) { 50 | error_msg = "first_"; 51 | put_errormsg(); 52 | return false; 53 | } 54 | return true; 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/action/RegisterAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.entity.Users; 4 | import com.opensymphony.xwork2.ModelDriven; 5 | 6 | /** 7 | * Created by zc on 2016/12/25. 8 | */ 9 | public class RegisterAction extends JsonActionSupport implements ModelDriven, 10 | ServiceSupport { 11 | 12 | public Users user = new Users();//表单模型 13 | 14 | @Override 15 | public String execute() throws Exception { 16 | 17 | 18 | if (USER_SERVICE.save(user)) { 19 | success = true; 20 | } else { 21 | success = false; 22 | } 23 | 24 | resp_json.put("username", user.getUserName()); 25 | put_issuccess(); 26 | return SUCCESS; 27 | } 28 | 29 | @Override 30 | public Users getModel() { 31 | return user; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/action/ServiceSupport.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.service.BarrageService; 4 | import com.service.UserService; 5 | import com.service.VideoService; 6 | 7 | /** 8 | * Created by zc on 2016/12/20. 9 | */ 10 | public interface ServiceSupport { 11 | UserService USER_SERVICE = new UserService(); 12 | BarrageService BARRAGE_SERVICE = new BarrageService(); 13 | VideoService VIDEO_SERVICE = new VideoService(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/action/SosoAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.entity.Videos; 4 | import com.entity.modelBeans.PageModel; 5 | import com.opensymphony.xwork2.ActionSupport; 6 | import com.opensymphony.xwork2.ModelDriven; 7 | import org.apache.struts2.ServletActionContext; 8 | 9 | /** 10 | * Created by zc on 2016/12/28. 11 | */ 12 | public class SosoAction extends ActionSupport implements ModelDriven>, ServiceSupport { 13 | public PageModel pageModel = new PageModel<>(); 14 | 15 | 16 | @Override 17 | public PageModel getModel() { 18 | return pageModel; 19 | } 20 | 21 | 22 | @Override 23 | public String execute() throws Exception { 24 | // 15 25 | pageModel.setPageNo(1); 26 | pageModel.setPageCount(15); 27 | String keyword = ServletActionContext.getRequest().getParameter("keyword"); 28 | 29 | pageModel = VIDEO_SERVICE.soso(pageModel, keyword); 30 | 31 | 32 | return SUCCESS; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/action/UserInfoAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.entity.Users; 4 | import com.opensymphony.xwork2.ModelDriven; 5 | 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by zc on 2016/12/26. 11 | */ 12 | public class UserInfoAction extends JsonActionSupport implements ModelDriven, ServiceSupport { 13 | 14 | Users user_info = new Users(); 15 | 16 | 17 | //进入userinfo修改页面 18 | public String setting() { 19 | //去session中拿吧 20 | return SUCCESS; 21 | } 22 | 23 | 24 | //修改用户信息 25 | public String uinfo() { 26 | 27 | Users users = USER_SERVICE.get(user_info.getUserId()); 28 | if (users != null) { 29 | users.setUserGender(user_info.getUserGender()); 30 | users.setUserEmail(user_info.getUserEmail()); 31 | 32 | 33 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); 34 | Date date=java.sql.Date.valueOf(sdf.format(user_info.getUserBirthday())); 35 | users.setUserBirthday(date); 36 | 37 | 38 | if (USER_SERVICE.update(users)) { 39 | //改变session中的user 40 | 41 | request.getSession().setAttribute("user", users); 42 | 43 | success = true; 44 | } else { 45 | success = false; 46 | } 47 | } else { 48 | success = false; 49 | } 50 | 51 | 52 | put_issuccess(); 53 | return SUCCESS; 54 | } 55 | 56 | 57 | @Override 58 | public Users getModel() { 59 | return user_info; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/action/VideoAjax_Page.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.entity.Videos; 4 | import com.utils.Json_format; 5 | import net.sf.json.JSONObject; 6 | 7 | /** 8 | * Created by zc on 2016/12/24. 9 | */ 10 | public class VideoAjax_Page extends Page_AjaxAction implements ServiceSupport { 11 | 12 | //所有视频分页查新 13 | public String all() { 14 | if (super.page_volatile_before()) { 15 | pageModel = VIDEO_SERVICE.findByPager(pageModel.getPageNo(), pageModel.getPageSize()); 16 | if (super.page_volatile_after()) { 17 | resp_json.put("pageModel", JSONObject.fromObject(pageModel, new Json_format("video"))); 18 | success = true; 19 | } 20 | } else { 21 | success = false; 22 | } 23 | put_issuccess(); 24 | return SUCCESS; 25 | } 26 | 27 | 28 | //根据视频类型分页查询 29 | public String classify() { 30 | 31 | String videoType = request.getParameter("videoType"); 32 | 33 | if (super.page_volatile_before()) { 34 | pageModel = VIDEO_SERVICE.classify(pageModel, videoType); 35 | if (super.page_volatile_after()) { 36 | resp_json.put("pageModel", JSONObject.fromObject(pageModel, new Json_format("video"))); 37 | success = true; 38 | } 39 | } else { 40 | success = false; 41 | } 42 | put_issuccess(); 43 | return SUCCESS; 44 | } 45 | 46 | 47 | 48 | //搜索关键字分页查询 49 | public String soso() { 50 | 51 | String keyword = request.getParameter("keyword"); 52 | if (super.page_volatile_before()) { 53 | pageModel = VIDEO_SERVICE.soso(pageModel, keyword); 54 | if (super.page_volatile_after()) { 55 | String userId = pageModel.getDatas().get(0).getUp_user().getUserId(); 56 | 57 | resp_json.put("pageModel", JSONObject.fromObject(pageModel, new Json_format("video"))); 58 | 59 | success = true; 60 | } 61 | } else { 62 | success = false; 63 | } 64 | put_issuccess(); 65 | return SUCCESS; 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/action/VideoSubmitAction.java: -------------------------------------------------------------------------------- 1 | package com.action; 2 | 3 | import com.entity.Videos; 4 | import com.opensymphony.xwork2.ModelDriven; 5 | 6 | /** 7 | * Created by zc on 2016/12/27. 8 | */ 9 | public class VideoSubmitAction extends JsonActionSupport implements ModelDriven ,ServiceSupport { 10 | 11 | public Videos video=new Videos(); 12 | 13 | @Override 14 | public String execute() throws Exception { 15 | 16 | if(VIDEO_SERVICE.save(video)){ 17 | 18 | // String videoId = video.getVideoId(); 19 | // System.out.println(videoId); 20 | 21 | resp_json.put("videoId",video.getVideoId()); 22 | resp_json.put("videoTitle",video.getVideoTitle()); 23 | success=true; 24 | }else { 25 | success=false; 26 | } 27 | 28 | 29 | put_issuccess(); 30 | return SUCCESS; 31 | } 32 | 33 | @Override 34 | public Videos getModel() { 35 | return video; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/dao/BarrageDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.Barrages; 4 | 5 | /** 6 | * Created by zc on 2016/12/20. 7 | */ 8 | public interface BarrageDao extends BaseDao { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/dao/BaseDao.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.dao; 5 | 6 | import com.entity.modelBeans.PageModel; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | 13 | /** 14 | * @author zc 15 | * 通用泛型DAO 16 | */ 17 | public interface BaseDao { 18 | 19 | /** 20 | * 新增一个实例 21 | * @param entity 要新增的实例 22 | */ 23 | public void save(T entity); 24 | 25 | /** 26 | * 根据主键删除一个实例 27 | * @param entity 对象 28 | */ 29 | public void delete(T entity); 30 | 31 | /** 32 | * 编辑指定实例的详细信息 33 | * @param entity 实例 34 | */ 35 | public void update(T entity); 36 | 37 | /** 38 | * 根据主键获取对应的实例 39 | * @param id 主键值 40 | * @return 如果查询成功,返回符合条件的实例;如果查询失败,返回null 41 | */ 42 | public T get(Serializable id); 43 | 44 | /** 45 | * 根据主键获取对应的实例 46 | * @param id 主键值 47 | * @return 如果查询成功,返回符合条件的实例;如果查询失败,抛出空指针异常 48 | */ 49 | public T load(Serializable id); 50 | 51 | /** 52 | * 获取所有实体实例列表 53 | * @return 符合条件的实例列表 54 | */ 55 | public List findAll(); 56 | 57 | /** 58 | * 59 | * 查询实体列表 60 | * 61 | * @param hql 62 | * 查询语句 63 | * @param params 64 | * 可选的查询参数 65 | * @return 实体列表 66 | */ 67 | List findList(String hql, Object... params); 68 | 69 | 70 | List findList(String hql, Map params); 71 | 72 | 73 | /** 74 | * 75 | * 根据单一属性查询实体列表 76 | * 77 | * @param hql 78 | * 查询语句 79 | * @param param 80 | * 可选的查询参数 81 | * @return 实体列表 82 | */ 83 | List findList(String hql, Object param); 84 | 85 | 86 | /** 87 | * 统计总实体实例的数量 88 | * @return 总数量 89 | */ 90 | public int totalCount(); 91 | 92 | 93 | int totalCount(String hql, Object... params); 94 | 95 | /** 96 | * 获取分页列表 97 | * @param pageNo 当前页号 98 | * @param pageSize 每页要显示的记录数 99 | * @return 符合分页条件的分页模型实例 100 | */ 101 | public PageModel findByPager(int pageNo, int pageSize); 102 | 103 | 104 | /* 105 | 按语句根据单一参数获得分页模型实例 106 | */ 107 | public PageModel findByPager(int pageNo, int pageSize, String hql, Object param); 108 | 109 | /* 110 | 按语句根据多参数获得分页模型实例 111 | */ 112 | public PageModel findByPager(int pageNo, int pageSize, String hql, Object... params); 113 | 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/com/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | 4 | import com.entity.Users; 5 | 6 | /** 7 | * Created by zc on 2016/12/15. 8 | */ 9 | public interface UserDao extends BaseDao { 10 | 11 | //(根据类型判断)用户是否存在 12 | public boolean exist_user(String user_param, int type); 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/dao/VideoDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.Videos; 4 | 5 | /** 6 | * Created by zc on 2016/12/20. 7 | */ 8 | public interface VideoDao extends BaseDao { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/dao/VideoFavDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.VideoFavlist; 4 | 5 | /** 6 | * Created by zc on 2016/12/20. 7 | */ 8 | public interface VideoFavDao extends BaseDao { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/dao/VideoLikeDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.VideoLike; 4 | 5 | /** 6 | * Created by zc on 2016/12/20. 7 | */ 8 | public interface VideoLikeDao extends BaseDao { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/dao/impl/BarrageDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.dao.impl; 2 | 3 | import com.dao.BarrageDao; 4 | import com.entity.Barrages; 5 | 6 | /** 7 | * Created by zc on 2016/12/20. 8 | */ 9 | public class BarrageDaoImpl extends BaseDaoImpl implements BarrageDao { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/dao/impl/BaseDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.dao.impl; 2 | 3 | import com.dao.BaseDao; 4 | import com.entity.modelBeans.PageModel; 5 | import com.utils.HibernateUtils; 6 | import org.hibernate.Query; 7 | 8 | import java.io.Serializable; 9 | import java.lang.reflect.ParameterizedType; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | 14 | /** 15 | * @author zc 16 | * 通用DAO接口的实现类 17 | */ 18 | 19 | @SuppressWarnings("unchecked") 20 | public abstract class BaseDaoImpl implements BaseDao { 21 | 22 | private Class clazz; 23 | 24 | public BaseDaoImpl() { 25 | //通过反射机制获取子类传递过来的实体类的类型信息 26 | ParameterizedType type = (ParameterizedType) this.getClass().getGenericSuperclass(); 27 | this.clazz = (Class) type.getActualTypeArguments()[0]; 28 | 29 | } 30 | 31 | @Override 32 | public void save(T entity) { 33 | HibernateUtils.getCurrentSession().save(entity); 34 | } 35 | 36 | @Override 37 | public void delete(T entity) { 38 | HibernateUtils.getCurrentSession().delete(entity); 39 | } 40 | 41 | @Override 42 | public void update(T entity) { 43 | HibernateUtils.getCurrentSession().update(entity); 44 | } 45 | 46 | @Override 47 | public T get(Serializable id) { 48 | return (T) HibernateUtils.getCurrentSession().get(clazz, id); 49 | } 50 | 51 | @Override 52 | public T load(Serializable id) { 53 | return (T) HibernateUtils.getCurrentSession().load(clazz, id); 54 | } 55 | 56 | @Override 57 | public List findAll() { 58 | String hql = "select t from " + clazz.getSimpleName() + " t"; 59 | return (List) HibernateUtils.getCurrentSession().createQuery(hql).list(); 60 | } 61 | 62 | @Override 63 | public List findList(String hql, Object... params) { 64 | Query query = HibernateUtils.getCurrentSession().createQuery(hql); 65 | for (int i = 0; i < params.length; ++i) { 66 | query.setParameter(i, params[i]); 67 | } 68 | return (List) query.list(); 69 | } 70 | 71 | @Override 72 | public List findList(String hql, Map params) { 73 | Query query = HibernateUtils.getCurrentSession().createQuery(hql); 74 | query.setProperties(params); 75 | return (List) query.list(); 76 | } 77 | 78 | @Override 79 | public List findList(String hql, Object param) { 80 | Query query = HibernateUtils.getCurrentSession().createQuery(hql); 81 | query.setParameter(0, param); 82 | return (List) query.list(); 83 | } 84 | 85 | @Override 86 | public int totalCount() { 87 | int count = 0; 88 | String hql = "select count(t) from " + clazz.getSimpleName() + " t"; 89 | Long temp = (Long) HibernateUtils.getCurrentSession().createQuery(hql).uniqueResult(); 90 | if (temp != null) { 91 | count = temp.intValue(); 92 | } 93 | return count; 94 | } 95 | 96 | @Override 97 | public int totalCount(String hql, Object... params) { 98 | int count = 0; 99 | Query query = HibernateUtils.getCurrentSession().createQuery(hql); 100 | for (int i = 0; i < params.length; ++i) { 101 | query.setParameter(i, params[i]); 102 | } 103 | Long temp = (Long) query.uniqueResult(); 104 | if (temp != null) { 105 | count = temp.intValue(); 106 | } 107 | return count; 108 | } 109 | 110 | 111 | @Override 112 | public PageModel findByPager(int pageNo, int pageSize) { 113 | String hql = "select t from " + clazz.getSimpleName() + " t"; 114 | List list = (List) HibernateUtils.getCurrentSession().createQuery(hql).setFirstResult((pageNo - 1)*pageSize).setMaxResults(pageSize).list(); 115 | PageModel pm = new PageModel(pageNo, pageSize, totalCount(), list); 116 | return pm; 117 | } 118 | 119 | @Override 120 | public PageModel findByPager(int pageNo, int pageSize, String hql, Object param) { 121 | 122 | Query query = HibernateUtils.getCurrentSession().createQuery(hql); 123 | query.setParameter(0, param); 124 | int totalCount = query.list().size(); 125 | List list = (List) query.setFirstResult((pageNo - 1)*pageSize).setMaxResults(pageSize).list(); 126 | PageModel pm = new PageModel(pageNo, pageSize,totalCount, list); 127 | return pm; 128 | } 129 | 130 | @Override 131 | public PageModel findByPager(int pageNo, int pageSize, String hql, Object... params) { 132 | Query query = HibernateUtils.getCurrentSession().createQuery(hql); 133 | for (int i = 0; i < params.length; ++i) { 134 | query.setParameter(i, params[i]); 135 | } 136 | int totalCount = query.list().size(); 137 | 138 | List list = (List) query.setFirstResult((pageNo - 1)*pageSize).setMaxResults(pageSize).list(); 139 | PageModel pm = new PageModel(pageNo, pageSize, totalCount, list); 140 | return pm; 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /src/main/java/com/dao/impl/UserDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.dao.impl; 2 | 3 | import com.dao.UserDao; 4 | import com.entity.Users; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by zc on 2016/12/15. 10 | */ 11 | 12 | public class UserDaoImpl extends BaseDaoImpl implements UserDao { 13 | public UserDaoImpl() { 14 | super(); 15 | } 16 | 17 | @Override 18 | public boolean exist_user(String user_param, int type) { 19 | String hql = null; 20 | if (type == 1) {//根据用户ID 21 | hql = " from Users u where u.userId=?"; 22 | } else if (type == 2) {//根据用户名 23 | hql = " from Users u where u.userName=?"; 24 | } 25 | 26 | List list = super.findList(hql, user_param); 27 | 28 | return (list != null && !list.isEmpty()); 29 | } 30 | 31 | 32 | 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dao/impl/VideoDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.dao.impl; 2 | 3 | import com.dao.VideoDao; 4 | import com.entity.Videos; 5 | import com.utils.HibernateUtils; 6 | import org.hibernate.Session; 7 | import org.hibernate.Transaction; 8 | 9 | 10 | /** 11 | * Created by zc on 2016/12/20. 12 | */ 13 | public class VideoDaoImpl extends BaseDaoImpl implements VideoDao { 14 | 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/dao/impl/VideoFavDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.dao.impl; 2 | 3 | import com.dao.VideoFavDao; 4 | import com.entity.VideoFavlist; 5 | 6 | /** 7 | * Created by zc on 2016/12/20. 8 | */ 9 | public class VideoFavDaoImpl extends BaseDaoImpl implements VideoFavDao { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/dao/impl/VideoLikeDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.dao.impl; 2 | 3 | import com.dao.VideoLikeDao; 4 | import com.entity.VideoLike; 5 | 6 | /** 7 | * Created by zc on 2016/12/20. 8 | */ 9 | public class VideoLikeDaoImpl extends BaseDaoImpl implements VideoLikeDao { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/entity/Barrages.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.Date; 5 | 6 | /** 7 | * Created by zc on 2016/12/20. 8 | */ 9 | public class Barrages { 10 | private String barrageId; 11 | private Date barrageCreateTime; 12 | private Float videoTimePrint; 13 | private Integer barrageSpeed; 14 | private String barrageContent; 15 | private String barrageColor; 16 | private Integer barrageFontSize; 17 | 18 | 19 | private Videos barrage_video;//弹幕所属视频 20 | private Users barr_user;//弹幕所属用户 21 | 22 | public Videos getBarrage_video() { 23 | return barrage_video; 24 | } 25 | 26 | public void setBarrage_video(Videos barrage_video) { 27 | this.barrage_video = barrage_video; 28 | } 29 | 30 | public Users getBarr_user() { 31 | return barr_user; 32 | } 33 | 34 | public void setBarr_user(Users barr_user) { 35 | this.barr_user = barr_user; 36 | } 37 | 38 | public String getBarrageId() { 39 | return barrageId; 40 | } 41 | 42 | public void setBarrageId(String barrageId) { 43 | this.barrageId = barrageId; 44 | } 45 | 46 | public Date getBarrageCreateTime() { 47 | return barrageCreateTime; 48 | } 49 | 50 | public void setBarrageCreateTime(Date barrageCreateTime) { 51 | this.barrageCreateTime = barrageCreateTime; 52 | } 53 | 54 | public Float getVideoTimePrint() { 55 | return videoTimePrint; 56 | } 57 | 58 | public void setVideoTimePrint(Float videoTimePrint) { 59 | this.videoTimePrint = videoTimePrint; 60 | } 61 | 62 | public Integer getBarrageSpeed() { 63 | return barrageSpeed; 64 | } 65 | 66 | public void setBarrageSpeed(Integer barrageSpeed) { 67 | this.barrageSpeed = barrageSpeed; 68 | } 69 | 70 | public String getBarrageContent() { 71 | return barrageContent; 72 | } 73 | 74 | public void setBarrageContent(String barrageContent) { 75 | this.barrageContent = barrageContent; 76 | } 77 | 78 | public String getBarrageColor() { 79 | return barrageColor; 80 | } 81 | 82 | public void setBarrageColor(String barrageColor) { 83 | this.barrageColor = barrageColor; 84 | } 85 | 86 | public Integer getBarrageFontSize() { 87 | return barrageFontSize; 88 | } 89 | 90 | public void setBarrageFontSize(Integer barrageFontSize) { 91 | this.barrageFontSize = barrageFontSize; 92 | } 93 | 94 | @Override 95 | public boolean equals(Object o) { 96 | if (this == o) return true; 97 | if (o == null || getClass() != o.getClass()) return false; 98 | 99 | Barrages barrages = (Barrages) o; 100 | 101 | if (barrageId != null ? !barrageId.equals(barrages.barrageId) : barrages.barrageId != null) return false; 102 | if (barrageCreateTime != null ? !barrageCreateTime.equals(barrages.barrageCreateTime) : barrages.barrageCreateTime != null) 103 | return false; 104 | if (videoTimePrint != null ? !videoTimePrint.equals(barrages.videoTimePrint) : barrages.videoTimePrint != null) 105 | return false; 106 | if (barrageSpeed != null ? !barrageSpeed.equals(barrages.barrageSpeed) : barrages.barrageSpeed != null) 107 | return false; 108 | if (barrageContent != null ? !barrageContent.equals(barrages.barrageContent) : barrages.barrageContent != null) 109 | return false; 110 | if (barrageColor != null ? !barrageColor.equals(barrages.barrageColor) : barrages.barrageColor != null) 111 | return false; 112 | if (barrageFontSize != null ? !barrageFontSize.equals(barrages.barrageFontSize) : barrages.barrageFontSize != null) 113 | return false; 114 | 115 | return true; 116 | } 117 | 118 | @Override 119 | public int hashCode() { 120 | int result = barrageId != null ? barrageId.hashCode() : 0; 121 | result = 31 * result + (barrageCreateTime != null ? barrageCreateTime.hashCode() : 0); 122 | result = 31 * result + (videoTimePrint != null ? videoTimePrint.hashCode() : 0); 123 | result = 31 * result + (barrageSpeed != null ? barrageSpeed.hashCode() : 0); 124 | result = 31 * result + (barrageContent != null ? barrageContent.hashCode() : 0); 125 | result = 31 * result + (barrageColor != null ? barrageColor.hashCode() : 0); 126 | result = 31 * result + (barrageFontSize != null ? barrageFontSize.hashCode() : 0); 127 | return result; 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /src/main/java/com/entity/Users.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | 4 | 5 | import java.util.Date; 6 | import java.util.HashSet; 7 | import java.util.Set; 8 | 9 | /** 10 | * Created by zc on 2016/12/20. 11 | */ 12 | public class Users { 13 | private String userId; 14 | private String userName; 15 | private String userPassword; 16 | private String userEmail; 17 | private String userGender; 18 | private Date userBirthday; 19 | private String userPicPath; 20 | private Integer roomId; 21 | 22 | private Set uploadSet = new HashSet<>();//用户上传视频列表 23 | private Set user_barrageSet=new HashSet<>();//该用户所发的弹幕集合 24 | private Set user_likeSet = new HashSet<>();//用户点赞列表 25 | private Set user_favSet = new HashSet<>();//用户收藏列表 26 | 27 | 28 | public Set getUser_barrageSet() { 29 | return user_barrageSet; 30 | } 31 | 32 | public void setUser_barrageSet(Set user_barrageSet) { 33 | this.user_barrageSet = user_barrageSet; 34 | } 35 | 36 | public Set getUser_likeSet() { 37 | return user_likeSet; 38 | } 39 | 40 | public void setUser_likeSet(Set user_likeSet) { 41 | this.user_likeSet = user_likeSet; 42 | } 43 | 44 | public Set getUser_favSet() { 45 | return user_favSet; 46 | } 47 | 48 | public void setUser_favSet(Set user_favSet) { 49 | this.user_favSet = user_favSet; 50 | } 51 | 52 | public Set getUploadSet() { 53 | return uploadSet; 54 | } 55 | 56 | public void setUploadSet(Set uploadSet) { 57 | this.uploadSet = uploadSet; 58 | } 59 | 60 | public String getUserId() { 61 | return userId; 62 | } 63 | 64 | public void setUserId(String userId) { 65 | this.userId = userId; 66 | } 67 | 68 | public String getUserName() { 69 | return userName; 70 | } 71 | 72 | public void setUserName(String userName) { 73 | this.userName = userName; 74 | } 75 | 76 | public String getUserPassword() { 77 | return userPassword; 78 | } 79 | 80 | public void setUserPassword(String userPassword) { 81 | this.userPassword = userPassword; 82 | } 83 | 84 | public String getUserEmail() { 85 | return userEmail; 86 | } 87 | 88 | public void setUserEmail(String userEmail) { 89 | this.userEmail = userEmail; 90 | } 91 | 92 | public String getUserGender() { 93 | return userGender; 94 | } 95 | 96 | public void setUserGender(String userGender) { 97 | this.userGender = userGender; 98 | } 99 | 100 | public Date getUserBirthday() { 101 | return userBirthday; 102 | } 103 | 104 | public void setUserBirthday(Date userBirthday) { 105 | this.userBirthday = userBirthday; 106 | } 107 | 108 | public String getUserPicPath() { 109 | 110 | return this.userPicPath; 111 | } 112 | 113 | public void setUserPicPath(String userPicPath) { 114 | this.userPicPath = userPicPath; 115 | } 116 | 117 | public Integer getRoomId() { 118 | return roomId; 119 | } 120 | 121 | public void setRoomId(Integer roomId) { 122 | this.roomId = roomId; 123 | } 124 | 125 | @Override 126 | public boolean equals(Object o) { 127 | if (this == o) return true; 128 | if (o == null || getClass() != o.getClass()) return false; 129 | 130 | Users users = (Users) o; 131 | 132 | if (userId != null ? !userId.equals(users.userId) : users.userId != null) return false; 133 | if (userName != null ? !userName.equals(users.userName) : users.userName != null) return false; 134 | if (userPassword != null ? !userPassword.equals(users.userPassword) : users.userPassword != null) return false; 135 | if (userEmail != null ? !userEmail.equals(users.userEmail) : users.userEmail != null) return false; 136 | if (userGender != null ? !userGender.equals(users.userGender) : users.userGender != null) return false; 137 | if (userBirthday != null ? !userBirthday.equals(users.userBirthday) : users.userBirthday != null) return false; 138 | if (userPicPath != null ? !userPicPath.equals(users.userPicPath) : users.userPicPath != null) return false; 139 | return roomId != null ? roomId.equals(users.roomId) : users.roomId == null; 140 | } 141 | 142 | @Override 143 | public int hashCode() { 144 | int result = userId != null ? userId.hashCode() : 0; 145 | result = 31 * result + (userName != null ? userName.hashCode() : 0); 146 | result = 31 * result + (userPassword != null ? userPassword.hashCode() : 0); 147 | result = 31 * result + (userEmail != null ? userEmail.hashCode() : 0); 148 | result = 31 * result + (userGender != null ? userGender.hashCode() : 0); 149 | result = 31 * result + (userBirthday != null ? userBirthday.hashCode() : 0); 150 | result = 31 * result + (userPicPath != null ? userPicPath.hashCode() : 0); 151 | result = 31 * result + (roomId != null ? roomId.hashCode() : 0); 152 | return result; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /src/main/java/com/entity/VideoFavlist.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.sql.Timestamp; 4 | 5 | /** 6 | * Created by zc on 2016/12/20. 7 | */ 8 | public class VideoFavlist { 9 | 10 | private VideoFavlistPK favId; 11 | private Timestamp favTime; 12 | 13 | private Videos fav_video;//被收藏的视频 14 | 15 | private Users fav_user;//收藏视频的用户 16 | 17 | public Videos getFav_video() { 18 | return fav_video; 19 | } 20 | 21 | public void setFav_video(Videos fav_video) { 22 | this.fav_video = fav_video; 23 | } 24 | 25 | public Users getFav_user() { 26 | return fav_user; 27 | } 28 | 29 | public void setFav_user(Users fav_user) { 30 | this.fav_user = fav_user; 31 | } 32 | 33 | public VideoFavlistPK getFavId() { 34 | return favId; 35 | } 36 | 37 | public void setFavId(VideoFavlistPK favId) { 38 | this.favId = favId; 39 | } 40 | 41 | public Timestamp getFavTime() { 42 | return favTime; 43 | } 44 | 45 | 46 | public void setFavTime(Timestamp favTime) { 47 | this.favTime = favTime; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/entity/VideoFavlistPK.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by zc on 2016/12/20. 7 | */ 8 | public class VideoFavlistPK implements Serializable { 9 | private String userId; 10 | private String videoId; 11 | 12 | public String getUserId() { 13 | return userId; 14 | } 15 | 16 | public void setUserId(String userId) { 17 | this.userId = userId; 18 | } 19 | 20 | public String getVideoId() { 21 | return videoId; 22 | } 23 | 24 | public void setVideoId(String videoId) { 25 | this.videoId = videoId; 26 | } 27 | 28 | @Override 29 | public boolean equals(Object o) { 30 | if (this == o) return true; 31 | if (o == null || getClass() != o.getClass()) return false; 32 | 33 | VideoFavlistPK that = (VideoFavlistPK) o; 34 | 35 | if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false; 36 | if (videoId != null ? !videoId.equals(that.videoId) : that.videoId != null) return false; 37 | 38 | return true; 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | int result = userId != null ? userId.hashCode() : 0; 44 | result = 31 * result + (videoId != null ? videoId.hashCode() : 0); 45 | return result; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/entity/VideoLike.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | /** 4 | * Created by zc on 2016/12/20. 5 | */ 6 | public class VideoLike { 7 | 8 | private VideoLikePK likeId; 9 | 10 | private Videos like_video; 11 | 12 | private Users like_user; 13 | 14 | public Videos getLike_video() { 15 | return like_video; 16 | } 17 | 18 | public void setLike_video(Videos like_video) { 19 | this.like_video = like_video; 20 | } 21 | 22 | public Users getLike_user() { 23 | return like_user; 24 | } 25 | 26 | public void setLike_user(Users like_user) { 27 | this.like_user = like_user; 28 | } 29 | 30 | public VideoLikePK getLikeId() { 31 | return likeId; 32 | } 33 | 34 | public void setLikeId(VideoLikePK likeId) { 35 | this.likeId = likeId; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/entity/VideoLikePK.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by zc on 2016/12/20. 7 | */ 8 | public class VideoLikePK implements Serializable { 9 | private String userId; 10 | private String videoId; 11 | 12 | public String getUserId() { 13 | return userId; 14 | } 15 | 16 | public void setUserId(String userId) { 17 | this.userId = userId; 18 | } 19 | 20 | public String getVideoId() { 21 | return videoId; 22 | } 23 | 24 | public void setVideoId(String videoId) { 25 | this.videoId = videoId; 26 | } 27 | 28 | @Override 29 | public boolean equals(Object o) { 30 | if (this == o) return true; 31 | if (o == null || getClass() != o.getClass()) return false; 32 | 33 | VideoLikePK that = (VideoLikePK) o; 34 | 35 | if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false; 36 | if (videoId != null ? !videoId.equals(that.videoId) : that.videoId != null) return false; 37 | 38 | return true; 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | int result = userId != null ? userId.hashCode() : 0; 44 | result = 31 * result + (videoId != null ? videoId.hashCode() : 0); 45 | return result; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/entity/Videos.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.util.Date; 4 | import java.util.HashSet; 5 | import java.util.Set; 6 | 7 | /** 8 | * Created by zc on 2016/12/20. 9 | */ 10 | public class Videos { 11 | private String videoId; 12 | private String videoTitle; 13 | private String videoPath; 14 | private String videoCoverPath; 15 | private Integer videoWatchCount; 16 | private String videoType; 17 | private String isDiy; 18 | private Date videoUploadTime; 19 | 20 | private Users up_user;//视频所有者 21 | 22 | // private Set video_barrageSet=new HashSet<>();//视频弹幕集合 23 | private Set video_favSet =new HashSet<>();//收藏该视频列表 24 | private Set video_likeSet =new HashSet<>();//给该视频点赞列表 25 | 26 | private Integer barrageNum;//弹幕总数 27 | 28 | public Integer getBarrageNum() { 29 | return barrageNum; 30 | } 31 | 32 | public void setBarrageNum(Integer barrageNum) { 33 | this.barrageNum = barrageNum; 34 | } 35 | 36 | // public Set getVideo_barrageSet() { 37 | // return video_barrageSet; 38 | // } 39 | 40 | // public void setVideo_barrageSet(Set video_barrageSet) { 41 | // this.video_barrageSet = video_barrageSet; 42 | // } 43 | 44 | public Set getVideo_likeSet() { 45 | return video_likeSet; 46 | } 47 | 48 | public void setVideo_likeSet(Set video_likeSet) { 49 | this.video_likeSet = video_likeSet; 50 | } 51 | 52 | public Set getVideo_favSet() { 53 | return video_favSet; 54 | } 55 | 56 | public void setVideo_favSet(Set video_favSet) { 57 | this.video_favSet = video_favSet; 58 | } 59 | 60 | public Users getUp_user() { 61 | return up_user; 62 | } 63 | 64 | public void setUp_user(Users up_user) { 65 | this.up_user = up_user; 66 | } 67 | 68 | public String getVideoId() { 69 | return videoId; 70 | } 71 | 72 | public void setVideoId(String videoId) { 73 | this.videoId = videoId; 74 | } 75 | 76 | public String getVideoTitle() { 77 | return videoTitle; 78 | } 79 | 80 | public void setVideoTitle(String videoTitle) { 81 | this.videoTitle = videoTitle; 82 | } 83 | 84 | public String getVideoPath() { 85 | return videoPath; 86 | } 87 | 88 | public void setVideoPath(String videoPath) { 89 | this.videoPath = videoPath; 90 | } 91 | 92 | public String getVideoCoverPath() { 93 | return videoCoverPath; 94 | } 95 | 96 | public void setVideoCoverPath(String videoCoverPath) { 97 | this.videoCoverPath = videoCoverPath; 98 | } 99 | 100 | public Integer getVideoWatchCount() { 101 | return videoWatchCount; 102 | } 103 | 104 | public void setVideoWatchCount(Integer videoWatchCount) { 105 | this.videoWatchCount = videoWatchCount; 106 | } 107 | 108 | public String getVideoType() { 109 | return videoType; 110 | } 111 | 112 | public void setVideoType(String videoType) { 113 | this.videoType = videoType; 114 | } 115 | 116 | public String getIsDiy() { 117 | return isDiy; 118 | } 119 | 120 | public void setIsDiy(String isDiy) { 121 | this.isDiy = isDiy; 122 | } 123 | 124 | public Date getVideoUploadTime() { 125 | return videoUploadTime; 126 | } 127 | 128 | public void setVideoUploadTime(Date videoUploadTime) { 129 | this.videoUploadTime = videoUploadTime; 130 | } 131 | 132 | @Override 133 | public boolean equals(Object o) { 134 | if (this == o) return true; 135 | if (o == null || getClass() != o.getClass()) return false; 136 | 137 | Videos videos = (Videos) o; 138 | 139 | if (videoId != null ? !videoId.equals(videos.videoId) : videos.videoId != null) return false; 140 | if (videoTitle != null ? !videoTitle.equals(videos.videoTitle) : videos.videoTitle != null) return false; 141 | if (videoPath != null ? !videoPath.equals(videos.videoPath) : videos.videoPath != null) return false; 142 | if (videoCoverPath != null ? !videoCoverPath.equals(videos.videoCoverPath) : videos.videoCoverPath != null) 143 | return false; 144 | if (videoWatchCount != null ? !videoWatchCount.equals(videos.videoWatchCount) : videos.videoWatchCount != null) 145 | return false; 146 | if (videoType != null ? !videoType.equals(videos.videoType) : videos.videoType != null) return false; 147 | if (isDiy != null ? !isDiy.equals(videos.isDiy) : videos.isDiy != null) return false; 148 | if (videoUploadTime != null ? !videoUploadTime.equals(videos.videoUploadTime) : videos.videoUploadTime != null) 149 | return false; 150 | 151 | return true; 152 | } 153 | 154 | @Override 155 | public int hashCode() { 156 | int result = videoId != null ? videoId.hashCode() : 0; 157 | result = 31 * result + (videoTitle != null ? videoTitle.hashCode() : 0); 158 | result = 31 * result + (videoPath != null ? videoPath.hashCode() : 0); 159 | result = 31 * result + (videoCoverPath != null ? videoCoverPath.hashCode() : 0); 160 | result = 31 * result + (videoWatchCount != null ? videoWatchCount.hashCode() : 0); 161 | result = 31 * result + (videoType != null ? videoType.hashCode() : 0); 162 | result = 31 * result + (isDiy != null ? isDiy.hashCode() : 0); 163 | result = 31 * result + (videoUploadTime != null ? videoUploadTime.hashCode() : 0); 164 | return result; 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /src/main/java/com/entity/modelBeans/PageModel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.entity.modelBeans; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author slw 10 | * 分页模型类 11 | */ 12 | public class PageModel { 13 | 14 | //当前页号 15 | private int pageNo=1; 16 | //每页显示的记录数 17 | private int pageSize=2; 18 | //总记录数 19 | private int recordCount; 20 | //总页数 21 | private int pageCount; 22 | //存放分页数据的集合 23 | private List datas; 24 | 25 | public PageModel(){ 26 | 27 | } 28 | 29 | public PageModel(int pageNo,int pageSize){ 30 | this.pageNo=pageNo; 31 | this.pageSize=pageSize; 32 | } 33 | 34 | public PageModel(int pageNo, int pageSize, int recordCount, List datas) { 35 | this.pageNo = pageNo; 36 | this.pageSize = pageSize; 37 | this.recordCount = recordCount; 38 | this.datas = datas; 39 | } 40 | 41 | public int getPageNo() { 42 | return pageNo; 43 | } 44 | 45 | public void setPageNo(int pageNo) { 46 | this.pageNo = pageNo; 47 | } 48 | 49 | public int getPageSize() { 50 | return pageSize; 51 | } 52 | 53 | public void setPageSize(int pageSize) { 54 | this.pageSize = pageSize; 55 | } 56 | 57 | public int getRecordCount() { 58 | return recordCount; 59 | } 60 | 61 | public void setRecordCount(int recordCount) { 62 | this.recordCount = recordCount; 63 | } 64 | 65 | public int getPageCount() { 66 | if(this.getRecordCount()<=0){ 67 | return 0; 68 | }else{ 69 | pageCount=(recordCount+pageSize-1)/pageSize; 70 | } 71 | return pageCount; 72 | } 73 | 74 | public void setPageCount(int pageCount) { 75 | this.pageCount = pageCount; 76 | } 77 | 78 | public List getDatas() { 79 | return datas; 80 | } 81 | 82 | public void setDatas(List datas) { 83 | this.datas = datas; 84 | } 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/listen/ApplicationListener.java: -------------------------------------------------------------------------------- 1 | package com.listen; 2 | /** 3 | * Created by zc on 2016/12/7. 4 | */ 5 | 6 | import com.utils.HibernateUtils; 7 | 8 | import javax.servlet.ServletContextEvent; 9 | import javax.servlet.ServletContextListener; 10 | import javax.servlet.annotation.WebListener; 11 | import javax.servlet.http.HttpSessionAttributeListener; 12 | import javax.servlet.http.HttpSessionBindingEvent; 13 | import javax.servlet.http.HttpSessionEvent; 14 | import javax.servlet.http.HttpSessionListener; 15 | import java.sql.DriverManager; 16 | 17 | @WebListener() 18 | public class ApplicationListener implements ServletContextListener, 19 | HttpSessionListener, HttpSessionAttributeListener { 20 | 21 | // Public constructor is required by servlet spec 22 | public ApplicationListener() { 23 | } 24 | 25 | // ------------------------------------------------------- 26 | // ServletContextListener implementation 27 | // ------------------------------------------------------- 28 | public void contextInitialized(ServletContextEvent sce) { 29 | // sce.getServletContext().setAttribute("onlineCount", 0); 30 | // sce.getServletContext().setAttribute("islived", false); 31 | } 32 | 33 | public void contextDestroyed(ServletContextEvent sce) { 34 | /* This method is invoked when the Servlet Context 35 | (the Web application) is undeployed or 36 | Application Server shuts down. 37 | */ 38 | 39 | // try { 40 | // System.out.println("-----------------------"); 41 | // HibernateUtils.getCurrentSession().close(); 42 | // System.out.println(DriverManager.getDrivers().nextElement().getMajorVersion()); 43 | // DriverManager.deregisterDriver(DriverManager.getDrivers().nextElement()); 44 | // 45 | // }catch (Exception e){ 46 | // e.printStackTrace(); 47 | // } 48 | } 49 | 50 | // ------------------------------------------------------- 51 | // HttpSessionListener implementation 52 | // ------------------------------------------------------- 53 | public void sessionCreated(HttpSessionEvent se) { 54 | /* Session is created. */ 55 | } 56 | 57 | public void sessionDestroyed(HttpSessionEvent se) { 58 | /* Session is destroyed. */ 59 | } 60 | 61 | // ------------------------------------------------------- 62 | // HttpSessionAttributeListener implementation 63 | // ------------------------------------------------------- 64 | 65 | public void attributeAdded(HttpSessionBindingEvent sbe) { 66 | /* This method is called when an attribute 67 | is added to a session. 68 | */ 69 | } 70 | 71 | public void attributeRemoved(HttpSessionBindingEvent sbe) { 72 | /* This method is called when an attribute 73 | is removed from a session. 74 | */ 75 | } 76 | 77 | public void attributeReplaced(HttpSessionBindingEvent sbe) { 78 | /* This method is invoked when an attibute 79 | is replaced in a session. 80 | */ 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/service/BarrageService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.entity.Barrages; 4 | import com.utils.HibernateUtils; 5 | import org.hibernate.Transaction; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by zc on 2016/12/20. 12 | */ 13 | public class BarrageService extends BaseServices { 14 | 15 | @Override 16 | public boolean save(Barrages entity) { 17 | return super.save(entity); 18 | } 19 | 20 | @Override 21 | public boolean delete(Barrages entity) { 22 | return super.delete(entity); 23 | } 24 | 25 | @Override 26 | public boolean update(Barrages entity) { 27 | return super.update(entity); 28 | } 29 | 30 | @Override 31 | public Barrages get(Serializable id) { 32 | return super.get(id); 33 | } 34 | 35 | 36 | 37 | //获得弹幕列表(按时间排序) 38 | public List queryByVideo(String video_id) { 39 | Transaction tx=null; 40 | try{ 41 | tx= HibernateUtils.getCurrentSession().beginTransaction(); 42 | String hql = "from Barrages b where b.barrage_video.videoId=? order by b.barrageCreateTime asc"; 43 | 44 | List list = barrageDao.findList(hql, video_id); 45 | 46 | tx.commit(); 47 | 48 | return list; 49 | 50 | }catch(Exception ce){ 51 | if (tx != null) { 52 | tx.rollback(); 53 | } 54 | ce.printStackTrace(); 55 | } 56 | return null; 57 | } 58 | 59 | 60 | //获得弹幕数 61 | public int queryCountByVideo(String video_id) { 62 | Transaction tx = null; 63 | try { 64 | tx = HibernateUtils.getCurrentSession().beginTransaction(); 65 | String hql = "select count(*) from Barrages b where b.barrage_video.videoId=? order by b.barrageCreateTime asc"; 66 | 67 | int count = barrageDao.totalCount(hql, video_id); 68 | 69 | tx.commit(); 70 | 71 | return count; 72 | 73 | } catch (Exception ce) { 74 | if (tx != null) { 75 | tx.rollback(); 76 | } 77 | ce.printStackTrace(); 78 | } 79 | return -1; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/service/UploadService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.utils.COSUtil; 4 | import com.utils.VideoUtils; 5 | import org.apache.commons.io.FileUtils; 6 | 7 | import java.io.File; 8 | import java.util.UUID; 9 | 10 | public class UploadService { 11 | 12 | public static String upload(File file, String fileName, String tmp_path, String cosPathPrefix) throws Exception { 13 | //扩展名 14 | //abc.jpg 15 | String fileExtend = fileName.substring(fileName.lastIndexOf(".")); 16 | String uploadFileName = UUID.randomUUID().toString() + fileExtend; 17 | 18 | File fileDir = new File(tmp_path); 19 | if (!fileDir.exists()) { 20 | fileDir.setWritable(true); 21 | fileDir.mkdirs(); 22 | } 23 | File targetFile = new File(tmp_path, uploadFileName); 24 | 25 | FileUtils.copyFile(file, targetFile);//复制到服务器 26 | 27 | 28 | Boolean aBoolean = COSUtil.uploadFile(cosPathPrefix + uploadFileName, targetFile.getAbsolutePath()); 29 | if (!aBoolean) { 30 | throw new Exception("COS上传失败"); 31 | } 32 | //已经上传到Cos 33 | 34 | targetFile.delete(); 35 | 36 | 37 | // /img/ -> img/ 38 | return cosPathPrefix.substring(1, cosPathPrefix.length()) + targetFile.getName(); 39 | } 40 | 41 | 42 | public static String extractAndUplaod(File video, String thumbnailExtend, String tmp_path, String cosPathPrefix) throws Exception { 43 | String uploadFileName = UUID.randomUUID().toString() + thumbnailExtend; 44 | File fileDir = new File(tmp_path); 45 | if (!fileDir.exists()) { 46 | fileDir.setWritable(true); 47 | fileDir.mkdirs(); 48 | } 49 | File targetFile = new File(tmp_path, uploadFileName); 50 | 51 | boolean extractOk = VideoUtils.extractThumbnail(video, targetFile.getAbsolutePath()); 52 | if (extractOk) { 53 | System.out.println("提取成功"); 54 | Boolean aBoolean = COSUtil.uploadFile(cosPathPrefix + uploadFileName, targetFile.getAbsolutePath()); 55 | if (!aBoolean) { 56 | throw new Exception("COS上传失败"); 57 | } 58 | } else { 59 | throw new Exception("提取失败"); 60 | } 61 | 62 | //已经上传到Cos 63 | targetFile.delete(); 64 | 65 | return cosPathPrefix.substring(1, cosPathPrefix.length()) + targetFile.getName(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/service/UserService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.service; 5 | 6 | import com.entity.Users; 7 | import com.utils.HibernateUtils; 8 | import com.utils.PropertiesUtil; 9 | import org.hibernate.Session; 10 | import org.hibernate.Transaction; 11 | 12 | import java.io.Serializable; 13 | import java.util.List; 14 | 15 | /** 16 | * @author zc 17 | */ 18 | public class UserService extends BaseServices { 19 | 20 | @Override //添加用户 21 | public boolean save(Users entity) { 22 | return super.save(entity); 23 | } 24 | 25 | @Override //删除用户 26 | public boolean delete(Users entity) { 27 | return super.delete(entity); 28 | } 29 | 30 | @Override //更新用户 31 | public boolean update(Users entity) { 32 | return super.update(entity); 33 | } 34 | 35 | @Override //找到用户 36 | public Users get(Serializable id) { 37 | return super.get(id); 38 | } 39 | 40 | 41 | //判断用户名是否存在 42 | public boolean exit_userName(String username) { 43 | Transaction tx = null; 44 | Boolean exit = false; 45 | try { 46 | Session session = HibernateUtils.getCurrentSession(); 47 | tx = session.beginTransaction(); 48 | exit = userDao.exist_user(username, 2); 49 | tx.commit(); 50 | } catch (Exception ce) { 51 | if (tx != null) { 52 | tx.rollback(); 53 | } 54 | ce.printStackTrace(); 55 | } 56 | return exit; 57 | } 58 | 59 | 60 | //判断用户id(手机号)是否存在 61 | public boolean exit_userId(String userid) { 62 | Transaction tx = null; 63 | Boolean exit = false; 64 | try { 65 | Session session = HibernateUtils.getCurrentSession(); 66 | tx = session.beginTransaction(); 67 | exit = userDao.exist_user(userid, 1); 68 | tx.commit(); 69 | } catch (Exception ce) { 70 | if (tx != null) { 71 | tx.rollback(); 72 | } 73 | ce.printStackTrace(); 74 | } 75 | return exit; 76 | } 77 | 78 | 79 | //登录业务逻辑 80 | public Users loginservice(Users user) { 81 | Transaction tx = null; 82 | try { 83 | Session session = HibernateUtils.getCurrentSession(); 84 | tx = session.beginTransaction(); 85 | String hql = 86 | " from Users where (userId=? or userName=?)and userPassword=?"; 87 | Object[] params = {user.getUserId(), user.getUserId(), user.getUserPassword()}; 88 | List list = userDao.findList(hql, params); 89 | tx.commit(); 90 | if (list != null && !list.isEmpty()) { 91 | 92 | Users login_user = list.get(0); 93 | login_user.setUserPassword(""); 94 | login_user.setUserPicPath(PropertiesUtil.getProperty("cos.server.http.prefix") + login_user.getUserPicPath()); 95 | return login_user; 96 | } 97 | } catch (Exception ce) { 98 | if (tx != null) { 99 | tx.rollback(); 100 | } 101 | ce.printStackTrace(); 102 | } 103 | 104 | return null; 105 | } 106 | 107 | 108 | public Users getUserbyRoomId(Integer roomId) { 109 | Transaction tx = null; 110 | try { 111 | Session session = HibernateUtils.getCurrentSession(); 112 | tx = session.beginTransaction(); 113 | String hql = 114 | "from Users where roomId=?"; 115 | Object[] params = {roomId}; 116 | List list = userDao.findList(hql, params); 117 | tx.commit(); 118 | if (list != null && !list.isEmpty()) { 119 | Users liver = list.get(0); 120 | liver.setUserPassword(""); 121 | liver.setUserPicPath(PropertiesUtil.getProperty("cos.server.http.prefix") + liver.getUserPicPath()); 122 | return liver; 123 | } 124 | } catch (Exception ce) { 125 | if (tx != null) { 126 | tx.rollback(); 127 | } 128 | ce.printStackTrace(); 129 | } 130 | 131 | return null; 132 | } 133 | 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/service/VideoService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.entity.VideoLike; 4 | import com.entity.Videos; 5 | import com.entity.modelBeans.PageModel; 6 | import com.utils.HibernateUtils; 7 | import com.utils.PropertiesUtil; 8 | import org.hibernate.Session; 9 | import org.hibernate.Transaction; 10 | 11 | import java.io.Serializable; 12 | import java.util.Iterator; 13 | import java.util.List; 14 | import java.util.Set; 15 | 16 | /** 17 | * Created by zc on 2016/12/20. 18 | */ 19 | public class VideoService extends BaseServices { 20 | 21 | @Override//添加视频 22 | public boolean save(Videos entity) { 23 | return super.save(entity); 24 | } 25 | 26 | @Override//删除视频 27 | public boolean delete(Videos entity) { 28 | return super.delete(entity); 29 | } 30 | 31 | @Override//更新视频 32 | public boolean update(Videos entity) { 33 | return super.update(entity); 34 | } 35 | 36 | @Override//获取视频 37 | public Videos get(Serializable id) { 38 | return super.get(id); 39 | } 40 | 41 | @Override//所有视频列表 42 | public List findAll() { 43 | return super.findAll(); 44 | } 45 | 46 | 47 | //增加视频观看次数 48 | public boolean addWatchCount(Videos video) { 49 | Transaction tx = null; 50 | try { 51 | Session session = HibernateUtils.getCurrentSession(); 52 | tx = session.beginTransaction(); 53 | if (video != null) { 54 | video.setVideoWatchCount((Integer) video.getVideoWatchCount() + 1); 55 | videoDao.update(video); 56 | tx.commit(); 57 | return true; 58 | } 59 | } catch (Exception ce) { 60 | if (tx != null) { 61 | tx.rollback(); 62 | } 63 | ce.printStackTrace(); 64 | } 65 | return false; 66 | 67 | } 68 | 69 | 70 | //获取视频信息(加载视频up主信息) 71 | public Videos getVideo_info(String video_id) { 72 | Transaction tx = null; 73 | try { 74 | Session session = HibernateUtils.getCurrentSession(); 75 | tx = session.beginTransaction(); 76 | Videos video = videoDao.get(video_id); 77 | 78 | if (video != null) { 79 | String up_user = video.getUp_user().getUserName();//通过访问属性加载用户对象 80 | Set video_likeSet = video.getVideo_likeSet(); 81 | video_likeSet.size(); 82 | } 83 | tx.commit(); 84 | return video; 85 | 86 | } catch (Exception ce) { 87 | if (tx != null) { 88 | tx.rollback(); 89 | } 90 | ce.printStackTrace(); 91 | } 92 | return null; 93 | } 94 | 95 | //根据页码获取视频分页模型 96 | public PageModel videosPageModel(int pageNo, int pageSize) { 97 | PageModel byPager = super.findByPager(pageNo, pageSize); 98 | Iterator iterator = byPager.getDatas().iterator(); 99 | while (iterator.hasNext()) { 100 | Videos video = iterator.next(); 101 | video.setVideoPath(PropertiesUtil.getProperty("cos.server.http.prefix") + video.getVideoPath()); 102 | video.setVideoCoverPath(PropertiesUtil.getProperty("cos.server.http.prefix") + video.getVideoCoverPath()); 103 | } 104 | return byPager; 105 | } 106 | 107 | 108 | //根据类型,页码获取视频分页模型 109 | public PageModel classify(PageModel pageModel, String videoType) { 110 | 111 | String hql = "from Videos v where v.videoType=? order by v.videoWatchCount DESC,v.videoId ASC"; 112 | PageModel byPager = super.findByPager 113 | (pageModel.getPageNo(), pageModel.getPageSize(), hql, videoType); 114 | 115 | Iterator iterator = byPager.getDatas().iterator(); 116 | while (iterator.hasNext()) { 117 | Videos video = iterator.next(); 118 | video.setVideoPath(PropertiesUtil.getProperty("cos.server.http.prefix") + video.getVideoPath()); 119 | video.setVideoCoverPath(PropertiesUtil.getProperty("cos.server.http.prefix") + video.getVideoCoverPath()); 120 | } 121 | 122 | return byPager; 123 | 124 | } 125 | 126 | //根据类型,页码获取视频分页模型 127 | public PageModel soso(PageModel pageModel, String keyword) { 128 | 129 | keyword = keyword.replace("%", "\\%").replace("_", "\\_"); 130 | 131 | String hql = "from Videos v where v.videoTitle like ? order by v.videoWatchCount DESC,v.videoId ASC"; 132 | 133 | PageModel byPager = super.findByPager 134 | (pageModel.getPageNo(), pageModel.getPageSize(), hql, "%" + keyword + "%"); 135 | Iterator iterator = byPager.getDatas().iterator(); 136 | while (iterator.hasNext()) { 137 | Videos video = iterator.next(); 138 | video.setVideoPath(PropertiesUtil.getProperty("cos.server.http.prefix") + video.getVideoPath()); 139 | video.setVideoCoverPath(PropertiesUtil.getProperty("cos.server.http.prefix") + video.getVideoCoverPath()); 140 | } 141 | 142 | return byPager; 143 | 144 | 145 | } 146 | 147 | } 148 | -------------------------------------------------------------------------------- /src/main/java/com/utils/COSUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import com.qcloud.cos.COSClient; 4 | import com.qcloud.cos.ClientConfig; 5 | import com.qcloud.cos.request.UploadFileRequest; 6 | import com.qcloud.cos.sign.Credentials; 7 | import org.json.JSONObject; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | 11 | 12 | /** 13 | * Created by zc on 2017/6/16. 14 | */ 15 | public class COSUtil { 16 | private static final Logger logger = LoggerFactory.getLogger(COSUtil.class); 17 | 18 | private COSClient cosClient; 19 | private long appId = Long.parseLong(PropertiesUtil.getProperty("appId")); 20 | private String secretId = PropertiesUtil.getProperty("secretId"); 21 | private String secretKey = PropertiesUtil.getProperty("secretKey"); 22 | // 设置要操作的bucket 23 | private String bucketName = PropertiesUtil.getProperty("bucketName"); 24 | 25 | private COSUtil() { 26 | // 初始化客户端配置 27 | ClientConfig clientConfig = new ClientConfig(); 28 | // 设置bucket所在的区域,比如华南园区:gz; 华北园区:tj;华东园区:sh ; 29 | clientConfig.setRegion(PropertiesUtil.getProperty("region")); 30 | // 初始化cosClient 31 | Credentials cred = new Credentials(appId, secretId, secretKey); 32 | this.cosClient = new COSClient(clientConfig, cred); 33 | } 34 | 35 | 36 | public static Boolean uploadFile(String cosPath, String localPath) { 37 | COSUtil cosUtil = new COSUtil(); 38 | 39 | UploadFileRequest uploadFileRequest = new UploadFileRequest( 40 | cosUtil.bucketName, cosPath, localPath); 41 | String uploadFileRet = cosUtil.cosClient.uploadFile(uploadFileRequest); 42 | JSONObject map = new JSONObject(uploadFileRet); 43 | if ((int) map.get("code") != 0) { 44 | logger.info("上传失败码:" + (int) map.get("code") + "原因:" + map.get("message")); 45 | return false; 46 | } 47 | return true; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/utils/CreateId.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.Random; 4 | /* 5 | * author 朱婷婷 6 | * 7 | * 版权所有 8 | * */ 9 | 10 | public class CreateId { 11 | 12 | //位数基 13 | final static int[] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999, 14 | 99999999, 999999999, Integer.MAX_VALUE }; 15 | 16 | 17 | //计算数的位数 18 | public static int sizeOfInt(int x) { 19 | for (int i = 0;; i++) 20 | if (x <= sizeTable[i]) 21 | return i + 1; 22 | } 23 | 24 | 25 | //生成随机序列码 26 | public static String OneId(int len){ 27 | Random random=new Random(); 28 | int num=random.nextInt(sizeTable[len-1]+1);//生成一个8位随机数 29 | String Id=""; 30 | int numDigit= sizeOfInt(num); 31 | for(int i=0;i cach = new HashMap(); 18 | 19 | static{ 20 | InputStream is=Thread.currentThread().getContextClassLoader().getResourceAsStream("dao.properties"); 21 | try { 22 | p.load(is); 23 | } catch (IOException e) { 24 | // TODO Auto-generated catch block 25 | e.printStackTrace(); 26 | } 27 | } 28 | 29 | 30 | public static Object getInstacne(String daoName){ 31 | Object obj=cach.get(daoName); 32 | if(obj==null){ 33 | String clazz=p.getProperty(daoName); 34 | if(clazz!=null&&!clazz.equals("")){ 35 | try { 36 | obj=Class.forName(clazz).newInstance(); 37 | } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { 38 | // TODO Auto-generated catch block 39 | e.printStackTrace(); 40 | } 41 | } 42 | } 43 | return obj; 44 | } 45 | 46 | /** 47 | * 传入dao名,创建这个实现类的一个实例 48 | * @param daoName dao名 49 | * @return 这个实现类的一个实例 50 | */ 51 | public synchronized static T getInstance(String daoName, Class daoClass){ 52 | T obj = (T)cach.get(daoName); 53 | 54 | if(null == obj){ 55 | String className = p.getProperty(daoName); 56 | 57 | if(null != className && !"".equals(className)){ 58 | try { 59 | //加载指定名字的字节码到虚拟机内存中 60 | Class clazz = (Class) Class.forName(className); 61 | //通过反射机制调用无参数的那个构造方法来创建出一个对象 62 | obj = (T)daoClass.cast(clazz.newInstance()); 63 | 64 | //往缓存池中存放 65 | cach.put(daoName, obj); 66 | } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { 67 | e.printStackTrace(); 68 | } 69 | } 70 | } 71 | 72 | return obj; 73 | } 74 | 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/utils/HibernateUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.utils; 5 | 6 | 7 | import org.hibernate.Session; 8 | import org.hibernate.SessionFactory; 9 | import org.hibernate.boot.registry.StandardServiceRegistryBuilder; 10 | import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl; 11 | import org.hibernate.cfg.Configuration; 12 | 13 | /** 14 | * @author zc 15 | * 工具类 16 | */ 17 | public class HibernateUtils { 18 | 19 | private static SessionFactory sessionFactory; 20 | private static Session session; 21 | 22 | static { 23 | try { 24 | // Configuration configiguration = new Configuration().configure(); 25 | // ServiceRegistryBuilder builder = new ServiceRegistryBuilder(). 26 | // applySettings(configiguration.getProperties()); 27 | // ServiceRegistry registry = builder.buildServiceRegistry(); 28 | // sessionFactory = configiguration.buildSessionFactory(registry); 29 | Configuration configuration = new Configuration().configure(); 30 | StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder() 31 | .applySettings(configuration.getProperties()); 32 | StandardServiceRegistryImpl registry = (StandardServiceRegistryImpl) builder.build(); 33 | sessionFactory = configuration.buildSessionFactory(registry); 34 | } catch (Throwable e) { 35 | e.printStackTrace(); 36 | } 37 | } 38 | 39 | private HibernateUtils() { 40 | 41 | } 42 | 43 | // public static SessionFactory getSessionFactory(){ 44 | // return sessionFactory; 45 | // } 46 | 47 | /** 48 | * 获取session对象 49 | */ 50 | // public static Session getSession() { 51 | // return sessionFactory.openSession(); 52 | // } 53 | 54 | 55 | /** 56 | * 获取当前线程中的session对象 57 | */ 58 | public static Session getCurrentSession() {return sessionFactory.getCurrentSession();} 59 | 60 | 61 | /** 62 | * 关闭session对象 63 | */ 64 | public static void closeSession() { 65 | if (session != null && session.isOpen()) { 66 | session.close(); 67 | } 68 | } 69 | // 70 | // 71 | // public static void closeSession(Session session) { 72 | // if (session != null && session.isOpen()) { 73 | // session.close(); 74 | // } 75 | // } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/utils/IDGenerator.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import org.hibernate.HibernateException; 4 | import org.hibernate.MappingException; 5 | import org.hibernate.Session; 6 | import org.hibernate.dialect.Dialect; 7 | import org.hibernate.engine.spi.SessionImplementor; 8 | import org.hibernate.id.Configurable; 9 | import org.hibernate.id.IdentifierGenerator; 10 | import org.hibernate.type.Type; 11 | 12 | import java.io.Serializable; 13 | import java.util.Properties; 14 | 15 | /** 16 | * 类名称: GeneratePK 17 | * 类描述: 在hibernate的基础上自动生成自定义的主键 18 | * 创建人: andy_lj 19 | * 创建时间:2012-08-10 上午11:40:50 20 | * 修改备注: 21 | */ 22 | 23 | public class IDGenerator implements Configurable, IdentifierGenerator { 24 | 25 | public String sign;// av00000001中的av 26 | public String classname; //实体类的类名 27 | public String pk;//主键名字 28 | public String idLength;//av00000001的长度(后面的数字序列的长度) 29 | 30 | /** 31 | * 取得 ***.hbm.xml中的自定义的值 32 | */ 33 | @Override 34 | public void configure(Type arg0, Properties arg1, Dialect arg2) 35 | throws MappingException { 36 | this.classname = arg1.getProperty("classname"); 37 | this.pk = arg1.getProperty("pk"); 38 | this.sign = arg1.getProperty("sign"); 39 | this.idLength = arg1.getProperty("idLength"); 40 | } 41 | 42 | /** 43 | * 生成主键 44 | */ 45 | @Override 46 | public Serializable generate(SessionImplementor arg0, Object arg1) 47 | throws HibernateException { 48 | 49 | //获得主键数字序列的长度 50 | int leng = Integer.valueOf(idLength); 51 | 52 | String random_pk = null; 53 | 54 | Session session = HibernateUtils.getCurrentSession();//打开session 55 | do { 56 | random_pk = CreateId.OneId(leng); 57 | 58 | } while (session.get(classname, random_pk) != null); 59 | 60 | return sign + random_pk; 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/utils/JsonDateValueProcessor.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import net.sf.json.JsonConfig; 4 | import net.sf.json.processors.JsonValueProcessor; 5 | 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | import java.util.Locale; 9 | 10 | /** 11 | * Created by zc on 2016/12/18. 12 | */ 13 | public class JsonDateValueProcessor implements JsonValueProcessor { 14 | 15 | private String datePattern = "yyyy-MM-dd HH:mm:ss"; 16 | 17 | public JsonDateValueProcessor() { 18 | super(); 19 | } 20 | 21 | public JsonDateValueProcessor(String format) { 22 | super(); 23 | this.datePattern = format; 24 | } 25 | 26 | public Object processArrayValue(Object value, JsonConfig jsonConfig) { 27 | return process(value); 28 | } 29 | 30 | public Object processObjectValue(String key, Object value, 31 | JsonConfig jsonConfig) { 32 | return process(value); 33 | } 34 | 35 | private Object process(Object value) { 36 | try { 37 | if (value instanceof Date) { 38 | SimpleDateFormat sdf = new SimpleDateFormat(datePattern,Locale.UK); 39 | return sdf.format((Date) value); 40 | } 41 | return value == null ? "" : value.toString(); 42 | } catch (Exception e) { 43 | return ""; 44 | } 45 | } 46 | 47 | public String getDatePattern() { 48 | return datePattern; 49 | } 50 | 51 | public void setDatePattern(String pDatePattern) { 52 | datePattern = pDatePattern; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/utils/Json_format.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import net.sf.json.JsonConfig; 4 | import net.sf.json.util.PropertyFilter; 5 | 6 | import java.util.Date; 7 | 8 | /** 9 | * Created by zc on 2016/12/24. 10 | * 设置特殊列的json序列化规则 11 | */ 12 | public class Json_format extends JsonConfig { 13 | 14 | public Json_format(String clazz) { 15 | super(); 16 | this.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor()); 17 | 18 | if ("video".equals(clazz)) { 19 | this.setJsonPropertyFilter(new PropertyFilter() { 20 | public boolean apply(Object source, String name, Object value) { 21 | if (name.equals("video_favSet") || name.equals("video_likeSet") || name.equals("video_barrageSet") 22 | ||name.equals("uploadSet")||name.equals("user_barrageSet") 23 | ||name.equals("user_likeSet")||name.equals("user_favSet")) { 24 | return true; 25 | } else { 26 | 27 | return false; 28 | } 29 | } 30 | }); 31 | } else if ("barrage".equals(clazz)) { 32 | this.setJsonPropertyFilter(new PropertyFilter() { 33 | public boolean apply(Object source, String name, Object value) { 34 | if (name.equals("barrage_video") || name.equals("barr_user")) { 35 | return true; 36 | } else { 37 | return false; 38 | } 39 | } 40 | }); 41 | } 42 | 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/utils/PropertiesUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import java.io.IOException; 6 | import java.io.InputStreamReader; 7 | import java.util.Properties; 8 | 9 | 10 | public class PropertiesUtil { 11 | 12 | // private static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class); 13 | 14 | private static Properties props; 15 | 16 | static { 17 | String fileName = "biubiu.properties"; 18 | props = new Properties(); 19 | try { 20 | props.load(new InputStreamReader(PropertiesUtil.class.getClassLoader().getResourceAsStream(fileName), "UTF-8")); 21 | } catch (IOException e) { 22 | System.out.println("配置文件读取异常"); 23 | } 24 | } 25 | 26 | public static String getProperty(String key) { 27 | String value = props.getProperty(key.trim()); 28 | if (StringUtils.isBlank(value)) { 29 | return null; 30 | } 31 | return value.trim(); 32 | } 33 | 34 | public static String getProperty(String key, String defaultValue) { 35 | 36 | String value = props.getProperty(key.trim()); 37 | if (StringUtils.isBlank(value)) { 38 | value = defaultValue; 39 | } 40 | return value.trim(); 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/utils/VideoUtils.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import java.io.File; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | 11 | public class VideoUtils { 12 | private static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class); 13 | 14 | public static final String FFMPEG_EXECUTOR = PropertiesUtil.getProperty("ffmpeg_executor"); 15 | public static final int THUMBNAIL_WIDTH = 320; 16 | public static final int THUMBNAIL_HEIGHT = 200; 17 | 18 | public static boolean extractThumbnail(File inputFile, String thumbnailOutput) { 19 | System.out.println(new File(thumbnailOutput).getAbsolutePath() ); 20 | List command = new ArrayList(); 21 | File ffmpegExe = new File(FFMPEG_EXECUTOR); 22 | if (!ffmpegExe.exists()) { 23 | logger.info("转码工具不存在"); 24 | return false; 25 | } 26 | 27 | System.out.println(ffmpegExe.getAbsolutePath()); 28 | System.out.println(inputFile.getAbsolutePath()); 29 | command.add(ffmpegExe.getAbsolutePath()); 30 | command.add("-ss"); 31 | command.add("10"); 32 | command.add("-t"); 33 | command.add("0.001"); 34 | command.add("-i"); 35 | command.add(inputFile.getAbsolutePath()); 36 | command.add("-f"); 37 | command.add("image2"); 38 | command.add("-y"); 39 | command.add("-s"); 40 | command.add(THUMBNAIL_WIDTH + "*" + THUMBNAIL_HEIGHT); 41 | command.add(thumbnailOutput); 42 | 43 | ProcessBuilder builder = new ProcessBuilder(); 44 | builder.command(command); 45 | builder.redirectErrorStream(true); 46 | try { 47 | long startTime = System.currentTimeMillis(); 48 | Process process = builder.start(); 49 | process.waitFor(); 50 | logger.info("FFMPEG启动耗时" + (System.currentTimeMillis() - startTime)); 51 | return true; 52 | } catch (Exception e) { 53 | e.printStackTrace(); 54 | return false; 55 | } 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /src/main/java/com/web_socket/GetHttpSessionConfigurator.java: -------------------------------------------------------------------------------- 1 | package com.web_socket; 2 | 3 | import javax.servlet.http.HttpSession; 4 | import javax.websocket.HandshakeResponse; 5 | import javax.websocket.server.HandshakeRequest; 6 | import javax.websocket.server.ServerEndpointConfig; 7 | import javax.websocket.server.ServerEndpointConfig.Configurator; 8 | 9 | public class GetHttpSessionConfigurator extends Configurator { 10 | 11 | @Override 12 | public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) { 13 | // TODO Auto-generated method stub 14 | HttpSession httpSession = (HttpSession) request.getHttpSession(); 15 | sec.getUserProperties().put(HttpSession.class.getName(), httpSession); 16 | 17 | // ServletContext servletContext = httpSession.getServletContext(); 18 | // sec.getUserProperties().put(ServletContext.class.getName(), servletContext); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /src/main/resources/biubiu.e.g.properties: -------------------------------------------------------------------------------- 1 | password.salt= 2 | #cos 3 | appId= 4 | secretId= 5 | secretKey= 6 | bucketName= 7 | region= 8 | cos.server.http.prefix= 9 | 10 | video_cover.prefix= 11 | avatar.prefix= 12 | video.prefix= 13 | ffmpeg_executor= -------------------------------------------------------------------------------- /src/main/resources/dao.properties: -------------------------------------------------------------------------------- 1 | userDao=com.dao.impl.UserDaoImpl 2 | videoDao=com.dao.impl.VideoDaoImpl 3 | barrageDao=com.dao.impl.BarrageDaoImpl 4 | videolikeDao=com.dao.impl.VideoLikeDaoImpl 5 | videofavDao=com.dao.impl.VideoFavDaoImpl -------------------------------------------------------------------------------- /src/main/resources/hbm/Barrages.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | com.entity.Barrages 12 | barrageId 13 | bg 14 | 8 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/hbm/Users.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/main/resources/hbm/VideoFavlist.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/resources/hbm/VideoLike.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/resources/hbm/Videos.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 11 | com.entity.Videos 12 | video_id 13 | av 14 | 8 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/main/resources/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | ProxoolPool 9 | proxool.xml 10 | org.hibernate.proxool.internal.ProxoolConnectionProvider 11 | 12 | true 13 | 14 | 15 | org.hibernate.dialect.MySQL57InnoDBDialect 16 | 17 | 18 | thread 19 | 20 | 21 | false 22 | true 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | UTF-8 8 | 9 | [%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n 10 | 11 | 12 | DEBUG 13 | 14 | 15 | 16 | 17 | 18 | /Users/zc/developer/apache-tomcat-8.5.15/logs/biubiu.log 19 | 20 | /Users/zc/developer/apache-tomcat-8.5.15/logs/biubiu.log.%d{yyyy-MM-dd}.gz 21 | 22 | true 23 | 10 24 | 25 | 26 | [%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n 27 | 28 | 29 | 30 | 31 | 32 | 33 | /Users/zc/developer/apache-tomcat-8.5.15/logs/error.log 34 | 35 | /Users/zc/developer/apache-tomcat-8.5.15/logs/error.log.%d{yyyy-MM-dd}.gz 36 | 37 | true 38 | 10 39 | 40 | 41 | [%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n 42 | 43 | 44 | ERROR 45 | ACCEPT 46 | DENY 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 65 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/main/resources/proxool.e.g.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ProxoolPool 5 | jdbc:mysql://127.0.0.1:3306/biubiu?useUnicode=true&characterEncoding=utf-8&useSSL=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true 6 | 7 | com.mysql.jdbc.Driver 8 | 9 | 10 | 11 | 12 | 13 | 14 | 100 15 | 16 | 10 17 | 18 | 90000 19 | 20 | 10 21 | 22 | 5 23 | 24 | true 25 | 26 | select CURRENT_DATE 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/webapp/404.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | 3 | 4 | 5 | 资源未找到-biubiu 6 | 17 | 18 | 19 |
20 |
21 |
22 | 前端服务器: cn-tj-dx-w-02   处理服务器:biubiu
23 | 请求地址:    错误号:404   24 |
用户IP:<%=request.getRemoteHost()%>
25 | 26 |
27 |
28 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | struts2 22 | org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 23 | 24 | encoding 25 | utf-8 26 | 27 | 28 | 29 | struts2 30 | /* 31 | 32 | 33 | 34 | 35 | ServletConfigurator 36 | org.logicalcobwebs.proxool.configuration.ServletConfigurator 37 | 38 | xmlFile 39 | WEB-INF/classes/proxool.xml 40 | 41 | 1 42 | 43 | 44 | 45 | Admin 46 | org.logicalcobwebs.proxool.admin.servlet.AdminServlet 47 | 48 | 49 | 50 | ServletConfigurator 51 | /ServletConfigurator 52 | 53 | 54 | Admin 55 | /Admin 56 | 57 | 58 | 59 | 60 | 500 61 | /error.jsp 62 | 63 | 64 | 65 | 404 66 | /404.jsp 67 | 68 | 69 | 70 | /homepage.jsp 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/webapp/classify.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | <% 4 | String path = request.getContextPath(); 5 | pageContext.setAttribute("path", path); 6 | %> 7 | 8 | 9 | 10 | 分区-biubiu 11 | <%@include file="inclued_page/base_js_css.jsp" %> 12 | 13 | 14 | 15 | 56 | 57 | 58 | 59 | 60 | <%@include file="inclued_page/nav.jsp" %> 61 |
62 |
63 | 64 | 65 | 66 |

67 |
68 |
69 | 70 |
71 | 72 | 73 |
74 | <%--
--%> 75 | <%--

共564条数据

--%> 76 | <%--
--%> 77 | <%--
    --%> 78 | <%--
  • --%> 79 | <%--
  • --%> 80 | <%--
--%> 81 |
82 | 83 |
84 |
    85 | <%--
  • «
  • --%> 86 | <%--
  • 1
  • --%> 87 | <%--
  • »
  • --%> 88 |
89 |
90 |
91 | 92 | 93 | <%@include file="inclued_page/model_login.jsp" %> 94 | 95 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /src/main/webapp/css/home.css: -------------------------------------------------------------------------------- 1 | a{ 2 | text-decoration: none!important; 3 | } 4 | 5 | body{ 6 | font-family: "Microsoft YaHei",Arial,Helvetica,sans-serif; 7 | } 8 | 9 | #header_img_header{ 10 | opacity: 0.8; 11 | width: 100%; 12 | height: 180px; 13 | /*border: 1px solid whitesmoke;*/ 14 | /*background-color: aqua;*/ 15 | text-align: center; 16 | /*margin:-42px auto 0;*/ 17 | background-image:url('../img/head_img.jpg'); 18 | /*background: transparent no-repeat center -10px;*/ 19 | 20 | } 21 | .header_img1{ 22 | width: 97%; 23 | height: 195px; 24 | text-align: center; 25 | margin: 3px auto; 26 | } 27 | .body_middle{ 28 | /*float: left;*/ 29 | position: relative; 30 | width: 100%; 31 | /*margin-left: 150px;*/ 32 | /*margin-right: 150px;*/ 33 | text-align: center; 34 | margin: 0 auto; 35 | margin-top: 20px; 36 | } 37 | .body_head{ 38 | position: relative; 39 | width: 90%; 40 | height: 40px; 41 | white-space: nowrap; 42 | margin: 0 auto; 43 | } 44 | .body_body{ 45 | /*position: relative;*/ 46 | /*float: left;*/ 47 | width: 700px; 48 | height: auto; 49 | } 50 | .body_head .body_head_text h2{ 51 | display: block; 52 | margin: 0; 53 | padding: 0; 54 | list-style-type: none; 55 | font-size: 24px!important; 56 | line-height: 24px; 57 | font-weight: normal; 58 | position: relative; 59 | float: left; 60 | top: 9px; 61 | margin-left: 5px; 62 | 63 | 64 | } 65 | .body_head_img{ 66 | /*background-color: aqua;*/ 67 | width: 40px; 68 | height: 39px; 69 | display: inline-block; 70 | position: relative; 71 | float: left; 72 | background-image: url('../img/icons.png'); 73 | 74 | } 75 | .body_head .body_link_more{ 76 | position: relative; 77 | float: right; 78 | text-align: center; 79 | top: 10px; 80 | margin-right: 4%; 81 | } 82 | .body_head .body_link_more a{ 83 | /*display: block;*/ 84 | /*width: 52px;*/ 85 | /*height: 22px;*/ 86 | /*line-height: 22px;*/ 87 | /*background-color: #ffffff;*/ 88 | /*border: 1px solid #ccd0d7;*/ 89 | /*color: #555;*/ 90 | /*border-radius: 4px;*/ 91 | /*text-decoration: none;*/ 92 | /*cursor: pointer;*/ 93 | /*outline: 0;*/ 94 | 95 | } 96 | .b_icon{ 97 | width: 6px; 98 | height: 12px; 99 | margin: -2px 0 0 5px; 100 | vertical-align: middle; 101 | background-color: blueviolet; 102 | } 103 | .body_body{ 104 | height: auto; 105 | width: 100%; 106 | /*position: relative;*/ 107 | /*float: left;*/ 108 | } 109 | .video_box_list{ 110 | width: 1300px; 111 | height: auto; 112 | overflow: hidden; 113 | padding-top: 30px; 114 | padding-left: 10px; 115 | margin: 0 auto; 116 | } 117 | .video_box_list li{ 118 | position: relative; 119 | float: left; 120 | margin: 0 10px 20px 40px; 121 | } 122 | .view_radio{ 123 | position: relative; 124 | width:200px; 125 | height:174px; 126 | font-size: 12px; 127 | overflow: hidden; 128 | /*border: 1px solid #e5e9ef;*/ 129 | } 130 | .img_display{ 131 | width:100%; 132 | height:125px; 133 | display: block; 134 | overflow: hidden; 135 | text-align: center; 136 | box-sizing: border-box; 137 | z-index: 0; 138 | border-radius: 4px; 139 | } 140 | 141 | .img_display img{ 142 | width: 100%; 143 | height: 100%; 144 | } 145 | .topic_title{ 146 | padding-left: 4px; 147 | font-size: 13px; 148 | margin-bottom: 8px; 149 | padding-top: 8px; 150 | height: 20px; 151 | line-height: 20px; 152 | color: black; 153 | text-align: center; 154 | overflow: hidden; 155 | text-align:left; 156 | height: 28px; 157 | font-family: "Microsoft YaHei",Arial,Helvetica,sans-serif; 158 | color: #00a1d6; 159 | 160 | } 161 | 162 | /*.cover-preview{*/ 163 | /*width: 160px;*/ 164 | /*height: 100px;*/ 165 | /*border-radius: 5px;*/ 166 | /*}*/ 167 | 168 | .view_radio_botton{ 169 | margin: 0; 170 | font-size: 12px; 171 | line-height: 12px; 172 | } 173 | 174 | .view_radio_botton span { 175 | display: inline-block; 176 | vertical-align: top; 177 | color: #99a2aa; 178 | width: 95px; 179 | white-space: nowrap; 180 | overflow: hidden; 181 | text-overflow: ellipsis; 182 | line-height: 12px; 183 | height: 14px; 184 | text-align: left; 185 | } 186 | 187 | .b-icon{ 188 | vertical-align: top; 189 | /*margin-right: 5px;*/ 190 | display: inline-block; 191 | vertical-align: middle; 192 | width: 12px; 193 | height: 12px; 194 | background: url(../img/icons.png) no-repeat; 195 | top: -1px; 196 | position: relative; 197 | 198 | } 199 | 200 | .b-icon-v-play{ 201 | background-position: -282px -90px 202 | } 203 | 204 | .b-icon-v-dm{ 205 | background-position: -282px -218px 206 | } -------------------------------------------------------------------------------- /src/main/webapp/css/modal_login_resign.css: -------------------------------------------------------------------------------- 1 | @-webkit-keyframes mod { 2 | from { 3 | transform: perspective(700px) rotateY(-90deg); 4 | } 5 | to { 6 | transform: perspective(700px) rotateY(0deg); 7 | } 8 | } 9 | 10 | @-webkit-keyframes umod { 11 | from { 12 | transform: perspective(900px) rotateY(0deg); 13 | } 14 | to { 15 | transform: perspective(900px) rotateY(90deg); 16 | } 17 | } 18 | 19 | body.modal-open { 20 | 21 | overflow-y: auto !important; 22 | 23 | padding-right: 0 !important; 24 | } 25 | 26 | 27 | .modal { 28 | top: 10%; 29 | } 30 | 31 | .modal-open .modal{ 32 | overflow-y: hidden; 33 | } 34 | 35 | .modal-dialog{ 36 | margin-top: 50px; 37 | } 38 | 39 | .modal-backdrop.in { /*阴影区域*/ 40 | opacity: 0.0; 41 | } 42 | 43 | .modal-content { 44 | background-color: rgba(255, 255, 255, 1); 45 | width: 60%; 46 | margin: 0 auto; 47 | } 48 | input[type="checkbox"] { 49 | -webkit-appearance: none; 50 | } 51 | 52 | input[type="checkbox"] { 53 | -webkit-appearance: none; 54 | background: #fff url(../img/check.png); 55 | height: 22px; 56 | vertical-align: middle; 57 | width: 22px; 58 | } 59 | 60 | input[type="checkbox"]:checked { 61 | background-position: -48px 0; 62 | } 63 | 64 | input[type="checkbox"]:focus, 65 | input[type="checkbox"]:hover { 66 | background-position: -24px 0; 67 | outline: none; 68 | } 69 | 70 | input[type="checkbox"]:checked { 71 | background-position: -48px 0; 72 | } 73 | 74 | input[type="checkbox"][disabled] { 75 | background-position: -72px 0; 76 | } 77 | 78 | input[type="checkbox"][disabled]:checked { 79 | background-position: -96px 0; 80 | } 81 | 82 | .holder { 83 | width: 80px; 84 | height: 25px; 85 | background-color: #ff5c00; 86 | position: absolute; 87 | color: white; 88 | text-align: center; 89 | line-height: 26px; 90 | z-index: 100; 91 | display: none; 92 | border-radius: 3px; 93 | } -------------------------------------------------------------------------------- /src/main/webapp/css/nav.css: -------------------------------------------------------------------------------- 1 | body{ 2 | overflow-x:hidden; 3 | min-width: 1300px; 4 | } 5 | 6 | li { 7 | list-style-type: none; 8 | } 9 | 10 | nav { 11 | width: 100%; 12 | height: 53px; 13 | /*position: fixed !important;*/ 14 | z-index: 999; 15 | top: 0; 16 | border: none !important; 17 | background-color: white; 18 | box-shadow: 0 0 5px rgba(0, 0, 0, .2); 19 | line-height: 53px !important; 20 | } 21 | 22 | .search_nav { 23 | margin: 0; 24 | overflow: hidden; 25 | height: 100%; 26 | /*float:right;*/ 27 | /*margin-right: 240px;*/ 28 | padding: 0; 29 | } 30 | 31 | .ul_buttons { 32 | width: auto; 33 | float: left; 34 | /*margin-right: 10px*/ 35 | } 36 | 37 | .item { 38 | width: 110px; 39 | height: 55px; 40 | } 41 | 42 | .head_item { 43 | text-align: center; 44 | /*padding-left: 20px!important;*/ 45 | display: inline-block; 46 | background-color: transparent; 47 | color: black; 48 | /*padding-top: 12px;*/ 49 | height: 55px; 50 | width: 110px; 51 | font-size: 15px; 52 | padding-left: 0; 53 | padding-right: 0; 54 | cursor: pointer; 55 | text-decoration: none !important; 56 | } 57 | 58 | .my_class { 59 | font-family: "Microsoft YaHei", Arial, Helvetica, sans-serif; 60 | line-height: 20px !important; 61 | /*background: url("../img/icons2.png") 12px -1613px no-repeat;*/ 62 | } 63 | 64 | .my_class i { 65 | color: #1B9AF7; 66 | } 67 | 68 | .head_iteam_main { 69 | background: url(../img/icons.png) -900px -69px no-repeat; 70 | } 71 | 72 | .head_iteam_demand { 73 | background: url(../img/icons.png) -647px -902px no-repeat; 74 | } 75 | 76 | .head_iteam_live { 77 | background: url("../img/icons.png") -650px -516px no-repeat; 78 | } 79 | 80 | .soso { 81 | font-size: 16px; 82 | color: #BBBBBB; 83 | top: 5px; 84 | left: -26px; 85 | cursor: pointer; 86 | } 87 | 88 | .soso:hover { 89 | color: cornflowerblue; 90 | } 91 | 92 | .nav_right_list { 93 | float: right; 94 | margin-right: 10px; 95 | } 96 | 97 | .logined { 98 | float: right !important; 99 | width: 210px; 100 | height: 53px; 101 | } 102 | 103 | #open_btn { 104 | position: absolute; 105 | left: 950px; 106 | top: 9px; 107 | } 108 | 109 | .i_face { 110 | position: absolute; 111 | top: 10px; 112 | left: 1097px; 113 | width: 36px; 114 | height: 36px; 115 | border-radius: 50%; 116 | border-color: white; 117 | transition: .3s; 118 | cursor: pointer; 119 | } 120 | 121 | .scale_in { 122 | width: 64px; 123 | height: 64px; 124 | top: 16px; 125 | left: 1081px; 126 | border: 2px solid #fff; 127 | } 128 | 129 | .i_menu { 130 | width: 260px; 131 | /*height: 103px;*/ 132 | background-color: white; 133 | position: absolute; 134 | top: 55px; 135 | left: 977px; 136 | z-index: -1; 137 | display: none; 138 | padding-top: 50px; 139 | line-height: normal; 140 | box-shadow: rgba(0, 0, 0, 0.16) 0 2px 4px; 141 | } 142 | 143 | .i_menu a { 144 | color: #666; 145 | text-decoration: none; 146 | cursor: pointer; 147 | font-size: 13px; 148 | font-family: "Microsoft YaHei", Arial, Helvetica, sans-serifsans-serif; 149 | } 150 | 151 | .i_menu a:hover { 152 | color: #00a1d6; 153 | } 154 | 155 | .member-menu { 156 | border-top: 1px solid #e5e9ef; 157 | padding: 10px 0; 158 | margin-right: -20px; 159 | clear: both; 160 | line-height: 42px; 161 | margin-bottom: 0; 162 | } 163 | 164 | .member-menu:after { 165 | content: ""; 166 | display: block; 167 | visibility: hidden; 168 | height: 0; 169 | clear: both; 170 | font-size: 0; 171 | } 172 | 173 | .member-menu li { 174 | float: left; 175 | width: 100px; 176 | margin-right: 20px; 177 | position: relative; 178 | } 179 | 180 | .member-menu li a { 181 | padding: 5px 0 5px 0; 182 | line-height: 29px; 183 | display: block; 184 | } 185 | 186 | .member-menu li a i { 187 | position: relative; 188 | width: 16px; 189 | height: 16px; 190 | display: inline-block; 191 | top: 3px; 192 | margin-right: 5px; 193 | background: url("../img/icons.png") no-repeat; 194 | } 195 | 196 | .member_bottom { 197 | background-color: #f4f5f7; 198 | height: 30px; 199 | line-height: 30px; 200 | padding: 0 20px; 201 | border-radius: 0 0 4px 4px; 202 | } 203 | 204 | .uname { 205 | line-height: 16px; 206 | text-align: center; 207 | padding-bottom: 15px; 208 | } 209 | 210 | .favlist,.video_submit { 211 | font-family: "KaiTi"; 212 | font-size: 15.5px; 213 | text-align: center; 214 | color: #222; 215 | position: absolute; 216 | display: block; 217 | cursor: pointer; 218 | padding: 0 10px; 219 | /*width: fit-content;*/ 220 | } 221 | 222 | .favlist:hover, .video_submit:hover{ 223 | color: #db5480; 224 | } 225 | 226 | .favlist{ 227 | left: 1155px; 228 | } 229 | 230 | .video_submit{ 231 | left: 1240px; 232 | } 233 | 234 | .logo{ 235 | color: #4586ee; 236 | font-size: 25px; 237 | font-family: "Microsoft YaHei",Arial,Helvetica,sans-serif; 238 | font-style: oblique; 239 | } -------------------------------------------------------------------------------- /src/main/webapp/css/res_soso.css: -------------------------------------------------------------------------------- 1 | /*#top_contain {*/ 2 | /*height: 50px;*/ 3 | /*background-color: #1B9AF7;*/ 4 | /*}*/ 5 | 6 | #logo_input { 7 | position: relative; 8 | width: 70%; 9 | height: 50px; 10 | text-align: center; 11 | margin: 5px auto; 12 | } 13 | 14 | #soso_logo { 15 | position: relative; 16 | float: left; 17 | height: 35px; 18 | line-height: 40px; 19 | color: #fd6853; 20 | font-size: 20px; 21 | } 22 | 23 | 24 | #search { 25 | position: relative; 26 | float: left; 27 | width: 60%; 28 | height: 50px; 29 | text-align: center; 30 | } 31 | 32 | #serarch_button { 33 | width: 200px; 34 | position: absolute; 35 | left: 754px; 36 | top: 2px; 37 | } 38 | 39 | #nav_sub { 40 | width: 90%; 41 | position: relative; 42 | margin: 5px auto; 43 | text-align: center; 44 | } 45 | 46 | .wrap { 47 | position: relative; 48 | width: 100%; 49 | height: 54px; 50 | text-align: center; 51 | } 52 | 53 | .sub_active { 54 | color: #1B9AF7; 55 | text-align: center; 56 | position: relative; 57 | float: left; 58 | width: 10%; 59 | height: 54px; 60 | line-height: 54px; 61 | font-size: 16px; 62 | list-style-type: none; 63 | } 64 | 65 | .sub { 66 | position: relative; 67 | float: left; 68 | width: 10%; 69 | height: 54px; 70 | line-height: 54px; 71 | font-size: 16px; 72 | text-align: center; 73 | list-style-type: none; 74 | } 75 | 76 | .so_wrap { 77 | /*width: 90%;*/ 78 | width: 1100px; 79 | margin: 0 auto; 80 | overflow: hidden; 81 | padding-bottom: 10px; 82 | } 83 | 84 | .so_info { 85 | position: relative; 86 | margin-top: 10px; 87 | padding-left: 40px; 88 | } 89 | 90 | .so_info_total { 91 | display: inline-block; 92 | visibility: visible; 93 | line-height: 16px; 94 | width: 200px; 95 | color: #9d9d9d; 96 | } 97 | 98 | .switch { 99 | position: absolute; 100 | top: 0; 101 | right: 0; 102 | z-index: 999; 103 | } 104 | 105 | .aver { 106 | right: 26px; 107 | } 108 | 109 | .so_info > .switch > span { 110 | position: absolute; 111 | top: 0; 112 | cursor: pointer; 113 | } 114 | 115 | .switch.imgleft { 116 | right: 0; 117 | } 118 | 119 | .so_info > .switch > span { 120 | position: absolute; 121 | top: 0; 122 | cursor: pointer; 123 | } 124 | 125 | .vedio_matrix i { 126 | display: inline-block; 127 | margin-right: 3px; 128 | position: relative; 129 | top: 2px; 130 | width: 11px; 131 | height: 11px; 132 | } 133 | 134 | .watch_num { 135 | background-image: url('../img/icon3.png'); 136 | background-position: -148px -476px; 137 | } 138 | 139 | .upload_time { 140 | background-image: url('../img/icon3.png'); 141 | background-position: -189px -476px; 142 | } 143 | 144 | .uper { 145 | background-image: url('../img/icon3.png'); 146 | background-position: -188px -392px; 147 | } 148 | 149 | .ajax_render { 150 | width: 100%; 151 | position: relative; 152 | width: 1100px; 153 | height: 920px; 154 | float: left; 155 | } 156 | 157 | .vedio_matrix { 158 | 159 | width: 170px; 160 | height: 210px; 161 | border: 1px solid #e5e9ef; 162 | border-radius: 4px; 163 | float: left; 164 | margin-top: 20px; 165 | margin-right: 32px; 166 | } 167 | 168 | /*a {*/ 169 | /*outline: 0;*/ 170 | /*color: #1B9AF7;*/ 171 | /*text-decoration: none;*/ 172 | /*cursor: pointer;*/ 173 | /*}*/ 174 | 175 | /*.vedio_matrix.img{*/ 176 | /*height: 100px;*/ 177 | /*!*border-bottom-left-radius: 0;*!*/ 178 | /*!*border-bottom-right-radius: 0;*!*/ 179 | /*}*/ 180 | .video_cover { 181 | /*width: 200px;*/ 182 | height: 100px; 183 | border-radius: 4px; 184 | overflow: hidden; 185 | position: relative; 186 | } 187 | 188 | .video_cover img { 189 | width: 100%; 190 | height: 100%; 191 | } 192 | 193 | .info { 194 | width: 100%; 195 | height: 48px; 196 | padding: 8px 10px 0 10px 197 | } 198 | 199 | .headline { 200 | height: 100%; 201 | text-align: center; 202 | font-size: 12px; 203 | margin-bottom: 40px; 204 | overflow: hidden; 205 | line-height: 19px; 206 | } 207 | 208 | .tags { 209 | margin-left: 8px; 210 | font-size: 10px; 211 | 212 | } 213 | 214 | .tags span { 215 | display: inline-block; 216 | max-width: 132px; 217 | height: 16px; 218 | overflow: hidden; 219 | text-overflow: ellipsis; 220 | /*white-space: nowrap;*/ 221 | float: left; 222 | margin-bottom: 12px; 223 | 224 | } -------------------------------------------------------------------------------- /src/main/webapp/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | 3 | 4 | 5 | 错误页面-biubiu 6 | 7 | 8 | 出错了!!!!! 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/webapp/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/webapp/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/webapp/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/webapp/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/webapp/img/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/img/404.png -------------------------------------------------------------------------------- /src/main/webapp/img/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/img/check.png -------------------------------------------------------------------------------- /src/main/webapp/img/head_img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/img/head_img.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/icon3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/img/icon3.png -------------------------------------------------------------------------------- /src/main/webapp/img/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/img/icons.png -------------------------------------------------------------------------------- /src/main/webapp/img/icons2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/img/icons2.png -------------------------------------------------------------------------------- /src/main/webapp/img/loading-sm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/img/loading-sm.gif -------------------------------------------------------------------------------- /src/main/webapp/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/img/loading.gif -------------------------------------------------------------------------------- /src/main/webapp/inclued_page/base_js_css.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/webapp/js/classify.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/12/25. 3 | */ 4 | 5 | //获取分类分页数据 6 | function page_ajax(page_No) { 7 | 8 | if (param != null&¶m.length>0) { 9 | 10 | $.ajax({ 11 | type: "GET", 12 | url: "ajax/pagevideo-classify", 13 | dataType: "json", 14 | data: { 15 | videoType: param, 16 | 'pageModel.pageNo': page_No 17 | 18 | },//请求分页数据 19 | success: function (data) { 20 | if (data.success) { 21 | 22 | //获取当前页号和总页数 23 | pageNo = data.pageModel.pageNo; 24 | pageCount = data.pageModel.pageCount; 25 | 26 | make_page_plugin();//生成分页插件 27 | 28 | update_video_ui(data.pageModel.datas, data.pageModel.recordCount)//更新视频ui 29 | 30 | } 31 | else { 32 | without_data(); 33 | } 34 | }, 35 | error: function (jqXHR) { 36 | alert("错误提示: " + jqXHR.status + " " + jqXHR.statusText); 37 | } 38 | }); 39 | } 40 | else { 41 | without_data(); 42 | } 43 | } 44 | 45 | 46 | 47 | //更新视频ui 48 | function update_video_ui(video_list, recordCount) { 49 | 50 | $("#page_result").empty(); 51 | 52 | var so_info = $("
").addClass("so_info").append("

共" + recordCount + "条数据

"); 53 | $("#page_result").append(so_info); 54 | 55 | var items = $("
    "); 56 | 57 | //... 58 | 59 | for (key in video_list) { 60 | 61 | var item = $("
  • ").append("
    "); 62 | 63 | item.find(".coverimg").attr({ 64 | "src": video_list[key].videoCoverPath, 65 | }); 66 | 67 | var video_info = $("
    ").append(""); 68 | 69 | 70 | var tags = $("
    ") 71 | 72 | $(""+video_list[key].videoWatchCount+"次").appendTo(tags); 73 | $(""+video_list[key].videoUploadTime+"").appendTo(tags); 74 | $(""+video_list[key].up_user.userName+"").appendTo(tags); 75 | 76 | video_info.appendTo(item); 77 | tags.appendTo(item); 78 | 79 | item.appendTo(items); 80 | } 81 | 82 | $("#page_result").append(items) 83 | } 84 | 85 | -------------------------------------------------------------------------------- /src/main/webapp/js/logout.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/12/14. 3 | */ 4 | 5 | //登出,下线 6 | function logout_submit() { 7 | 8 | if (userid_my) { 9 | 10 | if ("undefined" != typeof websocket) {//直播用户下线 11 | websocket.send(JSON.stringify({ 12 | "group": "danmu", 13 | "state": 2,//下线状态码 14 | "logout_id": userid_my 15 | }));//切换为用户登录状态 16 | 17 | //主播下线 18 | if ("undefined" != typeof websocket && isliver()) { 19 | close_live(); 20 | } 21 | 22 | } 23 | 24 | 25 | $.ajax({ 26 | type: "POST", 27 | url: server_path + "/ajax/logout_logoutJsonAction", 28 | dataType: "json", 29 | data: { 30 | logout_id: userid_my 31 | }, 32 | success: function (data) { 33 | if (data.success) { 34 | 35 | var strs = window.location.pathname.split("/"); 36 | var parent_path = strs[strs.length - 2]; 37 | 38 | if (parent_path == "vip") {//如果在vip下则 重新加载 39 | window.location.reload(true);//刷新页面 40 | } 41 | else { 42 | 43 | userid_my = ""; 44 | islogined = false; 45 | userPicPath = ""; 46 | username_my = ""; 47 | 48 | if ("undefined" != typeof isprovider) { 49 | isprovider = false; 50 | } 51 | login_update(); 52 | 53 | } 54 | 55 | } 56 | else { 57 | alert("下线失败请重试"); 58 | } 59 | }, 60 | error: function (jqXHR) { 61 | alert("错误提示: " + jqXHR.status + " " + jqXHR.statusText); 62 | } 63 | }); 64 | } 65 | else { 66 | alert("请先登录"); 67 | } 68 | 69 | 70 | } 71 | 72 | $(document).ready(function () { 73 | $("#logout").on("click", function () { 74 | 75 | if (confirm("亲,确定要走吗?")) { 76 | logout_submit(); 77 | } 78 | 79 | } 80 | ); 81 | }) -------------------------------------------------------------------------------- /src/main/webapp/js/modal_login_resign.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/6/27. 3 | */ 4 | function login_model_show() { 5 | $(".modal-body").find("input").val("") 6 | $("#login_div").show(); 7 | $("#resig_div").hide(); 8 | $(".holder").hide(); 9 | } 10 | function resign_model_show() { 11 | $(".modal-body").find("input").val("") 12 | $("#resig_div").show(); 13 | $("#login_div").hide(); 14 | $(".holder").hide(); 15 | } 16 | function close_modal() { 17 | $("#myModal_content").css("-webkit-animation", "umod 1s linear"); 18 | $("#myModal_content").css("animation-fill-mode", "forwards"); 19 | setTimeout(" $('#myModal').modal('hide')", 1000) 20 | } 21 | 22 | 23 | $(document).ready(function () { 24 | 25 | 26 | //用户id(手机号)存在检测 27 | $("#userid_login").blur(function () { 28 | var str_id = $(this).val().trim(); 29 | if (str_id != null && str_id.length > 0) { 30 | $.when(isexit_user(str_id)).done(function (is_exit) { 31 | if (is_exit) { 32 | $("#hold1").hide(); 33 | } else { 34 | $("#hold1").text("用户不存在"); 35 | $("#hold1").show(); 36 | } 37 | }) 38 | 39 | } else { 40 | $(this).next("span").text("用户不能为空"); 41 | $(this).next("span").show(); 42 | } 43 | }); 44 | 45 | 46 | $("#myModal").on("shown.bs.modal", function () { 47 | $("#myModal_content").css("-webkit-animation", "mod 1s linear"); 48 | }); 49 | 50 | //登录模态框打开 51 | $("#btn1").click(function () { 52 | $("#myModal").modal("show"); 53 | $("#xian").css({left: '2px'}); 54 | login_model_show() 55 | }); 56 | //注册模态框打开 57 | $("#btn2").click(function () { 58 | $("#myModal").modal("show"); 59 | $("#xian").animate({left: '51px'}); 60 | resign_model_show() 61 | }); 62 | 63 | //滑动小线动画 64 | $("#mydelulablel").click(function () { 65 | $("#xian").animate({left: '2px'}); 66 | login_model_show(); 67 | }); 68 | $("#myzhucelablel").click(function () { 69 | $("#xian").animate({left: '51px'}); 70 | resign_model_show(); 71 | }); 72 | 73 | 74 | $("#username_resig").blur(function () { 75 | var str = this.value; 76 | var par = /^\d+$/; 77 | if (par.test(str)) { 78 | $(this).next("span").text("用户名不能纯数字").show(); 79 | } else { 80 | $(this).next("span").hide(); 81 | if (str != null && str.length > 0) { 82 | isexit_user_name(str); 83 | } 84 | else { 85 | $(this).next("span").text("用户名不能为空").show(); 86 | } 87 | 88 | } 89 | }); 90 | 91 | //密码相同检验 92 | $("#password2").blur(function () { 93 | var str = $(this).val().trim(); 94 | if(str!=null&&str.length>0){ 95 | check_password2(); 96 | }else { 97 | $("#password2").next("span").text("请填写密码").show(); 98 | } 99 | }); 100 | 101 | 102 | function check_password2() { 103 | var password1 = document.getElementById('password1').value; 104 | var password2 = document.getElementById('password2').value; 105 | if (password1 != password2) { 106 | $("#password2").next("span").text("两次密码不同").show(); 107 | document.getElementById('password1').value = ""; 108 | document.getElementById('password2').value = ""; 109 | } 110 | } 111 | 112 | $("#phone_resig").blur(function () { 113 | var str_id = this.value; 114 | var par = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 115 | if (!par.test(str_id)) { 116 | $(this).next("span").text("手机格式错误").show(); 117 | } else {//手机号重复性检验 118 | if (str_id != null && str_id.length > 0) { 119 | $.when(isexit_user_id(str_id)).done(function (is_exit) { 120 | if (is_exit) { 121 | $("#hold3").text("手机号已被注册"); 122 | $("#hold3").show(); 123 | } else { 124 | $("#hold3").hide(); 125 | } 126 | }) 127 | } else { 128 | $(this).next("span").text("手机号不能为空"); 129 | $(this).next("span").show(); 130 | } 131 | } 132 | 133 | }); 134 | 135 | 136 | $("#email_resig").blur(function () { 137 | var str = this.value; 138 | var reg = /^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; 139 | if (!reg.test(str)) { 140 | $(this).next("span").text("邮箱格式错误").show(); 141 | } 142 | }); 143 | 144 | 145 | //恢复检验 146 | $("#resig_div,#login_div").find("input").focus(function () { 147 | 148 | if ($(this).attr("name") != "rember") { 149 | $(this).next("span").hide(); 150 | } 151 | }); 152 | 153 | }); 154 | -------------------------------------------------------------------------------- /src/main/webapp/js/page_.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/12/25. 3 | */ 4 | //动态生成分页插件 5 | function make_page_plugin() { 6 | $("#page_plugin").empty(); 7 | 8 | $("
  • «
  • ").appendTo("#page_plugin"); 9 | for (var i = 1; i <= pageCount; i++) { 10 | $("
  • " + i + "
  • ").appendTo("#page_plugin"); 11 | } 12 | $(".pageNo_li").eq(pageNo - 1).addClass("active");//将该页面的页号标签点亮 13 | $("
  • »
  • ").appendTo("#page_plugin"); 14 | } 15 | 16 | 17 | $(document).ready(function () { 18 | 19 | $(document).on("click", ".pageNo_li", function () {//跳到指定页 20 | if ($(this).hasClass('active')) { 21 | //...就在当前页 22 | } 23 | else { 24 | 25 | $("#page_plugin li").removeClass("active"); 26 | $(this).addClass("active"); 27 | var page_No = parseInt($(this).text());//获取点击的页面页号 28 | 29 | page_ajax(page_No); 30 | } 31 | 32 | 33 | }); 34 | 35 | $(document).on("click", "#next_passage", function () {//下一页 36 | var now = $(".active"); 37 | var act = $(".active").find("a").get(0); 38 | var last_passage = $(".normal").find("a").last().get(0); 39 | if (act == last_passage) { 40 | alert('到头了') 41 | } 42 | else { 43 | now.removeClass("active"); 44 | now.next().addClass("active"); 45 | var page_No = pageNo + 1; 46 | 47 | page_ajax(page_No); 48 | } 49 | }); 50 | 51 | 52 | $(document).on("click", "#prev_passage", function () {//上一页 53 | var now = $(".active"); 54 | var act = $(".active").find("a").get(0); 55 | var first_passage = $(".normal").find("a").first().get(0); 56 | if (act == first_passage) { 57 | alert('到头了') 58 | } 59 | else { 60 | now.removeClass("active"); 61 | now.prev().addClass("active"); 62 | var page_No = pageNo - 1; 63 | 64 | page_ajax(page_No); 65 | } 66 | }); 67 | }); 68 | 69 | 70 | function without_data() { 71 | $("#page_result").empty(); 72 | $("#page_result").append("

    没有相关数据哦

    "); 73 | } -------------------------------------------------------------------------------- /src/main/webapp/js/register.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/12/25. 3 | */ 4 | 5 | function resign_submit() { 6 | 7 | var is_register = true; 8 | $("#resig_div .holder").each(function () { 9 | if (!$(this).is(":hidden")) { 10 | is_register = false; 11 | } 12 | }); 13 | 14 | 15 | 16 | if (is_register) { 17 | $.ajax({ 18 | type: "POST", 19 | url: server_path + "/ajax/registerAction", 20 | dataType: "json", 21 | data: $('#resig_form').serializeArray(),// 提交表单 22 | success: function (data) { 23 | if (data.success) { 24 | 25 | alert(data.username + "注册成功!"); 26 | 27 | if ($("#myModal").hasClass('in')) { 28 | close_modal(); 29 | }//关闭注册模态框 30 | 31 | } 32 | else { 33 | alert(data.username + "注册失败!"); 34 | } 35 | }, 36 | error: function (jqXHR) { 37 | alert("错误提示: " + jqXHR.status + " " + jqXHR.statusText); 38 | } 39 | }); 40 | } 41 | else { 42 | alert("请核对信息再提交") 43 | } 44 | 45 | 46 | } -------------------------------------------------------------------------------- /src/main/webapp/js/soso.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/12/25. 3 | */ 4 | 5 | //获取搜索分页数据 6 | function page_ajax(page_No) { 7 | 8 | if (param != null&¶m.length>0) { 9 | 10 | $.ajax({ 11 | type: "POST", 12 | url: "ajax/pagevideo-soso", 13 | dataType: "json", 14 | data: { 15 | keyword: param,//搜索参数 16 | 'pageModel.pageNo': page_No //页号参数 17 | 18 | },//请求分页数据 19 | success: function (data) { 20 | if (data.success) { 21 | 22 | //获取当前页号和总页数 23 | pageNo = data.pageModel.pageNo; 24 | pageCount = data.pageModel.pageCount; 25 | 26 | make_page_plugin();//生成分页插件 27 | 28 | update_video_ui(data.pageModel.datas, data.pageModel.recordCount)//更新视频ui 29 | 30 | } 31 | else { 32 | without_data(); 33 | } 34 | }, 35 | error: function (jqXHR) { 36 | alert("错误提示: " + jqXHR.status + " " + jqXHR.statusText); 37 | } 38 | }); 39 | } 40 | else { 41 | // window.location = "404.jsp"; 42 | without_data(); 43 | } 44 | } 45 | 46 | 47 | //更新视频ui 48 | function update_video_ui(video_list, recordCount) { 49 | 50 | $("#page_result").empty(); 51 | 52 | var so_info = $("
    ").addClass("so_info").append("

    共" + recordCount + "条数据

    "); 53 | $("#page_result").append(so_info); 54 | 55 | var items = $("
      "); 56 | 57 | //... 58 | 59 | 60 | 61 | for (key in video_list) { 62 | 63 | var item = $("
    • ").append("
      "); 64 | 65 | item.find(".coverimg").attr({ 66 | "src": video_list[key].videoCoverPath, 67 | }); 68 | 69 | var video_info = $("
      ").append(""); 70 | 71 | 72 | var tags = $("
      ") 73 | 74 | $(""+video_list[key].videoWatchCount+"次").appendTo(tags); 75 | $(""+video_list[key].videoUploadTime+"").appendTo(tags); 76 | $(""+video_list[key].up_user.userName+"").appendTo(tags); 77 | 78 | video_info.appendTo(item); 79 | tags.appendTo(item); 80 | 81 | item.appendTo(items); 82 | } 83 | 84 | $("#page_result").append(items) 85 | } 86 | 87 | 88 | -------------------------------------------------------------------------------- /src/main/webapp/js/util.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/12/19. 3 | */ 4 | function getObjectURL(file){ 5 | var url=null; 6 | if(window.createObjectURL!=undefined){ // basic 7 | url=window.createObjectURL(file) 8 | }else if(window.URL!=undefined){ // mozilla(firefox) 9 | url=window.URL.createObjectURL(file) 10 | } else if(window.webkitURL.createObjectURL!=undefined){ // webkit or chrome 11 | url=window.webkitURL.createObjectURL(file) 12 | }else { 13 | url=URL.createObjectURL(file) 14 | } 15 | return url 16 | } 17 | 18 | 19 | //获取url指定参数的值 20 | // function getQueryString(name) { 21 | // var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 22 | // var r = window.location.search.substr(1).match(reg); 23 | // if (r != null) return unescape(r[2]); 24 | // return null; 25 | // 26 | // } 27 | 28 | 29 | function getQueryString (key){ 30 | var lot = location.search; 31 | var reg = new RegExp(".*" + key + "\\s*=([^=&#]*)(?=&|#|).*","g"); 32 | return decodeURIComponent(lot.replace(reg, "$1")); 33 | } -------------------------------------------------------------------------------- /src/main/webapp/not_login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <% 3 | String requestURI = request.getRequestURI(); 4 | String[] urls=requestURI.split("/"); 5 | pageContext.setAttribute("prefix", urls[1]); 6 | %> 7 | 8 | 9 | 10 | 未登录 11 | 12 | 13 | <%--请先登录!!!!!!!!--%> 14 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/webapp/param.json: -------------------------------------------------------------------------------- 1 | { 2 | "douga": ["动画", "-141", "-908"], 3 | "fanju": [ 4 | "番剧", 5 | "-141", 6 | "-140" 7 | ], 8 | "music": [ 9 | "音乐", 10 | "-141", 11 | "-266" 12 | ], 13 | "dance": [ 14 | "舞蹈", 15 | "-141", 16 | "-461" 17 | ], 18 | "game": [ 19 | "游戏", 20 | "-141", 21 | "-203" 22 | ], 23 | "technology": [ 24 | "科技", 25 | "-141", 26 | "-525" 27 | ], 28 | "life": [ 29 | "生活", 30 | "-141", 31 | "-970" 32 | ], 33 | "kichiku": [ 34 | "鬼畜", 35 | "-141", 36 | "-332" 37 | ], 38 | "fashion": [ 39 | "时尚", 40 | "-141", 41 | "-718" 42 | ], 43 | "ad": [ 44 | "广告", 45 | "-141", 46 | "-1228" 47 | ], 48 | "ent": [ 49 | "娱乐", 50 | "-141", 51 | "-1032" 52 | ], 53 | "film": [ 54 | "影视", 55 | "-141", 56 | "-396" 57 | ] 58 | } -------------------------------------------------------------------------------- /src/main/webapp/soso.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <% 3 | String path = request.getContextPath(); 4 | pageContext.setAttribute("path", path); 5 | %> 6 | 7 | 8 | 9 | 搜索-biubiu 10 | <%@include file="inclued_page/base_js_css.jsp" %> 11 | 12 | 13 | 14 | 15 | 16 | <%@include file="inclued_page/nav.jsp" %> 17 |
      18 | <%--
      --%> 19 | 20 |
      21 | 22 | 26 |
      27 | 搜 索 28 |
      29 |
      30 | 68 |
      69 | 70 |
      71 | <%--
      --%> 72 | <%--

      共564条数据

      --%> 73 | <%--
      --%> 74 | <%--
        --%> 75 | <%--
      • --%> 76 | <%--
      • --%> 77 | <%--
      --%> 78 |
      79 | 80 |
      81 |
        82 | <%--
      • «
      • --%> 83 | <%--
      • 1
      • --%> 84 | <%--
      • »
      • --%> 85 |
      86 |
      87 | 88 |
      89 | <%@include file="inclued_page/model_login.jsp" %> 90 | 91 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /src/main/webapp/video/img/bg_live.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/video/img/bg_live.jpg -------------------------------------------------------------------------------- /src/main/webapp/video/img/cannotfind.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/video/img/cannotfind.jpg -------------------------------------------------------------------------------- /src/main/webapp/video/img/colorpicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/video/img/colorpicker.png -------------------------------------------------------------------------------- /src/main/webapp/video/img/zhibo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/video/img/zhibo.jpg -------------------------------------------------------------------------------- /src/main/webapp/video/js/demand_Barrage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/11/8. 3 | */ 4 | 5 | $(document).ready(function () { 6 | 7 | check_video();//检查视频是否可用 8 | 9 | document.getElementById("demand_video").addEventListener("timeupdate", myFunction);//监听播放时间轴改变时间 10 | document.getElementById("demand_video").addEventListener("play", function () { 11 | barrage_array = barrage_array2.concat(); 12 | // $(".d_show").empty(); 13 | 14 | });//监听播放事件重新充满数组 15 | 16 | $("#sendbtn").click(function () {//弹幕发送按钮 17 | demand_send_Barrage(); 18 | }); 19 | }); 20 | 21 | 22 | function load_barrages() {//根据url获取视频信息及弹幕信息 23 | 24 | if (barrage_array2 == null || barrage_array2.length == 0) {//获取弹幕数组 25 | console.log("该视频还没有弹幕"); 26 | } 27 | barrage_array = barrage_array2.concat();//装载到全局变量 28 | update_barrage_list(barrage_array); 29 | 30 | } 31 | 32 | 33 | //检测视频 34 | function check_video() { 35 | // setTimeout(function () { 36 | // if ($("#demand_video")[0].readyState == 0) { 37 | // $("#demand_video")[0].poster = "img/cannotfind.jpg"; 38 | // } 39 | // },180) 40 | 41 | // if (getQueryString("video_id") == "av62813213"||true) { 42 | // $("#demand_video").attr("src", "http://www.bilibilijj.com/Files/DownLoad/12322682.mp4/www.bilibilijj.com.mp4?mp3=true"); 43 | // $("#demand_video")[0].load; 44 | // } 45 | 46 | } 47 | 48 | 49 | function update_barrage_list(barrage_list) {//更新弹幕列表 50 | $("#barrage_table").empty(); 51 | for (key in barrage_list) { 52 | var barrage_ = barrage_list[key]; 53 | var barrage_item = $("" + getnum(parseFloat(barrage_.videoTimePrint)) + "" + barrage_.barrageContent + "" + getDate(barrage_.barrageCreateTime + "") + "") 54 | $("#barrage_table").append(barrage_item); 55 | } 56 | $("#barrage_number_").text(barrage_list.length + "");//更新总条数 57 | } -------------------------------------------------------------------------------- /src/main/webapp/video/js/format_date.js: -------------------------------------------------------------------------------- 1 | function getnum(time)//视频时间格式转换 2 | { 3 | 4 | var minute = Math.floor(time / 60); 5 | if (minute < 10) { 6 | minute = "0" + minute; 7 | } 8 | var second = parseInt(time) - minute * 60; 9 | if (second < 10) { 10 | second = "0" + second; 11 | } 12 | 13 | 14 | return minute + ":" + second; 15 | } 16 | 17 | 18 | function Format(now, mask) { 19 | var d = now; 20 | var zeroize = function (value, length) { 21 | if (!length) length = 2; 22 | value = String(value); 23 | for (var i = 0, zeros = ''; i < (length - value.length); i++) { 24 | zeros += '0'; 25 | } 26 | return zeros + value; 27 | }; 28 | 29 | return mask.replace(/"[^"]*"|'[^']*'|\b(?:d{1,4}|m{1,4}|yy(?:yy)?|([hHMstT])\1?|[lLZ])\b/g, function ($0) { 30 | switch ($0) { 31 | case 'd': 32 | return d.getDate(); 33 | case 'dd': 34 | return zeroize(d.getDate()); 35 | case 'ddd': 36 | return ['Sun', 'Mon', 'Tue', 'Wed', 'Thr', 'Fri', 'Sat'][d.getDay()]; 37 | case 'dddd': 38 | return ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][d.getDay()]; 39 | case 'M': 40 | return d.getMonth() + 1; 41 | case 'MM': 42 | return zeroize(d.getMonth() + 1); 43 | case 'MMM': 44 | return ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getMonth()]; 45 | case 'MMMM': 46 | return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][d.getMonth()]; 47 | case 'yy': 48 | return String(d.getFullYear()).substr(2); 49 | case 'yyyy': 50 | return d.getFullYear(); 51 | case 'h': 52 | return d.getHours() % 12 || 12; 53 | case 'hh': 54 | return zeroize(d.getHours() % 12 || 12); 55 | case 'H': 56 | return d.getHours(); 57 | case 'HH': 58 | return zeroize(d.getHours()); 59 | case 'm': 60 | return d.getMinutes(); 61 | case 'mm': 62 | return zeroize(d.getMinutes()); 63 | case 's': 64 | return d.getSeconds(); 65 | case 'ss': 66 | return zeroize(d.getSeconds()); 67 | case 'l': 68 | return zeroize(d.getMilliseconds(), 3); 69 | case 'L': 70 | var m = d.getMilliseconds(); 71 | if (m > 99) m = Math.round(m / 10); 72 | return zeroize(m); 73 | case 'tt': 74 | return d.getHours() < 12 ? 'am' : 'pm'; 75 | case 'TT': 76 | return d.getHours() < 12 ? 'AM' : 'PM'; 77 | case 'Z': 78 | return d.toUTCString().match(/[A-Z]+$/); 79 | // Return quoted strings with the surrounding quotes removed 80 | default: 81 | return $0.substr(1, $0.length - 2); 82 | } 83 | }); 84 | }; 85 | 86 | 87 | 88 | function getDate(strDate) { 89 | var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/, 90 | function (a) { 91 | return parseInt(a, 10) - 1; 92 | }).match(/\d+/g) + ')'); 93 | return Format(date, "MM-dd HH:mm"); 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/webapp/video/js/full_screen.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/12/9. 3 | */ 4 | function full_screen() { 5 | if ($(".barrage_video").width()+2 == $("body").width()) { 6 | // alert("a") 7 | $(".d_show").addClass("full_screen"); 8 | // $(".d_show").css({width:$("#demand_video").width()}) 9 | } 10 | else { 11 | // alert("b") 12 | $(".d_show").removeClass("full_screen"); 13 | // $(".d_show").css({width:'100%'}) 14 | } 15 | } 16 | 17 | $(document).ready(function () { 18 | document.addEventListener('fullscreenchange', function () { 19 | full_screen(); 20 | }); 21 | 22 | document.addEventListener('webkitfullscreenchange', function () { 23 | full_screen(); 24 | }); 25 | 26 | document.addEventListener('mozfullscreenchange', function () { 27 | full_screen(); 28 | }); 29 | 30 | document.addEventListener('MSFullscreenChange', function () { 31 | full_screen(); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /src/main/webapp/video/js/live_socket.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/11/6. 3 | */ 4 | 5 | //websocket 方法组 6 | function websocket_functions() { 7 | //判断当前浏览器是否支持WebSocket 8 | if ('WebSocket' in window) { 9 | websocket = new WebSocket(ws_string + "/websocket/live/"+roomId); 10 | 11 | } else { 12 | alert('Not support websocket'); 13 | } 14 | //连接发生错误的回调方法 15 | websocket.onerror = function () { 16 | console.log("error"); 17 | 18 | } 19 | //连接成功建立的回调方法 20 | websocket.onopen = function (event) { 21 | console.log("open"); 22 | if (!isliver()) {//不是主播 23 | requst_live_src() 24 | }else { 25 | console.log("你是主播") 26 | requst_live_src() 27 | } 28 | } 29 | 30 | //接收到消息的回调方法 31 | websocket.onmessage = function (event) { 32 | var data = JSON.parse(event.data); 33 | if(data.group=="rtc"){ 34 | processSignalingMessage(data); 35 | }else { 36 | message_handle(data); 37 | } 38 | } 39 | //连接关闭的回调方法 40 | websocket.onclose = function () { 41 | console.log("close"); 42 | 43 | for (var key in pc_opened_array) { 44 | if (pc_opened_array[key] != null&&pc_opened_array[key].connectionState!=="closed") { 45 | pc_opened_array[key].close(); 46 | } 47 | } 48 | } 49 | } 50 | 51 | 52 | //消息处理方法 53 | function message_handle(data) { 54 | if (data.onlinenum!=null) {//更新用户在线列表 55 | $("#online").text(data.onlinenum);//围观人数刷新 56 | if (data.onlinelist != null) {//更新列表 57 | // console.log(data.onlinelist) 58 | update_onlinelist_ui(data.onlinelist); 59 | 60 | } 61 | // if (data.onlinenum>parseInt($("#online").text())) { 62 | // alert("围观数+1") 63 | // }else { 64 | // alert("围观数-1") 65 | // } 66 | } 67 | else {//接受并解析弹幕 68 | analyze_live_barrage(data.barrage); 69 | } 70 | } 71 | 72 | 73 | function update_onlinelist_ui(onlinelist) {//更新在人线数列表 74 | $("#online_list").empty();//列表刷新 75 | for (var key in onlinelist) { 76 | if(onlinelist[key]==liverName){ 77 | var online_item = $("" + onlinelist[key] + "(*主播*)"); 78 | }else { 79 | var online_item = $("" + onlinelist[key] + ""); 80 | } 81 | 82 | online_item.css({color: getReandomColor()})//颜色随机 83 | $("#online_list").append(online_item); 84 | } 85 | } 86 | 87 | 88 | function close_live() { 89 | if(isliver()&&islived){ 90 | var r=confirm("确定关闭直播吗?") 91 | if (r==true) 92 | { 93 | websocket.send(JSON.stringify({ 94 | "group":"rtc", 95 | "type": "live_close", 96 | "data": {} 97 | })); 98 | websocket.close(); 99 | window.location.reload(true);//刷新页面 100 | } 101 | }else { 102 | websocket.close(); 103 | } 104 | 105 | } 106 | 107 | function isliver() {//判断主播 108 | return (userid_my!==null&&liverId!==null&&userid_my===liverId); 109 | } -------------------------------------------------------------------------------- /src/main/webapp/video/js/send_Barrage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/11/8. 3 | */ 4 | 5 | /*//发弹幕 6 | barrageId id(扩展功能) 7 | barrageContent 弹幕内容 8 | barrageSpade 发送速度 (int倍率) 9 | barrageColor 弹幕颜色 String 10 | barrageFontSize 字体大小 int 11 | */ 12 | function send_barrage(barrageId, barrageContent, barrageSpeed, barrageColor, barrageFontSize) { 13 | var barr_div = $("
      " + barrageContent + "
      ");//装载弹幕到.show 14 | barr_div.addClass("new"); 15 | $(".d_show").append(barr_div); 16 | 17 | var _top = 2; 18 | var _left = $(".barrage_video").width(); 19 | var _height = $(".barrage_video").height(); 20 | if (barr_div.prev().position() != null) { 21 | _top = barr_div.prev().position().top + barr_div.prev().height(); 22 | // var range = 2 * _height / 3 - barr_div.height(); 23 | // do{ 24 | // _top= Math.random() * range 25 | // }while(Math.abs(_top-(barr_div.prev().position().top))<=barr_div.height()/2); 26 | } 27 | else { 28 | _top = 2; 29 | } 30 | 31 | if (_top >= 2 * _height / 3 - barr_div.height()) { 32 | _top = 2; 33 | } 34 | barr_div.css({"font-size": barrageFontSize + "px", left: _left, top: _top, color: barrageColor}); 35 | var distance = $(".barrage_video").width() + barr_div.width(); 36 | barr_div.removeClass("new"); 37 | barr_div.animate({left: "-=" +distance+ "px"}, 1000 * (distance / barrageSpeed), "linear", function () { 38 | barr_div.remove(); 39 | }); 40 | 41 | } 42 | 43 | 44 | function myFunction() {//根据时间点发送弹幕 45 | for (key in barrage_array) {//遍历弹幕 46 | var barrage_object = barrage_array[key]; 47 | // alert(parseInt(barrage_object.videoTimePrint)+"---"+this.currentTime) 48 | if (parseInt(this.currentTime) == parseInt(barrage_object.videoTimePrint)) { 49 | send_barrage(barrage_object.barrageId, barrage_object.barrageContent, barrage_object.barrageSpeed, 50 | barrage_object.barrageColor, barrage_object.barrageFontSize, barrage_object.videoTimePrint) 51 | barrage_array.splice(key, 1); 52 | } 53 | } 54 | } 55 | 56 | 57 | function demand_send_Barrage() {//点播发送弹幕 58 | if (!islogined) { 59 | alert("请先登录"); 60 | return; 61 | } 62 | 63 | var barrageContent = $("#barr_text").val(); 64 | var barrageSpeed = $("#speed_btns .clicked").val(); 65 | var barrageFontSize = $("#size_btns .clicked").val(); 66 | var barrageColor = $("#sendcolor").val(); 67 | var videoTimePrint = $("#demand_video")[0].currentTime;//发送的视频时间节点 68 | var videoId_ = videoId; 69 | // var userId = userid_my; 70 | 71 | if(barrageContent!=null&&barrageContent.length>0){ 72 | send_barrage(null, barrageContent, barrageSpeed, barrageColor, barrageFontSize);//上屏 73 | 74 | $.ajax({ 75 | type: "POST", 76 | url: "../ajax/insert_Barr_barragesJsonAction", 77 | dataType: "json", 78 | cache:false, 79 | data: { 80 | barrageContent: barrageContent, 81 | barrageSpeed: barrageSpeed, 82 | barrageColor: barrageColor, 83 | barrageFontSize: barrageFontSize, 84 | videoTimePrint: videoTimePrint, 85 | 'barrage_video.videoId': videoId_ 86 | // ,'barr_user.userId': userId 87 | }, 88 | success: function (data) { 89 | if (data.success) { 90 | $("#barr_text").val(""); 91 | console.log("insert barrage success"); 92 | } 93 | else { 94 | console.log("insert barrage failure"); 95 | } 96 | } 97 | , 98 | error: function (jqXHR) { 99 | alert("错误提示: " + jqXHR.status + " " + jqXHR.statusText); 100 | } 101 | }); 102 | 103 | } 104 | } 105 | 106 | function live_send_Barrage(state) {//直播发送弹幕 107 | //State 1 群发弹幕 108 | // 2 用户下线 109 | // 0 用户手动登陆 110 | if (!islogined) { 111 | alert("请先登录!"); 112 | return; 113 | } 114 | if (!islived) { 115 | alert("直播还未开始哟"); 116 | return; 117 | } 118 | 119 | 120 | 121 | var barrageContent = $("#barr_text").val().trim(); 122 | var barrageSpade = $("#speed_btns .clicked").val(); 123 | var barrageFontSize = $("#size_btns .clicked").val(); 124 | var barrageColor = $("#sendcolor").val(); 125 | 126 | // send_barrage(null, barrageContent, barrageSpade, barrageColor, barrageFontSize);//上屏 127 | 128 | if(barrageContent!=null&&barrageContent.length>0){ 129 | 130 | websocket.send(JSON.stringify({ 131 | "group":"danmu", 132 | "state": state, 133 | "barrage": { 134 | "barrageContent": barrageContent, 135 | "barrageSpeed": barrageSpade, 136 | "barrageColor": barrageColor, 137 | "barrageFontSize": barrageFontSize 138 | } 139 | })); 140 | 141 | $("#barr_text").val(""); 142 | 143 | } 144 | 145 | } 146 | 147 | function analyze_live_barrage(barrage) {//解析直播发过来的弹幕并上屏 148 | // var barr = barrage.barrageContent + "---" + barrage.barrageColor + "---" + barrage.barrageSpade + "---" + barrage.barrageFontSize; 149 | // alert(barr); 150 | send_barrage(null,barrage.barrageContent,barrage.barrageSpeed,barrage.barrageColor,barrage.barrageFontSize) 151 | 152 | } 153 | 154 | 155 | //获取随机颜色 156 | function getReandomColor() { 157 | return '#' + (function (h) { 158 | return new Array(7 - h.length).join("0") + h 159 | })((Math.random() * 0x1000000 << 0).toString(16)) 160 | } -------------------------------------------------------------------------------- /src/main/webapp/video/js/ui.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by johl on 2016/11/10. 3 | */ 4 | 5 | function isclick() {//单选按钮组事件 6 | $(this).parent().find("button").each(function (i, v) { 7 | if ($(this)[0] == event.target) { 8 | $(this).addClass("clicked"); 9 | $(this).css({background_color: "#4285F4"}) 10 | } 11 | else { 12 | $(this).removeClass("clicked"); 13 | } 14 | }); 15 | } 16 | 17 | 18 | $(document).ready(function () { 19 | 20 | $("#sendfont_size").on("click", function () { 21 | if ($("#sendfontchoose_panle").css("display") == "none") { 22 | $("#sendfontchoose_panle").show(); 23 | $("#size_btns").show(); 24 | } else { 25 | if ($("#size_btns").css("display") == "none") { 26 | $("#size_btns").show(); 27 | $("#speed_btns").hide(); 28 | } 29 | else { 30 | $("#sendfontchoose_panle").hide(); 31 | $("#size_btns").hide(); 32 | } 33 | } 34 | }); 35 | 36 | $("#sendfont_speed").on("click", function () { 37 | if ($("#sendfontchoose_panle").css("display") == "none") { 38 | $("#sendfontchoose_panle").show(); 39 | $("#speed_btns").show(); 40 | } else { 41 | if ($("#speed_btns").css("display") == "none") { 42 | $("#speed_btns").show(); 43 | $("#size_btns").hide(); 44 | } 45 | else { 46 | $("#sendfontchoose_panle").hide(); 47 | $("#speed_btns").hide(); 48 | } 49 | } 50 | }); 51 | 52 | $("#sendfontchoose_panle button").on("click", isclick) 53 | $("#sendcolor").colorpicker({ 54 | fillcolor: true, 55 | target: "#jADFV******FV7FW", 56 | success: function (o, color) { 57 | $("#sendcolor").val(color) 58 | $("#barr_text").css({color: color}); 59 | } 60 | }); 61 | 62 | $(".fontbutton_config").mouseenter(function () { 63 | $(this).css({"background-color": "#4285F4"}); 64 | $(this).css({"color": "white"}); 65 | }); 66 | $(".fontbutton_config").mouseleave(function () { 67 | $(this).css({"background-color": "white"}); 68 | $(this).css({"color": "black"}); 69 | }); 70 | 71 | $("#sendfont_size").on("click", function () { 72 | $("#colorpanel").hide(); 73 | }); 74 | 75 | $("#sendfont_speed").on("click", function () { 76 | $("#colorpanel").hide(); 77 | }); 78 | 79 | $("#sendcolor").on("click", function () { 80 | $("#sendfontchoose_panle").hide(); 81 | $("#speed_btns").hide(); 82 | $("#size_btns").hide(); 83 | }); 84 | 85 | 86 | $("#barr_text").keydown(function (event) { 87 | if(event.which==13){ 88 | if(videopage_type=="demand"){ 89 | demand_send_Barrage(); 90 | }else 91 | { 92 | live_send_Barrage(1) 93 | } 94 | } 95 | }); 96 | 97 | 98 | 99 | 100 | }); 101 | 102 | -------------------------------------------------------------------------------- /src/main/webapp/vip/css/fileinput.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2015 3 | * @package bootstrap-fileinput 4 | * @version 4.1.8 5 | * 6 | * File input styling for Bootstrap 3.0 7 | * Built for Yii Framework 2.0 8 | * Author: Kartik Visweswaran 9 | * Year: 2015 10 | * For more Yii related demos visit http://demos.krajee.com 11 | */ 12 | .file-input { 13 | overflow-x: auto 14 | } 15 | 16 | .file-loading { 17 | top: 0; 18 | right: 0; 19 | width: 25px; 20 | height: 25px; 21 | font-size: 999px; 22 | text-align: right; 23 | color: #fff; 24 | background: transparent url(../../img/loading.gif) top left no-repeat; 25 | border: none 26 | } 27 | 28 | .btn-file { 29 | position: relative; 30 | overflow: hidden 31 | } 32 | 33 | .btn-file input[type=file] { 34 | position: absolute; 35 | top: 0; 36 | right: 0; 37 | min-width: 100%; 38 | min-height: 100%; 39 | text-align: right; 40 | filter: alpha(opacity=0); 41 | opacity: 0; 42 | background: none repeat scroll 0 0 transparent; 43 | cursor: inherit; 44 | display: block 45 | } 46 | 47 | .file-caption .glyphicon { 48 | display: inline-block; 49 | min-width: 18px; 50 | float: left; 51 | margin-top: 2px 52 | } 53 | 54 | .file-caption-name { 55 | display: inline-block; 56 | overflow: hidden; 57 | max-height: 20px; 58 | padding-right: 10px; 59 | word-break: break-all 60 | } 61 | 62 | .file-caption-ellipsis { 63 | position: absolute; 64 | right: 10px; 65 | margin-top: -6px; 66 | font-size: 1.2em; 67 | display: none; 68 | font-weight: 700; 69 | cursor: default 70 | } 71 | 72 | .kv-has-ellipsis .file-caption-ellipsis { 73 | display: inline 74 | } 75 | 76 | .kv-has-ellipsis { 77 | padding-right: 17px 78 | } 79 | 80 | .kv-search-container .kv-search-clear { 81 | position: absolute; 82 | padding: 10px; 83 | right: 0 84 | } 85 | 86 | .file-error-message { 87 | background-color: #f2dede; 88 | color: #a94442; 89 | text-align: center; 90 | border-radius: 5px; 91 | padding: 5px 92 | } 93 | 94 | .file-error-message pre, .file-error-message ul { 95 | text-align: left; 96 | margin: 5px 0 97 | } 98 | 99 | .file-caption-disabled { 100 | background-color: #EEE; 101 | cursor: not-allowed; 102 | opacity: 1 103 | } 104 | 105 | .file-input .btn .disabled, .file-input .btn[disabled] { 106 | cursor: not-allowed 107 | } 108 | 109 | .file-preview { 110 | border-radius: 5px; 111 | border: 1px solid #ddd; 112 | padding: 5px; 113 | width: 100%; 114 | margin-bottom: 5px; 115 | height: 100%; 116 | 117 | } 118 | 119 | .file-preview-frame { 120 | display: table; 121 | margin: 0 auto; 122 | height: 150px; 123 | border: 1px solid #ddd; 124 | box-shadow: 1px 1px 5px 0 #a2958a; 125 | padding: 6px; 126 | float: left; 127 | text-align: center; 128 | vertical-align: middle 129 | } 130 | 131 | .file-preview-frame:hover { 132 | box-shadow: 3px 3px 5px 0 #333 133 | } 134 | 135 | .file-preview-image { 136 | height: 160px; 137 | vertical-align: text-center 138 | } 139 | 140 | .file-preview-text { 141 | width: 160px; 142 | color: #428bca; 143 | font-size: 11px; 144 | text-align: center 145 | } 146 | 147 | .file-preview-other { 148 | padding-top: 48px; 149 | text-align: center 150 | } 151 | 152 | .file-preview-other i { 153 | font-size: 2.4em 154 | } 155 | 156 | .file-other-error { 157 | width: 100%; 158 | padding-top: 30px; 159 | text-align: right 160 | } 161 | 162 | .file-input-ajax-new .fileinput-remove-button, .file-input-ajax-new .fileinput-upload-button, .file-input-new .close, .file-input-new .file-preview, .file-input-new .fileinput-remove-button, .file-input-new .fileinput-upload-button, .file-input-new .glyphicon-file { 163 | display: none 164 | } 165 | 166 | .loading { 167 | background: transparent url(../../img/loading.gif) no-repeat scroll center center content-box !important 168 | } 169 | 170 | .wrap-indicator { 171 | font-weight: 700; 172 | color: #245269; 173 | cursor: pointer 174 | } 175 | 176 | .file-actions { 177 | display: none; 178 | text-align: left 179 | } 180 | 181 | .file-footer-buttons { 182 | float: right 183 | } 184 | 185 | .file-thumbnail-footer .file-caption-name { 186 | padding-top: 4px; 187 | font-size: 11px; 188 | color: #777 189 | } 190 | 191 | .file-upload-indicator { 192 | padding-top: 2px; 193 | cursor: default 194 | } 195 | 196 | .file-upload-indicator:hover { 197 | font-size: 1.2em; 198 | font-weight: 700; 199 | padding-top: 0 200 | } 201 | 202 | .file-drop-zone { 203 | border: 1px dashed #aaa; 204 | border-radius: 4px; 205 | height: 100%; 206 | text-align: center; 207 | vertical-align: middle; 208 | margin: 12px 15px 12px 12px; 209 | padding: 5px 210 | } 211 | 212 | .file-drop-zone-title { 213 | color: #aaa; 214 | font-size: 40px; 215 | height: 80%; 216 | padding: 85px 10px 217 | } 218 | 219 | .highlighted { 220 | border: 2px dashed #999 !important; 221 | background-color: #f0f0f0 222 | } 223 | 224 | .file-uploading { 225 | background-image: url(../../img/loading-sm.gif); 226 | background-position: center bottom 10px; 227 | background-repeat: no-repeat; 228 | opacity: .6 229 | } 230 | 231 | .file-icon-large { 232 | font-size: 1.2em 233 | } -------------------------------------------------------------------------------- /src/main/webapp/vip/img/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/vip/img/bg.jpg -------------------------------------------------------------------------------- /src/main/webapp/vip/img/icons_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/vip/img/icons_m.png -------------------------------------------------------------------------------- /src/main/webapp/vip/img/rl_top2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/vip/img/rl_top2.jpg -------------------------------------------------------------------------------- /src/main/webapp/vip/img/rl_topbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderzc/biubiu/10b917546a5343a0b67b31d1b76ab4e5f68ea9e6/src/main/webapp/vip/img/rl_topbg.png -------------------------------------------------------------------------------- /src/main/webapp/vip/js/ajax_upload.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by zc on 2016/12/26. 3 | */ 4 | ;(function ($) { 5 | var defaults = { 6 | uploadProgress: null, 7 | beforeSend: null, 8 | success: null, 9 | }, 10 | setting = {}; 11 | 12 | var upload = function ($this) { 13 | $this.parent().on('change', $this, function (event) { 14 | //var $this = $(event.target), 15 | var formData = new FormData(), 16 | target = event.target || event.srcElement; 17 | //$.each(target.files, function(key, value) 18 | //{ 19 | // console.log(key); 20 | // formData.append(key, value); 21 | //}); 22 | formData.append('file', target.files[0]); 23 | formData.append("fileContentType", target.files[0].type); 24 | formData.append("fileFileName", target.files[0].name); 25 | 26 | settings.fileType && formData.append('fileType', settings.fileType); 27 | 28 | $.ajax({ 29 | url: $this.data('url'), 30 | type: "POST", 31 | data: formData, 32 | dataType: 'json', 33 | processData: false, 34 | contentType: false, 35 | cache: false, 36 | beforeSend: function () { 37 | //console.log('start'); 38 | if (settings.beforeSend) { 39 | settings.beforeSend(); 40 | } 41 | }, 42 | xhr: function () { 43 | var xhr = $.ajaxSettings.xhr(); 44 | if (xhr.upload) { 45 | xhr.upload.addEventListener('progress', function (event) { 46 | var total = event.total, 47 | position = event.loaded || event.position, 48 | percent = 0; 49 | if (event.lengthComputable) { 50 | percent = Math.ceil(position / total * 100); 51 | } 52 | if (settings.uploadProgress) { 53 | settings.uploadProgress(event, position, total, percent); 54 | } 55 | 56 | }, false); 57 | } 58 | return xhr; 59 | }, 60 | success: function (data, status, jXhr) { 61 | if (settings.success) { 62 | settings.success(data); 63 | } 64 | }, 65 | error: function (jXhr, status, error) { 66 | if (settings.error) { 67 | settings.error(jXhr, status, error); 68 | } 69 | } 70 | }); 71 | }); 72 | }; 73 | $.fn.uploadFile = function (options) { 74 | settings = $.extend({}, defaults, options); 75 | // 文件上传 76 | return this.each(function () { 77 | upload($(this)); 78 | }); 79 | } 80 | })($ || jQuery); -------------------------------------------------------------------------------- /src/main/webapp/vip/js/fileinput_locale_zh.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * FileInput Spanish (Latin American) Translations 3 | * 4 | * This file must be loaded after 'fileinput.js'. Patterns in braces '{}', or 5 | * any HTML markup tags in the messages must not be converted or translated. 6 | * 7 | * @see http://github.com/kartik-v/bootstrap-fileinput 8 | * 9 | * NOTE: this file must be saved in UTF-8 encoding. 10 | */ 11 | (function ($) { 12 | "use strict"; 13 | $.fn.fileinput.locales.es = { 14 | fileSingle: '单个文件', 15 | filePlural: '多个文件', 16 | browseLabel: '选择文件 …', 17 | removeLabel: '删除文件', 18 | removeTitle: '删除选中文件', 19 | cancelLabel: '取消', 20 | cancelTitle: '取消上传', 21 | uploadLabel: '上传', 22 | uploadTitle: '上传选中文件', 23 | msgSizeTooLarge: 'File "{name}" ({size} KB) exceeds maximum allowed upload size of {maxSize} KB. Please retry your upload!', 24 | msgFilesTooLess: '文件数量必须大于 {n} {files} ,请重新上传!', 25 | msgFilesTooMany: 'Number of files selected for upload ({n}) exceeds maximum allowed limit of {m}. Please retry your upload!', 26 | msgFileNotFound: '文件 "{name}" 未找到!', 27 | msgFileSecured: 'Security restrictions prevent reading the file "{name}".', 28 | msgFileNotReadable: 'File "{name}" is not readable.', 29 | msgFilePreviewAborted: 'File preview aborted for "{name}".', 30 | msgFilePreviewError: 'An error occurred while reading the file "{name}".', 31 | msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.', 32 | msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.', 33 | msgValidationError: 'File Upload Error', 34 | msgLoading: 'Loading file {index} of {files} …', 35 | msgProgress: 'Loading file {index} of {files} - {name} - {percent}% completed.', 36 | msgSelected: '选中{n}个文件', 37 | msgFoldersNotAllowed: 'Drag & drop files only! {n} folder(s) dropped were skipped.', 38 | dropZoneTitle: '拖拽文件到这里' 39 | }; 40 | 41 | $.extend($.fn.fileinput.defaults, $.fn.fileinput.locales.es); 42 | })(window.jQuery); 43 | -------------------------------------------------------------------------------- /src/main/webapp/vip/js/upload_video.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | 3 | $("#upload_video").on("change", function () { 4 | $(".file-other-error.text-danger").parent().remove(); 5 | }); 6 | 7 | 8 | $("#upload_video").fileinput({ 9 | language: 'zh', //设置语言 10 | uploadUrl: '../ajax/upload-video', // you must set a valid URL here else you will get an error 11 | maxFileSize: 2000000, 12 | maxFileCount: 1, //表示允许同时上传的最大文件个数 13 | dropZoneEnabled: true,//是否显示拖拽区域 14 | showUpload: true, 15 | showCaption: true,//是否显示标题 16 | showPreview: true,//是否显示预览 17 | overwriteInitial: true,//是否覆盖已经存在的图片 18 | validateInitialCount: true, 19 | allowedFileTypes: ["video"], 20 | previewFileIcon: '', 21 | allowedPreviewTypes: "text", 22 | // browseClass:"" , 23 | slugCallback: function (filename) { 24 | return filename.replace('(', '_').replace(']', '_'); 25 | 26 | } 27 | }); 28 | 29 | 30 | $("#uploadfile").on('fileselect', function (event, n, l) {//更改上传文件触发 31 | // alert('File Selected. Name: ' + l + ', Num: ' + n); 32 | // $(".file-other-error.text-danger").parent().remove(); 33 | $(".file-preview-frame").remove(); 34 | 35 | }); 36 | 37 | 38 | //异步上传失败返回结果处理 39 | $('#upload_video').on('fileerror', function (event, data, msg) { 40 | console.log(data.id); 41 | console.log(data.index); 42 | console.log(data.file); 43 | console.log(data.reader); 44 | console.log(data.files); 45 | // get message 46 | 47 | alert("上传失败!"); 48 | }); 49 | //异步上传成功返回结果处理 50 | $("#upload_video").on("fileuploaded", function (event, data, previewId, index) { 51 | console.log(data); 52 | console.log(data.id); 53 | console.log(data.index); 54 | console.log(data.file); 55 | console.log(data.reader); 56 | console.log(data.files); 57 | var obj = data.response; 58 | if (obj.success) { 59 | 60 | setTimeout(function () { 61 | 62 | alert("上传成功"); 63 | 64 | $(".cover-wrp .cover-box").css({ 65 | "background-image": "url(" + obj.videoCoverURL + ")", 66 | "border":"none" 67 | }); 68 | 69 | $("#videopath").val(obj.videoURI); 70 | $("#videocoverpath").val(obj.videoCoverURI); 71 | is_uploaded = true; 72 | 73 | },100) 74 | 75 | } else { 76 | alert("上传失败"); 77 | } 78 | 79 | }); 80 | 81 | 82 | //isDiy 单选操作 83 | $(".control-group label").on("click", function () { 84 | $(".control-group input").removeClass("is-checked"); 85 | $(this).find("input").addClass("is-checked"); 86 | }); 87 | 88 | 89 | //videoType单选操纵 90 | $(".section.type-wrp .type-btn").on("click", function () { 91 | $(".section.type-wrp .type-btn").removeClass("is-selected"); 92 | $(this).addClass("is-selected"); 93 | $("#videotype").val($(this).val()); 94 | 95 | }); 96 | 97 | //标题框 98 | $(".bili-input").on("input", function () { 99 | var length = $(this).val().length; 100 | // alert(length); 101 | $(".title-wrp .count-wrp").text(length + "/80") 102 | }); 103 | 104 | 105 | //提交视频信息 106 | $('#video_form').submit( 107 | function () { 108 | if (is_uploaded) { 109 | $.ajax({ 110 | type: "POST", 111 | url: server_path + "/ajax/video_submit", 112 | dataType: "json", 113 | data: $('#video_form').serializeArray(),// 提交表单 114 | success: function (data) { 115 | if (data.success) { 116 | // alert("投稿成功!"); 117 | 118 | $("#submiting").hide(); 119 | 120 | $(".success-wrp .outline").text(data.videoTitle); 121 | $(".success-wrp .video_url_").text(full_path + "/video/demand?video_id=" + data.videoId); 122 | $(".success-wrp .pic img").attr("src", $("#videocoverpath").val()); 123 | 124 | $("#submited").show(); 125 | 126 | $("#go_video").attr("href", server_path + "/video/demand?video_id=" + data.videoId); 127 | $("#again_video").attr("href", server_path + "vip/upload_video"); 128 | 129 | } 130 | else { 131 | alert("投稿失败!"); 132 | } 133 | }, 134 | error: function (jqXHR) { 135 | alert("错误提示: " + jqXHR.status + " " + jqXHR.statusText); 136 | } 137 | }); 138 | 139 | } else { 140 | alert("请等待视频上传成功在发布"); 141 | } 142 | 143 | 144 | return false; 145 | }); 146 | 147 | 148 | }) 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /src/main/webapp/vip/js/userinfo_setting.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | $('#sex_ul li').click(function () { 3 | var $this = $(this); 4 | $('#sex_ul li').removeClass('blue'); 5 | $this.addClass('blue'); 6 | $('#select_sex').val($this.data('sex')); 7 | }); 8 | var _sex = $('#select_sex').val(); 9 | $('#sex_ul li').each(function () { 10 | if (_sex == $(this).data('sex')) { 11 | $(this).addClass('blue'); 12 | } else { 13 | $(this).removeClass('blue'); 14 | } 15 | }) 16 | 17 | $('#user_info_form').submit( 18 | function () { 19 | $.ajax({ 20 | type: "POST", 21 | url: server_path + "/ajax/userAjax-uinfo", 22 | dataType: "json", 23 | data: $('#user_info_form').serializeArray(),// 提交表单 24 | success: function (data) { 25 | if (data.success) { 26 | alert("信息修改成功!"); 27 | window.location.reload(true); 28 | } 29 | else { 30 | alert("信息修改失败!"); 31 | } 32 | }, 33 | error: function (jqXHR) { 34 | alert("错误提示: " + jqXHR.status + " " + jqXHR.statusText); 35 | } 36 | }); 37 | 38 | 39 | return false; 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /src/main/webapp/vip/security-list.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | 3 |
      4 | 88 |
      89 | -------------------------------------------------------------------------------- /src/main/webapp/vip/user_info.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <% 3 | String path = request.getContextPath(); 4 | pageContext.setAttribute("path", path); 5 | %> 6 | 7 | 8 | 9 | 个人中心-biubiu 10 | <%@include file="../inclued_page/base_js_css.jsp" %> 11 | 12 | 13 | 14 | 15 | <%@include file="../inclued_page/nav.jsp" %> 16 |
      17 |
      18 |
      19 |
      20 | <%@include file="security-list.jsp" %> 21 |
      22 |
      23 |
      24 | 我的信息 25 |
      26 |
      27 |
        28 | 29 |
      • 30 |
        31 |

        用户名:

        32 |
        33 | 34 | ${sessionScope.user.userName} 35 |
        36 |
        37 |
      • 38 |
      • 39 |
        40 |

        手机号:

        41 |
        42 | 43 | ${sessionScope.user.userId} 44 |
        45 |
        46 |
      • 47 |
      • 48 |
        49 |

        邮箱:

        50 |
        51 | 53 |
        54 | <%--

        注:修改一次昵称需要消耗6个硬币

        --%> 55 |
        56 |
      • 57 |
      • 58 |
        59 |

        我的签名:

        60 |
        61 | 62 |
        63 |
        64 |
      • 65 |
      • 66 |
        67 |

        性别:

        68 | 69 |
        70 |
          71 |
        • 72 |
        • 73 |
        • 保密
        • 74 |
        75 |
        76 |
        77 |
      • 78 |
      • 79 |
        80 |

        出生日期:

        81 |
        82 | 85 | 89 | 90 |
        91 |
        92 |
      • 93 | 94 | 95 |
      96 |
      97 |
      98 | 99 |
      100 |
      101 |
      102 | <%@include file="../inclued_page/model_login.jsp" %> 103 | 104 | 120 | 121 | -------------------------------------------------------------------------------- /src/test/java/HibnerateTest.java: -------------------------------------------------------------------------------- 1 | import com.action.LiveAction; 2 | import com.entity.Barrages; 3 | import com.entity.Users; 4 | import com.entity.Videos; 5 | import com.utils.HibernateUtils; 6 | import org.hibernate.Session; 7 | import org.hibernate.Transaction; 8 | 9 | import java.util.HashMap; 10 | 11 | public class HibnerateTest { 12 | public static void main(String[] args) { 13 | // Session session = HibernateUtils.getCurrentSession(); 14 | // Transaction tx = session.beginTransaction(); 15 | // try { 16 | // 17 | // Barrages barrages = new Barrages(); 18 | // barrages.setBarr_user((Users) HibernateUtils.getCurrentSession().get(Users.class, "13061282767")); 19 | // barrages.setBarrage_video((Videos) HibernateUtils.getCurrentSession().get(Videos.class, "av62813213")); 20 | // barrages.setBarrageColor("#ffffff"); 21 | // barrages.setBarrageFontSize(22); 22 | // barrages.setBarrageSpeed(190); 23 | // barrages.setBarrageContent("lalallalallalalalal"); 24 | // barrages.setVideoTimePrint((float) 134.970927); 25 | // session.save(barrages); 26 | // tx.commit(); 27 | // } catch (Exception ce) { 28 | // if (tx != null) { 29 | // tx.rollback(); 30 | // } 31 | // ce.printStackTrace(); 32 | // } 33 | 34 | 35 | } 36 | 37 | } --------------------------------------------------------------------------------