├── src ├── main │ ├── resources │ │ ├── application.properties │ │ ├── static │ │ │ ├── yunba-2.1.2 │ │ │ │ ├── .gitignore │ │ │ │ ├── .travis.yml │ │ │ │ ├── test │ │ │ │ │ └── 2.x │ │ │ │ │ │ ├── _config.js │ │ │ │ │ │ ├── connect.js │ │ │ │ │ │ ├── connect_by_customid.js │ │ │ │ │ │ └── init.js │ │ │ │ ├── package.json │ │ │ │ └── README.md │ │ │ ├── test.png │ │ │ ├── images │ │ │ │ ├── ad.jpg │ │ │ │ ├── face │ │ │ │ │ ├── 0.gif │ │ │ │ │ ├── 1.gif │ │ │ │ │ ├── 2.gif │ │ │ │ │ ├── 3.gif │ │ │ │ │ ├── 4.gif │ │ │ │ │ ├── 5.gif │ │ │ │ │ ├── 6.gif │ │ │ │ │ ├── 7.gif │ │ │ │ │ ├── 8.gif │ │ │ │ │ ├── 9.gif │ │ │ │ │ ├── 10.gif │ │ │ │ │ ├── 11.gif │ │ │ │ │ ├── 12.gif │ │ │ │ │ ├── 13.gif │ │ │ │ │ ├── 14.gif │ │ │ │ │ ├── 15.gif │ │ │ │ │ ├── 16.gif │ │ │ │ │ ├── 17.gif │ │ │ │ │ ├── 18.gif │ │ │ │ │ ├── 19.gif │ │ │ │ │ ├── 20.gif │ │ │ │ │ ├── 21.gif │ │ │ │ │ ├── 22.gif │ │ │ │ │ ├── 23.gif │ │ │ │ │ ├── 24.gif │ │ │ │ │ ├── 25.gif │ │ │ │ │ ├── 26.gif │ │ │ │ │ ├── 27.gif │ │ │ │ │ ├── 28.gif │ │ │ │ │ ├── 29.gif │ │ │ │ │ ├── 30.gif │ │ │ │ │ ├── 31.gif │ │ │ │ │ ├── 32.gif │ │ │ │ │ ├── 33.gif │ │ │ │ │ ├── 34.gif │ │ │ │ │ ├── 35.gif │ │ │ │ │ ├── 36.gif │ │ │ │ │ ├── 37.gif │ │ │ │ │ ├── 38.gif │ │ │ │ │ ├── 39.gif │ │ │ │ │ ├── 40.gif │ │ │ │ │ ├── 41.gif │ │ │ │ │ ├── 42.gif │ │ │ │ │ ├── 43.gif │ │ │ │ │ ├── 44.gif │ │ │ │ │ ├── 45.gif │ │ │ │ │ ├── 46.gif │ │ │ │ │ ├── 47.gif │ │ │ │ │ ├── 48.gif │ │ │ │ │ ├── 49.gif │ │ │ │ │ ├── 50.gif │ │ │ │ │ ├── 51.gif │ │ │ │ │ ├── 52.gif │ │ │ │ │ ├── 53.gif │ │ │ │ │ ├── 54.gif │ │ │ │ │ ├── 55.gif │ │ │ │ │ ├── 56.gif │ │ │ │ │ ├── 57.gif │ │ │ │ │ ├── 58.gif │ │ │ │ │ ├── 59.gif │ │ │ │ │ ├── 60.gif │ │ │ │ │ ├── 61.gif │ │ │ │ │ ├── 62.gif │ │ │ │ │ ├── 63.gif │ │ │ │ │ ├── 64.gif │ │ │ │ │ ├── 65.gif │ │ │ │ │ ├── 66.gif │ │ │ │ │ ├── 67.gif │ │ │ │ │ ├── 68.gif │ │ │ │ │ ├── 69.gif │ │ │ │ │ ├── 70.gif │ │ │ │ │ └── 71.gif │ │ │ │ ├── test.png │ │ │ │ ├── twad.jpg │ │ │ │ ├── testHead.jpg │ │ │ │ ├── very_sorry.png │ │ │ │ └── errorPage-manga-2.png │ │ │ ├── font │ │ │ │ ├── iconfont.eot │ │ │ │ ├── iconfont.ttf │ │ │ │ └── iconfont.woff │ │ │ ├── easyEditor │ │ │ │ ├── emoji │ │ │ │ │ ├── 1.gif │ │ │ │ │ ├── 2.gif │ │ │ │ │ ├── 3.gif │ │ │ │ │ ├── 4.gif │ │ │ │ │ ├── 5.gif │ │ │ │ │ ├── 6.gif │ │ │ │ │ ├── 7.gif │ │ │ │ │ ├── 8.gif │ │ │ │ │ ├── 9.gif │ │ │ │ │ ├── 10.gif │ │ │ │ │ ├── 11.gif │ │ │ │ │ ├── 12.gif │ │ │ │ │ ├── 13.gif │ │ │ │ │ ├── 14.gif │ │ │ │ │ ├── 15.gif │ │ │ │ │ ├── 16.gif │ │ │ │ │ ├── 17.gif │ │ │ │ │ ├── 18.gif │ │ │ │ │ ├── 19.gif │ │ │ │ │ ├── 20.gif │ │ │ │ │ ├── 21.gif │ │ │ │ │ ├── 22.gif │ │ │ │ │ ├── 23.gif │ │ │ │ │ ├── 24.gif │ │ │ │ │ ├── 25.gif │ │ │ │ │ ├── 26.gif │ │ │ │ │ └── 27.gif │ │ │ │ ├── www.jq22.com.txt │ │ │ │ ├── jquery插件库.url │ │ │ │ ├── css │ │ │ │ │ └── easyEditor.css │ │ │ │ ├── index.html │ │ │ │ └── js │ │ │ │ │ └── easyEditor.js │ │ │ ├── upLoad │ │ │ │ └── head-pic │ │ │ │ │ └── testHead.jpg │ │ │ ├── css │ │ │ │ ├── modules │ │ │ │ │ ├── layer │ │ │ │ │ │ └── default │ │ │ │ │ │ │ ├── icon.png │ │ │ │ │ │ │ ├── icon-ext.png │ │ │ │ │ │ │ ├── loading-0.gif │ │ │ │ │ │ │ ├── loading-1.gif │ │ │ │ │ │ │ └── loading-2.gif │ │ │ │ │ ├── code.css │ │ │ │ │ └── laydate │ │ │ │ │ │ └── default │ │ │ │ │ │ └── laydate.css │ │ │ │ └── index.css │ │ │ ├── lay │ │ │ │ └── modules │ │ │ │ │ ├── code.js │ │ │ │ │ ├── laytpl.js │ │ │ │ │ ├── flow.js │ │ │ │ │ ├── util.js │ │ │ │ │ ├── tree.js │ │ │ │ │ ├── carousel.js │ │ │ │ │ ├── laypage.js │ │ │ │ │ ├── upload.js │ │ │ │ │ ├── element.js │ │ │ │ │ └── form.js │ │ │ └── layui.js │ │ ├── thread-config.properties │ │ ├── templates │ │ │ ├── error │ │ │ │ └── 404.html │ │ │ ├── live-show │ │ │ │ └── liveType.html │ │ │ ├── users-twitter │ │ │ │ ├── otherUserIngo.html │ │ │ │ └── userIngo.html │ │ │ └── common │ │ │ │ └── header.html │ │ └── application.yml │ └── java │ │ └── com │ │ └── zz │ │ ├── service │ │ ├── HitRecordService.java │ │ ├── SpiderService.java │ │ ├── LiveTypeService.java │ │ ├── UserFollowService.java │ │ ├── LiveShowService.java │ │ ├── impl │ │ │ ├── LiveTypeServiceImpl.java │ │ │ ├── HitRecordServiceImpl.java │ │ │ ├── UserFollowServiceImpl.java │ │ │ ├── UserServiceImpl.java │ │ │ ├── TwitterServiceImpl.java │ │ │ ├── SpiderServiceImpl.java │ │ │ └── LiveShowServiceImpl.java │ │ ├── TwitterService.java │ │ └── UserService.java │ │ ├── util │ │ ├── LiveSortUtil.java │ │ ├── ForHttpClient.java │ │ ├── PicShowUtil.java │ │ ├── ShowNumFormat.java │ │ └── CrowingLiveType.java │ │ ├── GatherTvApplication.java │ │ ├── controller │ │ ├── FocusErrorController.java │ │ ├── HitRecordController.java │ │ ├── MyFollowController.java │ │ ├── LiveController.java │ │ ├── TwitterController.java │ │ └── UserController.java │ │ ├── model │ │ ├── Result.java │ │ ├── Parameter.java │ │ ├── UserFollow.java │ │ ├── LiveType.java │ │ ├── Comment.java │ │ ├── HitRecord.java │ │ ├── User.java │ │ ├── LiveShow.java │ │ └── Twitter.java │ │ ├── mapper │ │ ├── HitRecordMapper.java │ │ ├── TypeMapper.java │ │ ├── CommentMapper.java │ │ ├── FollowMapper.java │ │ ├── UserMapper.java │ │ ├── LiveShowMapper.java │ │ └── TwitterMapper.java │ │ ├── thread │ │ └── SpiderThreadPool.java │ │ ├── provider │ │ └── LiveShowProvider.java │ │ └── config │ │ └── ThreadPoolConfig.java └── test │ └── java │ └── com │ └── zz │ └── GatherTvApplicationTests.java ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── README.md ├── .gitignore └── pom.xml /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/static/yunba-2.1.2/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules/ 3 | coverage/ 4 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gather-tv 2 | 直播的火热 3 | 相比喜欢的直播分布各个平台的要打开相应的网站,下载相应的软件 4 | 而做的这个直播聚合项目,集聚各大直播平台,很直观的在本平台查看大多数平台直播详情以及在本平台观看 5 | -------------------------------------------------------------------------------- /src/main/resources/static/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/test.png -------------------------------------------------------------------------------- /src/main/resources/static/images/ad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/ad.jpg -------------------------------------------------------------------------------- /src/main/resources/static/font/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/font/iconfont.eot -------------------------------------------------------------------------------- /src/main/resources/static/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/font/iconfont.ttf -------------------------------------------------------------------------------- /src/main/resources/static/images/face/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/0.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/1.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/2.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/3.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/4.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/5.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/6.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/7.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/8.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/9.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/test.png -------------------------------------------------------------------------------- /src/main/resources/static/images/twad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/twad.jpg -------------------------------------------------------------------------------- /src/main/resources/static/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/font/iconfont.woff -------------------------------------------------------------------------------- /src/main/resources/static/images/face/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/10.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/11.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/12.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/13.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/14.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/15.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/16.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/17.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/18.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/19.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/20.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/21.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/22.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/23.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/24.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/25.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/26.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/27.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/28.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/29.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/30.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/31.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/32.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/33.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/34.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/35.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/36.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/37.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/38.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/39.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/40.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/41.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/42.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/43.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/44.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/45.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/46.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/47.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/48.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/49.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/50.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/51.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/52.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/53.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/54.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/55.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/56.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/57.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/58.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/59.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/60.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/61.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/61.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/62.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/62.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/63.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/63.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/64.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/65.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/65.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/66.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/67.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/67.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/68.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/68.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/69.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/69.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/70.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/70.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/face/71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/face/71.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/testHead.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/testHead.jpg -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip 2 | -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/1.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/2.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/3.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/4.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/5.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/6.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/7.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/8.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/9.gif -------------------------------------------------------------------------------- /src/main/resources/static/images/very_sorry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/very_sorry.png -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/10.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/11.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/12.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/13.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/14.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/15.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/16.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/17.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/18.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/19.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/20.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/21.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/22.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/23.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/24.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/25.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/26.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/emoji/27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/emoji/27.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/www.jq22.com.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/easyEditor/www.jq22.com.txt -------------------------------------------------------------------------------- /src/main/resources/static/images/errorPage-manga-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/images/errorPage-manga-2.png -------------------------------------------------------------------------------- /src/main/resources/static/upLoad/head-pic/testHead.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/upLoad/head-pic/testHead.jpg -------------------------------------------------------------------------------- /src/main/resources/thread-config.properties: -------------------------------------------------------------------------------- 1 | #线程池配置 2 | thread.corePoolSize=10 3 | thread.maxPoolSize=20 4 | thread.queueCapacity=100 5 | thread.keepAlive=20 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/resources/static/css/modules/layer/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/css/modules/layer/default/icon.png -------------------------------------------------------------------------------- /src/main/resources/static/css/modules/layer/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/css/modules/layer/default/icon-ext.png -------------------------------------------------------------------------------- /src/main/resources/static/css/modules/layer/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/css/modules/layer/default/loading-0.gif -------------------------------------------------------------------------------- /src/main/resources/static/css/modules/layer/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/css/modules/layer/default/loading-1.gif -------------------------------------------------------------------------------- /src/main/resources/static/css/modules/layer/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lethean-kun/gather-tv/HEAD/src/main/resources/static/css/modules/layer/default/loading-2.gif -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/jquery插件库.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=http://www.jq22.com/ 5 | IDList= 6 | HotKey=0 7 | -------------------------------------------------------------------------------- /src/main/resources/static/yunba-2.1.2/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - '4.5.0' 5 | sudo: false 6 | script: "npm run test" 7 | after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls" -------------------------------------------------------------------------------- /src/main/resources/static/yunba-2.1.2/test/2.x/_config.js: -------------------------------------------------------------------------------- 1 | var options = { 2 | server: 'http://sock.yunba.io', 3 | port: '3000', 4 | appkey: '52fcc04c4dc903d66d6f8f92' 5 | } 6 | module.exports = { 7 | options: options 8 | } -------------------------------------------------------------------------------- /src/main/java/com/zz/service/HitRecordService.java: -------------------------------------------------------------------------------- 1 | package com.zz.service; 2 | 3 | import com.zz.model.HitRecord; 4 | import com.zz.model.Twitter; 5 | 6 | public interface HitRecordService { 7 | 8 | Twitter UpdateHitRecord(HitRecord hitRecord); 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | 12 | ### IntelliJ IDEA ### 13 | .idea 14 | *.iws 15 | *.iml 16 | *.ipr 17 | 18 | ### NetBeans ### 19 | nbproject/private/ 20 | build/ 21 | nbbuild/ 22 | dist/ 23 | nbdist/ 24 | .nb-gradle/ -------------------------------------------------------------------------------- /src/main/java/com/zz/service/SpiderService.java: -------------------------------------------------------------------------------- 1 | package com.zz.service; 2 | 3 | 4 | /** 5 | * @author dzk 6 | * Created by lethean on 2017/12/22. 7 | */ 8 | public interface SpiderService { 9 | /** 10 | *抓取直播列表 11 | * @param 12 | * @return 13 | */ 14 | int forInsertLive() throws Exception; 15 | 16 | /** 17 | *抓取直播类型 18 | * @param 19 | * @return 20 | */ 21 | int forInsertType() throws Exception; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zz/util/LiveSortUtil.java: -------------------------------------------------------------------------------- 1 | package com.zz.util; 2 | 3 | import com.zz.model.LiveShow; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author dzk 9 | * Created by lethean on 2017/12/23. 10 | */ 11 | public class LiveSortUtil { 12 | 13 | /** 14 | * 对直播人数进行排序 15 | * @param liveShowList 16 | * @return 17 | */ 18 | public static List sortByLiveNum(List liveShowList){ 19 | 20 | 21 | 22 | return liveShowList; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zz/GatherTvApplication.java: -------------------------------------------------------------------------------- 1 | package com.zz; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | /** 8 | * @author dzk 9 | */ 10 | @EnableScheduling 11 | @SpringBootApplication 12 | public class GatherTvApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(GatherTvApplication.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/LiveTypeService.java: -------------------------------------------------------------------------------- 1 | package com.zz.service; 2 | 3 | import com.zz.model.LiveType; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @author dzk 9 | * Created by lethean on 2017/12/24. 10 | */ 11 | public interface LiveTypeService { 12 | 13 | /** 14 | * 查所有直播类型 15 | * @param 16 | * @return 17 | */ 18 | List getAllType(); 19 | 20 | /** 21 | * 热门直播类型 22 | * @param 23 | * @return 24 | */ 25 | List getCateType(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/zz/util/ForHttpClient.java: -------------------------------------------------------------------------------- 1 | package com.zz.util; 2 | 3 | import org.apache.http.impl.client.DefaultHttpClient; 4 | 5 | import org.apache.http.client.HttpClient; 6 | 7 | public class ForHttpClient { 8 | 9 | private static HttpClient httpClient; 10 | 11 | private ForHttpClient() { 12 | } 13 | 14 | public static HttpClient getHttpClientInstance() { 15 | 16 | if (httpClient == null) { 17 | httpClient = new DefaultHttpClient(); 18 | } 19 | 20 | return httpClient; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/UserFollowService.java: -------------------------------------------------------------------------------- 1 | package com.zz.service; 2 | 3 | import com.zz.model.LiveShow; 4 | import com.zz.model.UserFollow; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author dzk 10 | * Created by lethean on 2018/1/28. 11 | */ 12 | public interface UserFollowService { 13 | 14 | /** 15 | * 获取所有关注直播列表 16 | * @param id 用户id 17 | * @return 18 | */ 19 | List getFollowList(int id); 20 | 21 | /** 22 | * 关注或取消 23 | * @param userFollow 24 | * @return 25 | */ 26 | int forMyFollow(UserFollow userFollow); 27 | 28 | /** 29 | * 是否关注 30 | * @param userFollow 31 | * @return 32 | */ 33 | int isMyFollow(UserFollow userFollow); 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/com/zz/GatherTvApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.zz; 2 | 3 | import com.zz.mapper.TwitterMapper; 4 | import com.zz.service.SpiderService; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | import org.springframework.test.context.junit4.SpringRunner; 9 | 10 | import javax.annotation.Resource; 11 | 12 | @RunWith(SpringRunner.class) 13 | @SpringBootTest 14 | public class GatherTvApplicationTests { 15 | 16 | @Resource 17 | TwitterMapper twitterMapper; 18 | 19 | @Resource 20 | SpiderService spiderService; 21 | 22 | @Test 23 | public void contextLoads() throws Exception { 24 | spiderService.forInsertLive(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/zz/controller/FocusErrorController.java: -------------------------------------------------------------------------------- 1 | package com.zz.controller; 2 | 3 | import org.springframework.boot.autoconfigure.web.ErrorController; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | 7 | /** 8 | * @author dzk 9 | * Created by lethean on 2018/2/28. 10 | */ 11 | @Controller 12 | public class FocusErrorController implements ErrorController{ 13 | 14 | private static final String ERROR_PATH = "/error"; 15 | 16 | @RequestMapping(value=ERROR_PATH) 17 | public String handleError(){ 18 | return "error/404"; 19 | } 20 | 21 | 22 | 23 | @Override 24 | public String getErrorPath() { 25 | return ERROR_PATH; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/LiveShowService.java: -------------------------------------------------------------------------------- 1 | package com.zz.service; 2 | 3 | import com.zz.model.LiveShow; 4 | import com.zz.model.Parameter; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author dzk 10 | * Created by lethean on 2017/12/23. 11 | */ 12 | public interface LiveShowService { 13 | 14 | /** 15 | * 获取所有直播列表 16 | * 17 | * @param parameter 包括搜索 类型等 18 | * @return 19 | */ 20 | List getLiveList(Parameter parameter); 21 | 22 | /** 23 | * 分页获取直播列表 24 | * 25 | * @param parameter 26 | * @return 27 | */ 28 | List getLiveListByPage(Parameter parameter); 29 | 30 | /** 31 | * 获取直播详情 32 | * 33 | * @param id room_id 34 | * @return 35 | */ 36 | LiveShow getLiveDetail(int id); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/zz/model/Result.java: -------------------------------------------------------------------------------- 1 | package com.zz.model; 2 | 3 | /** 4 | * @author dzk 5 | * Created by lethean on 2017/12/31. 6 | */ 7 | public class Result { 8 | //状态 9 | private int status; 10 | //信息 11 | private String message; 12 | //数据 13 | private Object data; 14 | 15 | public int getStatus() { 16 | return status; 17 | } 18 | 19 | public void setStatus(int status) { 20 | this.status = status; 21 | } 22 | 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | public void setMessage(String message) { 28 | this.message = message; 29 | } 30 | 31 | public Object getData() { 32 | return data; 33 | } 34 | 35 | public void setData(Object data) { 36 | this.data = data; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/resources/static/yunba-2.1.2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yunba-javascript-sdk", 3 | "version": "2.0.3", 4 | "description": "javascript sdk for yunba.io services", 5 | "main": "yunba-js-sdk.js", 6 | "directories": { 7 | "example": "examples", 8 | "test": "test" 9 | }, 10 | "scripts": { 11 | "test": "istanbul cover _mocha -- -R spec -t 60000 test/2.x" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/yunba/yunba-javascript-sdk" 16 | }, 17 | "keywords": [ 18 | "yunba", 19 | "javascript", 20 | "sdk" 21 | ], 22 | "bugs": { 23 | "url": "https://github.com/yunba/yunba-javascript-sdk/issues" 24 | }, 25 | "homepage": "https://github.com/yunba/yunba-javascript-sdk", 26 | "devDependencies": { 27 | "chai": "~3.5.0", 28 | "mocha": "~3.0.2", 29 | "istanbul": "~0.4.5", 30 | "socket.io-client": "~0.9.16" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/impl/LiveTypeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zz.service.impl; 2 | 3 | import com.zz.mapper.TypeMapper; 4 | import com.zz.model.LiveType; 5 | import com.zz.service.LiveTypeService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @author dzk 13 | * Created by lethean on 2017/12/24. 14 | */ 15 | @Service 16 | public class LiveTypeServiceImpl implements LiveTypeService { 17 | 18 | @Autowired 19 | TypeMapper typeMapper; 20 | 21 | @Override 22 | public List getAllType() { 23 | 24 | List liveTypes = typeMapper.getLiveTypes(); 25 | return liveTypes; 26 | } 27 | 28 | @Override 29 | public List getCateType() { 30 | 31 | List liveTypes = typeMapper.getCateTypes(); 32 | return liveTypes; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/impl/HitRecordServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zz.service.impl; 2 | 3 | import com.zz.mapper.HitRecordMapper; 4 | import com.zz.model.HitRecord; 5 | import com.zz.model.Twitter; 6 | import com.zz.service.HitRecordService; 7 | import com.zz.service.TwitterService; 8 | import org.springframework.stereotype.Service; 9 | 10 | import javax.annotation.Resource; 11 | 12 | @Service 13 | public class HitRecordServiceImpl implements HitRecordService { 14 | 15 | @Resource 16 | HitRecordMapper hitRecordMapper; 17 | 18 | @Resource 19 | TwitterService twitterService; 20 | 21 | @Override 22 | public Twitter UpdateHitRecord(HitRecord hitRecord) { 23 | if(hitRecord == null){ 24 | return null; 25 | } 26 | 27 | int status = hitRecordMapper.UpdateHitRecord(hitRecord); 28 | Twitter twitter = twitterService.getTwitter(hitRecord.getTwitterId()); 29 | 30 | return twitter; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/TwitterService.java: -------------------------------------------------------------------------------- 1 | package com.zz.service; 2 | 3 | import com.zz.model.Comment; 4 | import com.zz.model.Twitter; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author dzk 10 | * Created by lethean on 2018/3/5. 11 | */ 12 | public interface TwitterService { 13 | 14 | /** 15 | * 获取所有动态 16 | * @return 17 | */ 18 | List getAllTwitter(); 19 | 20 | /** 21 | * 获取用户动态 22 | * @param userId 23 | * @return 24 | */ 25 | List getUserTwitter(int userId); 26 | 27 | /** 28 | * 查询单个动态 29 | * @param twitterId 30 | * @return 31 | */ 32 | Twitter getTwitter(int twitterId); 33 | 34 | /** 35 | * 发布动态 36 | * @param twitter 37 | * @return 38 | */ 39 | int publishTwitter(Twitter twitter); 40 | 41 | /** 42 | * 评论 43 | * @param comment 44 | * @return 45 | */ 46 | int insertCommet(Comment comment); 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.zz.service; 2 | 3 | import com.zz.model.User; 4 | 5 | /** 6 | * @author dzk 7 | * Created by lethean on 2017/12/31. 8 | */ 9 | public interface UserService { 10 | 11 | /** 12 | * 用户注册 13 | * @param user 14 | * @return 15 | */ 16 | int register(User user); 17 | 18 | /** 19 | * 动态判断用户名是否可用 20 | * @param username 21 | * @return 22 | */ 23 | User getUserName(String username); 24 | 25 | /** 26 | * 用户登陆 27 | * @param user 28 | * @return 29 | */ 30 | int getUser(User user); 31 | 32 | /** 33 | * 获取user对象 34 | * @param user 35 | * @return 36 | */ 37 | User togetUser(User user); 38 | 39 | /** 40 | * 获取用户通过id 41 | * @param useriId 42 | * @return 43 | */ 44 | User getUserById(int useriId); 45 | /** 46 | * 更新用户头像 47 | * @return 48 | */ 49 | int updateUserHeadPic(User user); 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/zz/model/Parameter.java: -------------------------------------------------------------------------------- 1 | package com.zz.model; 2 | 3 | /** 4 | * @author dzk 5 | * Created by lethean on 2017/12/24. 6 | */ 7 | public class Parameter { 8 | 9 | private String type; 10 | private String keyWord; 11 | private int page; 12 | private int pageSize; 13 | 14 | public String getType() { 15 | return type; 16 | } 17 | 18 | public void setType(String type) { 19 | this.type = type; 20 | } 21 | 22 | public String getKeyWord() { 23 | return keyWord; 24 | } 25 | 26 | public void setKeyWord(String keyWord) { 27 | this.keyWord = keyWord; 28 | } 29 | 30 | public int getPage() { 31 | return page; 32 | } 33 | 34 | public void setPage(int page) { 35 | this.page = page; 36 | } 37 | 38 | public int getPageSize() { 39 | return pageSize; 40 | } 41 | 42 | public void setPageSize(int pageSize) { 43 | this.pageSize = pageSize; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/zz/model/UserFollow.java: -------------------------------------------------------------------------------- 1 | package com.zz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author dzk 7 | * Created by lethean on 2018/1/28. 8 | */ 9 | public class UserFollow implements Serializable{ 10 | 11 | private int id; 12 | private int userId; 13 | private int roomId; 14 | private int status; 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public int getUserId() { 25 | return userId; 26 | } 27 | 28 | public void setUserId(int userId) { 29 | this.userId = userId; 30 | } 31 | 32 | public int getRoomId() { 33 | return roomId; 34 | } 35 | 36 | public void setRoomId(int roomId) { 37 | this.roomId = roomId; 38 | } 39 | 40 | public int getStatus() { 41 | return status; 42 | } 43 | 44 | public void setStatus(int status) { 45 | this.status = status; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/resources/static/css/modules/code.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none} -------------------------------------------------------------------------------- /src/main/resources/templates/error/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 404 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 | -------------------------------------------------------------------------------- /src/main/resources/static/yunba-2.1.2/test/2.x/connect.js: -------------------------------------------------------------------------------- 1 | var expect = require('chai').expect; 2 | var Yunba = require('../../yunba-js-sdk.js'); 3 | var config = require('./_config.js'); 4 | var options = config.options; 5 | 6 | var client; 7 | 8 | before(function() { 9 | client = new Yunba(options); 10 | }); 11 | 12 | describe('#connect', function() { 13 | it('should success', function(done) { 14 | var called; 15 | client.init(function (success) { 16 | if (called) { 17 | return 18 | } 19 | called = true; 20 | if (success) { 21 | client.connect(function(success) { 22 | expect(success).to.be.true; 23 | done(); 24 | }); 25 | } else { 26 | throw 'init failed'; 27 | } 28 | }); 29 | }); 30 | }); 31 | 32 | after(function(done) { 33 | client.socket.on('disconnect', function() { 34 | done(); 35 | }); 36 | client.disconnect(); 37 | client.socket.disconnect(); 38 | }); -------------------------------------------------------------------------------- /src/main/java/com/zz/util/PicShowUtil.java: -------------------------------------------------------------------------------- 1 | package com.zz.util; 2 | 3 | import com.zz.model.Twitter; 4 | import org.jsoup.Jsoup; 5 | import org.jsoup.nodes.Document; 6 | import org.jsoup.nodes.Element; 7 | import org.jsoup.select.Elements; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public class PicShowUtil { 13 | 14 | public static List forThreePic(List twitters) { 15 | 16 | 17 | //筛选出三张图片下方显示 18 | for (Twitter twitter : twitters) { 19 | List imagesList = new ArrayList<>(); 20 | String blogInfo = twitter.getFeeling(); 21 | Document doc = Jsoup.parse(blogInfo); 22 | Elements jpgs = doc.select("img[src]"); // 查找图片 23 | for (int i = 0; i < jpgs.size(); i++) { 24 | Element jpg = jpgs.get(i); 25 | String temp = jpg.toString(); 26 | imagesList.add(temp); 27 | if (i == 2) { 28 | break; 29 | } 30 | } 31 | twitter.setImagesList(imagesList); 32 | } 33 | return twitters; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/css/easyEditor.css: -------------------------------------------------------------------------------- 1 | .easyEditor{ 2 | text-align: left; 3 | font-size:16px; 4 | line-height:24px; 5 | letter-spacing: 2px; 6 | outline: 0px; 7 | -webkit-user-select: auto; 8 | -moz-user-select: auto; 9 | -ms-user-select: auto; 10 | -o-user-select: auto; 11 | user-select: auto; 12 | overflow-y: auto; 13 | word-break: break-all; 14 | } 15 | .easyEditor img{ 16 | width:24px; 17 | margin: 0 5px; 18 | -webkit-user-select: none; 19 | -moz-user-select: none; 20 | -ms-user-select: none; 21 | -o-user-select: none; 22 | user-select: none; 23 | cursor: default; 24 | resize: none; 25 | vertical-align: middle; 26 | } 27 | .easyEditor input{ 28 | text-align: center; 29 | white-space: nowrap; 30 | overflow: hidden; 31 | border:0px; 32 | outline:0px; 33 | background-color:transparent; 34 | height:24px; 35 | line-height:24px; 36 | -webkit-user-select: none; 37 | -moz-user-select: none; 38 | -ms-user-select: none; 39 | -o-user-select: none; 40 | user-select: none; 41 | cursor: default; 42 | resize: none; 43 | } 44 | .easyEditor[contentEditable=true]:empty:not(:focus):before{ 45 | color:#aaa; 46 | content:attr(placeholder); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/resources/static/css/index.css: -------------------------------------------------------------------------------- 1 | .show{ 2 | width: 290px; 3 | height: 220px; 4 | background:white; 5 | } 6 | .layui-header li{ 7 | font-size: 20px; 8 | color:#23ade5; 9 | } 10 | .layui-nav layui-nav-tree{ 11 | text-align: center; 12 | } 13 | .layui-nav-tree .layui-nav-child dd.layui-this, .layui-nav-tree .layui-nav-child dd.layui-this a, .layui-nav-tree .layui-this, .layui-nav-tree .layui-this>a, .layui-nav-tree .layui-this>a:hover{ 14 | background-color: #23ade5; 15 | } 16 | .layui-form-onswitch{ 17 | border-color: #23ade5; 18 | background-color: #23ade5; 19 | } 20 | .button{ 21 | text-align: center; 22 | margin-top: 5px; 23 | 24 | } 25 | .e-button{ 26 | background-color: #23ade5; 27 | } 28 | .type-button{ 29 | background-color: #23ade5; 30 | } 31 | .room-video{ 32 | width: 75%; 33 | height: 40vw; 34 | float: left 35 | } 36 | .chat-list{ 37 | width: 20%; 38 | height: 40vw; 39 | float: left; 40 | background-color: white; 41 | margin-left: 20px 42 | } 43 | .js-game-list-item{ 44 | margin-left: 20px; 45 | margin-top:20px; 46 | float: left; 47 | width: 175px; 48 | height: 270px; 49 | 50 | } -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/code.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
  1. '+o.replace(/[\r\t\n]+/g,"
  2. ")+"
