├── .idea ├── artifacts │ ├── WebChat_war.xml │ └── WebChat_war_exploded.xml ├── compiler.xml ├── encodings.xml ├── libraries │ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_0.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_5_0.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_5_0.xml │ ├── Maven__com_github_jsqlparser_jsqlparser_0_9_5.xml │ ├── Maven__com_github_pagehelper_pagehelper_4_1_4.xml │ ├── Maven__com_sun_mail_javax_mail_1_5_0.xml │ ├── Maven__commons_beanutils_commons_beanutils_1_7_0.xml │ ├── Maven__commons_collections_commons_collections_3_2.xml │ ├── Maven__commons_dbcp_commons_dbcp_1_2_2.xml │ ├── Maven__commons_fileupload_commons_fileupload_1_2_2.xml │ ├── Maven__commons_io_commons_io_2_4.xml │ ├── Maven__commons_lang_commons_lang_2_4.xml │ ├── Maven__commons_logging_commons_logging_1_1_1.xml │ ├── Maven__commons_pool_commons_pool_1_3.xml │ ├── Maven__javax_activation_activation_1_1.xml │ ├── Maven__javax_javaee_api_7_0.xml │ ├── Maven__javax_servlet_javax_servlet_api_3_0_1.xml │ ├── Maven__javax_servlet_jsp_javax_servlet_jsp_api_2_3_2_b01.xml │ ├── Maven__javax_servlet_jstl_1_2.xml │ ├── Maven__junit_junit_3_8_1.xml │ ├── Maven__log4j_log4j_1_2_12.xml │ ├── Maven__mysql_mysql_connector_java_5_1_35.xml │ ├── Maven__net_sf_ezmorph_ezmorph_1_0_6.xml │ ├── Maven__net_sf_json_lib_json_lib_jdk15_2_2_3.xml │ ├── Maven__org_apache_commons_commons_lang3_3_4.xml │ ├── Maven__org_aspectj_aspectjweaver_1_6_12.xml │ ├── Maven__org_mybatis_mybatis_3_2_8.xml │ ├── Maven__org_mybatis_mybatis_spring_1_2_2.xml │ ├── Maven__org_slf4j_slf4j_api_1_6_6.xml │ ├── Maven__org_slf4j_slf4j_log4j12_1_6_6.xml │ ├── Maven__org_springframework_spring_aop_4_3_1_RELEASE.xml │ ├── Maven__org_springframework_spring_beans_4_3_1_RELEASE.xml │ ├── Maven__org_springframework_spring_context_4_3_1_RELEASE.xml │ ├── Maven__org_springframework_spring_core_4_3_1_RELEASE.xml │ ├── Maven__org_springframework_spring_expression_4_3_1_RELEASE.xml │ ├── Maven__org_springframework_spring_jdbc_4_3_1_RELEASE.xml │ ├── Maven__org_springframework_spring_tx_4_3_1_RELEASE.xml │ ├── Maven__org_springframework_spring_web_4_3_1_RELEASE.xml │ └── Maven__org_springframework_spring_webmvc_4_3_1_RELEASE.xml ├── misc.xml ├── modules.xml ├── uiDesigner.xml └── vcs.xml ├── README.md ├── WebChat.iml ├── pom.xml └── src └── main ├── java └── com │ └── ccq │ ├── controller │ ├── FiveChessController.java │ ├── LogController.java │ ├── LoginController.java │ ├── SystemController.java │ └── UserController.java │ ├── interceptor │ └── LoginInterceptor.java │ ├── mapper │ ├── LogMapper.java │ ├── LogMapper.xml │ ├── UserMapper.java │ └── UserMapper.xml │ ├── pojo │ ├── Log.java │ ├── LogExample.java │ ├── User.java │ └── UserExample.java │ ├── service │ ├── LogService.java │ ├── UserService.java │ └── impl │ │ ├── LogServiceImpl.java │ │ └── UserServiceImpl.java │ ├── utils │ ├── CommonDate.java │ ├── LogUtil.java │ ├── NetUtil.java │ ├── PageBean.java │ └── WordDefined.java │ └── webSocket │ ├── ChatServer.java │ ├── HttpSessionConfigurator.java │ ├── JsonConfigUtils.java │ ├── Message.java │ └── OnlineUser.java ├── resources ├── db.properties ├── log4j.properties ├── mybatis │ └── SqlMapConfig.xml ├── spring │ ├── spring-dao.xml │ ├── spring-service.xml │ ├── spring-tx.xml │ └── springmvc.xml └── webchat.sql └── webapp ├── WEB-INF ├── view │ ├── about.jsp │ ├── five-chess.jsp │ ├── help.jsp │ ├── include │ │ ├── commonfile.jsp │ │ ├── footer.jsp │ │ ├── header.jsp │ │ └── sidebar.jsp │ ├── index.jsp │ ├── info-setting.jsp │ ├── information.jsp │ ├── log.jsp │ ├── login.jsp │ └── system-setting.jsp └── web.xml ├── index.jsp └── static ├── plugins ├── amaze │ ├── css │ │ ├── admin.css │ │ ├── amazeui.cropper.css │ │ ├── amazeui.flat.css │ │ ├── amazeui.flat.min.css │ │ ├── amazeui.min.css │ │ └── app.css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ ├── i │ │ ├── app-icon72x72@2x.png │ │ ├── examples │ │ │ ├── admin-chrome.png │ │ │ ├── admin-firefox.png │ │ │ ├── admin-ie.png │ │ │ ├── admin-opera.png │ │ │ ├── admin-safari.png │ │ │ ├── adminPage.png │ │ │ ├── blogPage.png │ │ │ ├── landing.png │ │ │ ├── landingPage.png │ │ │ ├── loginPage.png │ │ │ └── sidebarPage.png │ │ ├── favicon.png │ │ └── startup-640x1096.png │ └── js │ │ ├── amazeui.ie8polyfill.js │ │ ├── amazeui.ie8polyfill.min.js │ │ ├── amazeui.min.js │ │ ├── amazeui.widgets.helper.js │ │ ├── amazeui.widgets.helper.min.js │ │ ├── app.js │ │ ├── cropper.min.js │ │ ├── handlebars.min.js │ │ └── jquery.min.js ├── contextjs │ ├── css │ │ └── context.standalone.css │ └── js │ │ └── context.js ├── custom │ ├── css │ │ ├── custom_up_img.css │ │ └── font-awesome.4.6.0.css │ └── js │ │ └── custom_up_img.js ├── jquery │ └── jquery-2.1.4.min.js ├── layer │ ├── extend │ │ └── layer.ext.js │ ├── layer.js │ └── skin │ │ ├── default │ │ ├── icon-ext.png │ │ ├── icon.png │ │ ├── loading-0.gif │ │ ├── loading-1.gif │ │ └── loading-2.gif │ │ ├── layer.css │ │ └── layer.ext.css ├── laypage │ ├── laypage.js │ └── skin │ │ └── laypage.css └── sockjs │ └── sockjs.js └── source ├── css ├── login.css └── mosto.css ├── img ├── adm.png ├── avtar.png ├── bg1.jpg ├── bg2.jpg ├── bg3.jpg ├── bg4.png ├── bg5.jpg ├── close.png ├── default_head.jpg ├── key.png └── robot.jpg └── js ├── ai2.js ├── ai2.min.js ├── board.js ├── jcanvas.min.js └── jquery.min.js /.idea/artifacts/WebChat_war.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/target 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/artifacts/WebChat_war_exploded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/target/WebChat 4 | 5 | 6 | 7 | 8 | 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 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_jsqlparser_jsqlparser_0_9_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_pagehelper_pagehelper_4_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_sun_mail_javax_mail_1_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_7_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_collections_commons_collections_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_dbcp_commons_dbcp_1_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_fileupload_commons_fileupload_1_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_io_commons_io_2_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_lang_commons_lang_2_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_logging_commons_logging_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_pool_commons_pool_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_activation_activation_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_javaee_api_7_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_servlet_jsp_javax_servlet_jsp_api_2_3_2_b01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_servlet_jstl_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_3_8_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__log4j_log4j_1_2_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__mysql_mysql_connector_java_5_1_35.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_sf_ezmorph_ezmorph_1_0_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_sf_json_lib_json_lib_jdk15_2_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_lang3_3_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_aspectj_aspectjweaver_1_6_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_3_2_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_spring_1_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_6_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_6_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aop_4_3_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_beans_4_3_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_4_3_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_core_4_3_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_expression_4_3_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jdbc_4_3_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_tx_4_3_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_web_4_3_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_webmvc_4_3_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 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 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 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 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WebChat 2 | 一份关于webSocket网页聊天的小demo 3 | 具体说明参见我的博客:http://blog.csdn.net/qq_27717967/article/details/78826475 4 | -------------------------------------------------------------------------------- /WebChat.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 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 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.ccq 5 | WebChat 6 | war 7 | 1.0-SNAPSHOT 8 | WebChat Maven Webapp 9 | http://maven.apache.org 10 | 11 | UTF-8 12 | 4.3.1.RELEASE 13 | 3.2.8 14 | 15 | 16 | 17 | 18 | junit 19 | junit 20 | 3.8.1 21 | test 22 | 23 | 24 | 25 | 26 | org.springframework 27 | spring-web 28 | ${spring.version} 29 | 30 | 31 | org.springframework 32 | spring-webmvc 33 | ${spring.version} 34 | 35 | 36 | org.springframework 37 | spring-tx 38 | ${spring.version} 39 | 40 | 41 | org.springframework 42 | spring-jdbc 43 | ${spring.version} 44 | 45 | 46 | org.springframework 47 | spring-aop 48 | ${spring.version} 49 | 50 | 51 | 52 | 53 | 54 | org.mybatis 55 | mybatis 56 | ${mybatis.version} 57 | 58 | 59 | 60 | 61 | org.mybatis 62 | mybatis-spring 63 | 1.2.2 64 | 65 | 66 | 67 | 68 | log4j 69 | log4j 70 | 1.2.12 71 | 72 | 73 | org.slf4j 74 | slf4j-log4j12 75 | 1.6.6 76 | 77 | 78 | org.slf4j 79 | slf4j-api 80 | 1.6.6 81 | 82 | 83 | 84 | 85 | mysql 86 | mysql-connector-java 87 | 5.1.35 88 | 89 | 90 | 91 | 92 | commons-fileupload 93 | commons-fileupload 94 | 1.2.2 95 | 96 | 97 | commons-io 98 | commons-io 99 | 2.4 100 | 101 | 102 | org.apache.commons 103 | commons-lang3 104 | 3.4 105 | 106 | 107 | 108 | 109 | javax.servlet 110 | jstl 111 | 1.2 112 | 113 | 114 | 115 | 116 | 117 | javax.servlet 118 | javax.servlet-api 119 | 3.0.1 120 | 121 | 122 | javax.servlet.jsp 123 | javax.servlet.jsp-api 124 | 2.3.2-b01 125 | 126 | 127 | 128 | 129 | commons-dbcp 130 | commons-dbcp 131 | 1.2.2 132 | 133 | 134 | 135 | 136 | com.fasterxml.jackson.core 137 | jackson-core 138 | 2.5.0 139 | 140 | 141 | com.fasterxml.jackson.core 142 | jackson-databind 143 | 2.5.0 144 | 145 | 146 | 147 | 148 | org.aspectj 149 | aspectjweaver 150 | 1.6.12 151 | 152 | 153 | 154 | 155 | javax 156 | javaee-api 157 | 7.0 158 | 159 | 160 | 161 | 162 | 163 | net.sf.json-lib 164 | json-lib 165 | 2.2.3 166 | jdk15 167 | 168 | 169 | 170 | com.github.pagehelper 171 | pagehelper 172 | 4.1.4 173 | 174 | 175 | 176 | 177 | WebChat 178 | 179 | 180 | 181 | 182 | src/main/java 183 | 184 | **/*.properties 185 | **/*.xml 186 | 187 | false 188 | 189 | 190 | 191 | src/main/resources 192 | 193 | **/* 194 | 195 | true 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/controller/FiveChessController.java: -------------------------------------------------------------------------------- 1 | package com.ccq.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.servlet.ModelAndView; 6 | 7 | /** 8 | * @author ccq 9 | * @Description 10 | * @date 2017/12/16 22:59 11 | */ 12 | @Controller 13 | public class FiveChessController { 14 | 15 | /** 16 | * 跳转到聊天页面 17 | * @return 18 | */ 19 | @RequestMapping("/fiveChess") 20 | public ModelAndView getFiveChess(){ 21 | ModelAndView mv = new ModelAndView("five-chess"); 22 | return mv; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/controller/LogController.java: -------------------------------------------------------------------------------- 1 | package com.ccq.controller; 2 | 3 | import com.ccq.pojo.Log; 4 | import com.ccq.service.LogService; 5 | import com.ccq.utils.PageBean; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestParam; 11 | import org.springframework.web.servlet.ModelAndView; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * @author ccq 17 | * @Description 18 | * @date 2017/12/3 16:51 19 | */ 20 | @Controller 21 | @RequestMapping("") 22 | public class LogController { 23 | 24 | @Autowired 25 | private LogService logService; 26 | 27 | @RequestMapping("/{userid}/log") 28 | public ModelAndView selectAll(@PathVariable("userid") String userid, @RequestParam(defaultValue = "1") int page){ 29 | int pageSize = 5; 30 | ModelAndView view = new ModelAndView("log"); 31 | PageBean pageBean = logService.selectLogByUserid(userid, page, pageSize); 32 | 33 | view.addObject("list",pageBean.getList()); 34 | view.addObject("count",pageBean.getTotal()); 35 | 36 | return view; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.ccq.controller; 2 | 3 | import com.ccq.pojo.Log; 4 | import com.ccq.pojo.User; 5 | import com.ccq.service.LogService; 6 | import com.ccq.service.UserService; 7 | import com.ccq.utils.CommonDate; 8 | import com.ccq.utils.LogUtil; 9 | import com.ccq.utils.NetUtil; 10 | import com.ccq.utils.WordDefined; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RequestMethod; 15 | import org.springframework.web.servlet.mvc.support.RedirectAttributes; 16 | 17 | import javax.servlet.http.HttpServletRequest; 18 | import javax.servlet.http.HttpSession; 19 | 20 | /** 21 | * @author ccq 22 | * @Description 用户登录和注销 23 | * @date 2017/11/26 14:24 24 | */ 25 | @Controller 26 | @RequestMapping("/user") 27 | public class LoginController { 28 | 29 | @Autowired 30 | private UserService userService; 31 | 32 | @Autowired 33 | private LogService logService; 34 | 35 | /** 36 | * 跳转登录页面 37 | * @return 38 | */ 39 | @RequestMapping(value = "/login", method = RequestMethod.GET) 40 | public String login() { 41 | return "login"; 42 | } 43 | 44 | /** 45 | * 用户登录 46 | * @param userid 47 | * @param password 48 | * @param session 49 | * @param attributes 50 | * @param request 51 | * @return 52 | */ 53 | @RequestMapping(value = "login", method = RequestMethod.POST) 54 | public String login(String userid, String password, HttpSession session, RedirectAttributes attributes,HttpServletRequest request) { 55 | User user = userService.getUserById(userid); 56 | if(user == null){ 57 | attributes.addFlashAttribute("error",WordDefined.LOGIN_USERID_ERROR); 58 | return "redirect:/user/login"; 59 | }else { 60 | if(!user.getPassword().equals(password)){ 61 | attributes.addFlashAttribute("error", WordDefined.LOGIN_PASSWORD_ERROR); 62 | return "redirect:/user/login"; 63 | }else if(user.getStatus() != 1){ 64 | attributes.addFlashAttribute("error", WordDefined.LOGIN_USERID_DISABLED); 65 | return "redirect:/user/login"; 66 | } else{ 67 | Log log = LogUtil.setLog(userid,CommonDate.getTime24(),WordDefined.LOG_TYPE_ADD,WordDefined.LOG_DETAIL_USER_LOGIN,NetUtil.getIpAddress(request)); 68 | logService.insertLog(log); 69 | session.setAttribute("userid", userid); 70 | session.setAttribute("user", user); 71 | session.setAttribute("login_status",true); 72 | user.setLasttime(CommonDate.getTime24()); 73 | userService.updateUser(user); 74 | attributes.addFlashAttribute("message", WordDefined.LOGIN_SUCCESS); 75 | return "redirect:/chat"; 76 | } 77 | } 78 | } 79 | 80 | /** 81 | * 用户退出 82 | * @param session 83 | * @param attributes 84 | * @return 85 | */ 86 | @RequestMapping("/logout") 87 | public String logout(HttpSession session,RedirectAttributes attributes){ 88 | session.removeAttribute("userid"); 89 | session.removeAttribute("login_status"); 90 | attributes.addFlashAttribute("message",WordDefined.LOGOUT_SUCCESS); 91 | return "redirect:/user/login"; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/controller/SystemController.java: -------------------------------------------------------------------------------- 1 | package com.ccq.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * 8 | * @author ccq 9 | * @Description 10 | * @date 2017/12/17 15:36 11 | */ 12 | @Controller 13 | public class SystemController { 14 | 15 | @RequestMapping(value = "") 16 | public String index() { 17 | return "redirect:/user/login"; 18 | } 19 | 20 | @RequestMapping(value = "/about") 21 | public String about() { 22 | return "about"; 23 | } 24 | 25 | @RequestMapping(value = "/help") 26 | public String help() { 27 | return "help"; 28 | } 29 | 30 | @RequestMapping(value = "/system") 31 | public String system() { 32 | return "system-setting"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.ccq.controller; 2 | 3 | import com.ccq.pojo.Log; 4 | import com.ccq.pojo.User; 5 | import com.ccq.service.LogService; 6 | import com.ccq.service.UserService; 7 | import com.ccq.utils.CommonDate; 8 | import com.ccq.utils.LogUtil; 9 | import com.ccq.utils.NetUtil; 10 | import com.ccq.utils.WordDefined; 11 | import net.sf.json.JSONObject; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Controller; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.web.bind.annotation.ResponseBody; 18 | import org.springframework.web.multipart.MultipartFile; 19 | import org.springframework.web.servlet.ModelAndView; 20 | import org.springframework.web.servlet.mvc.support.RedirectAttributes; 21 | import sun.misc.BASE64Decoder; 22 | 23 | import javax.servlet.http.HttpServletRequest; 24 | import javax.servlet.http.HttpServletResponse; 25 | import javax.servlet.http.HttpSession; 26 | import java.io.File; 27 | import java.io.FileOutputStream; 28 | import java.io.IOException; 29 | import java.util.UUID; 30 | 31 | /** 32 | * @author ccq 33 | * @Description 34 | * @date 2017/11/28 22:30 35 | */ 36 | @Controller 37 | public class UserController { 38 | 39 | @Autowired 40 | private UserService userService; 41 | 42 | @Autowired 43 | private LogService logService; 44 | 45 | /** 46 | * 跳转到聊天页面 47 | * @return 48 | */ 49 | @RequestMapping("/chat") 50 | public ModelAndView getIndex(){ 51 | ModelAndView mv = new ModelAndView("index"); 52 | return mv; 53 | } 54 | 55 | /** 56 | * 获取个人头像路径 57 | * @param userid 58 | * @param request 59 | * @param response 60 | * @return 61 | */ 62 | @RequestMapping("/{userid}/head") 63 | @ResponseBody 64 | public User head(@PathVariable("userid") String userid, HttpServletRequest request, HttpServletResponse response){ 65 | User user = userService.getUserById(userid); 66 | return user; 67 | } 68 | 69 | /** 70 | * 跳转到个人信息页面 71 | * @param userid 72 | * @return 73 | */ 74 | @RequestMapping(value = "/{userid}", method = RequestMethod.GET) 75 | public ModelAndView toInformation(@PathVariable("userid") String userid){ 76 | ModelAndView view = new ModelAndView("information"); 77 | User user = userService.getUserById(userid); 78 | view.addObject("user",user); 79 | return view; 80 | } 81 | 82 | /** 83 | * 显示个人信息编辑页面 84 | * @param userid 85 | * @return 86 | */ 87 | @RequestMapping(value = "{userid}/config") 88 | public ModelAndView setting(@PathVariable("userid") String userid){ 89 | ModelAndView view = new ModelAndView("info-setting"); 90 | User user = userService.getUserById(userid); 91 | view.addObject("user", user); 92 | return view; 93 | } 94 | 95 | /** 96 | * 更新用户个人信息 97 | * @param userid 98 | * @param user 99 | * @param request 100 | * @return 101 | */ 102 | @RequestMapping(value = "{userid}/update", method = RequestMethod.POST) 103 | public String updateUser(@PathVariable("userid") String userid, HttpSession session, User user, RedirectAttributes attributes, HttpServletRequest request){ 104 | int flag = userService.updateUser(user); 105 | if(flag > 0){ 106 | user = userService.getUserById(userid); 107 | session.setAttribute("user", user); 108 | Log log = LogUtil.setLog(userid, CommonDate.getTime24(), WordDefined.LOG_TYPE_UPDATE,WordDefined.LOG_DETAIL_UPDATE_PROFILE, NetUtil.getIpAddress(request)); 109 | logService.insertLog(log); 110 | attributes.addFlashAttribute("message", "["+userid+"]资料更新成功!"); 111 | }else{ 112 | attributes.addFlashAttribute("error", "["+userid+"]资料更新失败!"); 113 | } 114 | return "redirect:/{userid}/config"; 115 | } 116 | 117 | /** 118 | * 修改密码 119 | * @param userid 120 | * @param oldpass 121 | * @param newpass 122 | * @param attributes 123 | * @param request 124 | * @return 125 | */ 126 | @RequestMapping(value = "{userid}/pass", method = RequestMethod.POST) 127 | public String updateUserPassword(@PathVariable("userid") String userid,String oldpass, String newpass, RedirectAttributes attributes,HttpServletRequest request){ 128 | User user = userService.getUserById(userid); 129 | if(oldpass.equals(user.getPassword())){ 130 | user.setPassword(newpass); 131 | int flag = userService.updateUser(user); 132 | if(flag > 0){ 133 | Log log = LogUtil.setLog(userid, CommonDate.getTime24(), WordDefined.LOG_TYPE_UPDATE,WordDefined.LOG_DETAIL_UPDATE_PASSWORD, NetUtil.getIpAddress(request)); 134 | logService.insertLog(log); 135 | attributes.addFlashAttribute("message", "["+userid+"]密码更新成功!"); 136 | }else{ 137 | attributes.addFlashAttribute("error", "["+userid+"]密码更新失败!"); 138 | } 139 | }else{ 140 | attributes.addFlashAttribute("error", "原密码错误!"); 141 | } 142 | return "redirect:/{userid}/config"; 143 | } 144 | 145 | @RequestMapping(value = "{userid}/upload", method = RequestMethod.POST,produces = "application/json; charset=utf-8") 146 | @ResponseBody 147 | public String updateUserPassword(@PathVariable("userid") String userid,String image,HttpServletRequest request){ 148 | 149 | JSONObject responseJson = new JSONObject(); 150 | String filePath = "I:\\IDEA2017-02\\img\\"; 151 | String PicName= UUID.randomUUID().toString()+".png"; 152 | 153 | String header ="data:image"; 154 | String[] imageArr=image.split(","); 155 | if(imageArr[0].contains(header)) {//是img的 156 | 157 | // 去掉头部 158 | image=imageArr[1]; 159 | // 修改图片 160 | BASE64Decoder decoder = new BASE64Decoder(); 161 | try { 162 | byte[] decodedBytes = decoder.decodeBuffer(image); // 将字符串格式的image转为二进制流(biye[])的decodedBytes 163 | String imgFilePath = filePath + PicName; //指定图片要存放的位 164 | File targetFile = new File(filePath); 165 | if(!targetFile.exists()){ 166 | targetFile.mkdirs(); 167 | } 168 | FileOutputStream out = new FileOutputStream(imgFilePath); //新建一个文件输出器,并为它指定输出位置imgFilePath 169 | out.write(decodedBytes); //利用文件输出器将二进制格式decodedBytes输出 170 | out.close(); 171 | // 修改图片 172 | User user = userService.getUserById(userid); 173 | user.setProfilehead(PicName); 174 | int flag = userService.updateUser(user); 175 | if(flag > 0){ 176 | Log log = LogUtil.setLog(userid, CommonDate.getTime24(), WordDefined.LOG_TYPE_UPDATE,WordDefined.LOG_DETAIL_UPDATE_PROFILEHEAD, NetUtil.getIpAddress(request)); 177 | logService.insertLog(log); 178 | }else{ 179 | responseJson.put("result","error"); 180 | responseJson.put("msg","上传失败!"); 181 | } 182 | } catch (IOException e) { 183 | e.printStackTrace(); 184 | } 185 | } 186 | 187 | responseJson.put("result","ok"); 188 | responseJson.put("msg","上传成功!"); 189 | responseJson.put("fileUrl","/pic/" + PicName); 190 | return responseJson.toString(); 191 | } 192 | 193 | } 194 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/interceptor/LoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.ccq.interceptor; 2 | 3 | import org.springframework.web.servlet.ModelAndView; 4 | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import javax.servlet.http.HttpSession; 9 | import java.util.List; 10 | 11 | /** 12 | * NAME : EmailSystem/com.amayadream.interceptor 13 | * Author : Amayadream 14 | * Date : 2015.10.06 17:33 15 | * TODO : 16 | */ 17 | public class LoginInterceptor extends HandlerInterceptorAdapter { 18 | 19 | private List IGNORE_URI; 20 | 21 | @Override 22 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 23 | //获取URI后缀 24 | /* String requestUri = request.getServletPath(); 25 | 26 | if(requestUri.equalsIgnoreCase("/")) return true; 27 | 28 | //过滤不需要拦截的地址 29 | for (String uri : IGNORE_URI) { 30 | if (requestUri.startsWith(uri)) { 31 | return true; 32 | } 33 | } 34 | HttpSession session = request.getSession(); 35 | if(session != null && session.getAttribute("login_status") != null){ 36 | return true; 37 | }else{ 38 | response.sendRedirect("user/login?timeout=true"); 39 | return false; 40 | }*/ 41 | return true; 42 | } 43 | 44 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { 45 | super.postHandle(request, response, handler, modelAndView); 46 | } 47 | 48 | public List getIGNORE_URI() { 49 | return IGNORE_URI; 50 | } 51 | 52 | public void setIGNORE_URI(List IGNORE_URI) { 53 | this.IGNORE_URI = IGNORE_URI; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/mapper/LogMapper.java: -------------------------------------------------------------------------------- 1 | package com.ccq.mapper; 2 | 3 | import com.ccq.pojo.Log; 4 | import com.ccq.pojo.LogExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface LogMapper { 10 | int countByExample(LogExample example); 11 | 12 | int deleteByExample(LogExample example); 13 | 14 | int deleteByPrimaryKey(Integer id); 15 | 16 | int insert(Log record); 17 | 18 | int insertSelective(Log record); 19 | 20 | List selectByExample(LogExample example); 21 | 22 | Log selectByPrimaryKey(Integer id); 23 | 24 | int updateByExampleSelective(@Param("record") Log record, @Param("example") LogExample example); 25 | 26 | int updateByExample(@Param("record") Log record, @Param("example") LogExample example); 27 | 28 | int updateByPrimaryKeySelective(Log record); 29 | 30 | int updateByPrimaryKey(Log record); 31 | } -------------------------------------------------------------------------------- /src/main/java/com/ccq/mapper/LogMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | and ${criterion.condition} 21 | 22 | 23 | and ${criterion.condition} #{criterion.value} 24 | 25 | 26 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 27 | 28 | 29 | and ${criterion.condition} 30 | 31 | #{listItem} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | and ${criterion.condition} 50 | 51 | 52 | and ${criterion.condition} #{criterion.value} 53 | 54 | 55 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 56 | 57 | 58 | and ${criterion.condition} 59 | 60 | #{listItem} 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | id, userid, time, type, detail, ip 72 | 73 | 87 | 93 | 94 | delete from log 95 | where id = #{id,jdbcType=INTEGER} 96 | 97 | 98 | delete from log 99 | 100 | 101 | 102 | 103 | 104 | insert into log (id, userid, time, 105 | type, detail, ip) 106 | values (#{id,jdbcType=INTEGER}, #{userid,jdbcType=VARCHAR}, #{time,jdbcType=VARCHAR}, 107 | #{type,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}) 108 | 109 | 110 | insert into log 111 | 112 | 113 | id, 114 | 115 | 116 | userid, 117 | 118 | 119 | time, 120 | 121 | 122 | type, 123 | 124 | 125 | detail, 126 | 127 | 128 | ip, 129 | 130 | 131 | 132 | 133 | #{id,jdbcType=INTEGER}, 134 | 135 | 136 | #{userid,jdbcType=VARCHAR}, 137 | 138 | 139 | #{time,jdbcType=VARCHAR}, 140 | 141 | 142 | #{type,jdbcType=VARCHAR}, 143 | 144 | 145 | #{detail,jdbcType=VARCHAR}, 146 | 147 | 148 | #{ip,jdbcType=VARCHAR}, 149 | 150 | 151 | 152 | 158 | 159 | update log 160 | 161 | 162 | id = #{record.id,jdbcType=INTEGER}, 163 | 164 | 165 | userid = #{record.userid,jdbcType=VARCHAR}, 166 | 167 | 168 | time = #{record.time,jdbcType=VARCHAR}, 169 | 170 | 171 | type = #{record.type,jdbcType=VARCHAR}, 172 | 173 | 174 | detail = #{record.detail,jdbcType=VARCHAR}, 175 | 176 | 177 | ip = #{record.ip,jdbcType=VARCHAR}, 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | update log 186 | set id = #{record.id,jdbcType=INTEGER}, 187 | userid = #{record.userid,jdbcType=VARCHAR}, 188 | time = #{record.time,jdbcType=VARCHAR}, 189 | type = #{record.type,jdbcType=VARCHAR}, 190 | detail = #{record.detail,jdbcType=VARCHAR}, 191 | ip = #{record.ip,jdbcType=VARCHAR} 192 | 193 | 194 | 195 | 196 | 197 | update log 198 | 199 | 200 | userid = #{userid,jdbcType=VARCHAR}, 201 | 202 | 203 | time = #{time,jdbcType=VARCHAR}, 204 | 205 | 206 | type = #{type,jdbcType=VARCHAR}, 207 | 208 | 209 | detail = #{detail,jdbcType=VARCHAR}, 210 | 211 | 212 | ip = #{ip,jdbcType=VARCHAR}, 213 | 214 | 215 | where id = #{id,jdbcType=INTEGER} 216 | 217 | 218 | update log 219 | set userid = #{userid,jdbcType=VARCHAR}, 220 | time = #{time,jdbcType=VARCHAR}, 221 | type = #{type,jdbcType=VARCHAR}, 222 | detail = #{detail,jdbcType=VARCHAR}, 223 | ip = #{ip,jdbcType=VARCHAR} 224 | where id = #{id,jdbcType=INTEGER} 225 | 226 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.ccq.mapper; 2 | 3 | import com.ccq.pojo.User; 4 | import com.ccq.pojo.UserExample; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface UserMapper { 10 | int countByExample(UserExample example); 11 | 12 | int deleteByExample(UserExample example); 13 | 14 | int deleteByPrimaryKey(Integer id); 15 | 16 | int insert(User record); 17 | 18 | int insertSelective(User record); 19 | 20 | List selectByExample(UserExample example); 21 | 22 | User selectByPrimaryKey(Integer id); 23 | 24 | int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example); 25 | 26 | int updateByExample(@Param("record") User record, @Param("example") UserExample example); 27 | 28 | int updateByPrimaryKeySelective(User record); 29 | 30 | int updateByPrimaryKey(User record); 31 | } -------------------------------------------------------------------------------- /src/main/java/com/ccq/pojo/Log.java: -------------------------------------------------------------------------------- 1 | package com.ccq.pojo; 2 | 3 | public class Log { 4 | private Integer id; 5 | 6 | private String userid; 7 | 8 | private String time; 9 | 10 | private String type; 11 | 12 | private String detail; 13 | 14 | private String ip; 15 | 16 | public Integer getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Integer id) { 21 | this.id = id; 22 | } 23 | 24 | public String getUserid() { 25 | return userid; 26 | } 27 | 28 | public void setUserid(String userid) { 29 | this.userid = userid == null ? null : userid.trim(); 30 | } 31 | 32 | public String getTime() { 33 | return time; 34 | } 35 | 36 | public void setTime(String time) { 37 | this.time = time == null ? null : time.trim(); 38 | } 39 | 40 | public String getType() { 41 | return type; 42 | } 43 | 44 | public void setType(String type) { 45 | this.type = type == null ? null : type.trim(); 46 | } 47 | 48 | public String getDetail() { 49 | return detail; 50 | } 51 | 52 | public void setDetail(String detail) { 53 | this.detail = detail == null ? null : detail.trim(); 54 | } 55 | 56 | public String getIp() { 57 | return ip; 58 | } 59 | 60 | public void setIp(String ip) { 61 | this.ip = ip == null ? null : ip.trim(); 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/java/com/ccq/pojo/User.java: -------------------------------------------------------------------------------- 1 | package com.ccq.pojo; 2 | 3 | public class User { 4 | private Integer id; 5 | 6 | private String userid; 7 | 8 | private String password; 9 | 10 | private String nickname; 11 | 12 | private Integer sex; 13 | 14 | private Integer age; 15 | 16 | private String profilehead; 17 | 18 | private String profile; 19 | 20 | private String firsttime; 21 | 22 | private String lasttime; 23 | 24 | private Integer status; 25 | 26 | public Integer getId() { 27 | return id; 28 | } 29 | 30 | public void setId(Integer id) { 31 | this.id = id; 32 | } 33 | 34 | public String getUserid() { 35 | return userid; 36 | } 37 | 38 | public void setUserid(String userid) { 39 | this.userid = userid == null ? null : userid.trim(); 40 | } 41 | 42 | public String getPassword() { 43 | return password; 44 | } 45 | 46 | public void setPassword(String password) { 47 | this.password = password == null ? null : password.trim(); 48 | } 49 | 50 | public String getNickname() { 51 | return nickname; 52 | } 53 | 54 | public void setNickname(String nickname) { 55 | this.nickname = nickname == null ? null : nickname.trim(); 56 | } 57 | 58 | public Integer getSex() { 59 | return sex; 60 | } 61 | 62 | public void setSex(Integer sex) { 63 | this.sex = sex; 64 | } 65 | 66 | public Integer getAge() { 67 | return age; 68 | } 69 | 70 | public void setAge(Integer age) { 71 | this.age = age; 72 | } 73 | 74 | public String getProfilehead() { 75 | return profilehead; 76 | } 77 | 78 | public void setProfilehead(String profilehead) { 79 | this.profilehead = profilehead == null ? null : profilehead.trim(); 80 | } 81 | 82 | public String getProfile() { 83 | return profile; 84 | } 85 | 86 | public void setProfile(String profile) { 87 | this.profile = profile == null ? null : profile.trim(); 88 | } 89 | 90 | public String getFirsttime() { 91 | return firsttime; 92 | } 93 | 94 | public void setFirsttime(String firsttime) { 95 | this.firsttime = firsttime == null ? null : firsttime.trim(); 96 | } 97 | 98 | public String getLasttime() { 99 | return lasttime; 100 | } 101 | 102 | public void setLasttime(String lasttime) { 103 | this.lasttime = lasttime == null ? null : lasttime.trim(); 104 | } 105 | 106 | public Integer getStatus() { 107 | return status; 108 | } 109 | 110 | public void setStatus(Integer status) { 111 | this.status = status; 112 | } 113 | } -------------------------------------------------------------------------------- /src/main/java/com/ccq/service/LogService.java: -------------------------------------------------------------------------------- 1 | package com.ccq.service; 2 | 3 | import com.ccq.pojo.Log; 4 | import com.ccq.utils.PageBean; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author ccq 10 | * @Description 11 | * @date 2017/12/3 16:19 12 | */ 13 | public interface LogService { 14 | 15 | public void insertLog(Log log); 16 | 17 | public PageBean selectLogByUserid(String userid, int page, int pageSize); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.ccq.service; 2 | 3 | import com.ccq.pojo.User; 4 | 5 | /** 6 | * @author ccq 7 | * @Description 8 | * @date 2017/11/28 22:11 9 | */ 10 | public interface UserService { 11 | 12 | public User getUserById(String userid); 13 | public int updateUser(User user); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/service/impl/LogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ccq.service.impl; 2 | 3 | import com.ccq.mapper.LogMapper; 4 | import com.ccq.pojo.Log; 5 | import com.ccq.pojo.LogExample; 6 | import com.ccq.service.LogService; 7 | import com.ccq.utils.PageBean; 8 | import com.github.pagehelper.PageHelper; 9 | import com.github.pagehelper.PageInfo; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * @author ccq 17 | * @Description 18 | * @date 2017/12/3 16:20 19 | */ 20 | @Service 21 | public class LogServiceImpl implements LogService { 22 | 23 | @Autowired 24 | private LogMapper logMapper; 25 | 26 | public void insertLog(Log log) { 27 | logMapper.insert(log); 28 | } 29 | 30 | public PageBean selectLogByUserid(String userid, int pageNum, int pageSize) { 31 | 32 | PageBean pageBean = new PageBean(); 33 | 34 | LogExample logExample = new LogExample(); 35 | logExample.createCriteria().andUseridEqualTo(userid); 36 | PageHelper.startPage(pageNum,pageSize); 37 | List logList = logMapper.selectByExample(logExample); 38 | 39 | PageInfo logPageInfo = new PageInfo(logList); 40 | 41 | pageBean.setList(logList); 42 | pageBean.setTotal(logPageInfo.getTotal()); 43 | 44 | return pageBean; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ccq.service.impl; 2 | 3 | import com.ccq.mapper.UserMapper; 4 | import com.ccq.pojo.User; 5 | import com.ccq.pojo.UserExample; 6 | import com.ccq.service.UserService; 7 | import com.sun.org.apache.xpath.internal.operations.Bool; 8 | import org.apache.commons.collections.CollectionUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.Collections; 13 | import java.util.List; 14 | 15 | /** 16 | * @author ccq 17 | * @Description 18 | * @date 2017/11/28 22:12 19 | */ 20 | @Service 21 | public class UserServiceImpl implements UserService { 22 | 23 | @Autowired 24 | private UserMapper userMapper; 25 | 26 | public User getUserById(String userId) { 27 | UserExample userExample = new UserExample(); 28 | userExample.createCriteria().andUseridEqualTo(userId); 29 | List users = userMapper.selectByExample(userExample); 30 | if (CollectionUtils.isNotEmpty(users)){ 31 | return users.get(0); 32 | } 33 | return null; 34 | } 35 | 36 | public int updateUser(User user) { 37 | int flag = userMapper.updateByPrimaryKeySelective(user); 38 | return flag; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/utils/CommonDate.java: -------------------------------------------------------------------------------- 1 | package com.ccq.utils; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Calendar; 5 | import java.util.Date; 6 | 7 | /** 8 | * @author : Amayadream 9 | * @time : 2016.02.01 16:34 10 | */ 11 | public class CommonDate { 12 | 13 | public final String year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR)); 14 | public final String month = String.valueOf(Calendar.getInstance().get(Calendar.MONTH)+1); 15 | public final String day = String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)); 16 | public final String hour_24 = String.valueOf(Calendar.getInstance().get(Calendar.HOUR_OF_DAY)); 17 | public final String hour_12 = String.valueOf(Calendar.getInstance().get(Calendar.HOUR)); 18 | public final String minute = String.valueOf(Calendar.getInstance().get(Calendar.MINUTE)); 19 | public final String second = String.valueOf(Calendar.getInstance().get(Calendar.SECOND)); 20 | public final String week_of_year = String.valueOf(Calendar.getInstance().get(Calendar.WEEK_OF_YEAR)); 21 | public final String week_of_month = String.valueOf(Calendar.getInstance().get(Calendar.WEEK_OF_MONTH)); 22 | public final String day_of_year = String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_YEAR)); 23 | public final String day_of_month = String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)); 24 | public final String day_of_week = String.valueOf(Calendar.getInstance().get(Calendar.DAY_OF_WEEK)); 25 | 26 | 27 | 28 | /** 29 | * 获取当前时间 30 | * @return 当前时间,24小时yyyy-MM-dd HH:mm:ss格式 31 | */ 32 | public static String getTime24(){ 33 | Date date = new Date(); 34 | SimpleDateFormat timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 35 | String time = timeStamp.format(date); 36 | return time; 37 | } 38 | 39 | /** 40 | * 获取当前时间的时间戳 41 | * @return Unix时间戳 42 | */ 43 | public Long getStamp(){ 44 | return System.currentTimeMillis() / 1000; 45 | } 46 | 47 | /** 48 | * 将Unix时间戳转换为日期时间 49 | * @param timeStamp Unix时间戳 50 | * @return 日期时间yyyy-MM-dd HH:mm:ss 51 | */ 52 | public String stamp2Time(long timeStamp){ 53 | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(timeStamp * 1000)); 54 | } 55 | 56 | /** 57 | * 计算年龄 58 | * @param year 出生年份 59 | * @return 年龄 60 | */ 61 | public int getAge(int year){ 62 | return Integer.parseInt(this.year) - year; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/utils/LogUtil.java: -------------------------------------------------------------------------------- 1 | package com.ccq.utils; 2 | 3 | import com.ccq.pojo.Log; 4 | 5 | /** 6 | * @author ccq 7 | * @Description 8 | * @date 2017/12/3 16:15 9 | */ 10 | public class LogUtil { 11 | 12 | public static Log setLog(String userId,String time,String type,String detail,String ip){ 13 | Log log = new Log(); 14 | log.setUserid(userId); 15 | log.setDetail(detail); 16 | log.setTime(time); 17 | log.setIp(ip); 18 | log.setType(type); 19 | return log; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/utils/NetUtil.java: -------------------------------------------------------------------------------- 1 | package com.ccq.utils; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | /** 6 | * NAME : LeaveSystem/com.amayadream.leave.util 7 | * Author : Amayadream 8 | * Date : 2015.12.29 16:22 9 | * TODO : 网络工具类 10 | */ 11 | public class NetUtil { 12 | 13 | /** 14 | * 从request中获取ip地址 15 | * 16 | * @param request 17 | * @return 18 | */ 19 | public static String getIpAddress(HttpServletRequest request) { 20 | String ip = request.getHeader("x-forwarded-for"); 21 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 22 | ip = request.getHeader("Proxy-Client-IP"); 23 | } 24 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 25 | ip = request.getHeader("WL-Proxy-Client-IP"); 26 | } 27 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 28 | ip = request.getHeader("HTTP_CLIENT_IP"); 29 | } 30 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 31 | ip = request.getHeader("HTTP_X_FORWARDED_IP"); 32 | } 33 | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { 34 | ip = request.getRemoteAddr(); 35 | } 36 | return ip; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/utils/PageBean.java: -------------------------------------------------------------------------------- 1 | package com.ccq.utils; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author ccq 7 | * @Description 8 | * @date 2017/12/3 17:07 9 | */ 10 | public class PageBean { 11 | private List list; 12 | private long total; 13 | 14 | public List getList() { 15 | return list; 16 | } 17 | 18 | public void setList(List list) { 19 | this.list = list; 20 | } 21 | 22 | public long getTotal() { 23 | return total; 24 | } 25 | 26 | public void setTotal(long total) { 27 | this.total = total; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/utils/WordDefined.java: -------------------------------------------------------------------------------- 1 | package com.ccq.utils; 2 | 3 | /** 4 | * NAME : WebChat/com.amayadream.webchat.utils 5 | * Author : Amayadream 6 | * Date : 2016.01.09 17:18 7 | * TODO : 8 | */ 9 | public class WordDefined { 10 | public static String LOGIN_USERID_ERROR = "用户名不存在!"; 11 | public static String LOGIN_PASSWORD_ERROR = "密码错误!"; 12 | public static String LOGIN_USERID_DISABLED = "账号已被禁用!"; 13 | public static String LOGIN_NO_LOGED = "未登录!"; 14 | public static String LOGIN_SUCCESS = "登录成功!"; 15 | public static String LOGOUT_SUCCESS = "注销成功!"; 16 | 17 | public static String LOG_TYPE_LOGIN = "登陆"; 18 | public static String LOG_TYPE_LOGOUT = "注销"; 19 | public static String LOG_TYPE_ADD = "新增"; 20 | public static String LOG_TYPE_UPDATE = "更新"; 21 | public static String LOG_TYPE_DELETE = "删除"; 22 | public static String LOG_TYPE_COMPLETE = "完成"; 23 | public static String LOG_TYPE_IMPORT = "导入"; 24 | public static String LOG_TYPE_EXPORT = "导出"; 25 | public static String LOG_TYPE_DEPLOY = "部署"; 26 | public static String LOG_TYPE_START = "启动"; 27 | 28 | public static String LOG_DETAIL_USER_LOGIN = "用户登陆"; 29 | public static String LOG_DETAIL_USER_LOGOUT = "用户退出"; 30 | public static String LOG_DETAIL_UPDATE_PROFILE = "更新用户资料"; 31 | public static String LOG_DETAIL_UPDATE_PROFILEHEAD = "更新用户头像"; 32 | public static String LOG_DETAIL_SYSCONFIG = "系统设置"; 33 | public static String LOG_DETAIL_UPDATE_PASSWORD = "更新密码"; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/webSocket/ChatServer.java: -------------------------------------------------------------------------------- 1 | package com.ccq.webSocket; 2 | 3 | import com.ccq.pojo.User; 4 | import com.ccq.utils.CommonDate; 5 | import net.sf.json.JSONObject; 6 | import org.apache.log4j.Logger; 7 | 8 | import javax.servlet.http.HttpSession; 9 | import javax.websocket.*; 10 | import javax.websocket.server.PathParam; 11 | import javax.websocket.server.ServerEndpoint; 12 | import java.util.Map; 13 | import java.util.concurrent.ConcurrentHashMap; 14 | 15 | /** 16 | * @author ccq 17 | * @Description webSocket服务 18 | * @date 2017/12/16 17:31 19 | */ 20 | @ServerEndpoint(value="/chatServer/{userid}", configurator = HttpSessionConfigurator.class) 21 | public class ChatServer { 22 | 23 | private static Logger logger = Logger.getLogger(ChatServer.class); 24 | private static int onlineCount = 0; // 记录连接数目 25 | // Map<用户id,用户信息> 26 | private static Map onlineUserMap = new ConcurrentHashMap(); // 在线用户 27 | 28 | /** 29 | * 连接成功调用的方法 30 | */ 31 | @OnOpen 32 | public void onOpen(@PathParam("userid") String userid , Session session, EndpointConfig config){ 33 | 34 | logger.info("[ChatServer] connection : userid = " + userid + " , sessionId = " + session.getId()); 35 | 36 | // 增加用户数量 37 | addOnlineCount(); 38 | 39 | // 获取当前用户的session 40 | HttpSession httpSession = (HttpSession) config.getUserProperties().get(HttpSession.class.getName()); 41 | User user = (User) httpSession.getAttribute("user"); // 获得当前用户信息 42 | 43 | // 将当前用户存到在线用户列表中 44 | OnlineUser onlineUser = new OnlineUser(user.getUserid(),user.getNickname(),session); 45 | onlineUserMap.put(user.getUserid(),onlineUser); 46 | 47 | // 通知所有在线用户,当前用户上线 48 | String content = "[" + CommonDate.getTime24() + " : " + user.getNickname() + "加入聊天室,当前在线人数为 " + getOnlineCount() + "位" + "]"; 49 | JSONObject msg = new JSONObject(); 50 | msg.put("content",content); 51 | String message = Message.getMessage(msg.toString(),Message.NOTICE,onlineUserMap.values()); 52 | Message.broadcast(message,onlineUserMap.values()); 53 | 54 | } 55 | 56 | /** 57 | * 连接关闭方法 58 | */ 59 | @OnClose 60 | public void onClose(@PathParam("userid") String userid,Session session,CloseReason closeReason){ 61 | 62 | logger.info("[ChatServer] close : userid = " + userid + " , sessionId = " + session.getId() + 63 | " , closeCode = " + closeReason.getCloseCode().getCode() + " , closeReason = " +closeReason.getReasonPhrase()); 64 | 65 | // 减少当前用户 66 | subOnlienCount(); 67 | 68 | // 移除的用户信息 69 | OnlineUser removeUser = onlineUserMap.remove(userid); 70 | onlineUserMap.remove(userid); 71 | 72 | // 通知所有在线用户,当前用户下线 73 | String content = "["+ CommonDate.getTime24() + " : " + removeUser.getNickname() + " 离开聊天室,当前在线人数为 " + getOnlineCount() + "位" + "]"; 74 | JSONObject msg = new JSONObject(); 75 | msg.put("content",content); 76 | if(onlineUserMap.size() > 0){ 77 | String message = Message.getMessage(msg.toString(), Message.NOTICE, onlineUserMap.values()); 78 | Message.broadcast(message,onlineUserMap.values()); 79 | }else{ 80 | logger.info("content : ["+ CommonDate.getTime24() + " : " + removeUser.getNickname() + " 离开聊天室,当前在线人数为 " + getOnlineCount() + "位" + "]"); 81 | } 82 | 83 | } 84 | 85 | /** 86 | * 接收客户端的message,判断是否有接收人而选择进行广播还是指定发送 87 | * @param data 客户端发来的消息 88 | */ 89 | @OnMessage 90 | public void onMessage(@PathParam("userid") String userid,String data){ 91 | logger.info("[ChatServer] onMessage : userid = " + userid + " , data = " + data); 92 | 93 | JSONObject messageJson = JSONObject.fromObject(data); 94 | JSONObject message = messageJson.optJSONObject("message"); 95 | String to = message.optString("to"); 96 | String from = message.optString("from"); 97 | // 将用户id转换为名称 98 | to = this.userIdCastNickName(to); 99 | 100 | OnlineUser fromUser = onlineUserMap.get(from); 101 | String sendMessage = Message.getContent(fromUser,to,message.optString("content"),message.optString("time")); 102 | String returnData = Message.getMessage(sendMessage, messageJson.optString("type"),null); 103 | 104 | if(to == null || to.equals("")){ // 进行广播 105 | Message.broadcast(returnData.toString(),onlineUserMap.values()); 106 | }else{ 107 | Message.singleSend(returnData.toString(), onlineUserMap.get(from)); // 发送给自己 108 | String[] useridList = message.optString("to").split(","); 109 | for(String id : useridList){ 110 | if(!id.equals(from)){ 111 | Message.singleSend(returnData.toString(), onlineUserMap.get(id)); // 分别发送给指定的用户 112 | } 113 | } 114 | } 115 | } 116 | 117 | /** 118 | * 发生错误 119 | * @param throwable 120 | */ 121 | @OnError 122 | public void onError(@PathParam("userid") String userid,Session session,Throwable throwable){ 123 | logger.info("[ChatServer] close : userid = " + userid + " , sessionId = " + session.getId() +" , throwable = " + throwable.getMessage() ); 124 | } 125 | 126 | 127 | public static int getOnlineCount() { 128 | return onlineCount; 129 | } 130 | 131 | public synchronized void addOnlineCount(){ 132 | onlineCount++; 133 | } 134 | 135 | public synchronized void subOnlienCount(){ 136 | onlineCount--; 137 | } 138 | 139 | /** 140 | * 将用户id转换为名称 141 | * @param userIds 142 | * @return 143 | */ 144 | private String userIdCastNickName(String userIds){ 145 | String niceNames = ""; 146 | if(userIds != null && !userIds.equals("")){ 147 | String[] useridList = userIds.split(","); 148 | String toName = ""; 149 | for (String id : useridList){ 150 | toName = toName + onlineUserMap.get(id).getNickname() + ","; 151 | } 152 | niceNames = toName.substring(0,toName.length() - 1); 153 | } 154 | return niceNames; 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/webSocket/HttpSessionConfigurator.java: -------------------------------------------------------------------------------- 1 | package com.ccq.webSocket; 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 | 8 | /** 9 | * @author ccq 10 | * @Description 11 | * @date 2017/11/26 15:43 12 | */ 13 | public class HttpSessionConfigurator extends ServerEndpointConfig.Configurator{ 14 | 15 | @Override 16 | public void modifyHandshake(ServerEndpointConfig config, HandshakeRequest request, HandshakeResponse response) { 17 | HttpSession session = (HttpSession) request.getHttpSession(); 18 | config.getUserProperties().put(HttpSession.class.getName(), session); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/webSocket/JsonConfigUtils.java: -------------------------------------------------------------------------------- 1 | package com.ccq.webSocket; 2 | 3 | import net.sf.json.JsonConfig; 4 | import net.sf.json.util.PropertyFilter; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author ccq 10 | * @Description JSONObject转化json过滤属性方法 11 | * @date 2017/12/16 19:16 12 | */ 13 | public class JsonConfigUtils { 14 | 15 | 16 | public static JsonConfig getJsonConfig(final List propertys){ 17 | 18 | JsonConfig jsonConfig = new JsonConfig(); 19 | jsonConfig.setJsonPropertyFilter(new PropertyFilter() { 20 | public boolean apply(Object object, String property, Object value) { 21 | if(object instanceof OnlineUser ){ 22 | if (propertys.contains(property)){ 23 | //返回true属性不会被序列化 24 | return true; 25 | } 26 | } 27 | return false; 28 | } 29 | }); 30 | return jsonConfig; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/webSocket/Message.java: -------------------------------------------------------------------------------- 1 | package com.ccq.webSocket; 2 | 3 | import net.sf.json.JSONArray; 4 | import net.sf.json.JSONObject; 5 | import org.apache.commons.collections.CollectionUtils; 6 | import org.apache.log4j.Logger; 7 | 8 | import javax.websocket.Session; 9 | import java.io.IOException; 10 | import java.util.ArrayList; 11 | import java.util.Collection; 12 | import java.util.List; 13 | 14 | /** 15 | * @author ccq 16 | * @Description 消息类 17 | * @date 2017/12/16 19:08 18 | */ 19 | public class Message { 20 | 21 | private static Logger logger = Logger.getLogger(Message.class); 22 | 23 | /** 24 | * 消息类型 25 | */ 26 | public static String NOTICE = "notice"; //通知 27 | public static String MESSAGE = "message"; //消息 28 | 29 | /** 30 | * 组装信息返回给前台 31 | * @param message 交互信息 32 | * @param type 信息类型 33 | * @param userList 在线列表 34 | * @return 35 | * 36 | * "massage" : { 37 | * "from" : "xxx", 38 | * "to" : "xxx", 39 | * "content" : "xxx", 40 | * "time" : "xxxx.xx.xx" 41 | * }, 42 | * "type" : {notice|message}, 43 | * "list" : {[xx],[xx],[xx]} 44 | */ 45 | public static String getMessage(String message,String type,Collection userList){ 46 | JSONObject msg = new JSONObject(); 47 | msg.put("message",message); 48 | msg.put("type", type); 49 | 50 | if(CollectionUtils.isNotEmpty(userList)){ 51 | List propertys = new ArrayList(); 52 | propertys.add("session"); 53 | JSONArray userListArray = JSONArray.fromObject(userList,JsonConfigUtils.getJsonConfig(propertys)); 54 | msg.put("list", userListArray); 55 | } 56 | return msg.toString(); 57 | } 58 | 59 | /** 60 | * 消息内容 61 | * @param fromUser 62 | * @param to 63 | * @param content 64 | * @param time 65 | * @return 66 | * { 67 | * "from" : "xxx", 68 | * "to" : "xxx", 69 | * "content" : "xxx", 70 | * "time" : "xxxx.xx.xx" 71 | * } 72 | */ 73 | public static String getContent(OnlineUser fromUser,String to,String content,String time){ 74 | JSONObject contentJson = new JSONObject(); 75 | 76 | // 转化为json串时去掉session,用户session不能被序列化 77 | List propertys = new ArrayList(); 78 | propertys.add("session"); 79 | contentJson.put("from",JSONObject.fromObject(fromUser,JsonConfigUtils.getJsonConfig(propertys))); 80 | 81 | contentJson.put("to",to); 82 | contentJson.put("content",content); 83 | contentJson.put("time",time); 84 | return contentJson.toString(); 85 | } 86 | 87 | /** 88 | * 广播消息 89 | * @param message 消息 90 | * @param onlineUsers 在线用户 91 | */ 92 | public static void broadcast(String message,Collection onlineUsers){ 93 | /***************************在线用户***************************/ 94 | StringBuffer userStr = new StringBuffer(); 95 | for(OnlineUser user : onlineUsers){ 96 | userStr.append(user.getNickname() + ","); 97 | } 98 | userStr.deleteCharAt(userStr.length()-1); 99 | logger.info("[broadcast] message = " + message + ", onlineUsers = " + userStr.toString()); 100 | /***************************在线用户***************************/ 101 | for(OnlineUser user : onlineUsers){ 102 | try { 103 | user.getSession().getBasicRemote().sendText(message); 104 | } catch (IOException e) { 105 | e.printStackTrace(); 106 | logger.info("消息发送失败!" + e.getMessage()); 107 | continue; 108 | } 109 | } 110 | } 111 | 112 | /** 113 | * 对特定用户发送消息 114 | * @param message 115 | * @param onlineUser 116 | */ 117 | public static void singleSend(String message, OnlineUser onlineUser){ 118 | logger.info("[singleSend] message = " + message + ", toUser = " + onlineUser.getNickname()); 119 | try { 120 | onlineUser.getSession().getBasicRemote().sendText(message); 121 | } catch (IOException e) { 122 | e.printStackTrace(); 123 | logger.info("消息发送失败!" + e.getMessage()); 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/main/java/com/ccq/webSocket/OnlineUser.java: -------------------------------------------------------------------------------- 1 | package com.ccq.webSocket; 2 | 3 | import javax.websocket.Session; 4 | 5 | /** 6 | * @author ccq 7 | * @Description 8 | * @date 2017/12/10 22:44 9 | */ 10 | public class OnlineUser { 11 | private String userid; 12 | private String nickname; 13 | private Session session; 14 | 15 | public OnlineUser() { 16 | } 17 | 18 | public OnlineUser(String userid, String nickname, Session session) { 19 | this.userid = userid; 20 | this.nickname = nickname; 21 | this.session = session; 22 | } 23 | 24 | public String getUserid() { 25 | return userid; 26 | } 27 | 28 | public void setUserid(String userid) { 29 | this.userid = userid == null ? null : userid.trim(); 30 | } 31 | public String getNickname() { 32 | return nickname; 33 | } 34 | 35 | public void setNickname(String nickname) { 36 | this.nickname = nickname == null ? null : nickname.trim(); 37 | } 38 | 39 | public Session getSession() { 40 | return session; 41 | } 42 | 43 | public void setSession(Session session) { 44 | this.session = session; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/resources/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://127.0.0.1:3306/webchat 3 | jdbc.username=root 4 | jdbc.password=123456 5 | -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration\uff0c\u5efa\u8bae\u5f00\u53d1\u73af\u5883\u4e2d\u8981\u7528debug 2 | log4j.rootLogger=info,stdout 3 | # Console output... 4 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 5 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n 7 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/SqlMapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/resources/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/resources/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/resources/spring/spring-tx.xml: -------------------------------------------------------------------------------- 1 | 2 | 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 | -------------------------------------------------------------------------------- /src/main/resources/spring/springmvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | /user/login 39 | /user/logout 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 5242880 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/main/resources/webchat.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : mysql 5 | Source Server Version : 50173 6 | Source Host : 127.0.0.1:3306 7 | Source Database : webchat 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50173 11 | File Encoding : 65001 12 | 13 | Date: 2017-12-27 23:26:12 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for log 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `log`; 22 | CREATE TABLE `log` ( 23 | `id` int(11) NOT NULL AUTO_INCREMENT, 24 | `userid` varchar(255) DEFAULT NULL, 25 | `time` varchar(255) DEFAULT NULL, 26 | `type` varchar(255) DEFAULT NULL, 27 | `detail` varchar(255) DEFAULT NULL, 28 | `ip` varchar(255) DEFAULT NULL, 29 | PRIMARY KEY (`id`) 30 | ) ENGINE=InnoDB AUTO_INCREMENT=103 DEFAULT CHARSET=utf8; 31 | 32 | -- ---------------------------- 33 | -- Table structure for user 34 | -- ---------------------------- 35 | DROP TABLE IF EXISTS `user`; 36 | CREATE TABLE `user` ( 37 | `id` int(11) NOT NULL AUTO_INCREMENT, 38 | `userid` varchar(255) DEFAULT NULL, 39 | `password` varchar(255) DEFAULT NULL, 40 | `nickname` varchar(255) DEFAULT NULL, 41 | `sex` int(11) DEFAULT NULL COMMENT '1:男,0:女', 42 | `age` int(11) DEFAULT NULL, 43 | `profilehead` varchar(255) DEFAULT NULL COMMENT '个人头像', 44 | `profile` varchar(255) DEFAULT NULL COMMENT '个人简介', 45 | `firsttime` varchar(255) DEFAULT NULL COMMENT '注册时间', 46 | `lasttime` varchar(255) DEFAULT NULL COMMENT '最后登录时间', 47 | `status` int(11) DEFAULT NULL COMMENT '账号状态 1:正常,0禁用', 48 | PRIMARY KEY (`id`) 49 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; 50 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/view/about.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | 4 | 5 | 6 | WebChat | 关于 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 |
16 |
17 |
关于 / about
18 |
19 |
20 | 24 |
25 |
26 |
27 |
28 |

WebChat主要使用SSM框架,即Spring + Spring MVC + Mybatis

29 |

通讯使用的是websocket

30 |

数据库使用的是MySql

31 |

前端框架采用的是Amaze UI,弹窗控件和分页控件采用的是LayerLaypage

32 |
33 |
34 | 35 |
36 |
37 |
38 |

原博主代码:https://github.com/Amayadream/WebChat

39 |

小弟的代码:https://github.com/chengchuanqiang/WebChat

40 |
41 |
42 |
43 |
44 | 45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/view/help.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | 4 | 5 | 6 | WebChat | 帮助 7 | 8 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 |
21 |
22 |
帮助 / help
23 |
24 |
25 | 28 |
29 |
30 | 如何使用 31 |
32 |
33 |
34 | 35 |
36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/view/include/commonfile.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | <%-- 上传图片插件 --%> 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/view/include/footer.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/view/include/header.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 3 | 4 |
5 |
6 | WebChat 网页聊天室 7 |
8 | 9 |
10 | 22 |
23 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/view/include/sidebar.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | 4 | 5 |
6 |
7 | 23 |
24 |
25 |

Welcome

26 |

欢迎使用WebChat聊天室~

27 |
28 |
29 |
30 |
31 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/view/information.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | 4 | 5 | 6 | WebChat | 个人信息 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 |
16 |
17 |
个人信息 / info
18 |
19 |
20 | 23 |
24 |
25 |
26 | 27 |
昵称:
28 |
29 | ${user.nickname} 30 |
31 |
32 | ${user.nickname} 33 |
34 | 35 |
性别:
36 |
37 | 未知 38 | 39 | 40 | 41 | 保密 42 | 43 |
44 |
年龄:
45 |
46 | 未知 47 | ${user.age} 48 |
49 |
简介:
50 |
51 | 52 | 这个人很懒,什么都没有留下! 53 | 54 | 55 | ${user.profile} 56 | 57 |
58 |
注册时间
59 |
${user.firsttime}
60 |
最后登录
61 |
${user.lasttime}
62 |
63 |
64 |
65 |
66 | 67 |
68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/view/log.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | 4 | 5 | 6 | WebChat | 系统日志 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 |
16 |
17 |
系统日志 / log
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 |
#用户名时间类型详情IP
${status.index + 1}${log.userid}${log.time}${log.type}${log.detail}${log.ip}
44 |
45 |
46 |
47 | 48 |
49 | 50 | 51 | 52 | 53 | 54 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/view/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | <%String path = request.getContextPath();%> 4 | 5 | 6 | 7 | WebChat | 登陆 8 | 9 | 10 | 11 | 12 | 13 | 14 |