"),c.find(">.layui-code-h3")[0]||c.prepend('

'+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); -------------------------------------------------------------------------------- /src/main/resources/static/yunba-2.1.2/test/2.x/connect_by_customid.js: -------------------------------------------------------------------------------- 1 | var expect = require('chai').expect; 2 | var Yunba = require('../../yunba-js-sdk.js'); 3 | var config = require('./_config.js'); 4 | var options = config.options; 5 | 6 | var client; 7 | var customId = 'uid_customid_' + Math.random().toString().substr(-5); 8 | before(function() { 9 | client = new Yunba(options); 10 | }); 11 | 12 | describe('#connect_by_customid', function() { 13 | it('should success', function(done) { 14 | var called; 15 | client.init(function (success) { 16 | if (called) { 17 | return 18 | } 19 | called = true; 20 | if (success) { 21 | client.connect_by_customid(customId, function(success) { 22 | expect(success).to.be.true; 23 | done(); 24 | }); 25 | } else { 26 | throw 'init failed'; 27 | } 28 | }); 29 | }); 30 | }); 31 | 32 | after(function(done) { 33 | client.socket.on('disconnect', function() { 34 | done(); 35 | }); 36 | client.disconnect(); 37 | client.socket.disconnect(); 38 | }); -------------------------------------------------------------------------------- /src/main/java/com/zz/mapper/HitRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.zz.mapper; 2 | 3 | import com.zz.model.HitRecord; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | /** 9 | * @author dzk 10 | * Created by lethean on 2018/3/6. 11 | */ 12 | @Mapper 13 | public interface HitRecordMapper { 14 | 15 | /** 16 | * 获取文章点赞数 17 | * @param twitterId 18 | * @return 19 | */ 20 | @Select("SELECT count(*) FROM hit_record WHERE twitter_id=#{twitterId} and is_like = 2") 21 | int getLikeHit(int twitterId); 22 | 23 | /** 24 | * 获取文章点踩数 25 | * @param twitterId 26 | * @return 27 | */ 28 | @Select("SELECT count(*) FROM hit_record WHERE twitter_id=#{twitterId} and is_like = 1") 29 | int getDisLikeHit(int twitterId); 30 | 31 | /** 32 | * 点击赞或者踩 33 | * @param hitRecord 34 | * @return 35 | */ 36 | @Insert("INSERT INTO hit_record(user_id, twitter_id,hit_date,is_like) " + 37 | "VALUES(#{userId}, #{twitterId},now(),#{isLike})" + 38 | "ON DUPLICATE KEY UPDATE is_like= #{isLike}") 39 | int UpdateHitRecord(HitRecord hitRecord); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/zz/controller/HitRecordController.java: -------------------------------------------------------------------------------- 1 | package com.zz.controller; 2 | 3 | import com.zz.model.HitRecord; 4 | import com.zz.model.Result; 5 | import com.zz.model.Twitter; 6 | import com.zz.service.HitRecordService; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.ResponseBody; 12 | 13 | import javax.annotation.Resource; 14 | 15 | @Controller 16 | public class HitRecordController { 17 | 18 | private final Logger logger = LoggerFactory.getLogger(HitRecordController.class); 19 | 20 | @Resource 21 | HitRecordService hitRecordService; 22 | 23 | @RequestMapping("hitIt") 24 | @ResponseBody 25 | public Result hitIt(HitRecord hitRecord){ 26 | 27 | Result result = new Result(); 28 | Twitter twitter = hitRecordService.UpdateHitRecord(hitRecord); 29 | 30 | logger.info("点赞记录"+hitRecord); 31 | 32 | if(twitter!=null){ 33 | result.setStatus(1); 34 | result.setData(twitter); 35 | } 36 | result.setStatus(0); 37 | return result; 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/zz/mapper/TypeMapper.java: -------------------------------------------------------------------------------- 1 | package com.zz.mapper; 2 | 3 | import com.zz.model.LiveType; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @author dzk 12 | * Created by lethean on 2017/12/24. 13 | */ 14 | @Mapper 15 | public interface TypeMapper { 16 | 17 | /** 18 | * 爬取类型存入数据库 19 | * @param liveType 20 | * @return 21 | */ 22 | @Insert("INSERT INTO live_type(type_pic,type_name,msg_channel) " + 23 | "VALUES(#{typePic},#{typeName},#{msgChannel})") 24 | int insertType(LiveType liveType); 25 | 26 | 27 | /** 28 | * 获取所有分类 按火热度降序 29 | * @return 30 | */ 31 | @Select("SELECT id,type_pic as typePic,type_name as typeName,msg_channel as msgChannel " + 32 | "FROM live_type order by heat desc") 33 | List getLiveTypes(); 34 | 35 | /** 36 | * 获取热门分类 按火热度降序 37 | * @return 38 | */ 39 | @Select("SELECT id,type_pic as typePic,type_name as typeName,msg_channel as msgChannel " + 40 | "FROM live_type order by heat desc limit 0,10") 41 | List getCateTypes(); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/zz/model/LiveType.java: -------------------------------------------------------------------------------- 1 | package com.zz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author dzk 7 | * Created by lethean on 2017/12/24. 8 | */ 9 | public class LiveType implements Serializable{ 10 | 11 | private int id; 12 | private String typePic; 13 | private String typeName; 14 | private String msgChannel; 15 | private int heat; 16 | 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | public void setId(int id) { 22 | this.id = id; 23 | } 24 | 25 | public String getTypePic() { 26 | return typePic; 27 | } 28 | 29 | public void setTypePic(String typePic) { 30 | this.typePic = typePic; 31 | } 32 | 33 | public String getTypeName() { 34 | return typeName; 35 | } 36 | 37 | public void setTypeName(String typeName) { 38 | this.typeName = typeName; 39 | } 40 | 41 | public String getMsgChannel() { 42 | return msgChannel; 43 | } 44 | 45 | public void setMsgChannel(String msgChannel) { 46 | this.msgChannel = msgChannel; 47 | } 48 | 49 | public int getHeat() { 50 | return heat; 51 | } 52 | 53 | public void setHeat(int heat) { 54 | this.heat = heat; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/zz/util/ShowNumFormat.java: -------------------------------------------------------------------------------- 1 | package com.zz.util; 2 | 3 | import java.text.DecimalFormat; 4 | 5 | /** 6 | * @author dzk 7 | * Created by lethean on 2017/12/23. 8 | */ 9 | public class ShowNumFormat { 10 | 11 | public static String status = "万"; 12 | public static Double limt = 10000.0; 13 | 14 | public static String forGetCount(String showNum){ 15 | 16 | //如果带数字万则转化 17 | if(showNum.contains(status)){ 18 | String[] nums = showNum.split(status); 19 | Double num = Double.parseDouble(nums[0])*10000; 20 | showNum = String.valueOf(num); 21 | } 22 | return showNum; 23 | } 24 | 25 | public static String returnCount(String showNum){ 26 | 27 | //如果大于10000则转化为万显示 28 | if(Double.valueOf(showNum)>limt){ 29 | 30 | Double num = Double.parseDouble(showNum)/10000; 31 | DecimalFormat df = new DecimalFormat("#.0"); 32 | showNum = String.valueOf(df.format(num))+status; 33 | } 34 | return showNum; 35 | } 36 | 37 | public static void main(String[] args) { 38 | System.out.println(forGetCount("20000")); 39 | String s = "125555000.0"; 40 | System.out.println(returnCount(s)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/zz/model/Comment.java: -------------------------------------------------------------------------------- 1 | package com.zz.model; 2 | 3 | import java.util.Date; 4 | 5 | public class Comment { 6 | private int id; 7 | private int userId; 8 | private int twitterId; 9 | private String content; 10 | private Date date; 11 | private User user; 12 | 13 | public int getId() { 14 | return id; 15 | } 16 | 17 | public void setId(int id) { 18 | this.id = id; 19 | } 20 | 21 | public int getUserId() { 22 | return userId; 23 | } 24 | 25 | public void setUserId(int userId) { 26 | this.userId = userId; 27 | } 28 | 29 | public int getTwitterId() { 30 | return twitterId; 31 | } 32 | 33 | public void setTwitterId(int twitterId) { 34 | this.twitterId = twitterId; 35 | } 36 | 37 | public String getContent() { 38 | return content; 39 | } 40 | 41 | public void setContent(String content) { 42 | this.content = content; 43 | } 44 | 45 | public Date getDate() { 46 | return date; 47 | } 48 | 49 | public void setDate(Date date) { 50 | this.date = date; 51 | } 52 | 53 | public User getUser() { 54 | return user; 55 | } 56 | 57 | public void setUser(User user) { 58 | this.user = user; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/zz/thread/SpiderThreadPool.java: -------------------------------------------------------------------------------- 1 | package com.zz.thread; 2 | 3 | import com.zz.config.ThreadPoolConfig; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.scheduling.annotation.EnableAsync; 8 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 9 | import org.springframework.stereotype.Component; 10 | 11 | import java.util.concurrent.Executor; 12 | import java.util.concurrent.ThreadPoolExecutor; 13 | 14 | @Configuration 15 | @EnableAsync 16 | @Component 17 | public class SpiderThreadPool { 18 | 19 | 20 | @Autowired 21 | ThreadPoolConfig threadPoolConfig; 22 | 23 | @Bean 24 | public Executor getExecutor() { 25 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 26 | executor.setCorePoolSize(threadPoolConfig.getCorePoolSize()); 27 | executor.setMaxPoolSize(threadPoolConfig.getMaxPoolSize()); 28 | executor.setQueueCapacity(threadPoolConfig.getQueueCapacity()); 29 | executor.setThreadNamePrefix("Spider-pool--"); 30 | executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); 31 | executor.setKeepAliveSeconds(threadPoolConfig.getKeepAlive()); 32 | executor.initialize(); 33 | return executor; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/zz/provider/LiveShowProvider.java: -------------------------------------------------------------------------------- 1 | package com.zz.provider; 2 | 3 | import com.zz.model.LiveShow; 4 | 5 | import java.text.MessageFormat; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | 10 | /** 11 | * @author dzk 12 | * Created by lethean on 2018/1/29. 13 | */ 14 | public class LiveShowProvider { 15 | 16 | /** 17 | * 爬取的数据存入数据库 名称和平台相同则更新 18 | * @param map 19 | * @return 20 | */ 21 | public String insertAll(Map map) { 22 | List users = (List) map.get("list"); 23 | StringBuilder sb = new StringBuilder(); 24 | sb.append("INSERT INTO live_show "); 25 | sb.append("(person_name, pic_url, type,live_title,show_num,msg_channel,live_url,is_show) "); 26 | sb.append("VALUES "); 27 | MessageFormat mf = new MessageFormat("(#'{'list[{0}].personName}, #'{'list[{0}].picUrl}, #'{'list[{0}].type}, #'{'list[{0}].liveTitle}, #'{'list[{0}].showNum}, #'{'list[{0}].msgChannel},#'{'list[{0}].liveUrl},1)"); 28 | for (int i = 0; i < users.size(); i++) { 29 | sb.append(mf.format(new Object[]{i})); 30 | if (i < users.size() - 1) { 31 | sb.append(","); 32 | } 33 | } 34 | sb.append("ON DUPLICATE KEY UPDATE pic_url = VALUES(pic_url),type = VALUES(type),live_title = VALUES(live_title),show_num = VALUES(show_num),is_show = 1"); 35 | return sb.toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/zz/mapper/CommentMapper.java: -------------------------------------------------------------------------------- 1 | package com.zz.mapper; 2 | 3 | import com.zz.model.Comment; 4 | import org.apache.ibatis.annotations.*; 5 | import org.apache.ibatis.mapping.FetchType; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author dzk 11 | * Created by lethean on 2018/3/6. 12 | */ 13 | @Mapper 14 | public interface CommentMapper { 15 | 16 | /** 17 | * 获取文章评论数 18 | * @param twitterId 19 | * @return 20 | */ 21 | @Select("SELECT count(*) FROM comment WHERE twitter_id=#{twitterId}") 22 | int getCommentCount(int twitterId); 23 | 24 | /** 25 | * 获取文章所有评论 26 | * @param twitterId 27 | * @return 28 | */ 29 | @Select("SELECT id,user_id,twitter_id as twitterId,content,comment_date as commentDate " + 30 | "FROM comment WHERE twitter_id=#{twitterId}") 31 | @Results({ 32 | @Result(column = "user_id",property = "userId"), 33 | @Result(column = "user_id",property = "user",one = @One( 34 | select = "com.zz.mapper.UserMapper.selectUserById", 35 | fetchType= FetchType.EAGER 36 | )) 37 | 38 | }) 39 | List selectCommentsByTwitter(int twitterId); 40 | 41 | /** 42 | * 评论 43 | * @param comment 44 | * @return 45 | */ 46 | @Insert("INSERT INTO comment(user_id,twitter_id,content,comment_date) values(#{userId},#{twitterId},#{content},now())") 47 | int insertComment(Comment comment); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/zz/mapper/FollowMapper.java: -------------------------------------------------------------------------------- 1 | package com.zz.mapper; 2 | 3 | import com.zz.model.LiveShow; 4 | import com.zz.model.UserFollow; 5 | import org.apache.ibatis.annotations.Insert; 6 | import org.apache.ibatis.annotations.Mapper; 7 | import org.apache.ibatis.annotations.Select; 8 | import org.apache.ibatis.annotations.Update; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author dzk 14 | * Created by lethean on 2018/1/28. 15 | */ 16 | @Mapper 17 | public interface FollowMapper { 18 | 19 | 20 | /** 21 | * 获取用户关注列表 22 | * @param id 23 | * @return 24 | */ 25 | @Select("SELECT id, person_name as personName, pic_url as picUrl, type,live_title as liveTitle,show_num as showNum,msg_channel as msgChannel,live_url as liveUrl " + 26 | "FROM live_show where is_show=1 and id in (select room_id from user_follow where status=1 and user_id = #{id})") 27 | List selectFollowLive(int id); 28 | 29 | /** 30 | * 点击关注 31 | * @param userFollow 32 | * @return 33 | */ 34 | @Insert("INSERT INTO user_follow(user_id, room_id) " + 35 | "VALUES(#{userId}, #{roomId})" + 36 | "ON DUPLICATE KEY UPDATE status= CASE when status=1 then 0 when status=0 then 1 END") 37 | int UpdateMyFollow(UserFollow userFollow); 38 | 39 | @Select("SELECT user_id as userId, room_id as roomId FROM user_follow WHERE user_id = #{userId} and room_id = #{roomId} and status=1") 40 | UserFollow isMyFollow(UserFollow userFollow); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/zz/config/ThreadPoolConfig.java: -------------------------------------------------------------------------------- 1 | package com.zz.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.PropertySource; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Configuration 9 | @ConfigurationProperties(prefix = "thread", ignoreUnknownFields = true) 10 | @PropertySource(value = "file:/data/config/thread-config.properties") 11 | @Component 12 | public class ThreadPoolConfig { 13 | 14 | private int corePoolSize; 15 | 16 | private int maxPoolSize; 17 | 18 | private int queueCapacity; 19 | 20 | private int keepAlive; 21 | 22 | public int getCorePoolSize() { 23 | return corePoolSize; 24 | } 25 | 26 | public void setCorePoolSize(int corePoolSize) { 27 | this.corePoolSize = corePoolSize; 28 | } 29 | 30 | public int getMaxPoolSize() { 31 | return maxPoolSize; 32 | } 33 | 34 | public void setMaxPoolSize(int maxPoolSize) { 35 | this.maxPoolSize = maxPoolSize; 36 | } 37 | 38 | public int getQueueCapacity() { 39 | return queueCapacity; 40 | } 41 | 42 | public void setQueueCapacity(int queueCapacity) { 43 | this.queueCapacity = queueCapacity; 44 | } 45 | 46 | public int getKeepAlive() { 47 | return keepAlive; 48 | } 49 | 50 | public void setKeepAlive(int keepAlive) { 51 | this.keepAlive = keepAlive; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/resources/templates/live-show/liveType.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 所有分类 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 |
13 | 14 |
15 |