WebChat

15 | 37 | 38 | 106 | 107 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | WebChat 8 | 9 | 10 | contextConfigLocation 11 | classpath:spring/spring-*.xml 12 | 13 | 14 | org.springframework.web.context.ContextLoaderListener 15 | 16 | 17 | 18 | 19 | springmvc 20 | org.springframework.web.servlet.DispatcherServlet 21 | 22 | 23 | contextConfigLocation 24 | 25 | classpath:spring/springmvc.xml 26 | 27 | 1 28 | 29 | 30 | springmvc 31 | 33 | / 34 | 35 | 36 | 37 | CharacterEncodingFilter 38 | org.springframework.web.filter.CharacterEncodingFilter 39 | 40 | encoding 41 | utf-8 42 | 43 | 44 | 45 | CharacterEncodingFilter 46 | /* 47 | 48 | 49 | index.jsp 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | <% 5 | response.sendRedirect("user/login"); 6 | %> 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/css/admin.css: -------------------------------------------------------------------------------- 1 | /** 2 | * admin.css 3 | */ 4 | 5 | ul { 6 | margin-top: 0; 7 | } 8 | 9 | .admin-icon-yellow { 10 | color: #ffbe40; 11 | } 12 | 13 | .admin-header { 14 | font-size: 1.4rem; 15 | margin-bottom: 0; 16 | } 17 | 18 | .admin-header-list a:hover :after { 19 | content: none; 20 | } 21 | 22 | .admin-main { 23 | background: #f3f3f3; 24 | } 25 | 26 | .admin-menu { 27 | position: fixed; 28 | z-index: 10; 29 | bottom: 30px; 30 | right: 20px; 31 | } 32 | 33 | .admin-sidebar { 34 | width: 260px; 35 | min-height: 100%; 36 | float: left; 37 | border-right: 1px solid #cecece; 38 | } 39 | 40 | .admin-sidebar-list { 41 | margin-bottom: 0; 42 | } 43 | 44 | .admin-sidebar-list li a { 45 | color: #5c5c5c; 46 | padding-left: 24px; 47 | } 48 | 49 | .admin-sidebar-list li:first-child { 50 | border-top: none; 51 | } 52 | 53 | .admin-sidebar-sub { 54 | margin-top: 0; 55 | margin-bottom: 0; 56 | box-shadow: 0 16px 8px -15px #e2e2e2 inset; 57 | background: #ececec; 58 | padding-left: 24px; 59 | } 60 | 61 | .admin-sidebar-sub li:first-child { 62 | border-top: 1px solid #dedede; 63 | } 64 | 65 | .admin-sidebar-panel { 66 | margin: 10px; 67 | } 68 | 69 | .admin-content { 70 | width: auto; 71 | overflow: hidden; 72 | height: 100%; 73 | background: #fff; 74 | } 75 | 76 | .admin-content-list { 77 | border: 1px solid #e9ecf1; 78 | margin-top: 0; 79 | } 80 | 81 | .admin-content-list li { 82 | border: 1px solid #e9ecf1; 83 | border-width: 0 1px; 84 | margin-left: -1px; 85 | } 86 | 87 | .admin-content-list li:first-child { 88 | border-left: none; 89 | } 90 | 91 | .admin-content-list li:last-child { 92 | border-right: none; 93 | } 94 | 95 | .admin-content-table a { 96 | color: #535353; 97 | } 98 | .admin-content-file { 99 | margin-bottom: 0; 100 | color: #666; 101 | } 102 | 103 | .admin-content-file p { 104 | margin: 0 0 5px 0; 105 | font-size: 1.4rem; 106 | } 107 | 108 | .admin-content-file li { 109 | padding: 10px 0; 110 | } 111 | 112 | .admin-content-file li:first-child { 113 | border-top: none; 114 | } 115 | 116 | .admin-content-file li:last-child { 117 | border-bottom: none; 118 | } 119 | 120 | .admin-content-file li .am-progress { 121 | margin-bottom: 4px; 122 | } 123 | 124 | .admin-content-file li .am-progress-bar { 125 | line-height: 14px; 126 | } 127 | 128 | .admin-content-task { 129 | margin-bottom: 0; 130 | } 131 | 132 | .admin-content-task li { 133 | padding: 5px 0; 134 | border-color: #eee; 135 | } 136 | 137 | .admin-content-task li:first-child { 138 | border-top: none; 139 | } 140 | 141 | .admin-content-task li:last-child { 142 | border-bottom: none; 143 | } 144 | 145 | .admin-task-meta { 146 | font-size: 1.2rem; 147 | color: #999; 148 | } 149 | 150 | .admin-task-bd { 151 | font-size: 1.4rem; 152 | margin-bottom: 5px; 153 | } 154 | 155 | .admin-content-comment { 156 | margin-bottom: 0; 157 | } 158 | 159 | .admin-content-comment .am-comment-bd { 160 | font-size: 1.4rem; 161 | } 162 | 163 | .admin-content-pagination { 164 | margin-bottom: 0; 165 | } 166 | .admin-content-pagination li a { 167 | padding: 4px 8px; 168 | } 169 | 170 | @media only screen and (min-width: 641px) { 171 | .admin-sidebar { 172 | display: block; 173 | position: static; 174 | background: none; 175 | } 176 | 177 | .admin-offcanvas-bar { 178 | position: static; 179 | width: auto; 180 | background: none; 181 | -webkit-transform: translate3d(0, 0, 0); 182 | -ms-transform: translate3d(0, 0, 0); 183 | transform: translate3d(0, 0, 0); 184 | } 185 | .admin-offcanvas-bar:after { 186 | content: none; 187 | } 188 | } 189 | 190 | @media only screen and (max-width: 640px) { 191 | .admin-sidebar { 192 | width: inherit; 193 | } 194 | 195 | .admin-offcanvas-bar { 196 | background: #f3f3f3; 197 | } 198 | 199 | .admin-offcanvas-bar:after { 200 | background: #BABABA; 201 | } 202 | 203 | .admin-sidebar-list a:hover, .admin-sidebar-list a:active{ 204 | -webkit-transition: background-color .3s ease; 205 | -moz-transition: background-color .3s ease; 206 | -ms-transition: background-color .3s ease; 207 | -o-transition: background-color .3s ease; 208 | transition: background-color .3s ease; 209 | background: #E4E4E4; 210 | } 211 | 212 | .admin-content-list li { 213 | padding: 10px; 214 | border-width: 1px 0; 215 | margin-top: -1px; 216 | } 217 | 218 | .admin-content-list li:first-child { 219 | border-top: none; 220 | } 221 | 222 | .admin-content-list li:last-child { 223 | border-bottom: none; 224 | } 225 | 226 | .admin-form-text { 227 | text-align: left !important; 228 | } 229 | 230 | } 231 | 232 | /* 233 | * user.html css 234 | */ 235 | .user-info { 236 | margin-bottom: 15px; 237 | } 238 | 239 | .user-info .am-progress { 240 | margin-bottom: 4px; 241 | } 242 | 243 | .user-info p { 244 | margin: 5px; 245 | } 246 | 247 | .user-info-order { 248 | font-size: 1.4rem; 249 | } 250 | 251 | /* 252 | * errorLog.html css 253 | */ 254 | 255 | .error-log .am-pre-scrollable { 256 | max-height: 40rem; 257 | } 258 | 259 | /* 260 | * table.html css 261 | */ 262 | 263 | .table-main { 264 | font-size: 1.4rem; 265 | padding: .5rem; 266 | } 267 | 268 | .table-main button { 269 | background: #fff; 270 | } 271 | 272 | .table-check { 273 | width: 30px; 274 | } 275 | 276 | .table-id { 277 | width: 50px; 278 | } 279 | 280 | @media only screen and (max-width: 640px) { 281 | .table-select { 282 | margin-top: 10px; 283 | margin-left: 5px; 284 | } 285 | } 286 | 287 | /* 288 | gallery.html css 289 | */ 290 | 291 | .gallery-list li { 292 | padding: 10px; 293 | } 294 | 295 | .gallery-list a { 296 | color: #666; 297 | } 298 | 299 | .gallery-list a:hover { 300 | color: #3bb4f2; 301 | } 302 | 303 | .gallery-title { 304 | margin-top: 6px; 305 | font-size: 1.4rem; 306 | } 307 | 308 | .gallery-desc { 309 | font-size: 1.2rem; 310 | margin-top: 4px; 311 | } 312 | 313 | /* 314 | 404.html css 315 | */ 316 | 317 | .page-404 { 318 | background: #fff; 319 | border: none; 320 | width: 200px; 321 | margin: 0 auto; 322 | } 323 | 324 | 325 | /* 326 | fixed-layout 固定头部和边栏布局 327 | */ 328 | 329 | .fixed-layout, 330 | .fixed-layout body { 331 | height: 100%; 332 | overflow: hidden; 333 | } 334 | 335 | .fixed-layout .admin-header { 336 | position: fixed; 337 | top: 0; 338 | left: 0; 339 | right: 0; 340 | z-index: 1500; 341 | } 342 | 343 | .fixed-layout .admin-main { 344 | position: relative; 345 | height: 100%; 346 | padding-top: 51px; 347 | } 348 | 349 | .fixed-layout .admin-content, 350 | .fixed-layout .admin-sidebar { 351 | height: 100%; 352 | overflow-x: hidden; 353 | overflow-y: scroll; 354 | } 355 | 356 | .fixed-layout .admin-sidebar.am-active { 357 | z-index: 1600; 358 | } 359 | -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/css/amazeui.cropper.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Cropper v2.3.4 3 | * https://github.com/fengyuanchen/cropper 4 | * 5 | * Copyright (c) 2014-2016 Fengyuan Chen and contributors 6 | * Released under the MIT license 7 | * 8 | * Date: 2016-09-03T05:50:45.412Z 9 | */ 10 | .cropper-container { 11 | font-size: 0; 12 | line-height: 0; 13 | 14 | position: relative; 15 | 16 | -webkit-user-select: none; 17 | -moz-user-select: none; 18 | -ms-user-select: none; 19 | user-select: none; 20 | 21 | direction: ltr !important; 22 | } 23 | 24 | .cropper-container img { 25 | display: block; 26 | 27 | width: 100%; 28 | min-width: 0 !important; 29 | max-width: none !important; 30 | height: 100%; 31 | min-height: 0 !important; 32 | max-height: none !important; 33 | 34 | image-orientation: 0deg !important; 35 | } 36 | 37 | .cropper-wrap-box, 38 | .cropper-canvas, 39 | .cropper-drag-box, 40 | .cropper-crop-box, 41 | .cropper-modal { 42 | position: absolute; 43 | top: 0; 44 | right: 0; 45 | bottom: 0; 46 | left: 0; 47 | } 48 | 49 | .cropper-wrap-box { 50 | overflow: hidden; 51 | } 52 | 53 | .cropper-drag-box { 54 | opacity: 0; 55 | background-color: #fff; 56 | 57 | filter: alpha(opacity=0); 58 | } 59 | 60 | .cropper-modal { 61 | opacity: .5; 62 | background-color: #000; 63 | 64 | filter: alpha(opacity=50); 65 | } 66 | 67 | .cropper-view-box { 68 | display: block; 69 | overflow: hidden; 70 | 71 | width: 100%; 72 | height: 100%; 73 | 74 | outline: 1px solid #0e90d2; 75 | outline-color: #0e90d2; 76 | } 77 | 78 | .cropper-dashed { 79 | position: absolute; 80 | 81 | display: block; 82 | 83 | opacity: .5; 84 | border: 0 dashed #eee; 85 | 86 | filter: alpha(opacity=50); 87 | } 88 | 89 | .cropper-dashed.dashed-h { 90 | top: 33.33333%; 91 | left: 0; 92 | 93 | width: 100%; 94 | height: 33.33333%; 95 | 96 | border-top-width: 1px; 97 | border-bottom-width: 1px; 98 | } 99 | 100 | .cropper-dashed.dashed-v { 101 | top: 0; 102 | left: 33.33333%; 103 | 104 | width: 33.33333%; 105 | height: 100%; 106 | 107 | border-right-width: 1px; 108 | border-left-width: 1px; 109 | } 110 | 111 | .cropper-center { 112 | position: absolute; 113 | top: 50%; 114 | left: 50%; 115 | 116 | display: block; 117 | 118 | width: 0; 119 | height: 0; 120 | 121 | opacity: .75; 122 | 123 | filter: alpha(opacity=75); 124 | } 125 | 126 | .cropper-center:before, 127 | .cropper-center:after { 128 | position: absolute; 129 | 130 | display: block; 131 | 132 | content: ' '; 133 | 134 | background-color: #eee; 135 | } 136 | 137 | .cropper-center:before { 138 | top: 0; 139 | left: -3px; 140 | 141 | width: 7px; 142 | height: 1px; 143 | } 144 | 145 | .cropper-center:after { 146 | top: -3px; 147 | left: 0; 148 | 149 | width: 1px; 150 | height: 7px; 151 | } 152 | 153 | .cropper-face, 154 | .cropper-line, 155 | .cropper-point { 156 | position: absolute; 157 | 158 | display: block; 159 | 160 | width: 100%; 161 | height: 100%; 162 | 163 | opacity: .1; 164 | 165 | filter: alpha(opacity=10); 166 | } 167 | 168 | .cropper-face { 169 | top: 0; 170 | left: 0; 171 | 172 | background-color: #fff; 173 | } 174 | 175 | .cropper-line { 176 | background-color: #39f; 177 | } 178 | 179 | .cropper-line.line-e { 180 | top: 0; 181 | right: -3px; 182 | 183 | width: 5px; 184 | 185 | cursor: e-resize; 186 | } 187 | 188 | .cropper-line.line-n { 189 | top: -3px; 190 | left: 0; 191 | 192 | height: 5px; 193 | 194 | cursor: n-resize; 195 | } 196 | 197 | .cropper-line.line-w { 198 | top: 0; 199 | left: -3px; 200 | 201 | width: 5px; 202 | 203 | cursor: w-resize; 204 | } 205 | 206 | .cropper-line.line-s { 207 | bottom: -3px; 208 | left: 0; 209 | 210 | height: 5px; 211 | 212 | cursor: s-resize; 213 | } 214 | 215 | .cropper-point { 216 | width: 5px; 217 | height: 5px; 218 | 219 | opacity: .75; 220 | background-color: #0e90d2; 221 | 222 | filter: alpha(opacity=75); 223 | } 224 | 225 | .cropper-point.point-e { 226 | top: 50%; 227 | right: -3px; 228 | 229 | margin-top: -3px; 230 | 231 | cursor: e-resize; 232 | } 233 | 234 | .cropper-point.point-n { 235 | top: -3px; 236 | left: 50%; 237 | 238 | margin-left: -3px; 239 | 240 | cursor: n-resize; 241 | } 242 | 243 | .cropper-point.point-w { 244 | top: 50%; 245 | left: -3px; 246 | 247 | margin-top: -3px; 248 | 249 | cursor: w-resize; 250 | } 251 | 252 | .cropper-point.point-s { 253 | bottom: -3px; 254 | left: 50%; 255 | 256 | margin-left: -3px; 257 | 258 | cursor: s-resize; 259 | } 260 | 261 | .cropper-point.point-ne { 262 | top: -3px; 263 | right: -3px; 264 | 265 | cursor: ne-resize; 266 | } 267 | 268 | .cropper-point.point-nw { 269 | top: -3px; 270 | left: -3px; 271 | 272 | cursor: nw-resize; 273 | } 274 | 275 | .cropper-point.point-sw { 276 | bottom: -3px; 277 | left: -3px; 278 | 279 | cursor: sw-resize; 280 | } 281 | 282 | .cropper-point.point-se { 283 | right: -3px; 284 | bottom: -3px; 285 | 286 | width: 20px; 287 | height: 20px; 288 | 289 | cursor: se-resize; 290 | 291 | opacity: 1; 292 | 293 | filter: alpha(opacity=100); 294 | } 295 | 296 | .cropper-point.point-se:before { 297 | position: absolute; 298 | right: -50%; 299 | bottom: -50%; 300 | 301 | display: block; 302 | 303 | width: 200%; 304 | height: 200%; 305 | 306 | content: ' '; 307 | 308 | opacity: 0; 309 | background-color: #0e90d2; 310 | 311 | filter: alpha(opacity=0); 312 | } 313 | 314 | @media (min-width: 768px) { 315 | .cropper-point.point-se { 316 | width: 15px; 317 | height: 15px; 318 | } 319 | } 320 | 321 | @media (min-width: 992px) { 322 | .cropper-point.point-se { 323 | width: 10px; 324 | height: 10px; 325 | } 326 | } 327 | 328 | @media (min-width: 1200px) { 329 | .cropper-point.point-se { 330 | width: 5px; 331 | height: 5px; 332 | 333 | opacity: .75; 334 | 335 | filter: alpha(opacity=75); 336 | } 337 | } 338 | 339 | .cropper-invisible { 340 | opacity: 0; 341 | 342 | filter: alpha(opacity=0); 343 | } 344 | 345 | .cropper-bg { 346 | background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC'); 347 | } 348 | 349 | .cropper-hide { 350 | position: absolute; 351 | 352 | display: block; 353 | 354 | width: 0; 355 | height: 0; 356 | } 357 | 358 | .cropper-hidden { 359 | display: none !important; 360 | } 361 | 362 | .cropper-move { 363 | cursor: move; 364 | } 365 | 366 | .cropper-crop { 367 | cursor: crosshair; 368 | } 369 | 370 | .cropper-disabled .cropper-drag-box, 371 | .cropper-disabled .cropper-face, 372 | .cropper-disabled .cropper-line, 373 | .cropper-disabled .cropper-point { 374 | cursor: not-allowed; 375 | } 376 | -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/css/app.css: -------------------------------------------------------------------------------- 1 | /* Write your styles */ -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/app-icon72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/app-icon72x72@2x.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/admin-chrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/admin-chrome.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/admin-firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/admin-firefox.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/admin-ie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/admin-ie.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/admin-opera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/admin-opera.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/admin-safari.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/admin-safari.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/adminPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/adminPage.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/blogPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/blogPage.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/landing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/landing.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/landingPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/landingPage.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/loginPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/loginPage.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/examples/sidebarPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/examples/sidebarPage.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/favicon.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/i/startup-640x1096.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/amaze/i/startup-640x1096.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/amaze/js/app.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | 'use strict'; 3 | 4 | $(function() { 5 | var $fullText = $('.admin-fullText'); 6 | $('#admin-fullscreen').on('click', function() { 7 | $.AMUI.fullscreen.toggle(); 8 | }); 9 | 10 | $(document).on($.AMUI.fullscreen.raw.fullscreenchange, function() { 11 | $fullText.text($.AMUI.fullscreen.isFullscreen ? '退出全屏' : '开启全屏'); 12 | }); 13 | }); 14 | })(jQuery); 15 | -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/contextjs/css/context.standalone.css: -------------------------------------------------------------------------------- 1 | /** 2 | * ContextJS Styles 3 | * For use WITHOUT Twitters Bootstrap CSS 4 | */ 5 | 6 | .nav-header { 7 | display: block; 8 | padding: 3px 15px; 9 | font-size: 11px; 10 | font-weight: bold; 11 | line-height: 20px; 12 | color: #999; 13 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); 14 | text-transform: uppercase; 15 | } 16 | .dropdown-menu { 17 | position: absolute; 18 | top: 100%; 19 | left: 0; 20 | z-index: 1000; 21 | display: none; 22 | float: left; 23 | min-width: 160px; 24 | padding: 5px 0; 25 | margin: 2px 0 0; 26 | list-style: none; 27 | background-color: #ffffff; 28 | border: 1px solid #ccc; 29 | border: 1px solid rgba(0, 0, 0, 0.2); 30 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 31 | font-size: 14px; 32 | *border-right-width: 2px; 33 | *border-bottom-width: 2px; 34 | -webkit-border-radius: 6px; 35 | -moz-border-radius: 6px; 36 | border-radius: 6px; 37 | -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 38 | -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 39 | box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 40 | -webkit-background-clip: padding-box; 41 | -moz-background-clip: padding; 42 | background-clip: padding-box; 43 | text-align:left; 44 | } 45 | .dropdown-menu.pull-right { 46 | right: 0; 47 | left: auto; 48 | } 49 | .dropdown-menu .divider { 50 | *width: 100%; 51 | height: 1px; 52 | margin: 9px 1px; 53 | *margin: -5px 0 5px; 54 | overflow: hidden; 55 | background-color: #e5e5e5; 56 | border-bottom: 1px solid #ffffff; 57 | } 58 | .dropdown-menu a { 59 | display: block; 60 | padding: 3px 20px; 61 | clear: both; 62 | font-weight: normal; 63 | line-height: 20px; 64 | color: #333333; 65 | white-space: nowrap; 66 | text-decoration: none; 67 | } 68 | .dropdown-menu li > a:hover, .dropdown-menu li > a:focus, .dropdown-submenu:hover > a { 69 | color: #ffffff; 70 | text-decoration: none; 71 | background-color: #0088cc; 72 | background-color: #0081c2; 73 | background-image: -moz-linear-gradient(top, #0088cc, #0077b3); 74 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); 75 | background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); 76 | background-image: -o-linear-gradient(top, #0088cc, #0077b3); 77 | background-image: linear-gradient(to bottom, #0088cc, #0077b3); 78 | background-repeat: repeat-x; 79 | filter: progid: dximagetransform.microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); 80 | } 81 | .dropdown-menu .active > a, .dropdown-menu .active > a:hover { 82 | color: #ffffff; 83 | text-decoration: none; 84 | background-color: #0088cc; 85 | background-color: #0081c2; 86 | background-image: linear-gradient(to bottom, #0088cc, #0077b3); 87 | background-image: -moz-linear-gradient(top, #0088cc, #0077b3); 88 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); 89 | background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); 90 | background-image: -o-linear-gradient(top, #0088cc, #0077b3); 91 | background-repeat: repeat-x; 92 | outline: 0; 93 | filter: progid 94 | : dximagetransform.microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); 95 | } 96 | .dropdown-menu .disabled > a, .dropdown-menu .disabled > a:hover { 97 | color: #999999; 98 | } 99 | .dropdown-menu .disabled > a:hover { 100 | text-decoration: none; 101 | cursor: default; 102 | background-color: transparent; 103 | } 104 | .open { 105 | *z-index: 1000; 106 | } 107 | .open > .dropdown-menu { 108 | display: block; 109 | } 110 | .pull-right > .dropdown-menu { 111 | right: 0; 112 | left: auto; 113 | } 114 | .dropup .caret, .navbar-fixed-bottom .dropdown .caret { 115 | border-top: 0; 116 | border-bottom: 4px solid #000000; 117 | content: "\2191"; 118 | } 119 | .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { 120 | top: auto; 121 | bottom: 100%; 122 | margin-bottom: 1px; 123 | } 124 | .dropdown-submenu { 125 | position: relative; 126 | } 127 | .dropdown-submenu > .dropdown-menu { 128 | top: 0; 129 | left: 100%; 130 | margin-top: -6px; 131 | margin-left: -1px; 132 | -webkit-border-radius: 0 6px 6px 6px; 133 | -moz-border-radius: 0 6px 6px 6px; 134 | border-radius: 0 6px 6px 6px; 135 | } 136 | .dropdown-submenu > .dropdown-menu.drop-left{ 137 | left:-100%; 138 | } 139 | .dropdown-submenu:hover .dropdown-menu { 140 | display: block; 141 | } 142 | .dropdown-submenu > a:after { 143 | display: block; 144 | float: right; 145 | width: 0; 146 | height: 0; 147 | margin-top: 5px; 148 | margin-right: -10px; 149 | border-color: transparent; 150 | border-left-color: #cccccc; 151 | border-style: solid; 152 | border-width: 5px 0 5px 5px; 153 | content: " "; 154 | } 155 | .dropdown-submenu:hover > a:after { 156 | border-left-color: #ffffff; 157 | } 158 | .dropdown .dropdown-menu .nav-header { 159 | padding-right: 20px; 160 | padding-left: 20px; 161 | } 162 | /** 163 | * Context Styles 164 | */ 165 | 166 | .dropdown-context .nav-header { 167 | cursor: default; 168 | } 169 | .dropdown-context:before, .dropdown-context-up:before { 170 | position: absolute; 171 | top: -7px; 172 | left: 9px; 173 | display: inline-block; 174 | border-right: 7px solid transparent; 175 | border-bottom: 7px solid #ccc; 176 | border-left: 7px solid transparent; 177 | border-bottom-color: rgba(0, 0, 0, 0.2); 178 | content: ''; 179 | } 180 | .dropdown-context:after, .dropdown-context-up:after { 181 | position: absolute; 182 | top: -6px; 183 | left: 10px; 184 | display: inline-block; 185 | border-right: 6px solid transparent; 186 | border-bottom: 6px solid #ffffff; 187 | border-left: 6px solid transparent; 188 | content: ''; 189 | } 190 | .dropdown-context-up:before, .dropdown-context-up:after { 191 | top: auto; 192 | bottom: -7px; 193 | z-index: 9999; 194 | } 195 | .dropdown-context-up:before { 196 | border-right: 7px solid transparent; 197 | border-top: 7px solid #ccc; 198 | border-bottom: none; 199 | border-left: 7px solid transparent; 200 | } 201 | .dropdown-context-up:after { 202 | border-right: 6px solid transparent; 203 | border-top: 6px solid #ffffff; 204 | border-left: 6px solid transparent; 205 | border-bottom: none; 206 | } 207 | .dropdown-context-sub:before, .dropdown-context-sub:after { 208 | display: none; 209 | } 210 | .dropdown-context .dropdown-submenu:hover .dropdown-menu { 211 | display: none; 212 | } 213 | .dropdown-context .dropdown-submenu:hover > .dropdown-menu { 214 | display: block; 215 | } 216 | 217 | .compressed-context a{ 218 | padding-left: 14px; 219 | padding-top: 0; 220 | padding-bottom: 0; 221 | font-size: 13px; 222 | } 223 | .compressed-context .divider{ 224 | margin: 5px 1px; 225 | } 226 | .compressed-context .nav-header{ 227 | padding:1px 13px; 228 | } 229 | -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/contextjs/js/context.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Context.js 3 | * Copyright Jacob Kelley 4 | * MIT License 5 | */ 6 | 7 | var context = context || (function () { 8 | 9 | var options = { 10 | fadeSpeed: 100, 11 | filter: function ($obj) { 12 | // Modify $obj, Do not return 13 | }, 14 | above: 'auto', 15 | preventDoubleContext: true, 16 | compress: false 17 | }; 18 | 19 | function initialize(opts) { 20 | 21 | options = $.extend({}, options, opts); 22 | 23 | $(document).on('click', 'html', function () { 24 | $('.dropdown-context').fadeOut(options.fadeSpeed, function(){ 25 | $('.dropdown-context').css({display:''}).find('.drop-left').removeClass('drop-left'); 26 | }); 27 | }); 28 | if(options.preventDoubleContext){ 29 | $(document).on('contextmenu', '.dropdown-context', function (e) { 30 | e.preventDefault(); 31 | }); 32 | } 33 | $(document).on('mouseenter', '.dropdown-submenu', function(){ 34 | var $sub = $(this).find('.dropdown-context-sub:first'), 35 | subWidth = $sub.width(), 36 | subLeft = $sub.offset().left, 37 | collision = (subWidth+subLeft) > window.innerWidth; 38 | if(collision){ 39 | $sub.addClass('drop-left'); 40 | } 41 | }); 42 | 43 | } 44 | 45 | function updateOptions(opts){ 46 | options = $.extend({}, options, opts); 47 | } 48 | 49 | function buildMenu(data, id, subMenu) { 50 | var subClass = (subMenu) ? ' dropdown-context-sub' : '', 51 | compressed = options.compress ? ' compressed-context' : '', 52 | $menu = $(''); 53 | var i = 0, linkTarget = ''; 54 | for(i; i'); 57 | } else if (typeof data[i].header !== 'undefined') { 58 | $menu.append(''); 59 | } else { 60 | if (typeof data[i].href == 'undefined') { 61 | data[i].href = '#'; 62 | } 63 | if (typeof data[i].target !== 'undefined') { 64 | linkTarget = ' target="'+data[i].target+'"'; 65 | } 66 | if (typeof data[i].subMenu !== 'undefined') { 67 | $sub = (''); 68 | } else { 69 | $sub = $('
  • ' + data[i].text + '
  • '); 70 | } 71 | if (typeof data[i].action !== 'undefined') { 72 | var actiond = new Date(), 73 | actionID = 'event-' + actiond.getTime() * Math.floor(Math.random()*100000), 74 | eventAction = data[i].action; 75 | $sub.find('a').attr('id', actionID); 76 | $('#' + actionID).addClass('context-event'); 77 | $(document).on('click', '#' + actionID, eventAction); 78 | } 79 | $menu.append($sub); 80 | if (typeof data[i].subMenu != 'undefined') { 81 | var subMenuData = buildMenu(data[i].subMenu, id, true); 82 | $menu.find('li:last').append(subMenuData); 83 | } 84 | } 85 | if (typeof options.filter == 'function') { 86 | options.filter($menu.find('li:last')); 87 | } 88 | } 89 | return $menu; 90 | } 91 | 92 | function addContext(selector, data) { 93 | 94 | var d = new Date(), 95 | id = d.getTime(), 96 | $menu = buildMenu(data, id); 97 | 98 | $('body').append($menu); 99 | 100 | 101 | $(document).on('contextmenu', selector, function (e) { 102 | e.preventDefault(); 103 | e.stopPropagation(); 104 | 105 | $('.dropdown-context:not(.dropdown-context-sub)').hide(); 106 | 107 | $dd = $('#dropdown-' + id); 108 | if (typeof options.above == 'boolean' && options.above) { 109 | $dd.addClass('dropdown-context-up').css({ 110 | top: e.pageY - 20 - $('#dropdown-' + id).height(), 111 | left: e.pageX - 13 112 | }).fadeIn(options.fadeSpeed); 113 | } else if (typeof options.above == 'string' && options.above == 'auto') { 114 | $dd.removeClass('dropdown-context-up'); 115 | var autoH = $dd.height() + 12; 116 | if ((e.pageY + autoH) > $('html').height()) { 117 | $dd.addClass('dropdown-context-up').css({ 118 | top: e.pageY - 20 - autoH, 119 | left: e.pageX - 13 120 | }).fadeIn(options.fadeSpeed); 121 | } else { 122 | $dd.css({ 123 | top: e.pageY + 10, 124 | left: e.pageX - 13 125 | }).fadeIn(options.fadeSpeed); 126 | } 127 | } 128 | }); 129 | } 130 | 131 | function hideContext(){ 132 | $('.dropdown-context:not(.dropdown-context-sub)').hide(); 133 | } 134 | 135 | function destroyContext(selector) { 136 | $(document).off('contextmenu', selector).off('click', '.context-event'); 137 | } 138 | 139 | return { 140 | init: initialize, 141 | settings: updateOptions, 142 | attach: addContext, 143 | destroy: destroyContext, 144 | hide : hideContext 145 | }; 146 | })(); -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/custom/css/custom_up_img.css: -------------------------------------------------------------------------------- 1 | .up-frame-bj .up-frame-radius{padding-bottom: 20px;border-radius: 5px;} 2 | .up-frame-parent .up-frame-header{height: 50px;padding: 0px;line-height: 50px;border-bottom:solid 1px #e5e5e5;} 3 | .up-frame-parent .up-frame-header label{font-size: 16px;float: left;margin-left: 14px;color: #808080;} 4 | 5 | .up-frame-parent .up-frame-body{padding:20px;} 6 | .up-frame-parent .up-pre-before {width:327px;height: 327px;padding:0px;float: left;background: #fcfcfc;border: 1px solid #e3e3e3;} 7 | .up-frame-parent .up-pre-before img{width: 100%;} 8 | 9 | .up-frame-parent .up-frame-body .up-pre-after{background: #fcfcfc;overflow: hidden;width: 186px;height: 186px;border: 1px solid #e3e3e3;float: left;margin-left: 25px;} 10 | 11 | .up-frame-parent .up-control-btns{width: 150px;height:30px;margin-left: auto;margin-right: auto;background: #dddddd;text-align: center;line-height: 30px; margin-top: 30px;} 12 | .up-frame-parent .up-control-btns span{width: 30%;} 13 | 14 | @media screen and (max-width: 1024px){ 15 | .up-frame-parent .up-pre-before {width: 100%;} 16 | .up-frame-parent .up-frame-body .up-pre-after{margin-left: 0px;margin-top: 10px;} 17 | } -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/custom/css/font-awesome.4.6.0.css: -------------------------------------------------------------------------------- 1 | /*-防止各大cdn公共库加载地址失效问题,此地址我们会时时监控,及调整-www.jq22.com为您服务*/ 2 | /*当前为百度 cdn公共库提供font-awesome-4.6.0 Css样式文件*/ 3 | @import url("http://cdn.bootcss.com/font-awesome/4.6.0/css/font-awesome.min.css"); 4 | -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/custom/js/custom_up_img.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | $("#up-img-touch").click(function(){ 3 | $("#doc-modal-1").modal({width:'600px'}); 4 | }); 5 | }); 6 | $(function() { 7 | 'use strict'; 8 | // 初始化 9 | var $image = $('#image'); 10 | $image.cropper({ 11 | aspectRatio: '1', 12 | autoCropArea:0.8, 13 | preview: '.up-pre-after', 14 | 15 | }); 16 | 17 | // 事件代理绑定事件 18 | $('.docs-buttons').on('click', '[data-method]', function() { 19 | 20 | var $this = $(this); 21 | var data = $this.data(); 22 | var result = $image.cropper(data.method, data.option, data.secondOption); 23 | switch (data.method) { 24 | case 'getCroppedCanvas': 25 | if (result) { 26 | // 显示 Modal 27 | $('#cropped-modal').modal().find('.am-modal-bd').html(result); 28 | $('#download').attr('href', result.toDataURL('image/jpeg')); 29 | } 30 | break; 31 | } 32 | }); 33 | 34 | 35 | 36 | // 上传图片 37 | var $inputImage = $('#inputImage'); 38 | var URL = window.URL || window.webkitURL; 39 | var blobURL; 40 | 41 | if (URL) { 42 | $inputImage.change(function () { 43 | var files = this.files; 44 | var file; 45 | 46 | if (files && files.length) { 47 | file = files[0]; 48 | 49 | if (/^image\/\w+$/.test(file.type)) { 50 | blobURL = URL.createObjectURL(file); 51 | $image.one('built.cropper', function () { 52 | // Revoke when load complete 53 | URL.revokeObjectURL(blobURL); 54 | }).cropper('reset').cropper('replace', blobURL); 55 | $inputImage.val(''); 56 | } else { 57 | window.alert('Please choose an image file.'); 58 | } 59 | } 60 | 61 | // Amazi UI 上传文件显示代码 62 | var fileNames = ''; 63 | $.each(this.files, function() { 64 | fileNames += '' + this.name + ' '; 65 | }); 66 | $('#file-list').html(fileNames); 67 | }); 68 | } else { 69 | $inputImage.prop('disabled', true).parent().addClass('disabled'); 70 | } 71 | 72 | //绑定上传事件 73 | $('#up-btn-ok').on('click',function(){ 74 | var $modal = $('#my-modal-loading'); 75 | var $modal_alert = $('#my-alert'); 76 | var img_src=$image.attr("src"); 77 | if(img_src==""){ 78 | set_alert_info("没有选择上传的图片"); 79 | $modal_alert.modal(); 80 | return false; 81 | } 82 | 83 | $modal.modal(); 84 | 85 | var url=$(this).attr("url"); 86 | var canvas=$("#image").cropper('getCroppedCanvas'); 87 | var data=canvas.toDataURL(); //转成base64 88 | $.ajax( { 89 | url:url, 90 | dataType:'json', 91 | type: "POST", 92 | data: {"image":data.toString()}, 93 | success: function(data, textStatus){ 94 | $modal.modal('close'); 95 | set_alert_info(data.msg); 96 | $modal_alert.modal(); 97 | if(data.result=="ok"){ 98 | $("#up-img-touch img").attr("src",data.fileUrl); 99 | 100 | $("#doc-modal-1").modal('close'); 101 | 102 | var img_name=data.fileUrl; 103 | console.log(img_name); 104 | //$("#pic").text(img_name); 105 | } 106 | }, 107 | error: function(){ 108 | $modal.modal('close'); 109 | set_alert_info("上传文件失败了!"); 110 | $modal_alert.modal(); 111 | //console.log('Upload error'); 112 | } 113 | }); 114 | 115 | }); 116 | 117 | }); 118 | 119 | function rotateimgright() { 120 | $("#image").cropper('rotate', 90); 121 | } 122 | 123 | 124 | function rotateimgleft() { 125 | $("#image").cropper('rotate', -90); 126 | } 127 | 128 | function set_alert_info(content){ 129 | $("#alert_content").html(content); 130 | } 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/layer/extend/layer.ext.js: -------------------------------------------------------------------------------- 1 | /*! layer弹层组件拓展类 */ 2 | ;!function(){layer.use("skin/layer.ext.css",function(){layer.layui_layer_extendlayerextjs=!0});var a=layer.cache||{},b=function(b){return a.skin?" "+a.skin+" "+a.skin+"-"+b:""};layer.prompt=function(a,c){a=a||{},"function"==typeof a&&(c=a);var d,e=2==a.formType?'":function(){return''}();return layer.open($.extend({btn:["确定","取消"],content:e,skin:"layui-layer-prompt"+b("prompt"),success:function(a){d=a.find(".layui-layer-input"),d.focus()},yes:function(b){var e=d.val();""===e?d.focus():e.length>(a.maxlength||500)?layer.tips("最多输入"+(a.maxlength||500)+"个字数",d,{tips:1}):c&&c(e,b,d)}},a))},layer.tab=function(a){a=a||{};var c=a.tab||{};return layer.open($.extend({type:1,skin:"layui-layer-tab"+b("tab"),title:function(){var a=c.length,b=1,d="";if(a>0)for(d=''+c[0].title+"";a>b;b++)d+=""+c[b].title+"";return d}(),content:'
      '+function(){var a=c.length,b=1,d="";if(a>0)for(d='
    • '+(c[0].content||"no content")+"
    • ";a>b;b++)d+='
    • '+(c[b].content||"no content")+"
    • ";return d}()+"
    ",success:function(a){var b=a.find(".layui-layer-title").children(),c=a.find(".layui-layer-tabmain").children();b.on("mousedown",function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;var b=$(this),d=b.index();b.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"),c.eq(d).show().siblings().hide()})}},a))},layer.photos=function(a,c,d){function e(a,b,c){var d=new Image;d.onload=function(){d.onload=null,b(d)},d.onerror=function(a){d.onerror=null,c(a)},d.src=a}var f={};if(a=a||{},a.photos){var g=a.photos.constructor===Object,h=g?a.photos:{},i=h.data||[],j=h.start||0;if(f.imgIndex=j+1,g){if(0===i.length)return void layer.msg("没有图片")}else{var k=$(a.photos),l=k.find(a.img||"img");if(0===l.length)return;if(c||k.find(h.img||"img").each(function(b){var c=$(this);i.push({alt:c.attr("alt"),pid:c.attr("layer-pid"),src:c.attr("layer-src")||c.attr("src"),thumb:c.attr("src")}),c.on("click",function(){layer.photos($.extend(a,{photos:{start:b,data:i,tab:a.tab},full:a.full}),!0)})}),!c)return}f.imgprev=function(a){f.imgIndex--,f.imgIndex<1&&(f.imgIndex=i.length),f.tabimg(a)},f.imgnext=function(a,b){f.imgIndex++,f.imgIndex>i.length&&(f.imgIndex=1,b)||f.tabimg(a)},f.keyup=function(a){if(!f.end){var b=a.keyCode;a.preventDefault(),37===b?f.imgprev(!0):39===b?f.imgnext(!0):27===b&&layer.close(f.index)}},f.tabimg=function(b){i.length<=1||(h.start=f.imgIndex-1,layer.close(f.index),layer.photos(a,!0,b))},f.event=function(){f.bigimg.hover(function(){f.imgsee.show()},function(){f.imgsee.hide()}),f.bigimg.find(".layui-layer-imgprev").on("click",function(a){a.preventDefault(),f.imgprev()}),f.bigimg.find(".layui-layer-imgnext").on("click",function(a){a.preventDefault(),f.imgnext()}),$(document).on("keyup",f.keyup)},f.loadi=layer.load(1,{shade:"shade"in a?!1:.9,scrollbar:!1}),e(i[j].src,function(c){layer.close(f.loadi),f.index=layer.open($.extend({type:1,area:function(){var b=[c.width,c.height],d=[$(window).width()-100,$(window).height()-100];return!a.full&&b[0]>d[0]&&(b[0]=d[0],b[1]=b[0]*d[1]/b[0]),[b[0]+"px",b[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,shift:5*Math.random()|0,skin:"layui-layer-photos"+b("photos"),content:'
    '+(i[j].alt||
    '+(i.length>1?'':"")+'
    '+(i[j].alt||"")+""+f.imgIndex+"/"+i.length+"
    ",success:function(b,c){f.bigimg=b.find(".layui-layer-phimg"),f.imgsee=b.find(".layui-layer-imguide,.layui-layer-imgbar"),f.event(b),a.tab&&a.tab(i[j],b)},end:function(){f.end=!0,$(document).off("keyup",f.keyup)}},a))},function(){layer.close(f.loadi),layer.msg("当前图片地址异常
    是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){i.length>1&&f.imgnext(!0,!0)}})})}}}(); -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/layer/skin/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/layer/skin/default/icon-ext.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/layer/skin/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/layer/skin/default/icon.png -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/layer/skin/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/layer/skin/default/loading-0.gif -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/layer/skin/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/layer/skin/default/loading-1.gif -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/layer/skin/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/plugins/layer/skin/default/loading-2.gif -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/layer/skin/layer.ext.css: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | @Name: layer拓展样式 4 | @Date: 2012.12.13 5 | @Author: 贤心 6 | @blog: sentsin.com 7 | 8 | */.layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span{text-overflow:ellipsis;white-space:nowrap}.layui-layer-iconext{background:url(default/icon-ext.png) no-repeat}html #layui_layer_skinlayerextcss{display:none;position:absolute;width:1989px}.layui-layer-prompt .layui-layer-input{display:block;width:220px;height:30px;margin:0 auto;line-height:30px;padding:0 5px;border:1px solid #ccc;box-shadow:1px 1px 5px rgba(0,0,0,.1) inset;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;border-bottom:1px solid #ccc;background-color:#eee;overflow:visible}.layui-layer-tab .layui-layer-title span{position:relative;float:left;min-width:80px;max-width:260px;padding:0 20px;text-align:center;cursor:default;overflow:hidden}.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{height:43px;border-left:1px solid #ccc;border-right:1px solid #ccc;background-color:#fff;z-index:10}.layui-layer-tab .layui-layer-title span:first-child{border-left:none}.layui-layer-tabmain{line-height:24px;clear:both}.layui-layer-tabmain .layui-layer-tabli{display:none}.layui-layer-tabmain .layui-layer-tabli.xubox_tab_layer{display:block}.xubox_tabclose{position:absolute;right:10px;top:5px;cursor:pointer}.layui-layer-photos{-webkit-animation-duration:1s;animation-duration:1s;}.layui-layer-photos .layui-layer-content{overflow:hidden;text-align:center}.layui-layer-photos .layui-layer-phimg img{position:relative;width:100%;display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;blr:expression(this.onFocus=this.blur())}.layui-layer-imgprev{left:10px;background-position:-5px -5px;_background-position:-70px -5px}.layui-layer-imgprev:hover{background-position:-33px -5px;_background-position:-120px -5px}.layui-layer-imgnext{right:10px;_right:8px;background-position:-5px -50px;_background-position:-70px -50px}.layui-layer-imgnext:hover{background-position:-33px -50px;_background-position:-120px -50px}.layui-layer-imgbar{position:absolute;left:0;bottom:0;width:100%;height:32px;line-height:32px;background-color:rgba(0,0,0,.8);background-color:#000\9;filter:Alpha(opacity=80);color:#fff;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;color:#fff}.layui-layer-imgtit a:hover{color:#fff;text-decoration:underline}.layui-layer-imgtit em{padding-left:10px;font-style:normal} -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/laypage/laypage.js: -------------------------------------------------------------------------------- 1 | /*! layPage-v1.3.0 分页组件 License MIT http://laypage.layui.com/ By 贤心 */ 2 | ;!function(){"use strict";function a(d){var e="laypagecss";a.dir="dir"in a?a.dir:f.getpath+"/skin/laypage.css",new f(d),a.dir&&!b[c](e)&&f.use(a.dir,e)}a.v="1.3";var b=document,c="getElementById",d="getElementsByTagName",e=0,f=function(a){var b=this,c=b.config=a||{};c.item=e++,b.render(!0)};f.on=function(a,b,c){return a.attachEvent?a.attachEvent("on"+b,function(){c.call(a,window.even)}):a.addEventListener(b,c,!1),f},f.getpath=function(){var a=document.scripts,b=a[a.length-1].src;return b.substring(0,b.lastIndexOf("/")+1)}(),f.use=function(c,e){var f=b.createElement("link");f.type="text/css",f.rel="stylesheet",f.href=a.dir,e&&(f.id=e),b[d]("head")[0].appendChild(f),f=null},f.prototype.type=function(){var a=this.config;return"object"==typeof a.cont?void 0===a.cont.length?2:3:void 0},f.prototype.view=function(){var b=this,c=b.config,d=[],e={};if(c.pages=0|c.pages,c.curr=0|c.curr||1,c.groups="groups"in c?0|c.groups:5,c.first="first"in c?c.first:"首页",c.last="last"in c?c.last:"尾页",c.prev="prev"in c?c.prev:"上一页",c.next="next"in c?c.next:"下一页",c.pages<=1)return"";for(c.groups>c.pages&&(c.groups=c.pages),e.index=Math.ceil((c.curr+(c.groups>1&&c.groups!==c.pages?1:0))/(0===c.groups?1:c.groups)),c.curr>1&&c.prev&&d.push(''+c.prev+""),e.index>1&&c.first&&0!==c.groups&&d.push(''+c.first+""),e.poor=Math.floor((c.groups-1)/2),e.start=e.index>1?c.curr-e.poor:1,e.end=e.index>1?function(){var a=c.curr+(c.groups-e.poor-1);return a>c.pages?c.pages:a}():c.groups,e.end-e.start"+e.start+""):d.push(''+e.start+"");return c.pages>c.groups&&e.end'+c.last+""),e.flow=!c.prev&&0===c.groups,(c.curr!==c.pages&&c.next||e.flow)&&d.push(function(){return e.flow&&c.curr===c.pages?''+c.next+"":''+c.next+""}()),'
    '+d.join("")+function(){return c.skip?'':""}()+"
    "},f.prototype.jump=function(a){if(a){for(var b=this,c=b.config,e=a.children,g=a[d]("button")[0],h=a[d]("input")[0],i=0,j=e.length;j>i;i++)"a"===e[i].nodeName.toLowerCase()&&f.on(e[i],"click",function(){var a=0|this.getAttribute("data-page");c.curr=a,b.render()});g&&f.on(g,"click",function(){var a=0|h.value.replace(/\s|\D/g,"");a&&a<=c.pages&&(c.curr=a,b.render())})}},f.prototype.render=function(a){var d=this,e=d.config,f=d.type(),g=d.view();2===f?e.cont.innerHTML=g:3===f?e.cont.html(g):b[c](e.cont).innerHTML=g,e.jump&&e.jump(e,a),d.jump(b[c]("laypage_"+e.item)),e.hash&&!a&&(location.hash="!"+e.hash+"="+e.curr)},"function"==typeof define?define(function(){return a}):"undefined"!=typeof exports?module.exports=a:window.laypage=a}(); -------------------------------------------------------------------------------- /src/main/webapp/static/plugins/laypage/skin/laypage.css: -------------------------------------------------------------------------------- 1 | /*! 2 | laypage默认样式 3 | */.laypage_main a,.laypage_main input,.laypage_main span{height:26px;line-height:26px}.laypage_main button,.laypage_main input,.laypageskin_default a{border:1px solid #ccc;background-color:#fff}.laypage_main{font-size:0;clear:both;color:#666}.laypage_main *{display:inline-block;vertical-align:top;font-size:12px}.laypage_main a{text-decoration:none;color:#666}.laypage_main a,.laypage_main span{margin:0 3px 6px;padding:0 10px}.laypage_main input{width:40px;margin:0 5px;padding:0 5px}.laypage_main button{height:28px;line-height:28px;margin-left:5px;padding:0 10px;color:#666}.laypageskin_default span{height:28px;line-height:28px;color:#999}.laypageskin_default .laypage_curr{font-weight:700;color:#666}.laypageskin_molv a,.laypageskin_molv span{padding:0 12px;border-radius:2px}.laypageskin_molv a{background-color:#f1eff0}.laypageskin_molv .laypage_curr{background-color:#00AA91;color:#fff}.laypageskin_molv input{height:24px;line-height:24px}.laypageskin_molv button{height:26px;line-height:26px}.laypageskin_yahei{color:#333}.laypageskin_yahei a,.laypageskin_yahei span{padding:0 13px;border-radius:2px;color:#333}.laypageskin_yahei .laypage_curr{background-color:#333;color:#fff}.laypageskin_flow{text-align:center}.laypageskin_flow .page_nomore{color:#999} -------------------------------------------------------------------------------- /src/main/webapp/static/source/css/login.css: -------------------------------------------------------------------------------- 1 | /*-- 2 | Author: W3layouts 3 | Author URL: http://w3layouts.com 4 | License: Creative Commons Attribution 3.0 Unported 5 | License URL: http://creativecommons.org/licenses/by/3.0/ 6 | --*/ 7 | /* reset */ 8 | html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,dl,dt,dd,ol,nav ul,nav li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;} 9 | article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;} 10 | ol,ul{list-style:none;margin:0px;padding:0px;} 11 | blockquote,q{quotes:none;} 12 | blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;} 13 | table{border-collapse:collapse;border-spacing:0;} 14 | /* start editing from here */ 15 | a{text-decoration:none;} 16 | .txt-rt{text-align:right;}/* text align right */ 17 | .txt-lt{text-align:left;}/* text align left */ 18 | .txt-center{text-align:center;}/* text align center */ 19 | .float-rt{float:right;}/* float right */ 20 | .float-lt{float:left;}/* float left */ 21 | .clear{clear:both;}/* clear float */ 22 | .pos-relative{position:relative;}/* Position Relative */ 23 | .pos-absolute{position:absolute;}/* Position Absolute */ 24 | .vertical-base{ vertical-align:baseline;}/* vertical align baseline */ 25 | .vertical-top{ vertical-align:top;}/* vertical align top */ 26 | nav.vertical ul li{ display:block;}/* vertical menu */ 27 | nav.horizontal ul li{ display: inline-block;}/* horizontal menu */ 28 | img{max-width:100%;} 29 | /*end reset*/ 30 | /****-----start-body----****/ 31 | body{ 32 | background: url(../img/bg5.jpg) no-repeat 0px 0px; 33 | font-family: 'Open Sans', sans-serif; 34 | background-size:cover; 35 | -webkit-background-size:cover; 36 | -moz-background-size:cover; 37 | -o-background-size:cover; 38 | /*min-height:1050px;*/ 39 | } 40 | .wrap{ 41 | margin: 0 auto; 42 | width: 80%; 43 | } 44 | body a,form li,input[type="submit"],input[type="text"],.sixth-login input[type="submit"],.third-login input[type="submit"]{ 45 | transition: 0.1s all; 46 | -webkit-transition: 0.1s all; 47 | -moz-transition: 0.1s all; 48 | -o-transition: 0.1s all; 49 | } 50 | /*--close--*/ 51 | .close{ 52 | background: url('../img/close.png') no-repeat 0px 0px; 53 | cursor: pointer; 54 | width: 20px; 55 | height: 20px; 56 | position: absolute; 57 | left: 20px; 58 | top: 20px; 59 | -webkit-transition: color 0.2s ease-in-out; 60 | -moz-transition: color 0.2s ease-in-out; 61 | -o-transition: color 0.2s ease-in-out; 62 | transition: color 0.2s ease-in-out; 63 | } 64 | /*--/close--*/ 65 | h1 { 66 | font-family: 'Exo 2', sans-serif; 67 | text-align: center; 68 | padding-top: 1em; 69 | font-weight: 400; 70 | color: #2B2B36; 71 | font-size: 2em; 72 | } 73 | .login-form { 74 | background: #2b2b36; 75 | position: relative; 76 | width: 30%; 77 | margin: 3% auto 0 auto; 78 | text-align: center; 79 | border-radius: 15px; 80 | -webkit-border-radius: 15px; 81 | -moz-border-radius: 15px; 82 | -o-border-radius: 15px; 83 | } 84 | .head img { 85 | width: 100%; 86 | } 87 | .avtar img { 88 | margin: 2em 0 0; 89 | } 90 | .head-info { 91 | padding: 5px 0; 92 | text-align: center; 93 | font-weight: 600; 94 | font-size: 2em; 95 | color: #fff; 96 | background: #23232e; 97 | height: 50px; 98 | border-top-left-radius: 10px; 99 | -webkit-border-top-left-radius: 10px; 100 | -moz-border-top-left-radius: 10px; 101 | -o-border-top-left-radius: 10px; 102 | border-top-right-radius: 10px; 103 | -webkit-border-top-right-radius: 10px; 104 | -moz-border-top-right-radius: 10px; 105 | -o-border-top-right-radius: 10p 106 | } 107 | input[type="text"] { 108 | width: 70%; 109 | padding: 1em 2em 1em 3em; 110 | color: #9199aa; 111 | font-size: 18px; 112 | outline: none; 113 | background: url(../img/adm.png) no-repeat 10px 15px; 114 | border: none; 115 | font-weight: 100; 116 | border-bottom: 1px solid#484856; 117 | margin-top: 2em; 118 | } 119 | input[type="password"]{ 120 | width: 70%; 121 | padding: 1em 2em 1em 3em; 122 | color: #dd3e3e; 123 | font-size: 18px; 124 | outline: none; 125 | background: url(../img/key.png) no-repeat 10px 23px; 126 | border: none; 127 | font-weight: 100; 128 | border-bottom: 1px solid#484856; 129 | margin-bottom: 3em; 130 | } 131 | input[type="submit"]{ 132 | font-size: 30px; 133 | color: #fff; 134 | outline: none; 135 | border: none; 136 | background: #3ea751; 137 | width: 100%; 138 | padding: 18px 0; 139 | border-bottom-left-radius: 15px; 140 | -webkit-border-bottom-left-radius: 15px; 141 | -moz-border-bottom-left-radius: 15px; 142 | -o-border-bottom-left-radius: 15px; 143 | border-bottom-right-radius: 15px; 144 | -webkit-border-bottom-right-radius: 15px; 145 | -moz-border-bottom-right-radius: 15px; 146 | -o-border-bottom-right-radius: 15px; 147 | cursor: pointer; 148 | } 149 | input[type="submit"]:hover { 150 | background: #ff2775; 151 | border-bottom-left-radius: 15px; 152 | -webkit-border-bottom-left-radius: 15px; 153 | -moz-border-bottom-left-radius: 15px; 154 | -o-border-bottom-left-radius: 15px; 155 | border-bottom-right-radius: 15px; 156 | -webkit-border-bottom-right-radius: 15px; 157 | -moz-border-bottom-right-radius: 15px; 158 | -o-border-bottom-right-radius: 15px; 159 | transition: 1s all; 160 | -webkit-transition: 1s all; 161 | -moz-transition: 1s all; 162 | -o-transition: 1s all; 163 | } 164 | label.lbl-1 { 165 | background: #6756ea; 166 | width: 20px; 167 | height: 20px; 168 | display: block; 169 | float: right; 170 | border-radius: 50%; 171 | margin: 16px 10px 0px 0px; 172 | } 173 | label.lbl-2 { 174 | background: #ea569a; 175 | width: 20px; 176 | height: 20px; 177 | display: block; 178 | float: right; 179 | border-radius: 50%; 180 | margin: 16px 10px 0px 0px; 181 | } 182 | label.lbl-3 { 183 | background: #f1c85f; 184 | width: 20px; 185 | height: 20px; 186 | display: block; 187 | float: right; 188 | border-radius: 50%; 189 | margin: 16px 10px 0px 0px; 190 | } 191 | /*--copyrights--*/ 192 | .copy-rights{ 193 | text-align: center; 194 | margin-top: 8em; 195 | } 196 | .copy-rights p{ 197 | color:#FFF; 198 | font-size: 1em; 199 | line-height:1.8em; 200 | } 201 | .copy-rights p a{ 202 | color:#ff2a75; 203 | -webkit-transition: all 0.3s ease-out; 204 | -moz-transition: all 0.3s ease-out; 205 | -ms-transition: all 0.3s ease-out; 206 | -o-transition: all 0.3s ease-out; 207 | transition: all 0.3s ease-out; 208 | text-decoration:none; 209 | } 210 | .copy-rights p a:hover{ 211 | color:#3faa53; 212 | text-decoration:none; 213 | transition: 0.1s all; 214 | -webkit-transition: 0.1s all; 215 | -moz-transition: 0.1s all; 216 | -o-transition: 0.1s all; 217 | } 218 | /*--/copyrights--*/ 219 | /*--start-responsive-design--*/ 220 | @media (max-width:1440px){ 221 | body { 222 | min-height: 811px; 223 | } 224 | } 225 | @media (max-width:1366px){ 226 | .copy-rights { 227 | margin-top: 3em; 228 | } 229 | body { 230 | min-height: 680px; 231 | } 232 | } 233 | @media (max-width:1280px){ 234 | body { 235 | min-height: 711px; 236 | } 237 | .copy-rights { 238 | margin-top: 0.5em; 239 | } 240 | } 241 | @media (max-width:1024px){ 242 | .login-form { 243 | width: 37%; 244 | } 245 | .copy-rights { 246 | margin-top: 3em; 247 | } 248 | h1 { 249 | padding-top: 2em; 250 | } 251 | body { 252 | min-height: 675px; 253 | } 254 | } 255 | @media (max-width:768px){ 256 | .login-form { 257 | width: 50%; 258 | margin: 12% auto 0 auto; 259 | } 260 | body { 261 | min-height: 929px; 262 | } 263 | } 264 | @media (max-width:640px){ 265 | .login-form { 266 | width: 60%; 267 | margin: 20% auto 0 auto; 268 | } 269 | } 270 | @media (max-width:480px){ 271 | .login-form { 272 | width: 80%; 273 | } 274 | } 275 | @media (max-width:320px){ 276 | h1 { 277 | padding-top: 1em; 278 | font-size: 1.5em; 279 | } 280 | .login-form { 281 | width: 90%; 282 | margin: 10% auto 0 auto; 283 | } 284 | input[type="text"] { 285 | width: 62%; 286 | padding: 1.2em 2em .5em 2.5em; 287 | font-size: 17px; 288 | margin-top: .5em; 289 | } 290 | input[type="password"] { 291 | width: 62%; 292 | padding: 1.2em 2em .5em 2.5em; 293 | font-size: 17px; 294 | margin-top: .5em; 295 | margin-bottom: 2em; 296 | background: url(../img/key.png) no-repeat 8px 23px; 297 | } 298 | .avtar img { 299 | margin: 1.1em 0 0; 300 | } 301 | .head-info { 302 | height: 35px; 303 | } 304 | label.lbl-1 { 305 | margin: 8px 10px 0px 0px; 306 | } 307 | label.lbl-2 { 308 | margin: 8px 10px 0px 0px; 309 | } 310 | label.lbl-3 { 311 | margin: 8px 10px 0px 0px; 312 | } 313 | .close { 314 | left: 16px; 315 | top: 13px; 316 | } 317 | .copy-rights { 318 | margin-top: 2em; 319 | } 320 | body { 321 | min-height: 504px; 322 | } 323 | input[type="submit"] { 324 | font-size: 28px; 325 | padding: 10px 0; 326 | } 327 | } 328 | /*--end-responsive-design--*/ -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/adm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/adm.png -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/avtar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/avtar.png -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/bg1.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/bg2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/bg2.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/bg3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/bg3.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/bg4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/bg4.png -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/bg5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/bg5.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/close.png -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/default_head.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/default_head.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/key.png -------------------------------------------------------------------------------- /src/main/webapp/static/source/img/robot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengchuanqiang/WebChat/54bcb0d4c8bb8bf8ab94590e5e4cf79ebc8584ed/src/main/webapp/static/source/img/robot.jpg -------------------------------------------------------------------------------- /src/main/webapp/static/source/js/ai2.min.js: -------------------------------------------------------------------------------- 1 | var INFINITE=999999;var PD={A1:0,D2:1,D3:2,D4:3,A2:4,A3:5,A2_A2:6,A3_A3:7,D4_A3:8,D4_D4:9,A4:10,A5:11};var PV=[0,1,2,4,8,16,32,64,128,256,512,1024];var FS=[[0,0,"A1"],[1,5,"D2"],[1,5,"D3"],[1,5,"D4"],[3,10,"A2"],[3,15,"A3"],[4,30,"A2_A2"],[14,500,"A3_A3"],[18,1500,"D4_A3"],[19,2000,"D4_D4"],[20,2000,"A4"],[22,INFINITE,"A5"]];var LS=[[0,0,"A1"],[1,5,"D2"],[1,5,"D3"],[1,14000,"D4"],[3,10,"A2"],[3,1000,"A3"],[3,30,"A2_A2"],[13,1200,"A3_A3"],[15,15000,"D4_A3"],[16,20000,"D4_D4"],[17,20000,"A4"],[21,INFINITE]];function Brain(){var q=6;var k=10;var t;var n;var l,a;var b=false;var c=false;var e=false;this.setLevel=function(u){if(u==1){b=c=e=false}else{if(u==2){c=true;b=false;e=false}else{if(u==3){c=true;b=true;e=false}else{if(u==4){c=true;b=true;e=true}}}}};var d=function(y){var v=(t[y]>0)?1:-1;for(var w=-2;w<=2;++w){for(var u=-2;u<=2;++u){var x=y+w+u*(BS+2);if(x>=0&&x=0){n[x]+=v}}}};var p=function(C,x,N,M){var L=PD.A1;var E=1;var R=0,P=0;var w=0,v=0;for(var T=1;T<=4;++T){var O=C+(-T)*N+(-T)*M*(BS+2);if(t[O]<0){break}var z=t[O];if(z==x){R=w=-T;++E}else{if(z==0){w=-T}else{break}}}for(var T=1;T<=4;++T){var O=C+T*N+T*M*(BS+2);if(t[O]<0){break}var z=t[O];if(z==x){P=v=T;++E}else{if(z==0){v=T}else{break}}}var D=v-w+1;if(D>=5&&E>1){if(P-R>4){var K=0;var I,G;for(var T=R;T<=P-4;++T){var F=1,A,y;var B=true;for(var S=T;S<=T+4;++S){var O=C+S*N+S*M*(BS+2);if(t[O]==x){++F;if(B){y=A=S;B=false}else{y=S}}}if(A>0){A=0}if(y<0){y=0}if(F>K){K=F;I=A;G=y}else{if(F==K){if(y-A0){R=0}if(P<0){P=0}}var Q=P-R+1;var u=false;var J=C+(R-1)*N+(R-1)*M*(BS+2);var H=C+(P+1)*N+(P+1)*M*(BS+2);if(t[J]>=0&&t[H]>=0){u=(t[J]==0||t[J]==x)&&(t[H]==0||t[H]==x)}switch(E){case 5:L=PD.A5;break;case 4:L=(D>5&&Q==4&&u)?PD.A4:PD.D4;break;case 3:L=(D>5&&Q<=4&&u)?PD.A3:PD.D3;break;case 2:if(D>5){if(Q==2&&u){L=PD.A2}else{if(Q==3){L=PD.D2}}}break}}return L};var j=function(y,A){var C=new Array(12);for(var x=0;x<12;++x){C[x]=0}C[p(y,A,1,0)]++;C[p(y,A,0,1)]++;C[p(y,A,1,1)]++;C[p(y,A,1,-1)]++;var u=C[PD.A3];var B=C[PD.D4];if(C[PD.A2]>=2){C[PD.A2_A2]++}if(u>=2){C[PD.A3_A3]++}if(B>=2){C[PD.D4_D4]++}else{if(B>=1&&u>=1){C[PD.D4_A3]++}}var v=0;var z=0;for(var w=11;w>=0;--w){if(C[w]!=0){v|=PV[w];if(z==0){z=w}}}return[z,v]};var h=function(u){var v=function(x,w){for(var z=1;z<=4;++z){var y=u+z*x+z*w*(BS+2);if(y>=0&&y0){a[y]=j(y,1);l[y]=j(y,2)}else{a[y]=l[y]=-1}}}};v(1,0);v(-1,0);v(0,1);v(0,-1);v(1,1);v(-1,-1);v(1,-1);v(-1,1)};var g=function(v,w){var u=w[0]+w[1]*(BS+2);t[u]=v;a[u]=l[u]=-1;d(u);h(u)};var f=function(v){var u=v[0]+v[1]*(BS+2);t[u]=0;d(u);if(n[u]>0){a[u]=j(u,1);l[u]=j(u,2)}else{a[u]=l[u]=-1}h(u)};this.scan=function(A){t=A.getData();n=new Array(DS);l=new Array(DS);a=new Array(DS);for(var z=0;z0){d(w)}}}for(var u=1;u<=BS;++u){for(var B=1;B<=BS;++B){var w=u+B*(BS+2);var v=t[w];if(v==0&&n[w]>0){a[w]=j(w,1);l[w]=j(w,2)}}}return[n,a,l]};var m=function(J){var z=(J==BLACK)?a:l;var D=(J==BLACK)?l:a;var u=(J==BLACK);var w=-1;var F=[];var A={};var B=true;for(var G=1;G<=BS;++G){for(var E=1;E<=BS;++E){var C=G+E*(BS+2);if(z[C]!=-1&&D[C]!=-1){var I=FS[z[C][0]][0];var H=LS[D[C][0]][0];if(I<13&&u){++I}if(H<13&&(!u)){++H}var K=I>H?I:H;var v=[G,E];if(K>w){w=K;F=[v];A={};A[v]=I+H;B=(I>H)}else{if(K==w){F.push(v);A[v]=I+H}}}}}if(F.length>1){F.sort(function(y,x){var L=0.5;if(A[y]A[x]){deta=0.2}}return Math.random()-L})}return[w,F,B]};var r=function(z,A){var w=(z==BLACK)?l:a;var v=[];var u=A[0];var C=A[1];var B=function(y,x){for(var E=1;E<=4;++E){var H=u+E*y;var G=C+E*x;var D=H+G*(BS+2);if(t[D]<0){break}if(t[D]==0){var F=w[D][1];if(F&PV[PD.A5]){v=[[H,G]];return false}if(F&PV[PD.A4]){v.push([H,G])}}}return true};if(B(1,0)&&B(-1,0)&&B(0,1)&&B(0,-1)&&B(1,1)&&B(-1,-1)&&B(1,-1)&&B(-1,1)){}return v};var i=function(O,U,I,W){if(U>=q){return false}var S=(O==BLACK)?a:l;var V=(O==BLACK)?l:a;var R=[];var B=-1;var T=-1;var v=[];for(var F=1;F<=BS;++F){for(var D=1;D<=BS;++D){var C=F+D*(BS+2);if(S[C]!=-1){var M=S[C][1];if((M&PV[PD.D4])||(M&PV[PD.A4])||(M&PV[PD.A3])){R.push([F,D])}var G=FS[S[C][0]][0];var E=LS[V[C][0]][0];if(G>B){v=[F,D];B=G}if(E>T){T=E}}}}if(B>T&&B>=13){I.push(v);return true}else{if(B13){return false}}for(var Q=0;QH?J:H;if(w>6){continue}}g(O,A);var L=r(3-O,A);var K=false;var u;for(var P=0;PE?F:E;if(v>6){continue}}g(I,z);var w=r(3-I,z)[0];g(3-I,w);var G=o(I,M+1,D,z);f(w);f(z);if(G){D.push(z);return true}}return false};var s=function(A){var z=(A==BLACK)?a:l;var v=[];var C={};for(var u=1;u<=BS;++u){for(var D=1;D<=BS;++D){var w=u+D*(BS+2);if(z[w]!=-1&&n[w]>0){var B=z[w][0];if(B==PD.A2_A2||B==PD.A2||B==PD.D3||B==PD.A2){v.push([u,D])}}}}v.sort(function(E,x){var F=E[0]+E[1]*(BS+2);var y=x[0]+x[1]*(BS+2);return n[F]-n[y]});return v};this.findBestStep=function(y){var x=(new Date()).getTime();this.scan(y);var C=y.getPlayer();var F=m(C);var D=F[0];var w=F[1];var v=F[2];var B=[];while(c||b){var z;if(D>=18){B=w[0];break}z=[];if(c&&o(C,0,z)&&z.length>0){console.debug("VCF detected,result:"+z);B=z[z.length-1];break}z=[];if(c&&o(3-C,0,z)&&z.length>0){console.debug("VCF detected for opp,result:"+z);var E=false;var u;while(z.length>0&&!E){u=z.pop();console.debug("try to defend vcf at step:"+u);g(C,u);if(!o(3-C,0,[])){B=u;if(!i(3-C,0,[])){E=true}}f(u)}if(B.length==0){B=w[0]}break}if(D>=14){B=w[0];break}z=[];if(b&&i(C,0,z)&&z.length>0){console.debug("VCT detected,result:"+z);B=z[z.length-1];break}z=[];if(b&&i(3-C,0,z)&&z.length>0){console.debug("VCT detected for opp,result:"+z);var E=false;while(z.length>0&&!E){B=z.pop();console.debug("try to defend vct at step:"+B);g(C,B);if(!i(3-C,0,[])){E=true}f(B)}if(!E){B=w[0]}break}if(e){z=s(BLACK);var E=false;while(z.length>0&&!E&&(((new Date()).getTime()-x)<=5000)){var u=z.pop();g(BLACK,u);if(o(BLACK,0,[])||i(BLACK,0,[])){console.debug("VC2 detected,step:"+u);B=u;E=true}f(u)}}break}if(B.length==0){if(w.length>1){var A=Math.floor((Math.random()*w.length));B=w[A]}else{B=w[0]}}x=(new Date()).getTime()-x;console.debug("best step:"+B+" ,costs:"+x+" ms");return B}}; -------------------------------------------------------------------------------- /src/main/webapp/static/source/js/board.js: -------------------------------------------------------------------------------- 1 | var BS = 15; //BOARD SIZE 2 | var BT = 17; 3 | var DS = 289; //17*17 4 | var CENTER = 8; 5 | var BLACK = 1; 6 | var WHITE = 2; 7 | var BORDER = -1; 8 | 9 | function pos(x,y){ 10 | return x+y*17; 11 | } 12 | 13 | function Board(){ 14 | var data = new Array(DS); 15 | var currentPlayer = 0; 16 | var history = []; 17 | 18 | var trogglePlayer = function(){ 19 | currentPlayer = 3 - currentPlayer; 20 | }; 21 | 22 | this.init = function(){ 23 | for(var i=0;iBS || y<1 || y>BS){ 52 | break; 53 | } 54 | if(data[pos(x,y)]==chess){ 55 | ++result; 56 | } 57 | else{ 58 | break; 59 | } 60 | } 61 | return result; 62 | }; 63 | 64 | this.isGameOver = function(){ 65 | if(history.length>0){ 66 | var chess = (history.length%2==1)?WHITE:BLACK; 67 | var laststep = history[history.length-1]; 68 | var x = laststep[0]; 69 | var y = laststep[1]; 70 | if(check(x,y,1,0,chess)+check(x,y,-1,0,chess)>=4){ 71 | return chess; 72 | } 73 | if(check(x,y,0,1,chess)+check(x,y,0,-1,chess)>=4){ 74 | return chess; 75 | } 76 | if(check(x,y,1,1,chess)+check(x,y,-1,-1,chess)>=4){ 77 | return chess; 78 | } 79 | if(check(x,y,1,-1,chess)+check(x,y,-1,1,chess)>=4){ 80 | return chess; 81 | } 82 | } 83 | for(var i=0;i0){ 107 | var step = history.pop(); 108 | data[pos(step[0],step[1])] = 0; 109 | currentPlayer = (history.length%2==1)?BLACK:WHITE; 110 | return true; 111 | } 112 | return false; 113 | }; 114 | 115 | this.getHistory = function(){ 116 | return history.slice(0); 117 | } 118 | 119 | this.getData = function(){ 120 | return data.slice(0); 121 | } 122 | 123 | this.init(); 124 | } 125 | --------------------------------------------------------------------------------