16 |  全部分类

17 |
18 | 30 | 31 |
32 |
33 | 34 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/impl/UserFollowServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zz.service.impl; 2 | 3 | import com.zz.mapper.FollowMapper; 4 | import com.zz.model.LiveShow; 5 | import com.zz.model.UserFollow; 6 | import com.zz.service.UserFollowService; 7 | import com.zz.util.ShowNumFormat; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | /** 15 | * @author dzk 16 | * Created by lethean on 2018/1/28. 17 | */ 18 | @Service 19 | public class UserFollowServiceImpl implements UserFollowService{ 20 | 21 | @Autowired 22 | private FollowMapper followMapper; 23 | 24 | @Override 25 | public List getFollowList(int id) { 26 | List list = followMapper.selectFollowLive(id); 27 | if(list!=null) { 28 | //对list进行按观看人数降序排序 29 | Collections.sort(list); 30 | for (LiveShow liveShow : list) { 31 | liveShow.setShowNum(ShowNumFormat.returnCount(liveShow.getShowNum())); 32 | } 33 | } 34 | return list; 35 | } 36 | 37 | @Override 38 | public int forMyFollow(UserFollow userFollow) { 39 | followMapper.UpdateMyFollow(userFollow); 40 | return 1; 41 | } 42 | 43 | @Override 44 | public int isMyFollow(UserFollow userFollow) { 45 | int status = 0; 46 | UserFollow uf = followMapper.isMyFollow(userFollow); 47 | if(uf!=null){ 48 | status = 1; 49 | } 50 | return status; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/zz/model/HitRecord.java: -------------------------------------------------------------------------------- 1 | package com.zz.model; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * @author dzk 7 | * Created by lethean on 2018/3/6. 8 | */ 9 | public class HitRecord { 10 | private int id; 11 | private int userId; 12 | private int twitterId; 13 | private Date hitDate; 14 | /** 15 | * 0-大家当无事发生 16 | * 2-点了赞 17 | * 1-踩了一脚 18 | */ 19 | private int isLike; 20 | 21 | public int getId() { 22 | return id; 23 | } 24 | 25 | public void setId(int id) { 26 | this.id = id; 27 | } 28 | 29 | public int getUserId() { 30 | return userId; 31 | } 32 | 33 | public void setUserId(int userId) { 34 | this.userId = userId; 35 | } 36 | 37 | public int getTwitterId() { 38 | return twitterId; 39 | } 40 | 41 | public void setTwitterId(int twitterId) { 42 | this.twitterId = twitterId; 43 | } 44 | 45 | public Date getHitDate() { 46 | return hitDate; 47 | } 48 | 49 | public void setHitDate(Date hitDate) { 50 | this.hitDate = hitDate; 51 | } 52 | 53 | public int getIsLike() { 54 | return isLike; 55 | } 56 | 57 | public void setIsLike(int isLike) { 58 | this.isLike = isLike; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "HitRecord{" + 64 | "id=" + id + 65 | ", userId=" + userId + 66 | ", twitterId=" + twitterId + 67 | ", hitDate=" + hitDate + 68 | ", isLike=" + isLike + 69 | '}'; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zz.service.impl; 2 | 3 | import com.zz.mapper.UserMapper; 4 | import com.zz.model.User; 5 | import com.zz.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @author dzk 11 | * Created by lethean on 2017/12/31. 12 | */ 13 | @Service 14 | public class UserServiceImpl implements UserService{ 15 | 16 | @Autowired 17 | UserMapper userMapper; 18 | 19 | @Override 20 | public int register(User user) { 21 | int status = userMapper.insertUser(user); 22 | return status; 23 | } 24 | 25 | @Override 26 | public User getUserName(String username) { 27 | 28 | 29 | return userMapper.selectUserName(username); 30 | } 31 | 32 | @Override 33 | public int getUser(User user) { 34 | User cUser = userMapper.selectUser(user); 35 | 36 | if(cUser==null){ 37 | //用户不存在 38 | return 0; 39 | }else if(cUser.getPassword().equals(user.getPassword())){ 40 | //登陆成功 41 | return 1; 42 | } 43 | //密码错误 44 | return -1; 45 | } 46 | 47 | @Override 48 | public User togetUser(User user) { 49 | 50 | return userMapper.selectUser(user); 51 | } 52 | 53 | @Override 54 | public User getUserById(int useriId) { 55 | 56 | return userMapper.selectUserById(useriId); 57 | } 58 | 59 | @Override 60 | public int updateUserHeadPic(User user) { 61 | return userMapper.updateUserHeadPic(user); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | 4 | #pagehelper分页插件配置 5 | pagehelper: 6 | helper-dialect: mysql 7 | reasonable: true 8 | support-methods-arguments: true 9 | params: count=countSql 10 | spring: 11 | thymeleaf: 12 | mode: HTML5 13 | encoding: UTF-8 14 | content-type: text/html 15 | #开发时关闭缓存,不然没法看到实时页面 16 | cache: false 17 | 18 | datasource: 19 | name: test 20 | url: jdbc:mysql://localhost:3306/concentrate_tv?useUnicode=true&characterEncoding=UTF-8 21 | username: root 22 | password: 23 | 24 | type: com.alibaba.druid.pool.DruidDataSource 25 | driver-class-name: com.mysql.jdbc.Driver 26 | filters: stat 27 | maxActive: 20 28 | initialSize: 1 29 | maxWait: 60000 30 | minIdle: 1 31 | timeBetweenEvictionRunsMillis: 60000 32 | minEvictableIdleTimeMillis: 300000 33 | validationQuery: select 'x' 34 | testWhileIdle: true 35 | testOnBorrow: false 36 | testOnReturn: false 37 | poolPreparedStatements: true 38 | maxOpenPreparedStatements: 20 39 | #mybatis: 40 | # mapper-locations: classpath:mapping/*.xml 41 | # type-aliases-package: com.winter.model 42 | 43 | #头像上传目录 44 | web: 45 | upload-path: /static/upLoad/head-pic 46 | picupload-path: /static/upLoad/pic 47 | return-path: /upLoad/pic 48 | liveShow: 49 | hu-ya: 50 | name: 虎牙直播 51 | url: http://www.huya.com/l?areafib=1 52 | quan-min: 53 | name: 全民直播 54 | url: https://www.quanmin.tv/game/all 55 | zan-qi: 56 | name: 战旗直播 57 | url: http://www.zhanqi.tv/lives 58 | long-zhu: 59 | name: 龙珠直播 60 | url: http://longzhu.com/channels/all?from=rmlive 61 | -------------------------------------------------------------------------------- /src/main/java/com/zz/model/User.java: -------------------------------------------------------------------------------- 1 | package com.zz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author dzk 7 | * Created by lethean on 2017/12/31. 8 | */ 9 | public class User implements Serializable{ 10 | private int id; 11 | private String username; 12 | private String password; 13 | private String phone; 14 | private String email; 15 | private String headPic; 16 | private int status; 17 | 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | public String getUsername() { 27 | return username; 28 | } 29 | 30 | public void setUsername(String username) { 31 | this.username = username; 32 | } 33 | 34 | public String getPassword() { 35 | return password; 36 | } 37 | 38 | public void setPassword(String password) { 39 | this.password = password; 40 | } 41 | 42 | public String getPhone() { 43 | return phone; 44 | } 45 | 46 | public void setPhone(String phone) { 47 | this.phone = phone; 48 | } 49 | 50 | public String getEmail() { 51 | return email; 52 | } 53 | 54 | public void setEmail(String email) { 55 | this.email = email; 56 | } 57 | 58 | public String getHeadPic() { 59 | return headPic; 60 | } 61 | 62 | public void setHeadPic(String headPic) { 63 | this.headPic = headPic; 64 | } 65 | 66 | public int getStatus() { 67 | return status; 68 | } 69 | 70 | public void setStatus(int status) { 71 | this.status = status; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/zz/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.zz.mapper; 2 | 3 | import com.zz.model.User; 4 | import org.apache.ibatis.annotations.Insert; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.apache.ibatis.annotations.Update; 8 | 9 | /** 10 | * @author dzk 11 | * Created by lethean on 2017/12/31. 12 | */ 13 | @Mapper 14 | public interface UserMapper { 15 | 16 | 17 | /** 18 | * 注册插入数据库 19 | * @param user 20 | * @return 21 | */ 22 | @Insert("INSERT INTO user (nick_name,password,phone,email,head_pic) " + 23 | "VALUES(#{username},#{password},#{phone},#{email},'testHead.jpg')") 24 | int insertUser(User user); 25 | 26 | /** 27 | * 动态判断用户名是否可用 28 | * @param username 29 | * @return 30 | */ 31 | @Select("SELECT id,nick_name as username,phone,email " + 32 | "FROM user WHERE nick_name=#{username}") 33 | User selectUserName(String username); 34 | 35 | /** 36 | * 用户手机登陆 37 | * @param user 38 | * @return 39 | */ 40 | @Select("SELECT id,nick_name as username,password,phone,email,head_pic as headPic " + 41 | "FROM user WHERE phone=#{phone}") 42 | User selectUser(User user); 43 | 44 | 45 | @Select("SELECT id,nick_name as username,password,phone,email,head_pic as headPic " + 46 | "FROM user where id=#{userId}") 47 | User selectUserById(int userId); 48 | 49 | 50 | /** 51 | * 更新用户头像 (简单加了) 52 | * @param user 53 | * @return 54 | */ 55 | @Update("UPDATE user set head_pic = #{headPic} WHERE id = #{id}") 56 | int updateUserHeadPic(User user); 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/zz/controller/MyFollowController.java: -------------------------------------------------------------------------------- 1 | package com.zz.controller; 2 | 3 | import com.zz.model.Result; 4 | import com.zz.model.UserFollow; 5 | import com.zz.service.UserFollowService; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | 11 | import javax.annotation.Resource; 12 | import javax.servlet.http.HttpServletRequest; 13 | import java.util.List; 14 | 15 | /** 16 | * @author dzk 17 | * Created by lethean on 2018/1/28. 18 | */ 19 | @Controller 20 | public class MyFollowController { 21 | 22 | @Resource 23 | UserFollowService userFollowService; 24 | 25 | @RequestMapping("myFollow/{id}") 26 | public String myFollow(HttpServletRequest request, 27 | @PathVariable("id") int id){ 28 | List list = userFollowService.getFollowList(id); 29 | request.setAttribute("liveList",list); 30 | 31 | return "live-show/allLive"; 32 | } 33 | 34 | @ResponseBody 35 | @RequestMapping("subFollow") 36 | public void subFollow(HttpServletRequest request, 37 | UserFollow userFollow){ 38 | userFollowService.forMyFollow(userFollow); 39 | } 40 | 41 | @ResponseBody 42 | @RequestMapping("isMyFollow") 43 | public Result isMyFollow(HttpServletRequest request, 44 | UserFollow userFollow){ 45 | int status = userFollowService.isMyFollow(userFollow); 46 | Result result = new Result(); 47 | result.setStatus(status); 48 | return result; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/laytpl.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/flow.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)}); -------------------------------------------------------------------------------- /src/main/java/com/zz/util/CrowingLiveType.java: -------------------------------------------------------------------------------- 1 | package com.zz.util; 2 | 3 | import com.zz.model.LiveType; 4 | import com.zz.thread.ThreadCrowingLiveList; 5 | import org.apache.http.client.HttpClient; 6 | import org.apache.http.impl.client.DefaultHttpClient; 7 | import org.jsoup.Jsoup; 8 | import org.jsoup.nodes.Document; 9 | import org.jsoup.nodes.Element; 10 | import org.jsoup.select.Elements; 11 | import org.springframework.beans.factory.annotation.Value; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | /** 17 | * @author dzk 18 | * Created by lethean on 2017/12/24. 19 | */ 20 | public class CrowingLiveType { 21 | 22 | @Value("${liveShow.zan-qi.url}") 23 | private static String url; 24 | 25 | @Value("${liveShow.zan-qi.name}") 26 | private static String ZanQi; 27 | 28 | public static List getLiveTypes() throws Exception { 29 | 30 | HttpClient client = ForHttpClient.getHttpClientInstance(); 31 | //获取网站响应的html 32 | String html = ThreadCrowingLiveList.getRawHtml(client, url); 33 | List liveTypes = getData(html); 34 | 35 | return liveTypes; 36 | } 37 | 38 | public static List getData(String html) throws Exception { 39 | //获取的数据,存放在集合中 40 | List data = new ArrayList(); 41 | //采用Jsoup解析 42 | Document doc = Jsoup.parse(html); 43 | //获取html标签中的内容 44 | Elements elements = doc.select("ul[class=clearfix]").select("li[class=js-game-list-item]"); 45 | for (Element ele : elements) { 46 | String picurl = ele.select("a").select("div[class=img-box]").select("img").attr("src"); 47 | String type = ele.select("a").select("p[class=name]").text(); 48 | 49 | LiveType liveType = new LiveType(); 50 | //对象的值 51 | liveType.setTypeName(type); 52 | liveType.setTypePic(picurl); 53 | liveType.setMsgChannel(ZanQi); 54 | //将每一个对象的值,保存到List集合中 55 | data.add(liveType); 56 | } 57 | //返回数据 58 | return data; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/static/yunba-2.1.2/test/2.x/init.js: -------------------------------------------------------------------------------- 1 | var expect = require('chai').expect; 2 | var Yunba = require('../../yunba-js-sdk.js'); 3 | var config = require('./_config.js'); 4 | var options = config.options; 5 | var customId = 'uid_init_' + Math.random().toString().substr(-5); 6 | 7 | var client; 8 | describe('#init', function() { 9 | before(function() { 10 | client = new Yunba(options); 11 | }); 12 | it('should work', function(done) { 13 | var _initSuccess; 14 | var _connectSuccess; 15 | var _connectSessionId; 16 | var _reconnectCallbackCalled = 0; 17 | 18 | var check = function() { 19 | expect(_initSuccess).to.be.true; 20 | expect(_connectSuccess).to.be.true; 21 | expect(_connectSessionId).to.not.be.null; 22 | expect(_reconnectCallbackCalled).to.be.eq(1); 23 | done(); 24 | }; 25 | 26 | // 建立 socketio 连接 27 | var called; 28 | client.init(function (success) { 29 | // 成功连接回调 30 | if (called) { 31 | return; 32 | } 33 | called = true; 34 | _initSuccess = success; 35 | if (success) { 36 | client.connect_by_customid(customId, function(success, msg, sessionId) { 37 | _connectSuccess = success; 38 | _connectSessionId = sessionId; 39 | // trigger reconnect event 40 | // so the reconnect calback would be called 41 | client.socket.socket.reconnect(); 42 | client.socket.on('reconnect', function() { 43 | check(); 44 | }); 45 | }); 46 | } 47 | }, function () { 48 | // 当socketio 断开重连的时候执行的回调 49 | _reconnectCallbackCalled++; 50 | }); 51 | }); 52 | 53 | after(function(done) { 54 | client.socket.on('disconnect', function() { 55 | done(); 56 | }); 57 | client.disconnect(); 58 | client.socket.socket.disconnect(); 59 | }); 60 | }); 61 | 62 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/impl/TwitterServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zz.service.impl; 2 | 3 | import com.zz.mapper.CommentMapper; 4 | import com.zz.mapper.HitRecordMapper; 5 | import com.zz.mapper.TwitterMapper; 6 | import com.zz.model.Comment; 7 | import com.zz.model.Twitter; 8 | import com.zz.service.TwitterService; 9 | import org.springframework.stereotype.Service; 10 | 11 | import javax.annotation.Resource; 12 | import java.util.List; 13 | 14 | /** 15 | * @author dzk 16 | * Created by lethean on 2018/3/5. 17 | */ 18 | @Service 19 | public class TwitterServiceImpl implements TwitterService { 20 | 21 | 22 | @Resource 23 | private TwitterMapper twitterMapper; 24 | 25 | @Resource 26 | private HitRecordMapper hitRecordMapper; 27 | 28 | @Resource 29 | private CommentMapper commentMapper; 30 | 31 | @Override 32 | public List getAllTwitter() { 33 | 34 | List twitters = twitterMapper.allTwitter(); 35 | for (Twitter twitter : twitters) { 36 | twitter.setLikeHit(hitRecordMapper.getLikeHit(twitter.getId())); 37 | twitter.setDislikeHit(hitRecordMapper.getDisLikeHit(twitter.getId())); 38 | twitter.setReplyHit(commentMapper.getCommentCount(twitter.getId())); 39 | } 40 | return twitters; 41 | } 42 | 43 | @Override 44 | public List getUserTwitter(int userId) { 45 | 46 | return twitterMapper.userTwitters(userId); 47 | 48 | } 49 | 50 | @Override 51 | public Twitter getTwitter(int twitterId) { 52 | 53 | Twitter twitter = twitterMapper.getTwitter(twitterId); 54 | twitter.setLikeHit(hitRecordMapper.getLikeHit(twitter.getId())); 55 | twitter.setDislikeHit(hitRecordMapper.getDisLikeHit(twitter.getId())); 56 | twitter.setReplyHit(commentMapper.getCommentCount(twitter.getId())); 57 | return twitter; 58 | } 59 | 60 | @Override 61 | public int publishTwitter(Twitter twitter) { 62 | return twitterMapper.insertTwitter(twitter); 63 | } 64 | 65 | @Override 66 | public int insertCommet(Comment comment) { 67 | if (comment == null) { 68 | return 0; 69 | } 70 | return commentMapper.insertComment(comment); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/util.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var t=layui.$,i={fixbar:function(e){var i,o,a="layui-fixbar",r="layui-fixbar-top",n=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"":e.bar1,e.bar2=e.bar2===!0?"":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,""],g=t(['
    ',e.bar1?'
  • '+c[0]+"
  • ":"",e.bar2?'
  • '+c[1]+"
  • ":"",'
  • '+c[2]+"
  • ","
"].join("")),s=g.find("."+r),u=function(){var t=n.scrollTop();t>=e.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&g.css(e.css),l.append(g),u(),g.find("li").on("click",function(){var i=t(this),o=i.attr("lay-type");"top"===o&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,o)}),n.on("scroll",function(){clearTimeout(o),o=setTimeout(function(){u()},100)}))},countdown:function(e,t,i){var o=this,a="function"==typeof t,r=new Date(e).getTime(),n=new Date(!t||a?(new Date).getTime():t).getTime(),l=r-n,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var g=setTimeout(function(){o.countdown(e,n+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,g),l<=0&&clearTimeout(g),g},timeAgo:function(e,t){var i=this,o=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>6912e5?(a=new Date(e),o[0][0]=i.digit(a.getFullYear(),4),o[0][1]=i.digit(a.getMonth()+1),o[0][2]=i.digit(a.getDate()),t||(o[1][0]=i.digit(a.getHours()),o[1][1]=i.digit(a.getMinutes()),o[1][2]=i.digit(a.getSeconds())),o[0].join("-")+" "+o[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var o=e.length;o 43 | 44 | 45 | IE 46 | Safari 47 | Chrome 48 | Opera 49 | Firefox 50 | 51 | 52 | 7+ 53 | ✓ 54 | ✓ 55 | ✓ 56 | ✓ 57 | 58 | 59 | 60 | 61 | **IE 7以下版本支持** 62 | 63 | IE7 以下版本会报错对象不支持 "stringify" 属性或方法,在导入 socket.io.js 前导入 json2.js 即可解决。 64 | 65 | [https://github.com/douglascrockford/JSON-js](https://github.com/douglascrockford/JSON-js) 66 | 67 | ```javascript 68 | 71 | ``` 72 | 73 | ## 试用例子 74 | 75 | examples/yunba_javascript_demo_customid.html 演示了如何使用 Yunba JavaScript SDK。试用前先确保 Appkey 正确: 76 | 77 | ```javascript 78 | var yunba = new Yunba({appkey:'52fcc04c4dc903d66d6f8f92'}); 79 | ``` 80 | 81 | ** 替换为您的 Appkey ** 82 | 83 | 然后用浏览器打开即可。 84 | 85 | ## Test 86 | ``` 87 | npm install 88 | npm run test 89 | ``` 90 | 91 | -------------------------------------------------------------------------------- /src/main/java/com/zz/mapper/LiveShowMapper.java: -------------------------------------------------------------------------------- 1 | package com.zz.mapper; 2 | 3 | import com.zz.model.LiveShow; 4 | import com.zz.model.Parameter; 5 | import com.zz.provider.LiveShowProvider; 6 | import org.apache.ibatis.annotations.*; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @author dzk 12 | * Created by lethean on 2017/12/22. 13 | */ 14 | @Mapper 15 | public interface LiveShowMapper { 16 | 17 | /** 18 | * 获取所有直播列表 19 | * 20 | * @return 21 | */ 22 | @Select({""}) 30 | List getAllLive(Parameter parameter); 31 | 32 | /** 33 | * 分页获取所有直播列表 34 | * 35 | * @return 36 | */ 37 | @Select({""}) 45 | List getAllLiveByPage(Parameter parameter); 46 | 47 | /** 48 | * 获取直播详情 49 | * 50 | * @return 51 | */ 52 | @Select("SELECT id, person_name as personName, pic_url as picUrl, type,live_title as liveTitle,show_num as showNum,msg_channel as msgChannel,live_url as liveUrl " + 53 | "FROM live_show where id=#{id}") 54 | LiveShow getLiveDetail(int id); 55 | 56 | /** 57 | * 爬取数据存入数据库 名称和平台相同则更新 58 | * 59 | * @param liveShow 60 | * @return 61 | */ 62 | @Insert("INSERT INTO live_show(person_name, pic_url, type,live_title,show_num,msg_channel,live_url,is_show) " + 63 | "VALUES(#{personName}, #{picUrl}, #{type},#{liveTitle},#{showNum},#{msgChannel},#{liveUrl},1)" + 64 | "ON DUPLICATE KEY UPDATE pic_url=#{picUrl},show_num=#{showNum},type=#{type},live_title=#{liveTitle},is_show=1") 65 | int updateLive(LiveShow liveShow); 66 | 67 | /** 68 | * 爬取数据存入数据库 名称和平台相同则更新 69 | * 70 | * @param liveShows 71 | * @return 72 | */ 73 | @InsertProvider(type = LiveShowProvider.class, method = "insertAll") 74 | int newUpdateLive(@Param("list") List liveShows); 75 | 76 | /** 77 | * 每次抓取之前 类似心跳吧所有直播状态改为0(未播) 78 | * 79 | * @return 80 | */ 81 | @Update("update live_show set is_show=0") 82 | int updateLiveIsShow(); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/tree.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var o=layui.$,a=layui.hint(),i="layui-tree-enter",r=function(e){this.options=e},t={arrow:["",""],checkbox:["",""],radio:["",""],branch:["",""],leaf:""};r.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},r.prototype.tree=function(e,a){var i=this,r=i.options,n=a||r.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o('
    '),s=o(["
  • ",function(){return l?''+(n.spread?t.arrow[1]:t.arrow[0])+"":""}(),function(){return r.check?''+("checkbox"===r.check?t.checkbox[0]:"radio"===r.check?t.radio[0]:"")+"":""}(),function(){return'"+(''+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"")+(""+(n.name||"未命名")+"")}(),"
  • "].join(""));l&&(s.append(c),i.tree(c,n.children)),e.append(s),"function"==typeof r.click&&i.click(s,n),i.spread(s,n),r.drag&&i.drag(s,n)})},r.prototype.click=function(e,o){var a=this,i=a.options;e.children("a").on("click",function(e){layui.stope(e),i.click(o)})},r.prototype.spread=function(e,o){var a=this,i=(a.options,e.children(".layui-tree-spread")),r=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),r.removeClass("layui-show"),i.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),r.addClass("layui-show"),i.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};r[0]&&(i.on("click",l),n.on("dblclick",l))},r.prototype.on=function(e){var a=this,r=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),r.drag&&o(document).on("mousemove",function(e){var i=a.move;if(i.from){var r=(i.to,o('
    '));e.preventDefault(),o("."+t)[0]||o("body").append(r);var n=o("."+t)[0]?o("."+t):r;n.addClass("layui-show").html(i.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(i),e.to&&e.to.elem.children("a").removeClass(i),a.move={},o("."+t).remove())})},r.prototype.move={},r.prototype.drag=function(e,a){var r=this,t=(r.options,e.children("a")),n=function(){var t=o(this),n=r.move;n.from&&(n.to={item:a,elem:e},t.addClass(i))};t.on("mousedown",function(){var o=r.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=r.move;a.from&&(delete a.to,e.removeClass(i))})},e("tree",function(e){var i=new r(e=e||{}),t=o(e.elem);return t[0]?void i.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})}); -------------------------------------------------------------------------------- /src/main/java/com/zz/model/LiveShow.java: -------------------------------------------------------------------------------- 1 | package com.zz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author dzk 7 | * Created by lethean on 2017/12/22. 8 | */ 9 | public class LiveShow implements Comparable,Serializable { 10 | private int id; 11 | private String personName; 12 | private String picUrl; 13 | private String type; 14 | private String liveUrl; 15 | private String liveTitle; 16 | private String showNum; 17 | private String msgChannel; 18 | private int isShow; 19 | /** 20 | * 不同类别直播平台标识(1-虎牙龙珠、2-全民战旗) 21 | */ 22 | private int status; 23 | 24 | public int getId() { 25 | return id; 26 | } 27 | 28 | public void setId(int id) { 29 | this.id = id; 30 | } 31 | 32 | public String getPersonName() { 33 | return personName; 34 | } 35 | 36 | public void setPersonName(String personName) { 37 | this.personName = personName; 38 | } 39 | 40 | public String getPicUrl() { 41 | return picUrl; 42 | } 43 | 44 | public void setPicUrl(String picUrl) { 45 | this.picUrl = picUrl; 46 | } 47 | 48 | public String getType() { 49 | return type; 50 | } 51 | 52 | public void setType(String type) { 53 | this.type = type; 54 | } 55 | 56 | public String getLiveUrl() { 57 | return liveUrl; 58 | } 59 | 60 | public void setLiveUrl(String liveUrl) { 61 | this.liveUrl = liveUrl; 62 | } 63 | 64 | public String getLiveTitle() { 65 | return liveTitle; 66 | } 67 | 68 | public void setLiveTitle(String liveTitle) { 69 | this.liveTitle = liveTitle; 70 | } 71 | 72 | public String getShowNum() { 73 | return showNum; 74 | } 75 | 76 | public void setShowNum(String showNum) { 77 | this.showNum = showNum; 78 | } 79 | 80 | public String getMsgChannel() { 81 | return msgChannel; 82 | } 83 | 84 | public void setMsgChannel(String msgChannel) { 85 | this.msgChannel = msgChannel; 86 | } 87 | 88 | public int getIsShow() { 89 | return isShow; 90 | } 91 | 92 | public void setIsShow(int isShow) { 93 | this.isShow = isShow; 94 | } 95 | 96 | public int getStatus() { 97 | return status; 98 | } 99 | 100 | public void setStatus(int status) { 101 | this.status = status; 102 | } 103 | 104 | @Override 105 | public String toString() { 106 | return "LiveShow{" + 107 | "id=" + id + 108 | ", personName='" + personName + '\'' + 109 | ", picUrl='" + picUrl + '\'' + 110 | ", type='" + type + '\'' + 111 | ", liveUrl='" + liveUrl + '\'' + 112 | ", liveTitle='" + liveTitle + '\'' + 113 | ", showNum='" + showNum + '\'' + 114 | ", msgChannel='" + msgChannel + '\'' + 115 | '}'; 116 | } 117 | 118 | //重写排序方法 按直播人数降序 119 | @Override 120 | public int compareTo(LiveShow o) { 121 | if(Double.valueOf(this.getShowNum()) comments; 23 | private List imagesList; 24 | 25 | 26 | public int getId() { 27 | return id; 28 | } 29 | 30 | public void setId(int id) { 31 | this.id = id; 32 | } 33 | 34 | public int getUserId() { 35 | return userId; 36 | } 37 | 38 | public void setUserId(int userId) { 39 | this.userId = userId; 40 | } 41 | 42 | public String getFeeling() { 43 | return feeling; 44 | } 45 | 46 | public void setFeeling(String feeling) { 47 | this.feeling = feeling; 48 | } 49 | 50 | public Date getCreatData() { 51 | return creatData; 52 | } 53 | 54 | public void setCreatData(Date creatData) { 55 | this.creatData = creatData; 56 | } 57 | 58 | public Date getDeleteDate() { 59 | return deleteDate; 60 | } 61 | 62 | public void setDeleteDate(Date deleteDate) { 63 | this.deleteDate = deleteDate; 64 | } 65 | 66 | public int getLikeHit() { 67 | return likeHit; 68 | } 69 | 70 | public void setLikeHit(int likeHit) { 71 | this.likeHit = likeHit; 72 | } 73 | 74 | public int getDislikeHit() { 75 | return dislikeHit; 76 | } 77 | 78 | public void setDislikeHit(int dislikeHit) { 79 | this.dislikeHit = dislikeHit; 80 | } 81 | 82 | public int getReplyHit() { 83 | return replyHit; 84 | } 85 | 86 | public void setReplyHit(int replyHit) { 87 | this.replyHit = replyHit; 88 | } 89 | 90 | public User getUser() { 91 | return user; 92 | } 93 | 94 | public void setUser(User user) { 95 | this.user = user; 96 | } 97 | 98 | public List getComments() { 99 | return comments; 100 | } 101 | 102 | public void setComments(List comments) { 103 | this.comments = comments; 104 | } 105 | 106 | public List getImagesList() { 107 | return imagesList; 108 | } 109 | 110 | public void setImagesList(List imagesList) { 111 | this.imagesList = imagesList; 112 | } 113 | 114 | @Override 115 | public String toString() { 116 | return "Twitter{" + 117 | "id=" + id + 118 | ", userId=" + userId + 119 | ", feeling='" + feeling + '\'' + 120 | ", creatData=" + creatData + 121 | ", deleteDate=" + deleteDate + 122 | ", likeHit=" + likeHit + 123 | ", dislikeHit=" + dislikeHit + 124 | ", replyHit=" + replyHit + 125 | ", user=" + user.getUsername() + 126 | '}'; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/main/java/com/zz/controller/LiveController.java: -------------------------------------------------------------------------------- 1 | package com.zz.controller; 2 | 3 | import com.zz.model.LiveShow; 4 | import com.zz.model.LiveType; 5 | import com.zz.model.Parameter; 6 | import com.zz.model.Result; 7 | import com.zz.service.LiveShowService; 8 | import com.zz.service.LiveTypeService; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.web.bind.annotation.PathVariable; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.ResponseBody; 15 | 16 | import javax.annotation.Resource; 17 | import javax.servlet.http.HttpServletRequest; 18 | import java.util.List; 19 | 20 | /** 21 | * @author dzk 22 | * Created by lethean on 2017/12/21. 23 | */ 24 | @Controller 25 | public class LiveController { 26 | 27 | private final Logger logger = LoggerFactory.getLogger(LiveController.class); 28 | 29 | @Resource 30 | LiveShowService liveShowService; 31 | 32 | @Resource 33 | LiveTypeService liveTypeService; 34 | 35 | 36 | @RequestMapping("index") 37 | public String toIndex() { 38 | 39 | return "index"; 40 | } 41 | 42 | @RequestMapping("toLiveType") 43 | public String toLiveType(HttpServletRequest request) { 44 | List liveTypes = liveTypeService.getAllType(); 45 | request.setAttribute("liveTypes", liveTypes); 46 | 47 | return "live-show/liveType"; 48 | } 49 | 50 | @ResponseBody 51 | @RequestMapping("toCateType") 52 | public List toCateType() { 53 | 54 | List liveTypes = liveTypeService.getCateType(); 55 | 56 | return liveTypes; 57 | } 58 | 59 | //先前写法 已不用 60 | @ResponseBody 61 | @RequestMapping("getLiveList") 62 | public List getLiveList(Parameter parameter) { 63 | 64 | List list = liveShowService.getLiveList(parameter); 65 | 66 | return list; 67 | } 68 | 69 | @RequestMapping("toLiveList") 70 | public String toLiveList(HttpServletRequest request, 71 | Parameter parameter) { 72 | List list = liveShowService.getLiveList(parameter); 73 | request.setAttribute("liveList", list); 74 | 75 | return "live-show/allLive"; 76 | } 77 | 78 | @ResponseBody 79 | @RequestMapping("toLiveListByPg/{page}") 80 | public Result toLiveListByPg(HttpServletRequest request, 81 | @PathVariable int page, 82 | Parameter parameter) { 83 | Result result = new Result(); 84 | parameter.setPage(page); 85 | parameter.setPageSize(20); 86 | List list = liveShowService.getLiveListByPage(parameter); 87 | request.setAttribute("liveList", list); 88 | result.setData(list); 89 | return result; 90 | } 91 | 92 | @RequestMapping("liveDetail/{id}") 93 | public String liveDetail(@PathVariable("id") int id, 94 | HttpServletRequest request) { 95 | LiveShow liveShow = liveShowService.getLiveDetail(id); 96 | request.setAttribute("liveShow", liveShow); 97 | return "live-show/liveDetail"; 98 | } 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/carousel.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
      ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
    "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a>> futures = Sets.newHashSet(); 49 | //设置状态为未播 50 | liveShowMapper.updateLiveIsShow(); 51 | threadCrowingLiveList.getAllLiveShow().clear(); 52 | Long s = System.currentTimeMillis(); 53 | Future> hYList = threadCrowingLiveList.crowingHuya(); 54 | futures.add(hYList); 55 | Future> lZList = threadCrowingLiveList.crowingLongZhu(); 56 | futures.add(lZList); 57 | Future> ZQList = threadCrowingLiveList.crowingZanQi(); 58 | futures.add(ZQList); 59 | Future> QMList = threadCrowingLiveList.crowingQuanMin(); 60 | futures.add(QMList); 61 | //等待所有的爬虫线程执行完成 62 | boolean flag; 63 | while (true) { 64 | flag = true; 65 | Iterator>> isDoneIterator = futures.iterator(); 66 | while (isDoneIterator.hasNext()) { 67 | if (!isDoneIterator.next().isDone()) { 68 | flag = false; 69 | } 70 | } 71 | if (flag) { 72 | logger.info("批处理所有的线程执行完成..."); 73 | break; 74 | } 75 | } 76 | Long e = System.currentTimeMillis(); 77 | logger.info("线程爬取数据耗时耗时" + (e - s)); 78 | 79 | List liveShows = new ArrayList<>(); 80 | liveShows.addAll(threadCrowingLiveList.getAllLiveShow()); 81 | Long star = System.currentTimeMillis(); 82 | //未做成全部插入,虽然循环很消耗性能,日后再做 83 | // for(LiveShow liveShow:liveShows){ 84 | // liveShowMapper.updateLive(liveShow); 85 | // } 86 | //质的提升 相对于循环快了100多倍 87 | liveShowMapper.newUpdateLive(liveShows); 88 | Long end = System.currentTimeMillis(); 89 | logger.info("批量insert耗时" + (end - star)); 90 | logger.info("共爬到数据{},详细信息{}", liveShows.size(), liveShows.toString()); 91 | return 0; 92 | } 93 | 94 | 95 | @Override 96 | // @Scheduled(fixedRate = 50000000) 97 | public int forInsertType() throws Exception { 98 | List liveTypes = CrowingLiveType.getLiveTypes(); 99 | for (LiveType liveType : liveTypes) { 100 | typeMapper.insertType(liveType); 101 | } 102 | return 0; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/zz/mapper/TwitterMapper.java: -------------------------------------------------------------------------------- 1 | package com.zz.mapper; 2 | 3 | import com.zz.model.Twitter; 4 | import org.apache.ibatis.annotations.*; 5 | import org.apache.ibatis.mapping.FetchType; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author dzk 11 | * Created by lethean on 2018/3/5. 12 | */ 13 | @Mapper 14 | public interface TwitterMapper { 15 | 16 | 17 | /** 18 | * 发布动态 19 | * @param twitter 20 | * @return 21 | */ 22 | @Insert("INSERT INTO user_twitter(user_id,feeling,creat_date) VALUE(#{userId},#{feeling},now())") 23 | int insertTwitter(Twitter twitter); 24 | 25 | /** 26 | * 查询所有动态 27 | * @return 28 | */ 29 | @Select("SELECT id,user_id,feeling,creat_date as creatData,delete_date as deleteDate,like_hit as likeHit,dislike_hit as dislikeHit,reply_hit as replyHit " + 30 | "FROM user_twitter order by creat_date desc") 31 | @Results({ 32 | @Result(column = "user_id",property = "userId"), 33 | @Result(column = "user_id",property = "user",one = @One( 34 | select = "com.zz.mapper.UserMapper.selectUserById", 35 | fetchType= FetchType.EAGER 36 | )), 37 | @Result(column = "id",property = "id"), 38 | @Result(column = "id",property = "comments",many = @Many( 39 | select = "com.zz.mapper.CommentMapper.selectCommentsByTwitter", 40 | fetchType= FetchType.EAGER 41 | )) 42 | 43 | }) 44 | List allTwitter(); 45 | 46 | /** 47 | * 查询动态 48 | * @return 49 | */ 50 | @Select("SELECT id,user_id,feeling,creat_date as creatData,delete_date as deleteDate,like_hit as likeHit,dislike_hit as dislikeHit,reply_hit as replyHit " + 51 | "FROM user_twitter WHERE id=#{twitterId}") 52 | @Results({ 53 | @Result(column = "user_id",property = "userId"), 54 | @Result(column = "user_id",property = "user",one = @One( 55 | select = "com.zz.mapper.UserMapper.selectUserById", 56 | fetchType= FetchType.EAGER 57 | )) 58 | 59 | }) 60 | Twitter getTwitter(int twitterId); 61 | 62 | /** 63 | * 根据用户id查询用户发表的动态 64 | * @param userId 65 | * @return 66 | */ 67 | @Select("SELECT id,user_id,feeling,creat_date as creatData,delete_date as deleteDate,like_hit as likeHit,dislike_hit as dislikeHit,reply_hit as replyHit " + 68 | "FROM user_twitter WHERE user_id=#{userId} order by creat_date desc") 69 | @Results({ 70 | @Result(column = "user_id",property = "userId"), 71 | @Result(column = "user_id",property = "user",one = @One( 72 | select = "com.zz.mapper.UserMapper.selectUserById", 73 | fetchType= FetchType.EAGER 74 | )), 75 | @Result(column = "id",property = "id"), 76 | @Result(column = "id",property = "comments",many = @Many( 77 | select = "com.zz.mapper.CommentMapper.selectCommentsByTwitter", 78 | fetchType= FetchType.EAGER 79 | )) 80 | 81 | }) 82 | List userTwitters(int userId); 83 | 84 | /** 85 | * 点赞 86 | * @return 87 | */ 88 | @Update("UPDATE user_twitter SET like_hit = like_hit+1 WHERE id=#{twitterId}") 89 | int updateLikeHit(int twitterId); 90 | 91 | /** 92 | * 点踩 93 | * @return 94 | */ 95 | @Update("UPDATE user_twitter SET dislike_hit = dislike_hit+1 WHERE id=#{twitterId}") 96 | int updateDisLikeHit(int twitterId); 97 | 98 | /** 99 | * 回复 100 | * @return 101 | */ 102 | @Update("UPDATE user_twitter SET reply_hit = reply_hit+1 WHERE id=#{twitterId}") 103 | int updateReplyHit(int twitterId); 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/zz/service/impl/LiveShowServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zz.service.impl; 2 | 3 | import com.github.pagehelper.Page; 4 | import com.github.pagehelper.PageHelper; 5 | import com.zz.mapper.LiveShowMapper; 6 | import com.zz.model.LiveShow; 7 | import com.zz.model.Parameter; 8 | import com.zz.service.LiveShowService; 9 | import com.zz.util.ShowNumFormat; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.beans.factory.annotation.Value; 14 | import org.springframework.stereotype.Service; 15 | 16 | import java.util.Collections; 17 | import java.util.List; 18 | 19 | /** 20 | * @author dzk 21 | * Created by lethean on 2017/12/23. 22 | */ 23 | @Service 24 | public class LiveShowServiceImpl implements LiveShowService { 25 | 26 | private final Logger logger = LoggerFactory.getLogger(LiveShowServiceImpl.class); 27 | 28 | @Autowired 29 | LiveShowMapper liveShowMapper; 30 | 31 | @Value("${liveShow.hu-ya.name}") 32 | private String HuYa; 33 | 34 | @Value("${liveShow.quan-min.name}") 35 | private String QuanMin; 36 | 37 | @Value("${liveShow.zan-qi.name}") 38 | private String ZanQi; 39 | 40 | @Value("${liveShow.long-zhu.name}") 41 | private String LongZhu; 42 | 43 | @Override 44 | public List getLiveList(Parameter parameter) { 45 | List list = liveShowMapper.getAllLive(parameter); 46 | 47 | for (LiveShow liveShow : list) { 48 | liveShow.setShowNum(ShowNumFormat.returnCount(liveShow.getShowNum())); 49 | } 50 | return list; 51 | } 52 | 53 | @Override 54 | public List getLiveListByPage(Parameter parameter) { 55 | 56 | //使用分页插件,核心代码就这一行 57 | PageHelper.startPage(parameter.getPage(), parameter.getPageSize()); 58 | List list = liveShowMapper.getAllLiveByPage(parameter); 59 | for (LiveShow liveShow : list) { 60 | liveShow.setShowNum(ShowNumFormat.returnCount(liveShow.getShowNum())); 61 | } 62 | return list; 63 | } 64 | 65 | @Override 66 | public LiveShow getLiveDetail(int id) { 67 | LiveShow liveShow = liveShowMapper.getLiveDetail(id); 68 | //不同来源直播对应不同的处理 69 | if (liveShow.getMsgChannel().equals(HuYa)) { 70 | String[] str = liveShow.getLiveUrl().split("/"); 71 | String url = str[str.length - 1]; 72 | url = "http://liveshare.huya.com/" + url + "/huyacoop.swf"; 73 | logger.info("url为" + url); 74 | //不同类别直播平台标识(1-虎牙龙珠、2-全民战旗) 75 | liveShow.setStatus(1); 76 | liveShow.setLiveUrl(url); 77 | } else if (liveShow.getMsgChannel().equals(LongZhu)) { 78 | String[] str = liveShow.getLiveUrl().split("-"); 79 | String url = str[str.length - 1]; 80 | url = "http://r.plures.net/proton/flash/streaming-ifp2rgic.swf?autoPlay=1&roomId=" + url; 81 | logger.info("url为" + url); 82 | //不同类别直播平台标识(1-虎牙龙珠、2-全民战旗) 83 | liveShow.setStatus(1); 84 | liveShow.setLiveUrl(url); 85 | } else if (liveShow.getMsgChannel().equals(ZanQi)) { 86 | 87 | String url = "http://www.zhanqi.tv/live/embed?roomId=" + liveShow.getLiveUrl(); 88 | logger.info("url为" + url); 89 | //不同类别直播平台标识(1-虎牙龙珠、2-全民战旗) 90 | liveShow.setStatus(2); 91 | liveShow.setLiveUrl(url); 92 | } else if (liveShow.getMsgChannel().equals(QuanMin)) { 93 | //www.quanmin.tv/42416 94 | String[] str = liveShow.getLiveUrl().split("/"); 95 | String url = str[str.length - 1]; 96 | url = "http://www.quanmin.tv/embed/" + url; 97 | logger.info("url为" + url); 98 | //不同类别直播平台标识(1-虎牙龙珠、2-全民战旗) 99 | liveShow.setStatus(2); 100 | liveShow.setLiveUrl(url); 101 | } 102 | return liveShow; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/laypage.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),skip:function(){return['到第','','页',""].join("")}()};return['
    ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
    "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)}); -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.zz 7 | gather-tv 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | gather-tv 12 | Demo project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 1.5.9.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-jdbc 31 | 32 | 33 | org.mybatis.spring.boot 34 | mybatis-spring-boot-starter 35 | 1.3.1 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-web 40 | 41 | 42 | 43 | mysql 44 | mysql-connector-java 45 | runtime 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-starter-test 50 | test 51 | 52 | 53 | 54 | 55 | org.apache.httpcomponents 56 | httpclient 57 | 4.5.3 58 | 59 | 60 | 61 | 62 | org.jsoup 63 | jsoup 64 | 1.10.2 65 | 66 | 67 | 68 | com.alibaba 69 | druid 70 | 1.0.11 71 | 72 | 73 | 74 | 75 | com.alibaba 76 | druid-spring-boot-starter 77 | 1.1.0 78 | 79 | 80 | 81 | 82 | org.springframework.boot 83 | spring-boot-starter-thymeleaf 84 | 85 | 86 | 87 | 88 | com.alibaba 89 | fastjson 90 | 1.2.32 91 | 92 | 93 | com.google.collections 94 | google-collections 95 | 1.0 96 | 97 | 98 | 99 | 100 | com.github.pagehelper 101 | pagehelper-spring-boot-starter 102 | 1.2.2 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | org.springframework.boot 112 | spring-boot-maven-plugin 113 | 114 | 115 | org.codehaus.mojo 116 | cobertura-maven-plugin 117 | 2.7 118 | 119 | 120 | html 121 | xml 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | org.codehaus.mojo 132 | cobertura-maven-plugin 133 | 134 | 135 | html 136 | xml 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /src/main/java/com/zz/controller/TwitterController.java: -------------------------------------------------------------------------------- 1 | package com.zz.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.zz.model.Comment; 5 | import com.zz.model.Parameter; 6 | import com.zz.model.Result; 7 | import com.zz.model.Twitter; 8 | import com.zz.service.TwitterService; 9 | import com.zz.util.PicShowUtil; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | import org.springframework.beans.factory.annotation.Value; 13 | import org.springframework.stereotype.Controller; 14 | import org.springframework.util.ResourceUtils; 15 | import org.springframework.web.bind.annotation.PathVariable; 16 | import org.springframework.web.bind.annotation.RequestMapping; 17 | import org.springframework.web.bind.annotation.RequestParam; 18 | import org.springframework.web.bind.annotation.ResponseBody; 19 | import org.springframework.web.multipart.MultipartFile; 20 | import org.thymeleaf.util.StringUtils; 21 | 22 | import javax.annotation.Resource; 23 | import javax.servlet.http.HttpServletRequest; 24 | import javax.servlet.http.HttpServletResponse; 25 | import java.io.File; 26 | import java.io.IOException; 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | /** 31 | * @author dzk 32 | * Created by lethean on 2018/3/2. 33 | */ 34 | @Controller 35 | public class TwitterController { 36 | private final Logger logger = LoggerFactory.getLogger(TwitterController.class); 37 | 38 | @Resource 39 | TwitterService twitterService; 40 | 41 | @Value("${web.picupload-path}") 42 | private String picUploadPath; 43 | 44 | @Value("${web.return-path}") 45 | private String returnPath; 46 | 47 | @RequestMapping("toAllTwitter") 48 | public String toAllTwitter(HttpServletRequest request, 49 | Parameter parameter) { 50 | //所有用户动态 51 | List twitters = PicShowUtil.forThreePic(twitterService.getAllTwitter()); 52 | request.setAttribute("twitters", twitters); 53 | 54 | return "users-twitter/allTwitter"; 55 | } 56 | 57 | @RequestMapping("toUserTwitter/{userId}") 58 | public String toUserTwitter(HttpServletRequest request, 59 | @PathVariable int userId) { 60 | //用户的动态 61 | List twitters = PicShowUtil.forThreePic(twitterService.getUserTwitter(userId)); 62 | request.setAttribute("twitters", twitters); 63 | 64 | return "users-twitter/allTwitter"; 65 | } 66 | 67 | @RequestMapping("publishTwitter") 68 | public void publishTwitter(Twitter twitter, 69 | HttpServletResponse response) throws IOException { 70 | twitterService.publishTwitter(twitter); 71 | response.sendRedirect("/toAllTwitter"); 72 | } 73 | 74 | /** 75 | * 基于用户标识的头像上传 76 | * 77 | * @param file 图片 78 | * @return 79 | */ 80 | @ResponseBody 81 | @RequestMapping(value = "picUpload") 82 | public JSONObject picUpload(@RequestParam("file") MultipartFile file, 83 | HttpServletRequest request) throws Exception { 84 | 85 | // 获取图片的文件名 86 | String fileName = file.getOriginalFilename(); 87 | // 获取图片的扩展名 88 | String extensionName = StringUtils.substringAfter(fileName, "."); 89 | // 新的图片文件名 = 获取时间戳+"."图片扩展名 90 | String newFileName = String.valueOf(System.currentTimeMillis()) + "." + extensionName; 91 | 92 | // 文件路径 93 | File path = new File(ResourceUtils.getURL("classpath:").getPath()); 94 | //如果上传目录为/static/images/upload/,则可以如下获取: 95 | //File upload = new File(path.getAbsolutePath(),webUploadPath); 96 | //logger.info("upload url:"+upload.getAbsolutePath()); 97 | String filePath = path.getAbsolutePath() + picUploadPath; 98 | logger.info("上传图片路径" + filePath); 99 | 100 | File dest = new File(filePath, newFileName); 101 | if (!dest.getParentFile().exists()) { 102 | dest.getParentFile().mkdirs(); 103 | } 104 | 105 | JSONObject json = new JSONObject(); 106 | json.put("errno", 0); 107 | // 上传到指定目录 108 | file.transferTo(dest); 109 | 110 | List list = new ArrayList<>(); 111 | list.add(returnPath + "/" + newFileName); 112 | logger.info("返回地址为" + filePath); 113 | json.put("data", list); 114 | logger.info(json.toString()); 115 | return json; 116 | } 117 | 118 | @RequestMapping(value = "comment") 119 | @ResponseBody 120 | public Result comment(Comment comment) { 121 | Result result = new Result(); 122 | 123 | twitterService.insertCommet(comment); 124 | 125 | 126 | return result; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/main/resources/templates/users-twitter/otherUserIngo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 用户资料 5 | 6 | 7 | 8 |
    9 | 10 | 11 | 12 |
    14 |
    15 |
    16 |
    17 |
    18 |
    19 |
    20 |
    21 |
    22 |
    23 |
    24 |
    25 | 26 |

    27 |
    28 |
    29 |
    30 | 31 |
    32 | 34 |
    35 |
    36 |
    37 |
    38 |
    39 | 40 |
    41 | 43 |
    44 |
    45 |
    46 |
    47 |
    48 | 49 |
    50 | 52 |
    53 |
    54 |
    55 |
    56 |
    57 | 58 |
    59 |
    60 |
    61 |
    62 |
    63 |
    64 |
    65 | 66 |
    67 |
    68 | 69 |
    70 | 71 | 72 | 107 | -------------------------------------------------------------------------------- /src/main/resources/templates/common/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
    7 | 9 | 10 | 26 | 27 | 43 |
    44 |
    45 |
    46 |
    47 | 48 | 95 |
    96 |
    97 |
    98 | 99 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /src/main/resources/static/layui.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;!function(e){"use strict";var t=document,o={modules:{},status:{},timeout:10,event:{}},n=function(){this.v="2.2.45"},r=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,o=t.scripts,n=o.length-1,r=n;r>0;r--)if("interactive"===o[r].readyState){e=o[r].src;break}return e||o[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),i=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},a="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",tree:"modules/tree",table:"modules/table",element:"modules/element",util:"modules/util",flow:"modules/flow",carousel:"modules/carousel",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};n.prototype.cache=o,n.prototype.define=function(e,t){var n=this,r="function"==typeof e,i=function(){return"function"==typeof t&&t(function(e,t){layui[e]=t,o.status[e]=!0}),this};return r&&(t=e,e=[]),layui["layui.all"]||!layui["layui.all"]&&layui["layui.mobile"]?i.call(n):(n.use(e,i),n)},n.prototype.use=function(e,n,l){function s(e,t){var n="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||n.test((e.currentTarget||e.srcElement).readyState))&&(o.modules[f]=t,d.removeChild(v),function r(){return++m>1e3*o.timeout/4?i(f+" is not a valid module"):void(o.status[f]?c():setTimeout(r,4))}())}function c(){l.push(layui[f]),e.length>1?p.use(e.slice(1),n,l):"function"==typeof n&&n.apply(layui,l)}var p=this,y=o.dir=o.dir?o.dir:r,d=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(p.each(e,function(t,o){"jquery"===o&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var f=e[0],m=0;if(l=l||[],o.host=o.host||(y.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[f]||!layui["layui.all"]&&layui["layui.mobile"]&&u[f])return c(),p;if(o.modules[f])!function g(){return++m>1e3*o.timeout/4?i(f+" is not a valid module"):void("string"==typeof o.modules[f]&&o.status[f]?c():setTimeout(g,4))}();else{var v=t.createElement("script"),h=(u[f]?y+"lay/":/^\{\/\}/.test(p.modules[f])?"":o.base||"")+(p.modules[f]||f)+".js";h=h.replace(/^\{\/\}/,""),v.async=!0,v.charset="utf-8",v.src=h+function(){var e=o.version===!0?o.v||(new Date).getTime():o.version||"";return e?"?v="+e:""}(),d.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||a?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),o.modules[f]=h}return p},n.prototype.getStyle=function(t,o){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](o)},n.prototype.link=function(e,n,r){var a=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof n&&(r=n);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,p=0;return u.rel="stylesheet",u.href=e+(o.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof n?a:(function y(){return++p>1e3*o.timeout/100?i(e+" timeout"):void(1989===parseInt(a.getStyle(t.getElementById(c),"width"))?function(){n()}():setTimeout(y,100))}(),a)},n.prototype.addcss=function(e,t,n){return layui.link(o.dir+"css/"+e,t,n)},n.prototype.img=function(e,t,o){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,o(e)}))},n.prototype.config=function(e){e=e||{};for(var t in e)o[t]=e[t];return this},n.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),n.prototype.extend=function(e){var t=this;e=e||{};for(var o in e)t[o]||t.modules[o]?i("模块名 "+o+" 已被占用"):t.modules[o]=e[o];return t},n.prototype.router=function(e){var t=this,e=e||location.hash,o={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,"").replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),o.search[t[0]]=t[1]}():o.path.push(t)}),o):o},n.prototype.data=function(t,o){if(t=t||"layui",e.JSON&&e.JSON.parse){if(null===o)return delete localStorage[t];o="object"==typeof o?o:{key:o};try{var n=JSON.parse(localStorage[t])}catch(r){var n={}}return"value"in o&&(n[o.key]=o.value),o.remove&&delete n[o.key],localStorage[t]=JSON.stringify(n),o.key?n[o.key]:n}},n.prototype.device=function(t){var o=navigator.userAgent.toLowerCase(),n=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(o.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(o)?"windows":/linux/.test(o)?"linux":/iphone|ipod|ipad|ios/.test(o)?"ios":/mac/.test(o)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((o.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:n("micromessenger")};return t&&!r[t]&&(r[t]=n(t)),r.android=/android/.test(o),r.ios="ios"===r.os,r},n.prototype.hint=function(){return{error:i}},n.prototype.each=function(e,t){var o,n=this;if("function"!=typeof t)return n;if(e=e||[],e.constructor===Object){for(o in e)if(t.call(e[o],o,e[o]))break}else for(o=0;oi?1:r 2 | 3 | 4 | 用户资料 5 | 6 | 7 | 8 |
    9 | 10 | 11 | 12 |
    14 |
    15 |
    16 |
    17 |
    18 |
    19 |
    20 |
    21 |
    22 |
    23 |
    24 | 25 |
    26 | 27 |

    28 |
    29 |
    30 |
    31 | 32 |
    33 | 35 |
    36 |
    37 |
    38 |
    39 |
    40 | 41 |
    42 | 44 |
    45 |
    46 |
    47 |
    48 |
    49 | 50 |
    51 | 53 |
    54 |
    55 |
    56 |
    57 |
    58 | 59 |
    60 | 62 |
    63 |
    64 | 65 |
    66 |
    67 |
    68 | 71 | 72 |
    73 |
    74 |
    75 |
    76 |
    77 |
    78 |
    79 | 80 |
    81 |
    82 | 83 |
    84 | 85 | 86 | 124 | -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/upload.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("layer",function(e){"use strict";var i=layui.$,t=layui.layer,n=layui.hint(),a=layui.device(),o={config:{},set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,r,e,i)}},l=function(){var e=this;return{upload:function(i){e.upload.call(e,i)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var t=this;t.config=i.extend({},t.config,o.config,e),t.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var t=this,e=t.config;e.elem=i(e.elem),e.bindAction=i(e.bindAction),t.file(),t.events()},p.prototype.file=function(){var e=this,t=e.config,n=e.elemFile=i(['"].join("")),o=t.elem.next();(o.hasClass(u)||o.hasClass(c))&&o.remove(),a.ie&&a.ie<10&&t.elem.wrap('
    '),e.isFile()?(e.elemFile=t.elem,t.field=t.elem[0].name):t.elem.after(n),a.ie&&a.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,t=e.config,n=i(''),a=i(['
    ',"
    "].join(""));i("#"+f)[0]||i("body").append(n),t.elem.next().hasClass(f)||(e.elemFile.wrap(a),t.elem.next("."+f).append(function(){var e=[];return layui.each(t.data,function(i,t){e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return t.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var i=this;window.FileReader&&layui.each(i.chooseFiles,function(i,t){var n=new FileReader;n.readAsDataURL(t),n.onload=function(){e&&e(i,t,this.result)}})},p.prototype.upload=function(e,t){var n,o=this,l=o.config,r=o.elemFile[0],u=function(){var t=0,n=0,a=e||o.files||o.chooseFiles||r.files,u=function(){l.multiple&&t+n===o.fileLength&&"function"==typeof l.allDone&&l.allDone({total:o.fileLength,successful:t,aborted:n})};layui.each(a,function(e,a){var r=new FormData;r.append(l.field,a),layui.each(l.data,function(e,i){r.append(e,i)}),i.ajax({url:l.url,type:l.method,data:r,contentType:!1,processData:!1,dataType:"json",success:function(i){t++,d(e,i),u()},error:function(){n++,o.msg("请求上传接口出现异常"),m(e),u()}})})},c=function(){var e=i("#"+f);o.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var i,t=e.contents().find("body");try{i=t.text()}catch(n){o.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}i&&(clearInterval(p.timer),t.html(""),d(0,i))},30)},d=function(e,i){if(o.elemFile.next("."+s).remove(),r.value="","object"!=typeof i)try{i=JSON.parse(i)}catch(t){return i={},o.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(i,e||0,function(e){o.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){o.upload(e)})},h=l.exts,v=function(){var i=[];return layui.each(e||o.chooseFiles,function(e,t){i.push(t.name)}),i}(),g={preview:function(e){o.preview(e)},upload:function(e,i){var t={};t[e]=i,o.upload(t)},pushFile:function(){return o.files=o.files||{},layui.each(o.chooseFiles,function(e,i){o.files[e]=i}),o.files}},y=function(){return"choose"===t?l.choose&&l.choose(g):(l.before&&l.before(g),a.ie?a.ie>9?u():c():void u())};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return o.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return o.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return o.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,i){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(i))||(n=!0)}),n)return o.msg("选择的图片中包含不支持的格式"),r.value=""}if(o.fileLength=function(){var i=0,t=e||o.files||o.chooseFiles||r.files;return layui.each(t,function(){i++}),i}(),l.number&&o.fileLength>l.number)return o.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(a.ie&&a.ie<10)){var F;if(layui.each(o.chooseFiles,function(e,i){if(i.size>1024*l.size){var t=l.size/1024;t=t>=1?Math.floor(t)+(t%1>0?t.toFixed(1):0)+"MB":l.size+"KB",r.value="",F=t}}),F)return o.msg("文件不能超过"+F)}y()}},p.prototype.events=function(){var e=this,t=e.config,o=function(i){e.chooseFiles={},layui.each(i,function(i,t){var n=(new Date).getTime();e.chooseFiles[n+"-"+i]=t})},l=function(i,n){var a=e.elemFile,o=i.length>1?i.length+"个文件":(i[0]||{}).name||a[0].value.match(/[^\/\\]+\..+/g)||[]||"";a.next().hasClass(s)&&a.next().remove(),e.upload(null,"choose"),e.isFile()||t.choose||a.after(''+o+"")};t.elem.off("upload.start").on("upload.start",function(){var a=i(this),o=a.attr("lay-data");if(o)try{o=new Function("return "+o)(),e.config=i.extend({},t,o)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+o)}e.config.item=a,e.elemFile[0].click()}),a.ie&&a.ie<10||t.elem.off("upload.over").on("upload.over",function(){var e=i(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=i(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,a){var r=i(this),u=a.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),o(u),t.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var i=this.files||[];o(i),t.auto?e.upload():l(i)}),t.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),t.elem.data("haveEvents")||(e.elemFile.on("change",function(){i(this).trigger("upload.change")}),t.elem.on("click",function(){e.isFile()||i(this).trigger("upload.start")}),t.drag&&t.elem.on("dragover",function(e){e.preventDefault(),i(this).trigger("upload.over")}).on("dragleave",function(e){i(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),i(this).trigger("upload.drop",e)}),t.bindAction.on("click",function(){i(this).trigger("upload.action")}),t.elem.data("haveEvents",!0))},o.render=function(e){var i=new p(e);return l.call(i)},e(r,o)}); -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/element.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(i){"use strict";var t=layui.$,a=(layui.hint(),layui.device()),e="element",l="layui-this",n="layui-show",s=function(){this.config={}};s.prototype.set=function(i){var a=this;return t.extend(!0,a.config,i),a},s.prototype.on=function(i,t){return layui.onevent.call(this,e,i,t)},s.prototype.tabAdd=function(i,a){var e=".layui-tab-title",l=t(".layui-tab[lay-filter="+i+"]"),n=l.children(e),s=n.children(".layui-tab-bar"),o=l.children(".layui-tab-content"),c='
  • '+(a.title||"unnaming")+"
  • ";return s[0]?s.before(c):n.append(c),o.append('
    '+(a.content||"")+"
    "),y.hideTabMore(!0),y.tabAuto(),this},s.prototype.tabDelete=function(i,a){var e=".layui-tab-title",l=t(".layui-tab[lay-filter="+i+"]"),n=l.children(e),s=n.find('>li[lay-id="'+a+'"]');return y.tabDelete(null,s),this},s.prototype.tabChange=function(i,a){var e=".layui-tab-title",l=t(".layui-tab[lay-filter="+i+"]"),n=l.children(e),s=n.find('>li[lay-id="'+a+'"]');return y.tabClick(null,null,s),this},s.prototype.tab=function(i){i=i||{},v.on("click",i.headerElem,function(a){var e=t(this).index();y.tabClick.call(this,a,e,null,i)})},s.prototype.progress=function(i,a){var e="layui-progress",l=t("."+e+"[lay-filter="+i+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",a),s.text(a),this};var o=".layui-nav",c="layui-nav-item",r="layui-nav-bar",u="layui-nav-tree",d="layui-nav-child",h="layui-nav-more",f="layui-anim layui-anim-upbit",y={tabClick:function(i,a,s,o){o=o||{};var c=s||t(this),a=a||c.parent().children("li").index(c),r=o.headerElem?c.parent():c.parents(".layui-tab").eq(0),u=o.bodyElem?t(o.bodyElem):r.children(".layui-tab-content").children(".layui-tab-item"),d=c.find("a"),h=r.attr("lay-filter");"javascript:;"!==d.attr("href")&&"_blank"===d.attr("target")||(c.addClass(l).siblings().removeClass(l),u.eq(a).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+h+")",{elem:r,index:a})},tabDelete:function(i,a){var n=a||t(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),c=o.children(".layui-tab-content").children(".layui-tab-item"),r=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?y.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&y.tabClick.call(n.prev()[0],null,s-1)),n.remove(),c.eq(s).remove(),setTimeout(function(){y.tabAuto()},50),layui.event.call(this,e,"tabDelete("+r+")",{elem:o,index:s})},tabAuto:function(){var i="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;t(".layui-tab").each(function(){var s=t(this),o=s.children(".layui-tab-title"),c=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),r=t('');if(n===window&&8!=a.ie&&y.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var i=t(this);if(!i.find("."+l)[0]){var a=t('');a.on("click",y.tabDelete),i.append(a)}}),o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(r),s.attr("overflow",""),r.on("click",function(t){o[this.title?"removeClass":"addClass"](i),this.title=this.title?"":"收缩"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(i){var a=t(".layui-tab-title");i!==!0&&"tabmore"===t(i.target).attr("lay-stope")||(a.removeClass("layui-tab-more"),a.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var i=t(this),a=i.parents(o),n=a.attr("lay-filter"),s=i.find("a"),c="string"==typeof i.attr("lay-unselect");i.find("."+d)[0]||("javascript:;"!==s.attr("href")&&"_blank"===s.attr("target")||c||(a.find("."+l).removeClass(l),i.addClass(l)),layui.event.call(this,e,"nav("+n+")",i))},clickChild:function(){var i=t(this),a=i.parents(o),n=a.attr("lay-filter");a.find("."+l).removeClass(l),i.addClass(l),layui.event.call(this,e,"nav("+n+")",i)},showChild:function(){var i=t(this),a=i.parents(o),e=i.parent(),l=i.siblings("."+d);a.hasClass(u)&&(l.removeClass(f),e["none"===l.css("display")?"addClass":"removeClass"](c+"ed"))},collapse:function(){var i=t(this),a=i.find(".layui-colla-icon"),l=i.siblings(".layui-colla-content"),s=i.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),c="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var r=s.children(".layui-colla-item").children("."+n);r.siblings(".layui-colla-title").children(".layui-colla-icon").html(""),r.removeClass(n)}l[c?"addClass":"removeClass"](n),a.html(c?"":""),layui.event.call(this,e,"collapse("+o+")",{title:i,content:l,show:c})}};s.prototype.init=function(i,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){y.tabAuto.call({})},nav:function(){var i=200,e={},s={},p={},v=function(l,o,c){var r=t(this),y=r.find("."+d);o.hasClass(u)?l.css({top:r.position().top,height:r.children("a").height(),opacity:1}):(y.addClass(f),l.css({left:r.position().left+parseFloat(r.css("marginLeft")),top:r.position().top+r.height()-l.height()}),e[c]=setTimeout(function(){l.css({width:r.width(),opacity:1})},a.ie&&a.ie<10?0:i),clearTimeout(p[c]),"block"===y.css("display")&&clearTimeout(s[c]),s[c]=setTimeout(function(){y.addClass(n),r.find("."+h).addClass(h+"d")},300))};t(o+l).each(function(a){var l=t(this),o=t(''),f=l.find("."+c);l.find("."+r)[0]||(l.append(o),f.on("mouseenter",function(){v.call(this,o,l,a)}).on("mouseleave",function(){l.hasClass(u)||(clearTimeout(s[a]),s[a]=setTimeout(function(){l.find("."+d).removeClass(n),l.find("."+h).removeClass(h+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[a]),p[a]=setTimeout(function(){l.hasClass(u)?o.css({height:0,top:o.position().top+o.height()/2,opacity:0}):o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},i)})),f.each(function(){var i=t(this),a=i.find("."+d);if(a[0]&&!i.find("."+h)[0]){var e=i.children("a");e.append('')}i.off("click",y.clickThis).on("click",y.clickThis),i.children("a").off("click",y.showChild).on("click",y.showChild),a.children("dd").off("click",y.clickChild).on("click",y.clickChild)})})},breadcrumb:function(){var i=".layui-breadcrumb";t(i+l).each(function(){var i=t(this),a="lay-separator",e=i.attr(a)||"/",l=i.find("a");l.next("span["+a+"]")[0]||(l.each(function(i){i!==l.length-1&&t(this).after(""+e+"")}),i.css("visibility","visible"))})},progress:function(){var i="layui-progress";t("."+i+l).each(function(){var a=t(this),e=a.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),a.attr("lay-showPercent")&&setTimeout(function(){e.html(''+l+"")},350)})},collapse:function(){var i="layui-collapse";t("."+i+l).each(function(){var i=t(this).find(".layui-colla-item");i.each(function(){var i=t(this),a=i.find(".layui-colla-title"),e=i.find(".layui-colla-content"),l="none"===e.css("display");a.find(".layui-colla-icon").remove(),a.append(''+(l?"":"")+""),a.off("click",y.collapse).on("click",y.collapse)})})}};return s[i]?s[i]():layui.each(s,function(i,t){t()})},s.prototype.render=s.prototype.init;var p=new s,v=t(document);p.render();var b=".layui-tab-title li";v.on("click",b,y.tabClick),v.on("click",y.hideTabMore),t(window).on("resize",y.tabAuto),i(e,p)}); -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | easyEditor 7 | 8 | 9 | 102 | 103 | 104 | 105 |

    easyEditor

    106 |
    107 | 150 |
    151 | 152 | 251 | 252 | 253 | 254 | -------------------------------------------------------------------------------- /src/main/resources/static/css/modules/laydate/default/laydate.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | .laydate-set-ym,.layui-laydate,.layui-laydate *,.layui-laydate-list{box-sizing:border-box}html #layuicss-laydate{display:none;position:absolute;width:1989px}.layui-laydate *{margin:0;padding:0}.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit}.layui-laydate-main{width:272px}.layui-laydate-content td,.layui-laydate-header *,.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s}@-webkit-keyframes laydate-upbit{from{-webkit-transform:translate3d(0,20px,0);opacity:.3}to{-webkit-transform:translate3d(0,0,0);opacity:1}}@keyframes laydate-upbit{from{transform:translate3d(0,20px,0);opacity:.3}to{transform:translate3d(0,0,0);opacity:1}}.layui-laydate-static{position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none}.laydate-ym-show .laydate-next-m,.laydate-ym-show .laydate-prev-m{display:none!important}.laydate-ym-show .laydate-next-y,.laydate-ym-show .laydate-prev-y{display:inline-block!important}.laydate-time-show .laydate-set-ym span[lay-type=month],.laydate-time-show .laydate-set-ym span[lay-type=year],.laydate-time-show .layui-laydate-header .layui-icon,.laydate-ym-show .laydate-set-ym span[lay-type=month]{display:none!important}.layui-laydate-header{position:relative;line-height:30px;padding:10px 70px 5px}.laydate-set-ym span,.layui-laydate-header i{padding:0 5px;cursor:pointer}.layui-laydate-header *{display:inline-block;vertical-align:bottom}.layui-laydate-header i{position:absolute;top:10px;color:#999;font-size:18px}.layui-laydate-header i.laydate-prev-y{left:15px}.layui-laydate-header i.laydate-prev-m{left:45px}.layui-laydate-header i.laydate-next-y{right:15px}.layui-laydate-header i.laydate-next-m{right:45px}.laydate-set-ym{width:100%;text-align:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.laydate-time-text{cursor:default!important}.layui-laydate-content{position:relative;padding:10px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.layui-laydate-content table{border-collapse:collapse;border-spacing:0}.layui-laydate-content td,.layui-laydate-content th{width:36px;height:30px;padding:5px;text-align:center}.layui-laydate-content td{position:relative;cursor:pointer}.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden}.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%}.layui-laydate-footer{position:relative;height:46px;line-height:26px;padding:10px 20px}.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px}.layui-laydate-footer span:hover{color:#5FB878}.laydate-footer-btns{position:absolute;right:10px;top:10px}.laydate-footer-btns span{height:26px;line-height:26px;margin:0 0 0 -1px;padding:0 10px;border:1px solid #C9C9C9;background-color:#fff;white-space:nowrap;vertical-align:top;border-radius:2px}.layui-laydate-list>li,.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle}.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;background-color:#fff}.layui-laydate-list>li{position:relative;width:33.3%;height:36px;line-height:36px;margin:3px 0;text-align:center;cursor:pointer}.laydate-month-list>li{width:25%;margin:17px 0}.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default}.laydate-time-list p{position:relative;top:-4px;line-height:29px}.laydate-time-list ol{height:181px;overflow:hidden}.laydate-time-list>li:hover ol{overflow-y:auto}.laydate-time-list ol li{width:130%;padding-left:33px;line-height:30px;text-align:left;cursor:pointer}.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px}.layui-laydate-range{width:546px}.layui-laydate-range .laydate-main-list-0 .laydate-next-m,.layui-laydate-range .laydate-main-list-0 .laydate-next-y,.layui-laydate-range .laydate-main-list-1 .laydate-prev-m,.layui-laydate-range .laydate-main-list-1 .laydate-prev-y{display:none}.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2}.layui-laydate,.layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);background-color:#fff;color:#666}.layui-laydate-header{border-bottom:1px solid #e2e2e2}.layui-laydate-header i:hover,.layui-laydate-header span:hover{color:#5FB878}.layui-laydate-content{border-top:none 0;border-bottom:none 0}.layui-laydate-content th{font-weight:400;color:#333}.layui-laydate-content td{color:#666}.layui-laydate-content td.laydate-selected{background-color:#00F7DE}.laydate-selected:hover{background-color:#00F7DE!important}.layui-laydate-content td:hover,.layui-laydate-list li:hover{background-color:#eaeaea;color:#333}.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0}.laydate-time-list li:first-child ol{border-left-width:1px}.laydate-time-list>li:hover{background:0 0}.layui-laydate-content .laydate-day-next,.layui-laydate-content .laydate-day-prev{color:#d2d2d2}.laydate-selected.laydate-day-next,.laydate-selected.laydate-day-prev{background-color:#f8f8f8!important}.layui-laydate-footer{border-top:1px solid #e2e2e2}.layui-laydate-hint{color:#FF5722}.laydate-day-mark::after{background-color:#5FB878}.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none}.layui-laydate-footer span[lay-type=date]{color:#5FB878}.layui-laydate .layui-this{background-color:#009688!important;color:#fff!important}.layui-laydate .laydate-disabled,.layui-laydate .laydate-disabled:hover{background:0 0!important;color:#d2d2d2!important;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.laydate-theme-molv{border:none}.laydate-theme-molv.layui-laydate-range{width:548px}.laydate-theme-molv .layui-laydate-main{width:274px}.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688}.laydate-theme-molv .layui-laydate-header i,.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6}.laydate-theme-molv .layui-laydate-header i:hover,.laydate-theme-molv .layui-laydate-header span:hover{color:#fff}.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none}.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li,.laydate-theme-grid .layui-laydate-content td,.laydate-theme-grid .layui-laydate-content thead,.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2}.laydate-theme-grid .laydate-selected,.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important}.laydate-theme-grid .laydate-selected.laydate-day-next,.laydate-theme-grid .laydate-selected.laydate-day-prev{color:#d2d2d2!important}.laydate-theme-grid .laydate-month-list,.laydate-theme-grid .laydate-year-list{margin:1px 0 0 1px}.laydate-theme-grid .laydate-month-list>li,.laydate-theme-grid .laydate-year-list>li{margin:0 -1px -1px 0}.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px}.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px} -------------------------------------------------------------------------------- /src/main/resources/static/lay/modules/form.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("layer",function(e){"use strict";var i=layui.$,t=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",s="layui-this",o="layui-hide",c="layui-disabled",u=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:function(e){if(!e||isNaN(e))return"只能填写数字"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};u.prototype.set=function(e){var t=this;return i.extend(!0,t.config,e),t},u.prototype.verify=function(e){var t=this;return i.extend(!0,t.config.verify,e),t},u.prototype.on=function(e,i){return layui.onevent.call(this,l,e,i)},u.prototype.render=function(e,t){var n=this,u=i(r+function(){return t?'[lay-filter="'+t+'"]':""}()),d={select:function(){var e,t="请选择",a="layui-form-select",n="layui-select-title",r="layui-select-none",d="",f=u.find("select"),y=function(t,l){i(t.target).parent().hasClass(n)&&!l||(i("."+a).removeClass(a+"ed "+a+"up"),e&&d&&e.val(d)),e=null},h=function(t,u,f){var h=i(this),p=t.find("."+n),m=p.find("input"),k=t.find("dl"),g=k.children("dd");if(!u){var x=function(){var e=t.offset().top+t.outerHeight()+5-v.scrollTop(),i=k.outerHeight();t.addClass(a+"ed"),g.removeClass(o),e+i>v.height()&&e>=i&&t.addClass(a+"up")},b=function(e){t.removeClass(a+"ed "+a+"up"),m.blur(),e||C(m.val(),function(e){e&&(d=k.find("."+s).html(),m&&m.val(d))})};p.on("click",function(e){t.hasClass(a+"ed")?b():(y(e,!0),x()),k.find("."+r).remove()}),p.find(".layui-edge").on("click",function(){m.focus()}),m.on("keyup",function(e){var i=e.keyCode;9===i&&x()}).on("keydown",function(e){var i=e.keyCode;9===i?b():13===i&&e.preventDefault()});var C=function(e,t,a){var n=0;layui.each(g,function(){var t=i(this),l=t.text(),r=l.indexOf(e)===-1;(""===e||"blur"===a?e!==l:r)&&n++,"keyup"===a&&t[r?"addClass":"removeClass"](o)});var l=n===g.length;return t(l),l},w=function(e){var i=this.value,t=e.keyCode;return 9!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&(C(i,function(e){e?k.find("."+r)[0]||k.append('

    无匹配项

    '):k.find("."+r).remove()},"keyup"),void(""===i&&k.find("."+r).remove()))};f&&m.on("keyup",w).on("blur",function(i){e=m,d=k.find("."+s).html(),setTimeout(function(){C(m.val(),function(e){d||m.val("")},"blur")},200)}),g.on("click",function(){var e=i(this),a=e.attr("lay-value"),n=h.attr("lay-filter");return!e.hasClass(c)&&(e.hasClass("layui-select-tips")?m.val(""):(m.val(e.text()),e.addClass(s)),e.siblings().removeClass(s),h.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:h[0],value:a,othis:t}),b(!0),!1)}),t.find("dl>dt").on("click",function(e){return!1}),i(document).off("click",y).on("click",y)}};f.each(function(e,l){var r=i(this),o=r.next("."+a),u=this.disabled,d=l.value,f=i(l.options[l.selectedIndex]),y=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var v="string"==typeof r.attr("lay-search"),p=y?y.value?t:y.innerHTML||t:t,m=i(['
    ','
    ','
    ','
    '+function(e){var i=[];return layui.each(e,function(e,a){0!==e||a.value?"optgroup"===a.tagName.toLowerCase()?i.push("
    "+a.label+"
    "):i.push('
    '+a.innerHTML+"
    "):i.push('
    '+(a.innerHTML||t)+"
    ")}),0===i.length&&i.push('
    没有选项
    '),i.join("")}(r.find("*"))+"
    ","
    "].join(""));o[0]&&o.remove(),r.after(m),h.call(this,m,u,v)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},t=u.find("input[type=checkbox]"),a=function(e,t){var a=i(this);e.on("click",function(){var i=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(t[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(t[1]).find("em").text(n[0])),layui.event.call(a[0],l,t[2]+"("+i+")",{elem:a[0],value:a[0].value,othis:e}))})};t.each(function(t,n){var l=i(this),r=l.attr("lay-skin"),s=(l.attr("lay-text")||"").split("|"),o=this.disabled;"switch"===r&&(r="_"+r);var u=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+u[0]),f=i(['
    ',{_switch:""+((n.checked?s[0]:s[1])||"")+""}[r]||(n.title.replace(/\s/g,"")?""+n.title+"":"")+''+(r?"":"")+"","
    "].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,u)})},radio:function(){var e="layui-form-radio",t=["",""],a=u.find("input[type=radio]"),n=function(a){var n=i(this),s="layui-anim-scaleSpring";a.on("click",function(){var o=n[0].name,c=n.parents(r),u=n.attr("lay-filter"),d=c.find("input[name="+o.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=i(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(s).html(t[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(s).html(t[0]),layui.event.call(n[0],l,"radio("+u+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=i(this),s=r.next("."+e),o=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();var u=i(['
    ',''+t[l.checked?0:1]+"",""+(l.title||"未命名")+"","
    "].join(""));s[0]&&s.remove(),r.after(u),n.call(this,u)})}};return e?d[e]?d[e]():a.error("不支持的"+e+"表单渲染"):layui.each(d,function(e,i){i()}),n};var d=function(){var e=i(this),a=f.config.verify,s=null,o="layui-form-danger",c={},u=e.parents(r),d=u.find("*[lay-verify]"),y=e.parents("form")[0],v=u.find("input,select,textarea"),h=e.attr("lay-filter");if(layui.each(d,function(e,l){var r=i(this),c=r.attr("lay-verify").split("|"),u=r.attr("lay-verType"),d=r.val();if(r.removeClass(o),layui.each(c,function(e,i){var c,f="",y="function"==typeof a[i];if(a[i]){var c=y?f=a[i](d,l):!a[i][0].test(d);if(f=f||a[i][1],c)return"tips"===u?t.tips(f,function(){return"string"==typeof r.attr("lay-ignore")||"select"!==l.tagName.toLowerCase()&&!/^checkbox|radio$/.test(l.type)?r:r.next()}(),{tips:1}):"alert"===u?t.alert(f,{title:"提示",shadeClose:!0}):t.msg(f,{icon:5,shift:6}),n.android||n.ios||l.focus(),r.addClass(o),s=!0}}),s)return s}),s)return!1;var p={};return layui.each(v,function(e,i){if(i.name=(i.name||"").replace(/^\s*|\s*&/,""),i.name){if(/^.*\[\]$/.test(i.name)){var t=i.name.match(/^(.*)\[\]$/g)[0];p[t]=0|p[t],i.name=i.name.replace(/^(.*)\[\]$/,"$1["+p[t]++ +"]")}/^checkbox|radio$/.test(i.type)&&!i.checked||(c[i.name]=i.value)}}),layui.event.call(this,l,"submit("+h+")",{elem:this,form:y,field:c})},f=new u,y=i(document),v=i(window);f.render(),y.on("reset",r,function(){var e=i(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),y.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)}); -------------------------------------------------------------------------------- /src/main/java/com/zz/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.zz.controller; 2 | 3 | import com.zz.model.Parameter; 4 | import com.zz.model.Result; 5 | import com.zz.model.User; 6 | import com.zz.service.UserService; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.beans.factory.annotation.Value; 11 | import org.springframework.http.MediaType; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.util.ResourceUtils; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RequestParam; 17 | import org.springframework.web.bind.annotation.ResponseBody; 18 | import org.springframework.web.multipart.MultipartFile; 19 | import org.thymeleaf.util.StringUtils; 20 | 21 | import javax.servlet.http.HttpServletRequest; 22 | import javax.servlet.http.HttpServletResponse; 23 | import java.io.File; 24 | import java.io.IOException; 25 | import java.util.HashMap; 26 | import java.util.Map; 27 | 28 | /** 29 | * @author dzk 30 | * Created by lethean on 2017/12/31. 31 | */ 32 | @Controller 33 | public class UserController { 34 | 35 | private final Logger logger = LoggerFactory.getLogger(UserController.class); 36 | 37 | @Autowired 38 | UserService userService; 39 | 40 | /** 41 | * 文件上传根目录(在Spring的application.yml的配置文件中配置):
    42 | * web: 43 | * upload-path: (jar包所在目录)/resources/static/ 44 | */ 45 | @Value("${web.upload-path}") 46 | private String webUploadPath; 47 | 48 | @ResponseBody 49 | @RequestMapping("register") 50 | public Result register(User user, HttpServletRequest request) { 51 | Result result = new Result(); 52 | String username = request.getParameter("username"); 53 | int status = userService.register(user); 54 | if (status > 0) { 55 | result.setStatus(1); 56 | result.setMessage("注册成功"); 57 | User zUser = userService.togetUser(user); 58 | request.getSession().setAttribute("user", zUser); 59 | } else { 60 | result.setStatus(0); 61 | result.setMessage("注册失败"); 62 | } 63 | return result; 64 | } 65 | 66 | @ResponseBody 67 | @RequestMapping("login") 68 | public Result login(User user, HttpServletRequest request) { 69 | Result result = new Result(); 70 | int status = userService.getUser(user); 71 | if (status == 1) { 72 | result.setStatus(1); 73 | result.setMessage("登陆成功"); 74 | User zUser = userService.togetUser(user); 75 | request.getSession().setAttribute("user", zUser); 76 | } else if (status == -1) { 77 | result.setStatus(-1); 78 | result.setMessage("密码错误"); 79 | } else if (status == 0) { 80 | result.setStatus(0); 81 | result.setMessage("用户不存在"); 82 | } 83 | return result; 84 | } 85 | 86 | @RequestMapping("logout") 87 | public void logout(HttpServletRequest request, HttpServletResponse response) throws IOException { 88 | 89 | request.getSession().invalidate(); 90 | response.sendRedirect("/toLiveList"); 91 | } 92 | 93 | @ResponseBody 94 | @RequestMapping("check") 95 | public Result check(String username, HttpServletRequest request) { 96 | Result result = new Result(); 97 | 98 | User user = userService.getUserName(username); 99 | if (user == null) { 100 | result.setStatus(1); 101 | result.setMessage("昵称可用"); 102 | } else { 103 | result.setStatus(0); 104 | result.setMessage("昵称不可用"); 105 | } 106 | return result; 107 | } 108 | 109 | @RequestMapping("toUserInfo") 110 | public String toUserInfo(HttpServletRequest request, 111 | Parameter parameter) { 112 | 113 | return "users-twitter/userIngo"; 114 | } 115 | 116 | @RequestMapping("toOtherUserInfo/{userId}") 117 | public String toOtherUserInfo(HttpServletRequest request, 118 | @PathVariable int userId) { 119 | 120 | User user = userService.getUserById(userId); 121 | request.setAttribute("user",user); 122 | 123 | return "users-twitter/otherUserIngo"; 124 | } 125 | 126 | /** 127 | * 基于用户标识的头像上传 128 | * 129 | * @param file 图片 130 | * @return 131 | */ 132 | @ResponseBody 133 | @RequestMapping(value = "headUpload") 134 | public Result headUpload(@RequestParam("file") MultipartFile file, 135 | User user, 136 | HttpServletRequest request) { 137 | Result resultVo = new Result(); 138 | if (!file.isEmpty()) { 139 | if (file.getContentType().contains("image")) { 140 | try { 141 | // 获取图片的文件名 142 | String fileName = file.getOriginalFilename(); 143 | // 获取图片的扩展名 144 | String extensionName = StringUtils.substringAfter(fileName, "."); 145 | // 新的图片文件名 = 获取时间戳+"."图片扩展名 146 | String newFileName = String.valueOf(System.currentTimeMillis()) + "." + extensionName; 147 | 148 | // 文件路径 149 | File path = new File(ResourceUtils.getURL("classpath:").getPath()); 150 | //如果上传目录为/static/images/upload/,则可以如下获取: 151 | // File upload = new File(path.getAbsolutePath(),webUploadPath); 152 | // logger.info("upload url:"+upload.getAbsolutePath()); 153 | String filePath = path.getAbsolutePath() + webUploadPath; 154 | logger.info("上传图片路径" + filePath); 155 | 156 | File dest = new File(filePath, newFileName); 157 | if (!dest.getParentFile().exists()) { 158 | dest.getParentFile().mkdirs(); 159 | } 160 | // 判断是否有旧头像,如果有就先删除旧头像,再上传 161 | // User userInfo = sUserService.findUserInfo(userId.toString()); 162 | // if (StringUtils.isNotBlank(userInfo.getUserHead())) { 163 | // String oldFilePath = webUploadPath.concat(userInfo.getHeadPic()); 164 | // File oldFile = new File(oldFilePath); 165 | // if (oldFile.exists()) { 166 | // oldFile.delete(); 167 | // } 168 | // } 169 | // 上传到指定目录 170 | file.transferTo(dest); 171 | 172 | // 173 | // { 174 | // "code": 0, 175 | // "msg": "", 176 | // "data": { 177 | // "src": "http://cdn.layui.com/123.jpg" 178 | // } 179 | // } 180 | //更新user头像 181 | user.setHeadPic(newFileName); 182 | userService.updateUserHeadPic(user); 183 | //刷新session 184 | User user1 = (User) request.getSession().getAttribute("user"); 185 | user1.setHeadPic(newFileName); 186 | request.getSession().setAttribute("user", user1); 187 | 188 | 189 | Map resultMap = new HashMap<>(); 190 | resultVo.setStatus(0); 191 | resultVo.setData(resultMap); 192 | resultVo.setMessage("上传成功!"); 193 | } catch (IOException e) { 194 | resultVo.setStatus(1); 195 | resultVo.setMessage("上传失败!"); 196 | } 197 | } else { 198 | resultVo.setMessage("上传的文件不是图片类型,请重新上传!"); 199 | } 200 | return resultVo; 201 | } else { 202 | resultVo.setMessage("上传失败,请选择要上传的图片!"); 203 | return resultVo; 204 | } 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /src/main/resources/static/easyEditor/js/easyEditor.js: -------------------------------------------------------------------------------- 1 | function EasyEditor(id) { 2 | this.id = id; 3 | this.obj = document.getElementById(id); 4 | this.obj.setAttribute('class', 'easyEditor'); 5 | this.obj.spellcheck = false; 6 | this.obj.contentEditable = 'true'; 7 | this.sel; 8 | this.ran; 9 | this.editorBegin(); 10 | } 11 | EasyEditor.prototype = { 12 | editorBegin: function() { 13 | var self = this; 14 | var obj = this.obj; 15 | obj.focus(); 16 | this.setRange(); 17 | obj.blur(); 18 | window.scrollTo(0, 0); 19 | this.defaultFunc(); 20 | this.filter(); 21 | obj.onclick = function() { 22 | self.eventFunc(self); 23 | } 24 | obj.onkeyup = function() { 25 | self.eventFunc(self); 26 | } 27 | obj.onkeypress = function() { 28 | self.eventFunc(self); 29 | } 30 | obj.ondrop = function(event) { 31 | var event = event || window.event; 32 | if(event.preventDefault) { 33 | event.preventDefault(); 34 | } else { 35 | event.returnValue = false; 36 | } 37 | } 38 | }, 39 | eventFunc: function(editor) { 40 | var self = editor; 41 | var obj = editor.obj; 42 | var oText = obj.textContent; 43 | var oHtml = obj.innerHTML; 44 | var oTLen = oText.length; 45 | var oHLen = oHtml.length; 46 | if(oTLen == 0 && oHLen != 0) { 47 | if(oHLen == 4) { 48 | var br = obj.getElementsByTagName('br'); 49 | self.removeElement(br[br.length - 1]); 50 | } else if(oHLen == 11 || oHLen == 13) { 51 | var p = obj.getElementsByTagName('p'); 52 | self.removeElement(p[p.length - 1]); 53 | } else if(oHLen == 15) { 54 | var div = obj.getElementsByTagName('div'); 55 | self.removeElement(div[div.length - 1]); 56 | } 57 | } 58 | if(document.activeElement.id = self.id) self.setRange(); 59 | }, 60 | placeholder:function(holder){ 61 | this.obj.setAttribute('placeholder',holder); 62 | return this; 63 | }, 64 | insertHTML: function(html) { 65 | if(this.ran == undefined) { 66 | this.obj.focus(); 67 | this.setRange(); 68 | } 69 | var oFragment = this.ran.createContextualFragment(html); 70 | var oLastNode = oFragment.lastChild; 71 | this.ran.deleteContents(); 72 | this.ran.insertNode(oFragment); 73 | this.ran.setStartAfter(oLastNode); 74 | this.sel.removeAllRanges(); 75 | this.sel.addRange(this.ran); 76 | this.obj.focus(); 77 | }, 78 | /* 79 | opts.src; 图片路径 80 | opts.remark; 图片文字描述 81 | opts.afterInsert; 插入后回调 82 | * */ 83 | insertEmoji: function(opts) { 84 | if(opts.src == undefined){ 85 | console.error('insert emoji src is not define'); 86 | return false; 87 | } 88 | if(!opts.remark) opts.remark = ''; 89 | var newImg = ''; 90 | this.insertHTML(newImg); 91 | if(opts.afterInsert) { 92 | opts.afterInsert.call(this); 93 | } 94 | return this; 95 | }, 96 | /* 97 | opts.text; 插入文字 98 | opts.color; 文字颜色 99 | opts.afterInsert; 插入后毁掉函数 100 | * */ 101 | insertBlock: function(opts) { 102 | this.insertHTML('
    ' + opts.text + ''); 103 | var spanObj = document.getElementById('easyEditorSaveWidth'); 104 | var width = this.getRect(spanObj).width; 105 | this.removeElement(spanObj); 106 | this.removeElement(document.getElementById('changeLinear')); 107 | opts.color = opts.color == undefined ? '' : 'color:'+opts.color + ';'; 108 | var labelBox = ''; 109 | this.insertHTML(labelBox); 110 | if(opts.afterInsert) { 111 | opts.afterInsert.call(this); 112 | } 113 | return this; 114 | }, 115 | getContent: function(bol) { 116 | var oldHtml = this.obj.innerHTML; 117 | if(typeof bol == 'function') { 118 | var func = bol; 119 | var bol = false; 120 | } 121 | var res = this.obj.innerHTML; 122 | if(bol) { 123 | var block = this.obj.getElementsByTagName('input'); 124 | for(var i=0;i/g,'#easyEditor#'); 137 | res = res.replace(/<\/div>/g,'#easyEditor#'); 138 | res = res.replace(/<\/?[^>]*>/g,''); 139 | res = res.replace(/#easyEditor#/g,'
    '); 140 | } 141 | this.obj.innerHTML = oldHtml; 142 | this.obj.focus(); 143 | return res; 144 | }, 145 | editorHolder: function(holder) { 146 | this.obj.placeholder = holder; 147 | return this; 148 | }, 149 | getRange: function(savedSel) { 150 | var self = this; 151 | if(!savedSel) { 152 | if(self.ran) { 153 | var savedSel = self.ran; 154 | } else { 155 | return; 156 | } 157 | } 158 | if(window.getSelection) { 159 | var sel = window.getSelection(); 160 | sel.removeAllRanges(); 161 | sel.addRange(savedSel); 162 | } else if(document.selection) { 163 | savedSel.select(); 164 | } 165 | }, 166 | setRange: function() { 167 | this.sel = this.createRange(); 168 | if(this.sel == null) { 169 | return false 170 | } else { 171 | (window.getSelection) ? this.ran = this.sel.getRangeAt(0): this.ran = this.sel.createRange(); 172 | } 173 | }, 174 | createRange: function() { 175 | if(window.getSelection) { 176 | var sel = window.getSelection(); 177 | if(sel.rangeCount > 0) { 178 | return sel; 179 | } 180 | } else if(document.selection) { 181 | var sel = document.selection; 182 | return sel.createRange(); 183 | } 184 | return null; 185 | }, 186 | filter: function() { 187 | var self = this; 188 | try { 189 | document.execCommand("AutoUrlDetect", false, false); 190 | } catch(e) {} 191 | this.obj.onpaste = function(event) { 192 | var event = event || window.event; 193 | if(event.preventDefault) { 194 | event.preventDefault(); 195 | } else { 196 | event.returnValue = false; 197 | } 198 | var text = null; 199 | if(window.clipboardData && clipboardData.setData) { 200 | text = window.clipboardData.getData('text'); 201 | } else { 202 | text = (event.originalEvent || event).clipboardData.getData('text/plain'); 203 | } 204 | if(document.body.createTextRange) { 205 | if(document.selection) { 206 | textRange = document.selection.createRange(); 207 | } else if(window.getSelection) { 208 | sel = window.getSelection(); 209 | var range = sel.getRangeAt(0); 210 | var tempEl = document.createElement("span"); 211 | tempEl.innerHTML = "&#FEFF;"; 212 | range.deleteContents(); 213 | range.insertNode(tempEl); 214 | textRange = document.body.createTextRange(); 215 | textRange.moveToElementText(tempEl); 216 | tempEl.parentNode.removeChild(tempEl); 217 | } 218 | textRange.text = text; 219 | textRange.collapse(false); 220 | textRange.select(); 221 | } else { 222 | document.execCommand("insertText", false, text); 223 | } 224 | } 225 | }, 226 | defaultFunc: function() { 227 | if((typeof Range !== "undefined") && !Range.prototype.createContextualFragment) { 228 | Range.prototype.createContextualFragment = function(html) { 229 | var frag = document.createDocumentFragment(), 230 | div = document.createElement("div"); 231 | frag.appendChild(div); 232 | div.outerHTML = html; 233 | return frag; 234 | }; 235 | } 236 | }, 237 | removeElement: function(_element) { 238 | var _parentElement = _element.parentNode; 239 | if(_parentElement) { 240 | _parentElement.removeChild(_element); 241 | } 242 | }, 243 | getRect: function(el) { 244 | var rect = el.getBoundingClientRect(); 245 | var _left = document.documentElement.clientLeft; 246 | var _top = document.documentElement.clientTop; 247 | return { 248 | left: rect.left - _left, 249 | top: rect.top - _top, 250 | right: rect.right - _left, 251 | bottom: rect.bottom - _top, 252 | width: rect.right - rect.left, 253 | height: rect.bottom - rect.top 254 | } 255 | } 256 | } 257 | --------------------------------------------------------------------------------