├── .gitattributes
├── .gitignore
├── README.md
├── doc
├── 数据库模型.png
└── 数据库设计.txt
├── hahu.sql
├── pom.xml
└── src
├── main
├── java
│ └── com
│ │ └── fc
│ │ ├── async
│ │ └── MailTask.java
│ │ ├── controller
│ │ ├── AnswerController.java
│ │ ├── CollectionController.java
│ │ ├── CommentController.java
│ │ ├── ExceptionController.java
│ │ ├── IndexController.java
│ │ ├── QuestionController.java
│ │ ├── TopicController.java
│ │ ├── TouTiaoADController.java
│ │ └── UserController.java
│ │ ├── interceptor
│ │ └── LoginInterceptor.java
│ │ ├── mapper
│ │ ├── AnswerMapper.java
│ │ ├── CollectionMapper.java
│ │ ├── CommentMapper.java
│ │ ├── MessageMapper.java
│ │ ├── QuestionMapper.java
│ │ ├── TopicMapper.java
│ │ ├── TouTiaoAdMapper.java
│ │ └── UserMapper.java
│ │ ├── model
│ │ ├── Answer.java
│ │ ├── AnswerComment.java
│ │ ├── Collection.java
│ │ ├── Message.java
│ │ ├── PageBean.java
│ │ ├── Question.java
│ │ ├── QuestionComment.java
│ │ ├── Topic.java
│ │ ├── TouTiaoAdClickRecord.java
│ │ └── User.java
│ │ ├── service
│ │ ├── AnswerService.java
│ │ ├── CollectionService.java
│ │ ├── CommentService.java
│ │ ├── MessageService.java
│ │ ├── QuestionService.java
│ │ ├── TopicService.java
│ │ ├── TouTiaoAdService.java
│ │ └── UserService.java
│ │ └── util
│ │ ├── HttpUtils.java
│ │ ├── MyConstant.java
│ │ ├── MyFreeMarkerView.java
│ │ ├── MyUtil.java
│ │ ├── QiniuyunUtil.java
│ │ ├── RedisKey.java
│ │ └── Response.java
├── resources
│ ├── application-context.xml
│ ├── com
│ │ └── fc
│ │ │ └── mapper
│ │ │ ├── AnswerMapper.xml
│ │ │ ├── CollectionMapper.xml
│ │ │ ├── CommentMapper.xml
│ │ │ ├── MessageMapper.xml
│ │ │ ├── QuestionMapper.xml
│ │ │ ├── TopicMapper.xml
│ │ │ ├── TouTiaoAdMapper.xml
│ │ │ └── UserMapper.xml
│ ├── df.properties
│ ├── log4j.properties
│ ├── mybatis-config.xml
│ └── spring-mvc.xml
└── webapp
│ ├── WEB-INF
│ ├── view
│ │ ├── collectionContent.html
│ │ ├── collectionList.html
│ │ ├── editProfile.html
│ │ ├── explore.html
│ │ ├── index.html
│ │ ├── mask.html
│ │ ├── maskAddCollection.html
│ │ ├── maskCollectAnswer.html
│ │ ├── message.html
│ │ ├── nav.html
│ │ ├── profileAnswer.html
│ │ ├── profileCollection.html
│ │ ├── profileFollowCollection.html
│ │ ├── profileFollowPeople.html
│ │ ├── profileFollowQuestion.html
│ │ ├── profileFollowTopic.html
│ │ ├── profileFollowedPeople.html
│ │ ├── profileQuestion.html
│ │ ├── prompt
│ │ │ └── error.html
│ │ ├── questionDetail.html
│ │ ├── questionList.html
│ │ ├── setting.html
│ │ ├── toLogin.html
│ │ ├── topic.html
│ │ ├── topicDetail.html
│ │ ├── topicList.html
│ │ └── topics.html
│ └── web.xml
│ ├── css
│ ├── base.css
│ ├── collectionContent.css
│ ├── collectionList.css
│ ├── editProfile.css
│ ├── explore.css
│ ├── index.css
│ ├── login.css
│ ├── mask.css
│ ├── message.css
│ ├── nav.css
│ ├── nav2.css
│ ├── profile-follow-tab.css
│ ├── profile.css
│ ├── questionDetail.css
│ ├── questionList.css
│ ├── setting.css
│ ├── topic.css
│ ├── topicDetail.css
│ ├── topics.css
│ ├── wangEditor.css
│ ├── writeArticle.css
│ └── zhuanlanDetail.css
│ ├── favicon.ico
│ ├── fonts
│ ├── icomoon.eot
│ ├── icomoon.svg
│ ├── icomoon.ttf
│ └── icomoon.woff
│ ├── image
│ ├── avatar.jpg
│ ├── avatar2.jpg
│ ├── avatar3.jpg
│ ├── avatar4.jpg
│ ├── avatar5.jpg
│ ├── avatar6.jpg
│ ├── collectRight.jpg
│ ├── sprite-nav.png
│ ├── sprite-nav2.png
│ ├── sprite-vote.png
│ ├── sprite.png
│ ├── sprite2.png
│ ├── sprite3.png
│ ├── sprites-1.9.2.4c54885a.png
│ ├── sprites.auto.2bb79a7e.png
│ ├── sprites.auto.a740548f.png
│ ├── test.png
│ ├── topic1.png
│ ├── topic2.jpg
│ ├── topic3.png
│ ├── writeArticle.png
│ └── zhuanlanBottom.png
│ └── js
│ ├── collectionContent.js
│ ├── collectionList.js
│ ├── explore.js
│ ├── index.js
│ ├── jquery-1.10.2.min.js
│ ├── jquery-2.1.3.js
│ ├── login.js
│ ├── mask.js
│ ├── maskAddCollection.js
│ ├── maskCollectAnswer.js
│ ├── message.js
│ ├── nav.js
│ ├── profile.js
│ ├── questionDetail.js
│ ├── questionList.js
│ ├── setting.js
│ ├── template-web.js
│ ├── topic.js
│ ├── topicDetail.js
│ ├── topics.js
│ └── wangEditor.js
└── test
└── java
└── com
└── fc
└── mapper
└── TestMapper.java
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.js linguist-language=Java
2 | *.css linguist-language=Java
3 | *.html linguist-language=Java
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | .project
3 | .tern-project
4 | .iml
5 | .idea
6 | .settings
7 |
8 | *.class
9 | target
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 | .studio
13 |
14 | # Package Files #
15 | *.jar
16 | *.war
17 | *.ear
18 |
19 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
20 | hs_err_pid*
21 |
22 | #idea ftl
23 | .idea
24 | *.iml
25 | overlays/
26 | *.log
27 | logs
28 | *.epoch
29 | *.lck
30 | data
31 |
32 |
33 | # OS generated ftl #
34 | ######################
35 | .DS_Store
36 | .DS_Store?
37 | ._*
38 | .Spotlight-V100
39 | .Trashes
40 | Icon?
41 | ehthumbs.db
42 | Thumbs.db
43 |
44 | /bin/
45 |
46 | #eclipse file
47 | .classpath
48 | .gradle
49 | .project
50 | .settings
51 | /build/*
52 | src/main/webapp/WEB-INF/classes/
53 | bin
54 | .rules
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | 友情链接:https://github.com/fanchaoo/netease-cloud-music-community
3 |
4 | # Hahu
5 | 1. 本项目是参照知乎做的一个简易版的问答网站。
6 | 2. 后台采用Spring、SpringMVC、MyBatis、FreeMarker等技术,数据库用到MySQL、Redis,前端用到jQuery、artTemplate。
7 | 3. 本项目采用Maven构建,导入后需要:修改df.properties中的mysql.password,redis.password,mail.password为您个人的配置;修改com/fc/util/MyConstant.java,将七牛云的相关配置改为您的个人配置。
8 | 4. 此项目为初学者练手项目,由于时间仓促,前端的代码可能有些杂乱。有什么错误希望大家能指出,在此感谢。
9 | 5. 项目截图
10 |
11 | 
12 |
13 | 
14 |
15 | 
16 |
17 | 
18 |
--------------------------------------------------------------------------------
/doc/数据库模型.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/doc/数据库模型.png
--------------------------------------------------------------------------------
/doc/数据库设计.txt:
--------------------------------------------------------------------------------
1 | 1、用户:user(mongo)
2 |
3 |
4 | //注册后自带属性
5 |
6 | email 邮箱
7 | password 密码
8 | avtive_state 激活状态
9 | activate_code 激活码
10 |
11 | //用户本身可以编辑的属性
12 |
13 | username 用户名
14 | gender 性别
15 | simple_desc 一句话介绍
16 | avatar_url 头像路径
17 | position 居住地
18 | industry 所在行业
19 | career 职业经历
20 | education 教育经历
21 | full_desc 个人简介
22 |
23 |
24 | //其它衍生属性
25 |
26 | like_count 获得点赞数
27 | collect_count 获得收藏数
28 |
29 | following_count 关注了多少人
30 | follower_count 关注者多少人
31 |
32 | scan_count 个人主页浏览次数
33 |
34 | create_time 注册时间
35 |
36 |
37 | 2、话题:topic(mysql)
38 |
39 | topic_id 话题id
40 | topic_name 话题名称(unique)
41 | topic_desc 话题描述
42 | topic_image 话题图片url
43 |
44 |
45 |
46 | 3、问题:question(mysql)
47 |
48 | title 问题标题
49 | content 问题内容
50 | topic_id_list
51 | followed_count 问题被关注者
52 | scaned_count 问题浏览次数
53 | create_time 问题被提问时间
54 |
55 | user_id 提问用户
56 |
57 | 4、问题评论:question_comment(mysql)
58 |
59 | comment_id 评论id
60 | content 评论内容
61 | at_user_id 回复谁
62 | like_count 被点赞次数
63 | create_time 评论时间
64 |
65 | question_id 评论在哪个问题下
66 | user_id 评论用户
67 |
68 |
69 | 5、回答:answer(mysql)
70 |
71 | answer_id 评论id
72 | content 回答内容
73 | liked_count 点赞数
74 | create_time 回答时间
75 |
76 | question_id 回答的问题id
77 | user_id 回答用户id
78 |
79 | 6、回答评论:answer_comment(mysql)
80 |
81 | comment_id 评论id
82 | content 评论内容
83 | at_user_id 回复谁
84 | like_count 被点赞次数
85 | create_time 评论时间
86 |
87 | answer_id 评论在哪个回答下
88 | user_id 评论用户
89 |
90 |
91 | 7、收藏夹:collection(mysql)
92 |
93 | collection_id 收藏夹id
94 | collection_name 收藏夹名称
95 | create_time 创建时间
96 | update_time 更新时间
97 |
98 | user_id 收藏夹用户id
99 |
100 |
101 | 8、消息:message(mongo)
102 |
103 | message_id 消息id
104 | user_id 所属用户id
105 | message_type 消息类型(1、被关注;2、被点赞;3、评论相关;4、回答问题)
106 | son_type 子类型
107 |
108 | from_user_id 哪个用户的操作产生的消息
109 |
110 | question_id 问题id
111 |
112 | answer_id 回答id
113 |
114 | comment_id 评论id
115 |
116 |
117 | ===============================================================================================================
118 |
119 |
120 | 一、几种行为:
121 |
122 | 1、基础行为
123 |
124 | 提问、回答
125 |
126 | 2、收藏
127 |
128 | 收藏回答
129 |
130 | 3、关注
131 |
132 | 关注人、关注话题、关注问题、关注收藏夹
133 |
134 | 4、点赞
135 |
136 | 点赞回答、点赞评论(问题下、回答下)
137 |
138 |
139 |
140 | 二、Feed流推送内容:
141 |
142 | 关注的人提问了某问题
143 | 关注的人回答了某问题
144 |
145 | 关注的人关注了某问题
146 |
147 | 关注的人点赞了某回答
148 |
149 |
150 |
151 | 三、消息种类:
152 |
153 |
154 |
155 | 1、被关注消息
156 |
157 | XXX 关注了你 1.1---被关注(用户id)
158 |
159 | 2、被点赞消息
160 |
161 | 获得 1 次赞同: XXX 来自 XXX 2.1---赞回答(用户id,问题id,回答id)
162 |
163 | XXX 赞了你在 XXX 下的评论 2.2---赞问题下的评论(用户id,问题id,问题评论id)
164 |
165 | XXX 赞了你在 XX 中 XXX 的回答下的评论 2.3---赞回答下的评论(用户id,问题id,回答id,回答评论id)
166 |
167 |
168 | 3、评论消息
169 |
170 | XX 评论了你回答 XXX 3.1---评论回答(用户id,问题id,回答id)
171 | XX 回复了你在 XXX 问题下的评论 3.2---回复问题下的评论(用户id,问题id,问题评论id)
172 | XX 回复了你在 XXX 问题回答下的评论 3.3---回复回答下的评论(用户id,问题id,回答id,回答评论id)
173 |
174 | 4、回答问题消息
175 |
176 | XXX 回答了 XXX 4.1---提问的问题有新回答(用户id,问题id,回答id)
177 |
178 |
179 |
180 | 四、Redis设计
181 |
182 | 1、收藏
183 |
184 | collection_id:collect --> set(answer_id)
185 |
186 | 例如,
187 | 123:collect --> set(1,2,3,4)。
188 | 表示id为123的收藏夹,收藏了id在(1,2,3,4)中的回答。
189 |
190 |
191 | 2、关注
192 |
193 | user_id:follow_people --> set(user_id)
194 | user_id:followed_people --> set(user_id)
195 |
196 | 例如,
197 | 123:follow_people --> set(1,2,3,4)。
198 | 表示id为123的用户,关注了id在(1,2,3,4)中的用户。
199 |
200 | 123:followed_people --> set(1,2,3,4)。
201 | 表示id为123的用户,被id在(1,2,3,4)中的用户关注。
202 |
203 | user_id:follow_topic --> set(topic_id);某用户关注了哪些话题。
204 | topic_id:followed_topic --> set(user_id);某话题被哪些用户关注。
205 |
206 | user_id:follow_question --> set(question_id);某用户关注了哪些问题。
207 | question_id:followed_question --> set(user_id);某问题被哪些用户关注。
208 |
209 | user_id:follow_collection --> set(collection_id);某用户关注了哪些收藏夹。
210 | collection_id:followed_collectoin --> set(user_id);某收藏夹被哪些用户关注。
211 |
212 |
213 | 3、点赞
214 |
215 | answer_id:liked_answer --> set(user_id);某回答被哪些用户点赞。
216 | question_comment_id:liked_question_comment --> set(user_id);某问题下的评论被哪些用户点赞。
217 | answer_comment_id:liked_answer_comment --> set(user_id);某回答下的评论被哪些用户点赞。
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/async/MailTask.java:
--------------------------------------------------------------------------------
1 | package com.fc.async;
2 |
3 | import javax.mail.internet.MimeMessage;
4 |
5 | import org.springframework.mail.javamail.JavaMailSender;
6 | import org.springframework.mail.javamail.MimeMessageHelper;
7 | import org.springframework.mail.javamail.MimeMessagePreparator;
8 |
9 | import com.fc.util.MyConstant;
10 |
11 | public class MailTask implements Runnable {
12 |
13 | private String code;
14 | private String email;
15 | private JavaMailSender javaMailSender;
16 | private int operation;
17 |
18 | public MailTask(String code, String email, JavaMailSender javaMailSender, int operation) {
19 | this.code = code;
20 | this.email = email;
21 | this.javaMailSender = javaMailSender;
22 | this.operation = operation;
23 | }
24 |
25 | @Override
26 | public void run() {
27 | javaMailSender.send(new MimeMessagePreparator() {
28 | @Override
29 | public void prepare(MimeMessage mimeMessage) throws Exception {
30 | System.out.println("开始发邮件...");
31 | MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true, "UTF-8");
32 | mimeMessageHelper.setFrom(MyConstant.MAIL_FROM);
33 | mimeMessageHelper.setTo(email);
34 | mimeMessageHelper.setSubject("一封激活邮件");
35 | StringBuilder sb = new StringBuilder();
36 | sb.append("
");
37 |
38 | if (operation == 1) {
39 | sb.append("点击激活");
42 | } else {
43 | sb.append("是否将您的密码修改为:");
44 | sb.append(code.substring(0, 8));
45 | sb.append(",");
46 | sb.append("点击是");
47 | }
48 |
49 | mimeMessageHelper.setText(sb.toString(), true);
50 |
51 | System.out.println("结束发邮件...");
52 | }
53 | });
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/controller/AnswerController.java:
--------------------------------------------------------------------------------
1 | package com.fc.controller;
2 |
3 | import java.util.Map;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 |
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Controller;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.ResponseBody;
11 |
12 | import com.fc.model.Answer;
13 | import com.fc.service.AnswerService;
14 | import com.fc.service.UserService;
15 | import com.fc.util.Response;
16 |
17 | @Controller
18 | @RequestMapping("/")
19 | public class AnswerController {
20 |
21 | @Autowired
22 | private AnswerService answerService;
23 |
24 | @Autowired
25 | private UserService userService;
26 |
27 | @RequestMapping("/answer")
28 | @ResponseBody
29 | public Response answer(Answer answer, HttpServletRequest request) {
30 | System.out.println(answer);
31 | Integer userId = userService.getUserIdFromRedis(request);
32 | Integer answerId = answerService.answer(answer, userId);
33 |
34 | return new Response(0, "", answerId);
35 | }
36 |
37 | @RequestMapping("/likeAnswer")
38 | @ResponseBody
39 | public Response likeAnswer(Integer answerId, HttpServletRequest request) {
40 | Integer userId = userService.getUserIdFromRedis(request);
41 | answerService.likeAnswer(userId, answerId);
42 | return new Response(0, "");
43 | }
44 |
45 | @RequestMapping("/listTodayHotAnswer")
46 | @ResponseBody
47 | public Response listTodayHotAnswer() {
48 | Map map = answerService.listTodayHotAnswer();
49 | return new Response(0, "", map);
50 | }
51 |
52 | @RequestMapping("/listMonthHotAnswer")
53 | @ResponseBody
54 | public Response listMonthHotAnswer() {
55 | Map map = answerService.listMonthHotAnswer();
56 | return new Response(0, "", map);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/controller/CollectionController.java:
--------------------------------------------------------------------------------
1 | package com.fc.controller;
2 |
3 | import java.util.HashMap;
4 | import java.util.List;
5 | import java.util.Map;
6 |
7 | import javax.servlet.http.HttpServletRequest;
8 |
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Controller;
11 | import org.springframework.ui.Model;
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 com.fc.model.Collection;
17 | import com.fc.service.CollectionService;
18 | import com.fc.service.UserService;
19 | import com.fc.util.Response;
20 |
21 | @Controller
22 | @RequestMapping("/")
23 | public class CollectionController {
24 |
25 | @Autowired
26 | private CollectionService collectionService;
27 | @Autowired
28 | private UserService userService;
29 |
30 | @RequestMapping("/collections")
31 | public String collections() {
32 | return "collectionList";
33 | }
34 |
35 | @RequestMapping("/collection/{collectionId}")
36 | public String collection(@PathVariable Integer collectionId, HttpServletRequest request, Model model) {
37 | // 当前用户id
38 | Integer localUserId = userService.getUserIdFromRedis(request);
39 | // 收藏夹内的答案列表信息
40 | Map map = collectionService.getCollectionContent(collectionId, localUserId);
41 |
42 | // 获取当前用户收藏夹列表
43 | List collectionList = collectionService.listCreatingCollection(localUserId);
44 |
45 | map.put("collectionList", collectionList);
46 | model.addAllAttributes(map);
47 | return "collectionContent";
48 | }
49 |
50 | @RequestMapping("/addCollection")
51 | @ResponseBody
52 | public Response addCollection(Collection collection, HttpServletRequest request) {
53 | Integer userId = userService.getUserIdFromRedis(request);
54 | collectionService.addCollection(collection, userId);
55 | return new Response(0);
56 | }
57 |
58 | @RequestMapping("/listCreatingCollection")
59 | @ResponseBody
60 | public Response listCreatingCollection(HttpServletRequest request) {
61 | Integer userId = userService.getUserIdFromRedis(request);
62 | List collectionList = collectionService.listCreatingCollection(userId);
63 | Map map = new HashMap<>();
64 | map.put("collectionList", collectionList);
65 | return new Response(0, "", map);
66 | }
67 |
68 | @RequestMapping("/collectAnswer")
69 | @ResponseBody
70 | public Response collectAnswer(Integer collectionId, Integer answerId) {
71 |
72 | collectionService.collectAnswer(collectionId, answerId);
73 | return new Response(0, "");
74 | }
75 |
76 | @RequestMapping("/uncollectAnswer")
77 | @ResponseBody
78 | public Response uncollectAnswer(Integer collectionId, Integer answerId) {
79 |
80 | collectionService.uncollectAnswer(collectionId, answerId);
81 | return new Response(0, "");
82 | }
83 |
84 | @RequestMapping("/collectionContainAnswer")
85 | @ResponseBody
86 | public Response collectionContainAnswer(Integer collectionId, Integer answerId) {
87 |
88 | boolean status = collectionService.collectionContainAnswer(collectionId, answerId);
89 | return new Response(0, "", status);
90 | }
91 |
92 | @RequestMapping("/judgePeopleFollowCollection")
93 | @ResponseBody
94 | public Response judgePeopleFollowCollection(Integer collectionId, HttpServletRequest request) {
95 | Integer userId = userService.getUserIdFromRedis(request);
96 | boolean status = collectionService.judgePeopleFollowCollection(userId, collectionId);
97 | return new Response(0, "", status);
98 | }
99 |
100 | @RequestMapping("/followCollection")
101 | @ResponseBody
102 | public Response followCollection(Integer collectionId, HttpServletRequest request) {
103 | Integer userId = userService.getUserIdFromRedis(request);
104 | collectionService.followCollection(userId, collectionId);
105 | return new Response(0, "");
106 | }
107 |
108 | @RequestMapping("/unfollowCollection")
109 | @ResponseBody
110 | public Response unfollowCollection(Integer collectionId, HttpServletRequest request) {
111 | Integer userId = userService.getUserIdFromRedis(request);
112 | collectionService.unfollowCollection(userId, collectionId);
113 | return new Response(0, "");
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/controller/CommentController.java:
--------------------------------------------------------------------------------
1 | package com.fc.controller;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.ResponseBody;
9 |
10 | import com.fc.model.AnswerComment;
11 | import com.fc.model.QuestionComment;
12 | import com.fc.service.CommentService;
13 | import com.fc.service.UserService;
14 | import com.fc.util.Response;
15 |
16 | @Controller
17 | @RequestMapping("/")
18 | public class CommentController {
19 |
20 | @Autowired
21 | private UserService userService;
22 |
23 | @Autowired
24 | private CommentService commentService;
25 |
26 | @RequestMapping("/commentQuestion")
27 | @ResponseBody
28 | public Response commentQuestion(Integer questionId, String commentContent, HttpServletRequest request) {
29 | Integer userId = userService.getUserIdFromRedis(request);
30 | QuestionComment comment = commentService.commentQuestion(questionId, commentContent, userId);
31 | return new Response(0, "", comment);
32 | }
33 |
34 | @RequestMapping("/replyQuestionComment")
35 | @ResponseBody
36 | public Response replyQuestionComment(QuestionComment questionComment, HttpServletRequest request) {
37 | System.out.println(questionComment);
38 | Integer userId = userService.getUserIdFromRedis(request);
39 | QuestionComment comment = commentService.replyQuestionComment(questionComment, userId);
40 | return new Response(0, "", comment);
41 | }
42 |
43 | @RequestMapping("/commentAnswer")
44 | @ResponseBody
45 | public Response commentAnswer(Integer answerId, String commentContent, HttpServletRequest request) {
46 | Integer userId = userService.getUserIdFromRedis(request);
47 | AnswerComment comment = commentService.commentAnswer(answerId, commentContent, userId);
48 | return new Response(0, "", comment);
49 | }
50 |
51 | @RequestMapping("/replyAnswerComment")
52 | @ResponseBody
53 | public Response replyAnswerComment(AnswerComment answerComment, HttpServletRequest request) {
54 | System.out.println(answerComment);
55 | Integer userId = userService.getUserIdFromRedis(request);
56 | AnswerComment comment = commentService.replyAnswerComment(answerComment, userId);
57 | return new Response(0, "", comment);
58 | }
59 |
60 | @RequestMapping("/likeQuestionComment")
61 | @ResponseBody
62 | public Response likeQuestionComment(Integer questionCommentId, HttpServletRequest request) {
63 | Integer userId = userService.getUserIdFromRedis(request);
64 | commentService.likeQuestionComment(userId, questionCommentId);
65 | return new Response(0, "");
66 | }
67 |
68 | @RequestMapping("/likeAnswerComment")
69 | @ResponseBody
70 | public Response likeAnswerComment(Integer answerCommentId, HttpServletRequest request) {
71 | Integer userId = userService.getUserIdFromRedis(request);
72 | commentService.likeAnswerComment(userId, answerCommentId);
73 | return new Response(0, "");
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/controller/ExceptionController.java:
--------------------------------------------------------------------------------
1 | package com.fc.controller;
2 |
3 |
4 | //@ControllerAdvice
5 | public class ExceptionController {
6 |
7 | // @ExceptionHandler({ Exception.class })
8 | // public ModelAndView handlerException(Exception ex) {
9 | // ModelAndView mv = new ModelAndView();
10 | // mv.setViewName("prompt/error");
11 | // mv.addObject("error", ex);
12 | // return mv;
13 | // }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.fc.controller;
2 |
3 | import java.io.IOException;
4 | import java.util.Arrays;
5 | import java.util.List;
6 | import java.util.Map;
7 | import java.util.UUID;
8 |
9 | import javax.servlet.http.HttpServletRequest;
10 |
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.stereotype.Controller;
13 | import org.springframework.ui.Model;
14 | import org.springframework.web.bind.annotation.RequestMapping;
15 | import org.springframework.web.bind.annotation.RequestMethod;
16 | import org.springframework.web.bind.annotation.ResponseBody;
17 | import org.springframework.web.multipart.MultipartFile;
18 |
19 | import com.fc.model.Message;
20 | import com.fc.model.User;
21 | import com.fc.service.MessageService;
22 | import com.fc.service.UserService;
23 | import com.fc.util.MyConstant;
24 | import com.fc.util.QiniuyunUtil;
25 | import com.fc.util.Response;
26 |
27 | @Controller
28 | @RequestMapping("/")
29 | public class IndexController {
30 | @Autowired
31 | private UserService userService;
32 | @Autowired
33 | private MessageService messageService;
34 |
35 | @RequestMapping(value = { "/", "/index" })
36 | public String index() {
37 | return "index";
38 | }
39 |
40 | @RequestMapping("getIndexDetail")
41 | @ResponseBody
42 | public Response getIndexDetail(Integer page, HttpServletRequest request) {
43 | Integer userId = userService.getUserIdFromRedis(request);
44 | Map map = userService.getIndexDetail(userId, page);
45 |
46 | return new Response(0, "", map);
47 | }
48 |
49 | @RequestMapping("/setting")
50 | public String setting(HttpServletRequest request, Model model) {
51 | Integer userId = userService.getUserIdFromRedis(request);
52 | User user = userService.getProfileInfo(userId);
53 | model.addAttribute("user", user);
54 | return "editProfile";
55 | }
56 |
57 | @RequestMapping("/editProfile")
58 | public String editProfile(User user, HttpServletRequest request) {
59 | Integer userId = userService.getUserIdFromRedis(request);
60 | user.setUserId(userId);
61 |
62 | userService.updateProfile(user);
63 | return "redirect:/profile/" + userId;
64 | }
65 |
66 | @RequestMapping("/updatePassword")
67 | public String updatePassword(String password, String newpassword, HttpServletRequest request, Model model) {
68 | Integer userId = userService.getUserIdFromRedis(request);
69 | Map map = userService.updatePassword(userId, password, newpassword);
70 | if (map.get("error") != null) {
71 | model.addAttribute("error", map.get("error"));
72 | return "forward:/setting";
73 | }
74 | return "redirect:/logout";
75 |
76 | }
77 |
78 | @RequestMapping("/updateAvatarUrl")
79 | public String updateAvatarUrl(MultipartFile paramName, HttpServletRequest request) throws IOException {
80 | Integer userId = userService.getUserIdFromRedis(request);
81 |
82 | // 包含原始文件名的字符串
83 | String fi = paramName.getOriginalFilename();
84 | // 提取文件拓展名
85 | String fileNameExtension = fi.substring(fi.indexOf("."), fi.length());
86 | // 生成云端的真实文件名
87 | String remoteFileName = UUID.randomUUID().toString() + fileNameExtension;
88 | QiniuyunUtil.upload(paramName.getBytes(), remoteFileName);
89 | // 返回图片的URL地址
90 | String avatarUrl = MyConstant.QINIU_IMAGE_URL + remoteFileName;
91 |
92 | userService.updateAvatarUrl(userId, avatarUrl);
93 | return "redirect:/profile/" + userId;
94 | }
95 |
96 | @RequestMapping("/explore")
97 | public String explore() {
98 | return "explore";
99 | }
100 |
101 | @RequestMapping("/message")
102 | public String message(HttpServletRequest request, Model model) {
103 | Integer userId = userService.getUserIdFromRedis(request);
104 | Map> map = messageService.listMessage(userId);
105 | model.addAttribute("map", map);
106 | return "message";
107 | }
108 |
109 | @RequestMapping(value = "/uploadImage", method = { RequestMethod.POST }, produces = "text/plain;charset=UTF-8")
110 | public @ResponseBody String uploadImage(MultipartFile paramName) throws IOException {
111 |
112 | // 文件类型限制
113 | String[] allowedType = { "image/bmp", "image/gif", "image/jpeg", "image/png" };
114 | boolean allowed = Arrays.asList(allowedType).contains(paramName.getContentType());
115 | if (!allowed) {
116 | return "error|不支持的类型";
117 | }
118 | // 图片大小限制
119 | if (paramName.getSize() > 3 * 1024 * 1024) {
120 | return "error|图片大小不能超过3M";
121 | }
122 | // 包含原始文件名的字符串
123 | String fi = paramName.getOriginalFilename();
124 | // 提取文件拓展名
125 | String fileNameExtension = fi.substring(fi.indexOf("."), fi.length());
126 | // 生成云端的真实文件名
127 | String remoteFileName = UUID.randomUUID().toString() + fileNameExtension;
128 |
129 | QiniuyunUtil.upload(paramName.getBytes(), remoteFileName);
130 |
131 | // 返回图片的URL地址
132 | return MyConstant.QINIU_IMAGE_URL + remoteFileName;
133 | }
134 |
135 | }
136 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/controller/QuestionController.java:
--------------------------------------------------------------------------------
1 | package com.fc.controller;
2 |
3 | import java.util.HashMap;
4 | import java.util.List;
5 | import java.util.Map;
6 |
7 | import javax.servlet.http.HttpServletRequest;
8 |
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Controller;
11 | import org.springframework.ui.Model;
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 com.fc.model.Collection;
17 | import com.fc.model.Question;
18 | import com.fc.service.CollectionService;
19 | import com.fc.service.QuestionService;
20 | import com.fc.service.UserService;
21 | import com.fc.util.Response;
22 |
23 | @Controller
24 | @RequestMapping("/")
25 | public class QuestionController {
26 |
27 | @Autowired
28 | private QuestionService questionService;
29 | @Autowired
30 | private CollectionService collectionService;
31 |
32 | @Autowired
33 | private UserService userService;
34 |
35 | @RequestMapping("/ask")
36 | @ResponseBody
37 | public Response ask(Question question, String topicNameString, HttpServletRequest request) {
38 |
39 | Integer userId = userService.getUserIdFromRedis(request);
40 | Integer questionId = questionService.ask(question, topicNameString, userId);
41 | return new Response(0, "", questionId);
42 | }
43 |
44 | @RequestMapping("/question/{questionId}")
45 | public String questionDetail(@PathVariable Integer questionId, HttpServletRequest request, Model model) {
46 | Integer userId = userService.getUserIdFromRedis(request);
47 |
48 | Map questionDetail = questionService.getQuestionDetail(questionId, userId);
49 |
50 | // 获取收藏夹信息
51 | List collectionList = collectionService.listCreatingCollection(userId);
52 | questionDetail.put("collectionList", collectionList);
53 | model.addAllAttributes(questionDetail);
54 | return "questionDetail";
55 | }
56 |
57 | @RequestMapping("/questionList")
58 | public String questionList() {
59 | return "questionList";
60 | }
61 |
62 | @RequestMapping("/listQuestionByPage")
63 | @ResponseBody
64 | public Response listQuestionByPage(Integer page) {
65 | Map map = new HashMap();
66 | List questionList = questionService.listQuestionByPage(page);
67 | map.put("questionList", questionList);
68 | return new Response(0, "", map);
69 | }
70 |
71 | @RequestMapping("/judgePeopleFollowQuestion")
72 | @ResponseBody
73 | public Response judgePeopleFollowQuestion(Integer questionId, HttpServletRequest request) {
74 | Integer userId = userService.getUserIdFromRedis(request);
75 | boolean status = questionService.judgePeopleFollowQuestion(userId, questionId);
76 | return new Response(0, "", status);
77 | }
78 |
79 | @RequestMapping("/followQuestion")
80 | @ResponseBody
81 | public Response followQuestion(Integer questionId, HttpServletRequest request) {
82 | Integer userId = userService.getUserIdFromRedis(request);
83 | questionService.followQuestion(userId, questionId);
84 | return new Response(0, "");
85 | }
86 |
87 | @RequestMapping("/unfollowQuestion")
88 | @ResponseBody
89 | public Response unfollowQuestion(Integer questionId, HttpServletRequest request) {
90 | Integer userId = userService.getUserIdFromRedis(request);
91 | questionService.unfollowQuestion(userId, questionId);
92 | return new Response(0, "");
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/controller/TopicController.java:
--------------------------------------------------------------------------------
1 | package com.fc.controller;
2 |
3 | import java.io.UnsupportedEncodingException;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import javax.servlet.http.HttpServletRequest;
9 |
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.stereotype.Controller;
12 | import org.springframework.ui.Model;
13 | import org.springframework.web.bind.annotation.PathVariable;
14 | import org.springframework.web.bind.annotation.RequestMapping;
15 | import org.springframework.web.bind.annotation.ResponseBody;
16 |
17 | import com.fc.model.Topic;
18 | import com.fc.service.TopicService;
19 | import com.fc.service.UserService;
20 | import com.fc.util.Response;
21 |
22 | @Controller
23 | @RequestMapping("/")
24 | public class TopicController {
25 |
26 | @Autowired
27 | private TopicService topicService;
28 |
29 | @Autowired
30 | private UserService userService;
31 |
32 | @RequestMapping("/topic")
33 | public String topic(Model model) {
34 |
35 | return "topic";
36 | }
37 |
38 | @RequestMapping("/topics")
39 | public String topics(Model model) {
40 | Map map = topicService.listAllTopic();
41 | model.addAllAttributes(map);
42 | return "topics";
43 | }
44 |
45 | @RequestMapping("/listTopicByTopicName")
46 | public String listTopicByTopicName(String topicName, Model model) throws UnsupportedEncodingException {
47 | topicName = new String(topicName.getBytes("iso8859-1"), "utf-8");
48 | Map map = topicService.listTopicByTopicName(topicName);
49 | model.addAllAttributes(map);
50 | return "topicList";
51 | }
52 |
53 | @RequestMapping("/listTopicByParentTopicId")
54 | @ResponseBody
55 | public Response listTopicByParentTopicId(Integer parentTopicId) {
56 | List list = topicService.listTopicByParentTopicId(parentTopicId);
57 | Map map = new HashMap<>();
58 | map.put("topicList", list);
59 | return new Response(0, "", map);
60 | }
61 |
62 | @RequestMapping("/topicDetail/{topicId}")
63 | public String topicDetail(@PathVariable Integer topicId, Integer page, Boolean allQuestion, Model model, HttpServletRequest request) {
64 | Integer userId = userService.getUserIdFromRedis(request);
65 | Map map = topicService.getTopicDetail(topicId, allQuestion, page, userId);
66 | model.addAllAttributes(map);
67 | return "topicDetail";
68 | }
69 |
70 | @RequestMapping("/judgePeopleFollowTopic")
71 | @ResponseBody
72 | public Response judgePeopleFollowTopic(Integer topicId, HttpServletRequest request) {
73 | Integer userId = userService.getUserIdFromRedis(request);
74 | boolean status = topicService.judgePeopleFollowTopic(userId, topicId);
75 | return new Response(0, "", status);
76 | }
77 |
78 | @RequestMapping("/followTopic")
79 | @ResponseBody
80 | public Response followTopic(Integer topicId, HttpServletRequest request) {
81 | Integer userId = userService.getUserIdFromRedis(request);
82 | topicService.followTopic(userId, topicId);
83 | return new Response(0, "");
84 | }
85 |
86 | @RequestMapping("/unfollowTopic")
87 | @ResponseBody
88 | public Response unfollowTopic(Integer topicId, HttpServletRequest request) {
89 | Integer userId = userService.getUserIdFromRedis(request);
90 | topicService.unfollowTopic(userId, topicId);
91 | return new Response(0, "");
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/controller/TouTiaoADController.java:
--------------------------------------------------------------------------------
1 | package com.fc.controller;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.stereotype.Controller;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 | import org.springframework.web.bind.annotation.ResponseBody;
8 |
9 | import com.alibaba.fastjson.JSONObject;
10 | import com.fc.service.TouTiaoAdService;
11 |
12 | @Controller
13 | @RequestMapping("/toutiaoad")
14 | public class TouTiaoADController {
15 |
16 | @Autowired
17 | TouTiaoAdService touTiaoAdService;
18 |
19 | @RequestMapping(value = "/feedback")
20 | @ResponseBody
21 | public Object feedback(@RequestParam(value = "adid", required = false) String adid,
22 | @RequestParam(value = "cid", required = false) String cid,
23 | @RequestParam(value = "mac", required = false) String mac,
24 | @RequestParam(value = "os", required = false) Integer os,
25 | @RequestParam(value = "timestamp", required = false) String timestamp,
26 | @RequestParam(value = "convert_id", required = false) String convertId,
27 | @RequestParam(value = "callback_url") String callbackUrl,
28 | @RequestParam(value = "idfa", required = false) String idfa,
29 | @RequestParam(value = "imei", required = false) String imei,
30 | @RequestParam(value = "androidid", required = false) String androidid) {
31 |
32 | touTiaoAdService.insertClickRecord(adid, cid, mac, os, timestamp, convertId, callbackUrl, idfa, imei,
33 | androidid);
34 |
35 | JSONObject json = new JSONObject();
36 | json.put("status", 0);
37 | return json;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/interceptor/LoginInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.fc.interceptor;
2 |
3 | import java.util.List;
4 |
5 | import javax.servlet.http.Cookie;
6 | import javax.servlet.http.HttpServletRequest;
7 | import javax.servlet.http.HttpServletResponse;
8 |
9 | import org.apache.commons.lang3.ArrayUtils;
10 | import org.apache.commons.lang3.StringUtils;
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.web.servlet.ModelAndView;
13 | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
14 |
15 | import redis.clients.jedis.Jedis;
16 | import redis.clients.jedis.JedisPool;
17 |
18 | public class LoginInterceptor extends HandlerInterceptorAdapter {
19 |
20 | @Autowired
21 | private JedisPool jedisPool;
22 |
23 | private List excludedUrls;
24 |
25 | @Override
26 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
27 |
28 | String requestUri = request.getRequestURI();
29 |
30 | // 是否需要拦截
31 | for (String s : excludedUrls) {
32 | if (requestUri.endsWith(s)) {
33 | return true;
34 | }
35 | }
36 | String loginToken = null;
37 | // 是否有cookie
38 | Cookie[] cookies = request.getCookies();
39 | if (ArrayUtils.isEmpty(cookies)) {
40 | request.getRequestDispatcher("toLogin").forward(request, response);
41 | return false;
42 | } else {
43 | for (Cookie cookie : cookies) {
44 | if (cookie.getName().equals("loginToken")) {
45 | loginToken = cookie.getValue();
46 | break;
47 | }
48 | }
49 | }
50 |
51 | // cookie中是否有loginToken
52 | if (StringUtils.isEmpty(loginToken)) {
53 | request.getRequestDispatcher("toLogin").forward(request, response);
54 | return false;
55 | }
56 |
57 | Jedis jedis = jedisPool.getResource();
58 | String userId = jedis.get(loginToken);
59 |
60 | // 根据loginToken是否能从redis中获取userId
61 | if (StringUtils.isEmpty(userId)) {
62 | request.getRequestDispatcher("toLogin").forward(request, response);
63 | return false;
64 | }
65 |
66 | return true;
67 | }
68 |
69 | @Override
70 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
71 | }
72 |
73 | @Override
74 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
75 | }
76 |
77 | public List getExcludedUrls() {
78 | return excludedUrls;
79 | }
80 |
81 | public void setExcludedUrls(List excludedUrls) {
82 | this.excludedUrls = excludedUrls;
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/mapper/AnswerMapper.java:
--------------------------------------------------------------------------------
1 | package com.fc.mapper;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | import org.apache.ibatis.annotations.Param;
7 |
8 | import com.fc.model.Answer;
9 |
10 | public interface AnswerMapper {
11 |
12 | void insertAnswer(Answer answer);
13 |
14 | List selectAnswerByQuestionId(@Param("questionId") Integer questionId);
15 |
16 | int selectAnswerCountByUserId(@Param("userId") Integer userId);
17 |
18 | List listAnswerByUserId(Map map);
19 |
20 | List listAnswerByAnswerId(List idList);
21 |
22 | List listGoodAnswerByQuestionId(Map map);
23 |
24 | int listAnswerCountByQuestionId(List questionIdList);
25 |
26 | int selectAnswerCountByQuestionId(@Param("questionId") Integer questionId);
27 |
28 | void updateLikedCount(@Param("answerId") Integer answerId);
29 |
30 | List listAnswerByUserIdList(Map map);
31 |
32 | List listAnswerByCreateTime(@Param("createTime") long createTime);
33 |
34 | Integer selectUserIdByAnswerId(@Param("answerId") Integer answerId);
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/mapper/CollectionMapper.java:
--------------------------------------------------------------------------------
1 | package com.fc.mapper;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import com.fc.model.Collection;
8 |
9 | public interface CollectionMapper {
10 |
11 | void insertCollection(Collection collection);
12 |
13 | List listCreatingCollectionByUserId(@Param("userId") Integer userId);
14 |
15 | Collection selectCollectionByCollectionId(@Param("collectionId") Integer collectionId);
16 |
17 | Integer selectUserIdByCollectionId(@Param("collectionId") Integer collectionId);
18 |
19 | List listCollectionByCollectionId(List idList);
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/mapper/CommentMapper.java:
--------------------------------------------------------------------------------
1 | package com.fc.mapper;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import com.fc.model.AnswerComment;
8 | import com.fc.model.QuestionComment;
9 |
10 | public interface CommentMapper {
11 |
12 | List listQuestionCommentByQuestionId(@Param("questionId") Integer questionId);
13 |
14 | List listAnswerCommentByAnswerId(@Param("answerId") Integer answerId);
15 |
16 | void insertQuestionComment(QuestionComment comment);
17 |
18 | void insertQuestionCommentReply(QuestionComment comment);
19 |
20 | void insertAnswerComment(AnswerComment comment);
21 |
22 | void insertAnswerCommentReply(AnswerComment comment);
23 |
24 | int selectAnswerCommentCountByAnswerId(@Param("answerId") Integer answerId);
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/mapper/MessageMapper.java:
--------------------------------------------------------------------------------
1 | package com.fc.mapper;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import com.fc.model.Message;
8 |
9 | public interface MessageMapper {
10 |
11 | void insertTypeFollowed(Message message);
12 |
13 | void insertTypeLiked(Message message);
14 |
15 | void insertTypeComment(Message message);
16 |
17 | void insertTypeAnswer(Message message);
18 |
19 | List listMessageByUserId(@Param("userId") Integer userId);
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/mapper/QuestionMapper.java:
--------------------------------------------------------------------------------
1 | package com.fc.mapper;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | import org.apache.ibatis.annotations.Param;
7 |
8 | import com.fc.model.Question;
9 |
10 | public interface QuestionMapper {
11 |
12 | Integer insertQuestion(Question question);
13 |
14 | Question selectQuestionByQuestionId(@Param("questionId") Integer questionId);
15 |
16 | int selectQuestionCountByUserId(@Param("userId") Integer userId);
17 |
18 | List listQuestionByUserId(Map map);
19 |
20 | List listQuestionByPage(@Param("offset") int offset, @Param("limit") int limit);
21 |
22 | void insertIntoQuestionTopic(@Param("questionId") Integer questionId, @Param("topicId") Integer topicId);
23 |
24 | int selectQuestionCountByTopicId(@Param("topicId") Integer topicId);
25 |
26 | List listQuestionIdByTopicId(Map map);
27 |
28 | List listQuestionByQuestionId(List questionIdList);
29 |
30 | List listRelatedQuestion(@Param("questionId") Integer questionId);
31 |
32 | Question selectQuestionByAnswerId(@Param("answerId") Integer answerId);
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/mapper/TopicMapper.java:
--------------------------------------------------------------------------------
1 | package com.fc.mapper;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import com.fc.model.Topic;
8 |
9 | public interface TopicMapper {
10 |
11 | Integer selectTopicIdByTopicName(@Param("topicName") String topicName);
12 |
13 | Integer insertTopic(Topic topic);
14 |
15 | List listRootTopic();
16 |
17 | List listTopicByParentId(@Param("parentTopicId") Integer parentTopicId);
18 |
19 | Topic selectTopicByTopicId(@Param("topicId") Integer topicId);
20 |
21 | List selectQuestionIdByTopicId(@Param("topicId") Integer topicId);
22 |
23 | List listTopicByTopicId(List idList);
24 |
25 | List listHotTopic();
26 |
27 | void updateFollowedCount(@Param("topicId") Integer topicId);
28 |
29 | List listTopicByTopicName(@Param("topicName") String topicName);
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/mapper/TouTiaoAdMapper.java:
--------------------------------------------------------------------------------
1 | package com.fc.mapper;
2 |
3 | import com.fc.model.TouTiaoAdClickRecord;
4 |
5 | public interface TouTiaoAdMapper {
6 |
7 | int selectCountByIdfa(String idfa);
8 |
9 | int selectCountByImei(String imei);
10 |
11 | void insertClickRecord(TouTiaoAdClickRecord record);
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/mapper/UserMapper.java:
--------------------------------------------------------------------------------
1 | package com.fc.mapper;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import com.fc.model.User;
8 |
9 | public interface UserMapper {
10 |
11 | void insertUser(User user);
12 |
13 | int selectEmailCount(String email);
14 |
15 | // 这里需要用包装类型
16 | Integer selectUserIdByEmailAndPassword(@Param("email") String email, @Param("password") String password);
17 |
18 | User selectUserInfoByUserId(@Param("userId") Integer userId);
19 |
20 | Integer selectActivationStateByUserId(@Param("userId") Integer userId);
21 |
22 | void updateActivationStateByActivationCode(@Param("activationCode") String activationCode);
23 |
24 | User selectProfileInfoByUserId(@Param("userId") Integer userId);
25 |
26 | List listUserInfoByUserId(List userIdList);
27 |
28 | void updateLikedCountByAnswerId(@Param("answerId") Integer answerId);
29 |
30 | void updateCollectedCountByAnswerId(@Param("answerId") Integer answerId);
31 |
32 | void updateProfile(User user);
33 |
34 | int selectUserCountByUserIdAndPassword(@Param("userId") Integer userId, @Param("password") String password);
35 |
36 | void updatePassword(@Param("userId") Integer userId, @Param("newpassword") String newpassword);
37 |
38 | void updateAvatarUrl(@Param("userId") Integer userId, @Param("avatarUrl") String avatarUrl);
39 |
40 | String selectUsernameByUserId(@Param("userId") Integer userId);
41 |
42 | User selectUserInfoByWeiboUserId(String weiboUserId);
43 |
44 | int insertWeiboUser(User user);
45 |
46 | String getWeiboUserId(Integer userId);
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/Answer.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | import java.util.List;
4 |
5 | public class Answer {
6 |
7 | private Integer answerId;
8 | private String answerContent;
9 | private Integer likedCount;
10 | private Long createTime;
11 |
12 | private Integer questionId;
13 | private Integer userId;
14 |
15 | private Question question;
16 | private User user;
17 |
18 | private String likeState;
19 | private Integer commentCount;
20 |
21 | private List answerCommentList;
22 |
23 | public Integer getAnswerId() {
24 | return answerId;
25 | }
26 |
27 | public void setAnswerId(Integer answerId) {
28 | this.answerId = answerId;
29 | }
30 |
31 | public String getAnswerContent() {
32 | return answerContent;
33 | }
34 |
35 | public void setAnswerContent(String answerContent) {
36 | this.answerContent = answerContent;
37 | }
38 |
39 | public Integer getLikedCount() {
40 | return likedCount;
41 | }
42 |
43 | public void setLikedCount(Integer likedCount) {
44 | this.likedCount = likedCount;
45 | }
46 |
47 | public Long getCreateTime() {
48 | return createTime;
49 | }
50 |
51 | public void setCreateTime(Long createTime) {
52 | this.createTime = createTime;
53 | }
54 |
55 | public Integer getQuestionId() {
56 | return questionId;
57 | }
58 |
59 | public void setQuestionId(Integer questionId) {
60 | this.questionId = questionId;
61 | }
62 |
63 | public Integer getUserId() {
64 | return userId;
65 | }
66 |
67 | public void setUserId(Integer userId) {
68 | this.userId = userId;
69 | }
70 |
71 | public User getUser() {
72 | return user;
73 | }
74 |
75 | public void setUser(User user) {
76 | this.user = user;
77 | }
78 |
79 | public List getAnswerCommentList() {
80 | return answerCommentList;
81 | }
82 |
83 | public void setAnswerCommentList(List answerCommentList) {
84 | this.answerCommentList = answerCommentList;
85 | }
86 |
87 | public Question getQuestion() {
88 | return question;
89 | }
90 |
91 | public void setQuestion(Question question) {
92 | this.question = question;
93 | }
94 |
95 | public String getLikeState() {
96 | return likeState;
97 | }
98 |
99 | public void setLikeState(String likeState) {
100 | this.likeState = likeState;
101 | }
102 |
103 | public Integer getCommentCount() {
104 | return commentCount;
105 | }
106 |
107 | public void setCommentCount(Integer commentCount) {
108 | this.commentCount = commentCount;
109 | }
110 |
111 | @Override
112 | public String toString() {
113 | return "Answer [answerId=" + answerId + ", answerContent=" + answerContent + ", likedCount=" + likedCount + ", createTime=" + createTime + ", questionId=" + questionId + ", userId=" + userId + ", question=" + question + ", user=" + user + ", likeState=" + likeState + ", answerCommentList="
114 | + answerCommentList + "]";
115 | }
116 |
117 | }
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/AnswerComment.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | public class AnswerComment {
4 | private Integer answerCommentId;
5 | private String answerCommentContent;
6 | private Integer likedCount;
7 | private Long createTime;
8 | private Integer atUserId;
9 | private String atUserName;
10 |
11 | private Integer answerId;
12 | private Integer userId;
13 |
14 | private String likeState;
15 |
16 | private User user;
17 |
18 | public Integer getAnswerCommentId() {
19 | return answerCommentId;
20 | }
21 |
22 | public void setAnswerCommentId(Integer answerCommentId) {
23 | this.answerCommentId = answerCommentId;
24 | }
25 |
26 | public String getAnswerCommentContent() {
27 | return answerCommentContent;
28 | }
29 |
30 | public void setAnswerCommentContent(String answerCommentContent) {
31 | this.answerCommentContent = answerCommentContent;
32 | }
33 |
34 | public Integer getLikedCount() {
35 | return likedCount;
36 | }
37 |
38 | public void setLikedCount(Integer likedCount) {
39 | this.likedCount = likedCount;
40 | }
41 |
42 | public Long getCreateTime() {
43 | return createTime;
44 | }
45 |
46 | public void setCreateTime(Long createTime) {
47 | this.createTime = createTime;
48 | }
49 |
50 | public Integer getAtUserId() {
51 | return atUserId;
52 | }
53 |
54 | public void setAtUserId(Integer atUserId) {
55 | this.atUserId = atUserId;
56 | }
57 |
58 | public String getAtUserName() {
59 | return atUserName;
60 | }
61 |
62 | public void setAtUserName(String atUserName) {
63 | this.atUserName = atUserName;
64 | }
65 |
66 | public Integer getAnswerId() {
67 | return answerId;
68 | }
69 |
70 | public void setAnswerId(Integer answerId) {
71 | this.answerId = answerId;
72 | }
73 |
74 | public Integer getUserId() {
75 | return userId;
76 | }
77 |
78 | public void setUserId(Integer userId) {
79 | this.userId = userId;
80 | }
81 |
82 | public User getUser() {
83 | return user;
84 | }
85 |
86 | public void setUser(User user) {
87 | this.user = user;
88 | }
89 |
90 | public String getLikeState() {
91 | return likeState;
92 | }
93 |
94 | public void setLikeState(String likeState) {
95 | this.likeState = likeState;
96 | }
97 |
98 | @Override
99 | public String toString() {
100 | return "AnswerComment [answerCommentId=" + answerCommentId + ", answerCommentContent=" + answerCommentContent + ", likedCount=" + likedCount + ", createTime=" + createTime + ", atUserId=" + atUserId + ", atUserName=" + atUserName + ", answerId=" + answerId + ", userId=" + userId
101 | + ", likeState=" + likeState + ", user=" + user + "]";
102 | }
103 |
104 | }
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/Collection.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | public class Collection {
4 |
5 | private Integer collectionId;
6 | private String collectionName;
7 | private Long createTime;
8 | private Long updateTime;
9 |
10 | private Integer userId;
11 |
12 | private Integer followedCount;
13 | private Integer answerCount;
14 | private User user;
15 |
16 | public Integer getCollectionId() {
17 | return collectionId;
18 | }
19 |
20 | public void setCollectionId(Integer collectionId) {
21 | this.collectionId = collectionId;
22 | }
23 |
24 | public String getCollectionName() {
25 | return collectionName;
26 | }
27 |
28 | public void setCollectionName(String collectionName) {
29 | this.collectionName = collectionName;
30 | }
31 |
32 | public Long getCreateTime() {
33 | return createTime;
34 | }
35 |
36 | public void setCreateTime(Long createTime) {
37 | this.createTime = createTime;
38 | }
39 |
40 | public Long getUpdateTime() {
41 | return updateTime;
42 | }
43 |
44 | public void setUpdateTime(Long updateTime) {
45 | this.updateTime = updateTime;
46 | }
47 |
48 | public Integer getUserId() {
49 | return userId;
50 | }
51 |
52 | public void setUserId(Integer userId) {
53 | this.userId = userId;
54 | }
55 |
56 | public User getUser() {
57 | return user;
58 | }
59 |
60 | public void setUser(User user) {
61 | this.user = user;
62 | }
63 |
64 | public Integer getFollowedCount() {
65 | return followedCount;
66 | }
67 |
68 | public void setFollowedCount(Integer followedCount) {
69 | this.followedCount = followedCount;
70 | }
71 |
72 | public Integer getAnswerCount() {
73 | return answerCount;
74 | }
75 |
76 | public void setAnswerCount(Integer answerCount) {
77 | this.answerCount = answerCount;
78 | }
79 |
80 | }
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/Message.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | public class Message {
4 |
5 | public static final int TYPE_FOLLOWED = 1;
6 | public static final int TYPE_LIKED = 2;
7 | public static final int TYPE_COMMENT = 3;
8 | public static final int TYPE_ANSWER = 4;
9 |
10 | private Integer messageId;
11 | private Integer type;
12 | private Integer secondType;
13 | private String messageDate;
14 | private Long messageTime;
15 |
16 | private Integer fromUserId;
17 | private String fromUserName;
18 | private Integer questionId;
19 | private String questionTitle;
20 | private Integer answerId;
21 | private Integer commentId;
22 |
23 | private Integer userId;
24 |
25 | public Integer getMessageId() {
26 | return messageId;
27 | }
28 |
29 | public void setMessageId(Integer messageId) {
30 | this.messageId = messageId;
31 | }
32 |
33 | public Integer getType() {
34 | return type;
35 | }
36 |
37 | public void setType(Integer type) {
38 | this.type = type;
39 | }
40 |
41 | public Integer getSecondType() {
42 | return secondType;
43 | }
44 |
45 | public void setSecondType(Integer secondType) {
46 | this.secondType = secondType;
47 | }
48 |
49 | public String getMessageDate() {
50 | return messageDate;
51 | }
52 |
53 | public void setMessageDate(String messageDate) {
54 | this.messageDate = messageDate;
55 | }
56 |
57 | public Long getMessageTime() {
58 | return messageTime;
59 | }
60 |
61 | public void setMessageTime(Long messageTime) {
62 | this.messageTime = messageTime;
63 | }
64 |
65 | public Integer getFromUserId() {
66 | return fromUserId;
67 | }
68 |
69 | public void setFromUserId(Integer fromUserId) {
70 | this.fromUserId = fromUserId;
71 | }
72 |
73 | public String getFromUserName() {
74 | return fromUserName;
75 | }
76 |
77 | public void setFromUserName(String fromUserName) {
78 | this.fromUserName = fromUserName;
79 | }
80 |
81 | public Integer getQuestionId() {
82 | return questionId;
83 | }
84 |
85 | public void setQuestionId(Integer questionId) {
86 | this.questionId = questionId;
87 | }
88 |
89 | public String getQuestionTitle() {
90 | return questionTitle;
91 | }
92 |
93 | public void setQuestionTitle(String questionTitle) {
94 | this.questionTitle = questionTitle;
95 | }
96 |
97 | public Integer getAnswerId() {
98 | return answerId;
99 | }
100 |
101 | public void setAnswerId(Integer answerId) {
102 | this.answerId = answerId;
103 | }
104 |
105 | public Integer getCommentId() {
106 | return commentId;
107 | }
108 |
109 | public void setCommentId(Integer commentId) {
110 | this.commentId = commentId;
111 | }
112 |
113 | public Integer getUserId() {
114 | return userId;
115 | }
116 |
117 | public void setUserId(Integer userId) {
118 | this.userId = userId;
119 | }
120 | }
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/PageBean.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | public class PageBean {
7 |
8 | private int allPage;
9 | private int curPage;
10 |
11 | private List list = new ArrayList();
12 |
13 | public PageBean() {
14 | }
15 |
16 | public PageBean(int allPage, int curPage) {
17 | this.allPage = allPage;
18 | this.curPage = curPage;
19 | }
20 |
21 | public int getAllPage() {
22 | return allPage;
23 | }
24 |
25 | public void setAllPage(int allPage) {
26 | this.allPage = allPage;
27 | }
28 |
29 | public int getCurPage() {
30 | return curPage;
31 | }
32 |
33 | public void setCurPage(int curPage) {
34 | this.curPage = curPage;
35 | }
36 |
37 | public List getList() {
38 | return list;
39 | }
40 |
41 | public void setList(List list) {
42 | this.list = list;
43 | }
44 |
45 | @Override
46 | public String toString() {
47 | return "PageBean{" + "allPage=" + allPage + ", curPage=" + curPage + ", list=" + list + '}';
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/Question.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | import java.util.List;
4 |
5 | public class Question {
6 | private Integer questionId;
7 | private String questionTitle;
8 | private String questionContent;
9 | private String topicKvList;
10 | private Integer followedCount;
11 | private Integer scanedCount;
12 | private Long createTime;
13 |
14 | private Integer userId;
15 |
16 | private User user;
17 | private Integer answerCount;
18 |
19 | private List questionCommentList;
20 |
21 | public Integer getQuestionId() {
22 | return questionId;
23 | }
24 |
25 | public void setQuestionId(Integer questionId) {
26 | this.questionId = questionId;
27 | }
28 |
29 | public String getQuestionTitle() {
30 | return questionTitle;
31 | }
32 |
33 | public void setQuestionTitle(String questionTitle) {
34 | this.questionTitle = questionTitle;
35 | }
36 |
37 | public String getQuestionContent() {
38 | return questionContent;
39 | }
40 |
41 | public void setQuestionContent(String questionContent) {
42 | this.questionContent = questionContent;
43 | }
44 |
45 | public String getTopicKvList() {
46 | return topicKvList;
47 | }
48 |
49 | public void setTopicKvList(String topicKvList) {
50 | this.topicKvList = topicKvList;
51 | }
52 |
53 | public Integer getFollowedCount() {
54 | return followedCount;
55 | }
56 |
57 | public void setFollowedCount(Integer followedCount) {
58 | this.followedCount = followedCount;
59 | }
60 |
61 | public Integer getScanedCount() {
62 | return scanedCount;
63 | }
64 |
65 | public void setScanedCount(Integer scanedCount) {
66 | this.scanedCount = scanedCount;
67 | }
68 |
69 | public Long getCreateTime() {
70 | return createTime;
71 | }
72 |
73 | public void setCreateTime(Long createTime) {
74 | this.createTime = createTime;
75 | }
76 |
77 | public Integer getUserId() {
78 | return userId;
79 | }
80 |
81 | public void setUserId(Integer userId) {
82 | this.userId = userId;
83 | }
84 |
85 | public User getUser() {
86 | return user;
87 | }
88 |
89 | public void setUser(User user) {
90 | this.user = user;
91 | }
92 |
93 | public List getQuestionCommentList() {
94 | return questionCommentList;
95 | }
96 |
97 | public void setQuestionCommentList(List questionCommentList) {
98 | this.questionCommentList = questionCommentList;
99 | }
100 |
101 | public Integer getAnswerCount() {
102 | return answerCount;
103 | }
104 |
105 | public void setAnswerCount(Integer answerCount) {
106 | this.answerCount = answerCount;
107 | }
108 |
109 | @Override
110 | public String toString() {
111 | return "Question [questionId=" + questionId + ", questionTitle=" + questionTitle + ", questionContent=" + questionContent + ", topicKvList=" + topicKvList + ", followedCount=" + followedCount + ", scanedCount=" + scanedCount + ", createTime=" + createTime + ", userId=" + userId + ", user="
112 | + user + ", answerCount=" + answerCount + ", questionCommentList=" + questionCommentList + "]";
113 | }
114 |
115 | }
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/QuestionComment.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | public class QuestionComment {
4 | private Integer questionCommentId;
5 | private String questionCommentContent;
6 | private Integer likedCount;
7 | private Long createTime;
8 | private Integer atUserId;
9 | private String atUserName;
10 |
11 | private Integer questionId;
12 | private Integer userId;
13 |
14 | private String likeState;
15 | private User user;
16 |
17 | public Integer getQuestionCommentId() {
18 | return questionCommentId;
19 | }
20 |
21 | public void setQuestionCommentId(Integer questionCommentId) {
22 | this.questionCommentId = questionCommentId;
23 | }
24 |
25 | public String getQuestionCommentContent() {
26 | return questionCommentContent;
27 | }
28 |
29 | public void setQuestionCommentContent(String questionCommentContent) {
30 | this.questionCommentContent = questionCommentContent;
31 | }
32 |
33 | public Integer getLikedCount() {
34 | return likedCount;
35 | }
36 |
37 | public void setLikedCount(Integer likedCount) {
38 | this.likedCount = likedCount;
39 | }
40 |
41 | public Long getCreateTime() {
42 | return createTime;
43 | }
44 |
45 | public void setCreateTime(Long createTime) {
46 | this.createTime = createTime;
47 | }
48 |
49 | public Integer getAtUserId() {
50 | return atUserId;
51 | }
52 |
53 | public void setAtUserId(Integer atUserId) {
54 | this.atUserId = atUserId;
55 | }
56 |
57 | public String getAtUserName() {
58 | return atUserName;
59 | }
60 |
61 | public void setAtUserName(String atUserName) {
62 | this.atUserName = atUserName;
63 | }
64 |
65 | public Integer getQuestionId() {
66 | return questionId;
67 | }
68 |
69 | public void setQuestionId(Integer questionId) {
70 | this.questionId = questionId;
71 | }
72 |
73 | public Integer getUserId() {
74 | return userId;
75 | }
76 |
77 | public void setUserId(Integer userId) {
78 | this.userId = userId;
79 | }
80 |
81 | public User getUser() {
82 | return user;
83 | }
84 |
85 | public void setUser(User user) {
86 | this.user = user;
87 | }
88 |
89 | public String getLikeState() {
90 | return likeState;
91 | }
92 |
93 | public void setLikeState(String likeState) {
94 | this.likeState = likeState;
95 | }
96 |
97 | @Override
98 | public String toString() {
99 | return "QuestionComment [questionCommentId=" + questionCommentId + ", questionCommentContent=" + questionCommentContent + ", likedCount=" + likedCount + ", createTime=" + createTime + ", atUserId=" + atUserId + ", atUserName=" + atUserName + ", questionId=" + questionId + ", userId="
100 | + userId + ", likeState=" + likeState + ", user=" + user + "]";
101 | }
102 |
103 | }
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/Topic.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | public class Topic {
4 | private Integer topicId;
5 | private String topicName;
6 | private String topicDesc;
7 | private String topicImage;
8 | private Integer parentTopicId;
9 |
10 | private Integer followedCount;
11 |
12 | public Integer getTopicId() {
13 | return topicId;
14 | }
15 |
16 | public void setTopicId(Integer topicId) {
17 | this.topicId = topicId;
18 | }
19 |
20 | public String getTopicName() {
21 | return topicName;
22 | }
23 |
24 | public void setTopicName(String topicName) {
25 | this.topicName = topicName;
26 | }
27 |
28 | public String getTopicDesc() {
29 | return topicDesc;
30 | }
31 |
32 | public void setTopicDesc(String topicDesc) {
33 | this.topicDesc = topicDesc;
34 | }
35 |
36 | public String getTopicImage() {
37 | return topicImage;
38 | }
39 |
40 | public void setTopicImage(String topicImage) {
41 | this.topicImage = topicImage;
42 | }
43 |
44 | public Integer getParentTopicId() {
45 | return parentTopicId;
46 | }
47 |
48 | public void setParentTopicId(Integer parentTopicId) {
49 | this.parentTopicId = parentTopicId;
50 | }
51 |
52 | public Integer getFollowedCount() {
53 | return followedCount;
54 | }
55 |
56 | public void setFollowedCount(Integer followedCount) {
57 | this.followedCount = followedCount;
58 | }
59 |
60 | @Override
61 | public int hashCode() {
62 | final int prime = 31;
63 | int result = 1;
64 | result = prime * result + ((topicId == null) ? 0 : topicId.hashCode());
65 | return result;
66 | }
67 |
68 | @Override
69 | public boolean equals(Object obj) {
70 | if (this == obj)
71 | return true;
72 | if (obj == null)
73 | return false;
74 | if (getClass() != obj.getClass())
75 | return false;
76 | Topic other = (Topic) obj;
77 | if (topicId == null) {
78 | if (other.topicId != null)
79 | return false;
80 | } else if (!topicId.equals(other.topicId))
81 | return false;
82 | return true;
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/TouTiaoAdClickRecord.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | public class TouTiaoAdClickRecord {
4 |
5 | private String adid;
6 | private String cid;
7 | private String mac;
8 | private Integer os;
9 | private String timestamp;
10 | private String convertId;
11 | private String callbackUrl;
12 | private String idfa;
13 | private String imei;
14 | private String androidid;
15 |
16 | public String getAdid() {
17 | return adid;
18 | }
19 |
20 | public void setAdid(String adid) {
21 | this.adid = adid;
22 | }
23 |
24 | public String getCid() {
25 | return cid;
26 | }
27 |
28 | public void setCid(String cid) {
29 | this.cid = cid;
30 | }
31 |
32 | public String getMac() {
33 | return mac;
34 | }
35 |
36 | public void setMac(String mac) {
37 | this.mac = mac;
38 | }
39 |
40 | public Integer getOs() {
41 | return os;
42 | }
43 |
44 | public void setOs(Integer os) {
45 | this.os = os;
46 | }
47 |
48 | public String getTimestamp() {
49 | return timestamp;
50 | }
51 |
52 | public void setTimestamp(String timestamp) {
53 | this.timestamp = timestamp;
54 | }
55 |
56 | public String getConvertId() {
57 | return convertId;
58 | }
59 |
60 | public void setConvertId(String convertId) {
61 | this.convertId = convertId;
62 | }
63 |
64 | public String getCallbackUrl() {
65 | return callbackUrl;
66 | }
67 |
68 | public void setCallbackUrl(String callbackUrl) {
69 | this.callbackUrl = callbackUrl;
70 | }
71 |
72 | public String getIdfa() {
73 | return idfa;
74 | }
75 |
76 | public void setIdfa(String idfa) {
77 | this.idfa = idfa;
78 | }
79 |
80 | public String getImei() {
81 | return imei;
82 | }
83 |
84 | public void setImei(String imei) {
85 | this.imei = imei;
86 | }
87 |
88 | public String getAndroidid() {
89 | return androidid;
90 | }
91 |
92 | public void setAndroidid(String androidid) {
93 | this.androidid = androidid;
94 | }
95 |
96 | @Override
97 | public String toString() {
98 | return "TouTiaoAdClickRecord [adid=" + adid + ", cid=" + cid + ", mac=" + mac + ", os=" + os + ", timestamp="
99 | + timestamp + ", convertId=" + convertId + ", callbackUrl=" + callbackUrl + ", idfa=" + idfa + ", imei="
100 | + imei + ", androidid=" + androidid + "]";
101 | }
102 |
103 | }
--------------------------------------------------------------------------------
/src/main/java/com/fc/model/User.java:
--------------------------------------------------------------------------------
1 | package com.fc.model;
2 |
3 | public class User {
4 | private Integer userId;
5 | private String email;
6 | private String password;
7 | private Integer activationState;
8 | private String activationCode;
9 |
10 | private String username;
11 | private Integer gender;
12 | private String simpleDesc;
13 | private String avatarUrl;
14 | private String position;
15 | private String industry;
16 | private String career;
17 | private String education;
18 | private String fullDesc;
19 |
20 | private Integer likedCount;
21 | private Integer collectedCount;
22 | private Integer followCount;
23 | private Integer followedCount;
24 | private Integer followTopicCount;
25 | private Integer followQuestionCount;
26 | private Integer followCollectionCount;
27 |
28 | private Integer scanedCount;
29 | private Long joinTime;
30 |
31 | private String weiboUserId;
32 |
33 | public Integer getUserId() {
34 | return userId;
35 | }
36 |
37 | public void setUserId(Integer userId) {
38 | this.userId = userId;
39 | }
40 |
41 | public String getEmail() {
42 | return email;
43 | }
44 |
45 | public void setEmail(String email) {
46 | this.email = email;
47 | }
48 |
49 | public String getPassword() {
50 | return password;
51 | }
52 |
53 | public void setPassword(String password) {
54 | this.password = password;
55 | }
56 |
57 | public Integer getActivationState() {
58 | return activationState;
59 | }
60 |
61 | public void setActivationState(Integer activationState) {
62 | this.activationState = activationState;
63 | }
64 |
65 | public String getActivationCode() {
66 | return activationCode;
67 | }
68 |
69 | public void setActivationCode(String activationCode) {
70 | this.activationCode = activationCode;
71 | }
72 |
73 | public String getUsername() {
74 | return username;
75 | }
76 |
77 | public void setUsername(String username) {
78 | this.username = username;
79 | }
80 |
81 | public Integer getGender() {
82 | return gender;
83 | }
84 |
85 | public void setGender(Integer gender) {
86 | this.gender = gender;
87 | }
88 |
89 | public String getSimpleDesc() {
90 | return simpleDesc;
91 | }
92 |
93 | public void setSimpleDesc(String simpleDesc) {
94 | this.simpleDesc = simpleDesc;
95 | }
96 |
97 | public String getAvatarUrl() {
98 | return avatarUrl;
99 | }
100 |
101 | public void setAvatarUrl(String avatarUrl) {
102 | this.avatarUrl = avatarUrl;
103 | }
104 |
105 | public String getPosition() {
106 | return position;
107 | }
108 |
109 | public void setPosition(String position) {
110 | this.position = position;
111 | }
112 |
113 | public String getIndustry() {
114 | return industry;
115 | }
116 |
117 | public void setIndustry(String industry) {
118 | this.industry = industry;
119 | }
120 |
121 | public String getCareer() {
122 | return career;
123 | }
124 |
125 | public void setCareer(String career) {
126 | this.career = career;
127 | }
128 |
129 | public String getEducation() {
130 | return education;
131 | }
132 |
133 | public void setEducation(String education) {
134 | this.education = education;
135 | }
136 |
137 | public String getFullDesc() {
138 | return fullDesc;
139 | }
140 |
141 | public void setFullDesc(String fullDesc) {
142 | this.fullDesc = fullDesc;
143 | }
144 |
145 | public Integer getLikedCount() {
146 | return likedCount;
147 | }
148 |
149 | public void setLikedCount(Integer likedCount) {
150 | this.likedCount = likedCount;
151 | }
152 |
153 | public Integer getCollectedCount() {
154 | return collectedCount;
155 | }
156 |
157 | public void setCollectedCount(Integer collectedCount) {
158 | this.collectedCount = collectedCount;
159 | }
160 |
161 | public Integer getFollowCount() {
162 | return followCount;
163 | }
164 |
165 | public void setFollowCount(Integer followCount) {
166 | this.followCount = followCount;
167 | }
168 |
169 | public Integer getFollowedCount() {
170 | return followedCount;
171 | }
172 |
173 | public void setFollowedCount(Integer followedCount) {
174 | this.followedCount = followedCount;
175 | }
176 |
177 | public Integer getScanedCount() {
178 | return scanedCount;
179 | }
180 |
181 | public void setScanedCount(Integer scanedCount) {
182 | this.scanedCount = scanedCount;
183 | }
184 |
185 | public Long getJoinTime() {
186 | return joinTime;
187 | }
188 |
189 | public void setJoinTime(Long joinTime) {
190 | this.joinTime = joinTime;
191 | }
192 |
193 | public Integer getFollowTopicCount() {
194 | return followTopicCount;
195 | }
196 |
197 | public void setFollowTopicCount(Integer followTopicCount) {
198 | this.followTopicCount = followTopicCount;
199 | }
200 |
201 | public Integer getFollowQuestionCount() {
202 | return followQuestionCount;
203 | }
204 |
205 | public void setFollowQuestionCount(Integer followQuestionCount) {
206 | this.followQuestionCount = followQuestionCount;
207 | }
208 |
209 | public Integer getFollowCollectionCount() {
210 | return followCollectionCount;
211 | }
212 |
213 | public void setFollowCollectionCount(Integer followCollectionCount) {
214 | this.followCollectionCount = followCollectionCount;
215 | }
216 |
217 | public String getWeiboUserId() {
218 | return weiboUserId;
219 | }
220 |
221 | public void setWeiboUserId(String weiboUserId) {
222 | this.weiboUserId = weiboUserId;
223 | }
224 |
225 | }
226 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/service/CommentService.java:
--------------------------------------------------------------------------------
1 | package com.fc.service;
2 |
3 | import java.util.Date;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import redis.clients.jedis.Jedis;
9 | import redis.clients.jedis.JedisPool;
10 |
11 | import com.fc.mapper.AnswerMapper;
12 | import com.fc.mapper.CommentMapper;
13 | import com.fc.mapper.MessageMapper;
14 | import com.fc.mapper.QuestionMapper;
15 | import com.fc.mapper.UserMapper;
16 | import com.fc.model.AnswerComment;
17 | import com.fc.model.Message;
18 | import com.fc.model.Question;
19 | import com.fc.model.QuestionComment;
20 | import com.fc.model.User;
21 | import com.fc.util.MyUtil;
22 | import com.fc.util.RedisKey;
23 |
24 | @Service
25 | public class CommentService {
26 |
27 | @Autowired
28 | private UserMapper userMapper;
29 |
30 | @Autowired
31 | private CommentMapper commentMapper;
32 |
33 | @Autowired
34 | private MessageMapper messageMapper;
35 |
36 | @Autowired
37 | private QuestionMapper questionMapper;
38 | @Autowired
39 | private AnswerMapper answerMapper;
40 |
41 | @Autowired
42 | private JedisPool jedisPool;
43 |
44 | public QuestionComment commentQuestion(Integer questionId, String commentContent, Integer userId) {
45 | QuestionComment comment = new QuestionComment();
46 | comment.setLikedCount(0);
47 | comment.setCreateTime(new Date().getTime());
48 | comment.setQuestionCommentContent(commentContent);
49 | comment.setQuestionId(questionId);
50 | comment.setUserId(userId);
51 |
52 | commentMapper.insertQuestionComment(comment);
53 | User user = userMapper.selectUserInfoByUserId(userId);
54 | comment.setUser(user);
55 |
56 | return comment;
57 | }
58 |
59 | public QuestionComment replyQuestionComment(QuestionComment comment, Integer userId) {
60 | comment.setLikedCount(0);
61 | comment.setCreateTime(new Date().getTime());
62 | comment.setUserId(userId);
63 |
64 | commentMapper.insertQuestionCommentReply(comment);
65 | User user = userMapper.selectUserInfoByUserId(userId);
66 | comment.setUser(user);
67 |
68 | return comment;
69 | }
70 |
71 | // 评论回答
72 | public AnswerComment commentAnswer(Integer answerId, String commentContent, Integer userId) {
73 | AnswerComment comment = new AnswerComment();
74 | comment.setLikedCount(0);
75 | comment.setCreateTime(new Date().getTime());
76 | comment.setAnswerCommentContent(commentContent);
77 | comment.setAnswerId(answerId);
78 | comment.setUserId(userId);
79 |
80 | commentMapper.insertAnswerComment(comment);
81 | User user = userMapper.selectUserInfoByUserId(userId);
82 | comment.setUser(user);
83 |
84 | // 插入一条评论消息
85 | Message message = new Message();
86 | message.setType(Message.TYPE_COMMENT);
87 | message.setSecondType(1);
88 | Date date = new Date();
89 | message.setMessageDate(MyUtil.formatDate(date));
90 | message.setMessageTime(date.getTime());
91 | message.setFromUserId(userId);
92 | message.setFromUserName(userMapper.selectUsernameByUserId(userId));
93 | Question question = questionMapper.selectQuestionByAnswerId(answerId);
94 | message.setQuestionId(question.getQuestionId());
95 | message.setQuestionTitle(question.getQuestionTitle());
96 | message.setAnswerId(answerId);
97 | message.setCommentId(comment.getAnswerCommentId());
98 | message.setUserId(answerMapper.selectUserIdByAnswerId(answerId));
99 | messageMapper.insertTypeComment(message);
100 |
101 | return comment;
102 | }
103 |
104 | public AnswerComment replyAnswerComment(AnswerComment comment, Integer userId) {
105 | comment.setLikedCount(0);
106 | comment.setCreateTime(new Date().getTime());
107 | comment.setUserId(userId);
108 |
109 | commentMapper.insertAnswerCommentReply(comment);
110 | User user = userMapper.selectUserInfoByUserId(userId);
111 | comment.setUser(user);
112 |
113 | return comment;
114 | }
115 |
116 | public void likeQuestionComment(Integer userId, Integer questionCommentId) {
117 | Jedis jedis = jedisPool.getResource();
118 | jedis.zadd(userId + RedisKey.LIKE_QUESTION_COMMENT, new Date().getTime(), String.valueOf(questionCommentId));
119 | jedis.zadd(questionCommentId + RedisKey.LIKED_QUESTION_COMMENT, new Date().getTime(), String.valueOf(userId));
120 | jedisPool.returnResource(jedis);
121 | }
122 |
123 | public void likeAnswerComment(Integer userId, Integer answerCommentId) {
124 | Jedis jedis = jedisPool.getResource();
125 | jedis.zadd(userId + RedisKey.LIKE_ANSWER_COMMENT, new Date().getTime(), String.valueOf(answerCommentId));
126 | jedis.zadd(answerCommentId + RedisKey.LIKED_ANSWER_COMMENT, new Date().getTime(), String.valueOf(userId));
127 | jedisPool.returnResource(jedis);
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/service/MessageService.java:
--------------------------------------------------------------------------------
1 | package com.fc.service;
2 |
3 | import java.util.HashMap;
4 | import java.util.LinkedList;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 |
11 | import com.fc.mapper.AnswerMapper;
12 | import com.fc.mapper.MessageMapper;
13 | import com.fc.mapper.QuestionMapper;
14 | import com.fc.mapper.UserMapper;
15 | import com.fc.model.Message;
16 |
17 | @Service
18 | public class MessageService {
19 |
20 | @Autowired
21 | private AnswerMapper answerMapper;
22 |
23 | @Autowired
24 | private QuestionMapper questionMapper;
25 |
26 | @Autowired
27 | private UserMapper userMapper;
28 |
29 | @Autowired
30 | private MessageMapper messageMapper;
31 |
32 | public Map> listMessage(Integer userId) {
33 | List messageList = messageMapper.listMessageByUserId(userId);
34 | Map> map = new HashMap<>();
35 | for (Message message : messageList) {
36 | String time = message.getMessageDate();
37 | if (map.get(time) == null) {
38 | map.put(time, new LinkedList());
39 | map.get(time).add(message);
40 | } else {
41 | map.get(time).add(message);
42 | }
43 | }
44 | return map;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/service/TouTiaoAdService.java:
--------------------------------------------------------------------------------
1 | package com.fc.service;
2 |
3 | import org.apache.log4j.Logger;
4 | import org.apache.log4j.spi.LoggerFactory;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import com.fc.mapper.TouTiaoAdMapper;
9 | import com.fc.model.TouTiaoAdClickRecord;
10 |
11 | @Service
12 | public class TouTiaoAdService {
13 |
14 | @Autowired
15 | public TouTiaoAdMapper touTiaoAdMapper;
16 |
17 |
18 |
19 | public void insertClickRecord(String adid, String cid, String mac, Integer os, String timestamp, String convertId,
20 | String callbackUrl, String idfa, String imei, String androidid) {
21 |
22 | // 如果数据库有该手机的记录,则不再插入
23 | if (os.equals(1)) {
24 | int count = touTiaoAdMapper.selectCountByIdfa(idfa);
25 | if (count >= 1) {
26 | return;
27 | }
28 | } else if (os.equals(0)) {
29 | int count = touTiaoAdMapper.selectCountByImei(imei);
30 | if (count >= 1) {
31 | return;
32 | }
33 | }
34 |
35 | TouTiaoAdClickRecord record = new TouTiaoAdClickRecord();
36 | record.setAdid(adid);
37 | record.setCid(cid);
38 | record.setMac(mac);
39 | record.setOs(os);
40 | record.setTimestamp(timestamp);
41 | record.setConvertId(convertId);
42 | record.setCallbackUrl(callbackUrl);
43 | record.setIdfa(idfa);
44 | record.setImei(imei);
45 | record.setAndroidid(androidid);
46 |
47 |
48 |
49 | touTiaoAdMapper.insertClickRecord(record);
50 |
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/util/HttpUtils.java:
--------------------------------------------------------------------------------
1 | package com.fc.util;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 | import java.util.Map;
7 | import java.util.Map.Entry;
8 |
9 | import org.apache.http.HttpEntity;
10 | import org.apache.http.NameValuePair;
11 | import org.apache.http.ParseException;
12 | import org.apache.http.client.ClientProtocolException;
13 | import org.apache.http.client.entity.UrlEncodedFormEntity;
14 | import org.apache.http.client.methods.CloseableHttpResponse;
15 | import org.apache.http.client.methods.HttpGet;
16 | import org.apache.http.client.methods.HttpPost;
17 | import org.apache.http.impl.client.CloseableHttpClient;
18 | import org.apache.http.impl.client.HttpClients;
19 | import org.apache.http.message.BasicNameValuePair;
20 | import org.apache.http.util.EntityUtils;
21 |
22 | public class HttpUtils {
23 | public static String send(String url, Map map, String encoding) throws ParseException, IOException {
24 | String body = "";
25 |
26 | // 创建httpclient对象
27 | CloseableHttpClient client = HttpClients.createDefault();
28 | // 创建post方式请求对象
29 | HttpPost httpPost = new HttpPost(url);
30 |
31 | // 装填参数
32 | List nvps = new ArrayList();
33 | if (map != null) {
34 | for (Entry entry : map.entrySet()) {
35 | nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
36 | }
37 | }
38 | // 设置参数到请求对象中
39 | httpPost.setEntity(new UrlEncodedFormEntity(nvps, encoding));
40 |
41 | System.out.println("请求地址:" + url);
42 | System.out.println("请求参数:" + nvps.toString());
43 |
44 | // 设置header信息
45 | // 指定报文头【Content-type】、【User-Agent】
46 | httpPost.setHeader("Content-type", "application/x-www-form-urlencoded");
47 | httpPost.setHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
48 |
49 | // 执行请求操作,并拿到结果(同步阻塞)
50 | CloseableHttpResponse response = client.execute(httpPost);
51 | // 获取结果实体
52 | HttpEntity entity = response.getEntity();
53 | if (entity != null) {
54 | // 按指定编码转换结果实体为String类型
55 | body = EntityUtils.toString(entity, encoding);
56 | }
57 | EntityUtils.consume(entity);
58 | // 释放链接
59 | response.close();
60 | System.out.println("返回结果:" + body);
61 | return body;
62 | }
63 |
64 | public static String get(String url) throws ClientProtocolException, IOException {
65 | CloseableHttpClient httpclient = HttpClients.createDefault();
66 | HttpGet httpGet = new HttpGet(url);
67 | CloseableHttpResponse response1 = httpclient.execute(httpGet);
68 | System.out.println(response1.getStatusLine());
69 | HttpEntity entity = response1.getEntity();
70 |
71 | String body = "";
72 | if (entity != null) {
73 | // 按指定编码转换结果实体为String类型
74 | body = EntityUtils.toString(entity, "utf8");
75 | }
76 | EntityUtils.consume(entity);
77 | // 释放链接
78 | response1.close();
79 | System.out.println("返回结果:" + body);
80 | return body;
81 |
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/util/MyConstant.java:
--------------------------------------------------------------------------------
1 | package com.fc.util;
2 |
3 | public class MyConstant {
4 | // 七牛云相关
5 | public static final String QINIU_IMAGE_URL = "http://od6v5lenq.bkt.clouddn.com/";
6 | public static final String QINIU_ACCESS_KEY = "OO_3P93p4-feCji_Vd3SQPA4FtrUpjw8bL1jXhF8";
7 | public static final String QINIU_SECRET_KEY = "AXdJXoYtGL42K_w7UzaNxhrNU55K_XEkv-Zgte1w";
8 | public static final String QINIU_BUCKET_NAME = "excited";
9 |
10 | // 发送邮件的邮箱,要与df.properties中的一致
11 | public static final String MAIL_FROM = "ceshihahu@yeah.net";
12 |
13 | // 域名
14 | // public static final String DOMAIN_NAME = "http://localhost:8080/hahu/";
15 | public static final String DOMAIN_NAME = "http://naivee.me/";
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/util/MyFreeMarkerView.java:
--------------------------------------------------------------------------------
1 | package com.fc.util;
2 |
3 | import java.util.Map;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 |
7 | import org.springframework.web.servlet.view.freemarker.FreeMarkerView;
8 |
9 | public class MyFreeMarkerView extends FreeMarkerView {
10 |
11 | private static final String CONTEXT_PATH = "base";
12 |
13 | @Override
14 | protected void exposeHelpers(Map model, HttpServletRequest request) throws Exception {
15 | model.put(CONTEXT_PATH, request.getContextPath());
16 | super.exposeHelpers(model, request);
17 | }
18 | }
--------------------------------------------------------------------------------
/src/main/java/com/fc/util/MyUtil.java:
--------------------------------------------------------------------------------
1 | package com.fc.util;
2 |
3 | import java.math.BigInteger;
4 | import java.security.MessageDigest;
5 | import java.security.NoSuchAlgorithmException;
6 | import java.text.SimpleDateFormat;
7 | import java.util.ArrayList;
8 | import java.util.Date;
9 | import java.util.List;
10 | import java.util.Set;
11 | import java.util.UUID;
12 |
13 | public class MyUtil {
14 |
15 | public static String md5(String plainText) {
16 | byte[] secretBytes = null;
17 | try {
18 | secretBytes = MessageDigest.getInstance("md5").digest(plainText.getBytes());
19 | } catch (NoSuchAlgorithmException e) {
20 | throw new RuntimeException("没有md5这个算法!");
21 | }
22 | String md5code = new BigInteger(1, secretBytes).toString(16);// 16进制数字
23 | // 如果生成数字未满32位,需要前面补0
24 | for (int i = 0; i < 32 - md5code.length(); i++) {
25 | md5code = "0" + md5code;
26 | }
27 | return md5code;
28 | }
29 |
30 | public static String formatDate(Date date) {
31 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
32 | return sdf.format(date);
33 | }
34 |
35 | public static String createRandomCode() {
36 | return new Date().getTime() + UUID.randomUUID().toString().replace("-", "");
37 | }
38 |
39 | public static List StringSetToIntegerList(Set set) {
40 | List list = new ArrayList<>();
41 | for (String s : set) {
42 | list.add(Integer.parseInt(s));
43 | }
44 | return list;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/util/QiniuyunUtil.java:
--------------------------------------------------------------------------------
1 | package com.fc.util;
2 |
3 | import java.io.IOException;
4 |
5 | import org.springframework.stereotype.Service;
6 |
7 | import com.qiniu.http.Response;
8 | import com.qiniu.storage.UploadManager;
9 | import com.qiniu.util.Auth;
10 |
11 | @Service
12 | public class QiniuyunUtil {
13 | // 设置好账号的ACCESS_KEY和SECRET_KEY
14 | private static String ACCESS_KEY = MyConstant.QINIU_ACCESS_KEY;
15 | private static String SECRET_KEY = MyConstant.QINIU_SECRET_KEY;
16 | // 要上传的空间
17 | private static String BUCKET_NAME = MyConstant.QINIU_BUCKET_NAME;
18 | // 密钥配置
19 | private static Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);
20 | // 创建上传对象
21 | private static UploadManager uploadManager = new UploadManager();
22 |
23 | // 简单上传,使用默认策略,只需要设置上传的空间名就可以了
24 | public static String getUpToken() {
25 | return auth.uploadToken(BUCKET_NAME);
26 | }
27 |
28 | public static void upload(byte[] localData, String remoteFileName) throws IOException {
29 | Response res = uploadManager.put(localData, remoteFileName, getUpToken());
30 | // 打印返回的信息
31 | System.out.println(res.bodyString());
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/util/RedisKey.java:
--------------------------------------------------------------------------------
1 | package com.fc.util;
2 |
3 | public class RedisKey {
4 |
5 | // 某收藏夹收藏了哪些回答
6 | public static final String COLLECT = ":collect";
7 | // 某回答被哪些收藏夹收藏
8 | public static final String COLLECTED = ":collected";
9 |
10 | // 某人关注哪些人
11 | public static final String FOLLOW_PEOPLE = ":follow_people";
12 | // 某人被哪些人关注
13 | public static final String FOLLOWED_PEOPLE = ":followed_people";
14 |
15 | // 某人关注哪些话题
16 | public static final String FOLLOW_TOPIC = ":follow_topic";
17 | // 某话题被哪些人关注
18 | public static final String FOLLOWED_TOPIC = ":followed_topic";
19 |
20 | // 某人关注哪些问题
21 | public static final String FOLLOW_QUESTION = ":follow_question";
22 | // 某问题被哪些人关注
23 | public static final String FOLLOWED_QUESTION = ":followed_question";
24 |
25 | // 某人关注哪些收藏夹
26 | public static final String FOLLOW_COLLECTION = ":follow_collection";
27 | // 某收藏夹被哪些人关注
28 | public static final String FOLLOWED_COLLECTION = ":followed_collection";
29 |
30 | // 某人点赞了哪些回答
31 | public static final String LIKE_ANSWER = ":like_answer";
32 | // 某回答被哪些人点赞
33 | public static final String LIKED_ANSWER = ":liked_answer";
34 |
35 | // 某人点赞了哪些某问题评论
36 | public static final String LIKE_QUESTION_COMMENT = ":like_question_answer";
37 | // 某问题评论被哪些人点赞
38 | public static final String LIKED_QUESTION_COMMENT = ":liked_question_answer";
39 |
40 | // 某人点赞了哪些回答评论
41 | public static final String LIKE_ANSWER_COMMENT = ":like_answer_comment";
42 | // 某回答评论被哪些人点赞
43 | public static final String LIKED_ANSWER_COMMENT = ":liked_answer_comment";
44 |
45 | // 某问题被浏览次数
46 | public static final String QUESTION_SCANED_COUNT = ":question_scaned_count";
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/fc/util/Response.java:
--------------------------------------------------------------------------------
1 | package com.fc.util;
2 |
3 | public class Response {
4 | private int state;
5 | private String message;
6 | private Object data;
7 |
8 | public Response() {
9 | }
10 |
11 | public Response(int state) {
12 | this.state = state;
13 | }
14 |
15 | public Response(int state, String message) {
16 | this.state = state;
17 | this.message = message;
18 | }
19 |
20 | public Response(int state, String message, Object data) {
21 | this.state = state;
22 | this.message = message;
23 | this.data = data;
24 | }
25 |
26 | public int getState() {
27 | return state;
28 | }
29 |
30 | public void setState(int state) {
31 | this.state = state;
32 | }
33 |
34 | public String getMessage() {
35 | return message;
36 | }
37 |
38 | public void setMessage(String message) {
39 | this.message = message;
40 | }
41 |
42 | public Object getData() {
43 | return data;
44 | }
45 |
46 | public void setData(Object data) {
47 | this.data = data;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/resources/application-context.xml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | true
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/src/main/resources/com/fc/mapper/CollectionMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | insert into collection(collection_name,create_time,update_time,user_id)
23 | values(#{collectionName},#{createTime},#{updateTime},#{userId})
24 |
25 |
26 |
31 |
32 |
38 |
39 |
43 |
44 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/src/main/resources/com/fc/mapper/CommentMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
16 |
17 |
24 |
25 |
32 |
33 |
40 |
41 |
48 |
49 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/src/main/resources/com/fc/mapper/MessageMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | insert into message(type,second_type,message_date,message_time,from_user_id,from_user_name,user_id)
8 | values(#{type},#{secondType},#{messageDate},#{messageTime},#{fromUserId},#{fromUserName},#{userId})
9 |
10 |
11 |
12 | insert into message(type,second_type,message_date,message_time,from_user_id,from_user_name,question_id,question_title,answer_id,user_id)
13 | values(#{type},#{secondType},#{messageDate},#{messageTime},#{fromUserId},#{fromUserName},#{questionId},#{questionTitle},#{answerId},#{userId})
14 |
15 |
16 |
20 |
21 |
22 | insert into message(type,second_type,message_date,message_time,from_user_id,from_user_name,question_id,question_title,answer_id,user_id)
23 | values(#{type},#{secondType},#{messageDate},#{messageTime},#{fromUserId},#{fromUserName},#{questionId},#{questionTitle},#{answerId},#{userId})
24 |
25 |
26 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/resources/com/fc/mapper/QuestionMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | select last_insert_id() as questionId
8 |
9 | insert into question(question_title,question_content,topic_kv_list,create_time,user_id)
10 | values(#{questionTitle},#{questionContent},#{topicKvList},#{createTime},#{userId})
11 |
12 |
13 |
14 | insert into question_topic(question_id,topic_id)
15 | values(#{questionId},#{topicId})
16 |
17 |
18 |
19 |
22 |
23 |
26 |
27 |
32 |
33 |
38 |
39 |
43 |
44 |
50 |
51 |
61 |
62 |
63 |
71 |
72 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/src/main/resources/com/fc/mapper/TopicMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | select last_insert_id() as topicId
8 |
9 | insert into topic(topic_name,parent_topic_id,topic_desc) values(#{topicName},#{parentTopicId},'暂无描述')
10 |
11 |
12 |
15 |
16 |
19 |
20 |
25 |
26 |
29 |
30 |
33 |
34 |
37 |
38 |
48 |
49 |
50 | update topic set followed_count = followed_count + 1
51 | where topic_id = #{topicId}
52 |
53 |
54 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/main/resources/com/fc/mapper/TouTiaoAdMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | insert into toutiao_ad_click_record(adid, cid, mac, os, timestamp, convert_id, callback_url, idfa, imei, androidid, ctime)
7 | values(#{adid}, #{cid}, #{mac}, #{os}, #{timestamp}, #{convertId}, #{callbackUrl}, #{idfa}, #{imei}, #{androidid}, now())
8 |
9 |
10 |
14 |
15 |
19 |
--------------------------------------------------------------------------------
/src/main/resources/com/fc/mapper/UserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | select last_insert_id() as userId
8 |
9 | insert into user(email,password,activation_code,join_time,username,avatar_url)
10 | values(#{email},#{password},#{activationCode},#{joinTime},#{username},#{avatarUrl})
11 |
12 |
13 |
14 |
15 |
16 | select last_insert_id() as userId
17 |
18 | insert into user(username, avatar_url, weibo_user_id)
19 | values(#{username}, #{avatarUrl}, #{weiboUserId})
20 |
21 |
22 |
25 |
26 |
29 |
30 |
33 |
34 |
37 |
38 |
41 |
42 |
43 | update user set activation_state = 1 where activation_code = #{activationCode}
44 |
45 |
46 |
50 |
51 |
61 |
62 |
63 | update user set liked_count = liked_count + 1
64 | where user_id = (select user_id from answer where answer_id = #{answerId})
65 |
66 |
67 |
68 | update user set collected_count = collected_count + 1
69 | where user_id = (select user_id from answer where answer_id = #{answerId})
70 |
71 |
72 |
73 | update user set username=#{username},simple_desc=#{simpleDesc},position=#{position},
74 | industry=#{industry},career=#{career},education=#{education},full_desc=#{fullDesc}
75 | where user_id=#{userId}
76 |
77 |
78 |
82 |
83 |
84 | update user set password = #{newpassword}
85 | where user_id = #{userId}
86 |
87 |
88 |
89 | update user set avatar_url = #{avatarUrl}
90 | where user_id= #{userId}
91 |
92 |
93 |
97 |
98 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/src/main/resources/df.properties:
--------------------------------------------------------------------------------
1 | mysql.url=jdbc:mysql://127.0.0.1:3306/hahu?useUnicode=true&characterEncoding=utf-8
2 | mysql.driverClassName=com.mysql.jdbc.Driver
3 | mysql.username=root
4 | mysql.password=000000
5 |
6 | redis.hostName=localhost
7 | redis.port=6379
8 | redis.password=666666
9 | redis.timeout=5000
10 |
11 | redis.pool.maxActive=300
12 | redis.pool.maxIdle=250
13 | redis.pool.minIdle=200
14 | redis.pool.maxWait=3000
15 |
16 | redis.pool.testOnBorrow=true
17 | redis.pool.testOnReturn=true
18 |
19 | mail.host=smtp.yeah.net
20 | mail.username=ceshihahu@yeah.net
21 | mail.password=ceshihahu000000
22 |
--------------------------------------------------------------------------------
/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=WARN, stdout, R
2 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
3 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
4 | # Pattern to output the caller's file name and line number.
5 | #log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
6 | # Print the date in ISO 8601 format
7 | log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
8 | log4j.appender.R=org.apache.log4j.RollingFileAppender
9 | log4j.appender.R.File=example.log
10 | log4j.appender.R.MaxFileSize=100KB
11 | # Keep one backup file
12 | log4j.appender.R.MaxBackupIndex=1
13 | log4j.appender.R.layout=org.apache.log4j.PatternLayout
14 | log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
15 | # Print only messages of level WARN or above in the package com.foo.
16 | log4j.logger.com.fc=WARN
--------------------------------------------------------------------------------
/src/main/resources/mybatis-config.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/spring-mvc.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
30 |
31 |
32 | application/json
33 | text/html;charset=UTF-8
34 |
35 |
36 |
37 |
38 | WriteMapNullValue
39 | QuoteFieldNames
40 | WriteDateUseDateFormat
41 | WriteEnumUsingToString
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
51 |
52 |
53 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | /toLogin
79 | /register
80 | /login
81 | /activate
82 | /logout
83 | /weiboLogin
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/collectionContent.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 收藏夹详情
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | <#include "nav.html"/>
15 |
16 |
17 |
18 |
19 |
${collection.collectionName}
20 |
21 |
22 |
23 | <#if answerList??>
24 | <#list answerList as answer>
25 |
26 |
27 |
28 |
29 |
32 |
37 |
38 | ${answer.answerContent}
39 |
40 |
45 |
46 |
47 | #list>
48 | #if>
49 |
50 |
51 |
86 |
87 | <#include "mask.html"/>
88 | <#include "maskCollectAnswer.html"/>
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/collectionList.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 收藏夹列表
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | <#include "nav.html"/>
14 |
58 | <#include "mask.html"/>
59 | <#include "maskAddCollection.html"/>
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/editProfile.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 编辑信息
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | <#include "nav.html"/>
14 |
15 |
16 |
17 |
49 |
50 |
51 |
52 |
64 |
65 |
66 |
67 |
76 |
77 |
78 |
79 |
80 | <#include "mask.html"/>
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/explore.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 发现
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | <#include "nav.html"/>
14 |
15 |
16 |
20 |
21 |
22 | -
23 |
24 |
55 |
56 |
57 | -
58 |
59 |
90 |
91 |
92 |
93 |
94 |
112 |
113 | <#include "mask.html"/>
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 首页
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | <#include "nav.html"/>
15 |
16 |
17 |
18 |
19 |

20 |
21 |
27 |
28 |
32 |
33 |
76 |
77 |
78 |
96 |
97 | <#include "mask.html"/>
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/mask.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 提问
6 | ×
7 |
8 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/maskAddCollection.html:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 | 创建收藏夹
12 | ×
13 |
14 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/maskCollectAnswer.html:
--------------------------------------------------------------------------------
1 |
54 |
55 |
56 |
57 |
58 | 添加到收藏夹
59 | ×
60 |
61 |
62 | <#list collectionList as collection>
63 | -
64 |
${collection.collectionName}
65 | 5 条内容
66 | •
67 | 5 人关注
68 |
69 |
70 | #list>
71 |
72 |
73 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/message.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 首页
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | <#include "nav.html" parse=true encoding="utf-8"/>
14 |
15 |
16 |
17 |
全部消息
18 |
19 | <#list map?keys as key>
20 | -
21 |
${key}
22 |
23 | <#list map[key] as message>
24 | <#if message.type==1>
25 |
29 | <#elseif message.type==2>
30 |
34 | <#elseif message.type==3>
35 |
39 | <#else>
40 |
44 | #if>
45 | #list>
46 |
47 |
48 | #list>
49 |
50 |
51 |
69 |
70 | <#include "mask.html"/>
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/nav.html:
--------------------------------------------------------------------------------
1 | <#setting number_format="#">;
2 |
3 |
13 |
14 | <#assign base = request.contextPath/>
15 |
16 |
17 |
18 |
蛤乎
19 |
20 |
24 |
25 |
34 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/prompt/error.html:
--------------------------------------------------------------------------------
1 | ${error}
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/questionList.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 问题列表
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | <#include "nav.html"/>
14 |
15 |
16 |
19 |
20 |
21 | -
22 |
33 |
34 |
37 |
38 |
39 |
40 |
57 |
58 | <#include "mask.html"/>
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/setting.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 设置
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | <#include "nav.html"/>
13 |
14 |
15 |
18 |
19 |
20 | -
21 |
22 |
更换邮箱
23 |
1104641801@qq.com 修改
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 | <#include "mask.html"/>
35 |
36 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/topicList.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 话题广场
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | <#include "nav.html"/>
15 |
16 |
17 |
34 |
35 |
36 |
37 |
38 |
39 | <#include "mask.html"/>
40 |
41 |
42 |
43 |
44 |
45 |
46 |
81 |
82 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/view/topics.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 话题广场
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | <#include "nav.html"/>
15 |
16 |
17 |
28 |
29 |
30 |
48 |
49 |
50 |
51 |
78 |
79 |
80 | <#include "mask.html"/>
81 |
82 |
83 |
84 |
85 |
86 |
87 |
122 |
123 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 | contextConfigLocation
9 | classpath:application-context.xml
10 |
11 |
12 |
16 |
17 | CharacterEncodingFilter
18 | org.springframework.web.filter.CharacterEncodingFilter
19 |
20 | encoding
21 | utf-8
22 |
23 |
24 |
28 |
29 | CharacterEncodingFilter
30 | /*
31 |
32 |
33 |
34 | org.springframework.web.context.ContextLoaderListener
35 |
36 |
37 |
38 |
39 | spring-mvc
40 | org.springframework.web.servlet.DispatcherServlet
41 |
42 | contextConfigLocation
43 |
44 | classpath:spring-mvc.xml
45 |
46 |
47 |
48 |
49 | spring-mvc
50 | /
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/main/webapp/css/base.css:
--------------------------------------------------------------------------------
1 | html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, fieldset, legend, img {
2 | margin: 0;
3 | padding: 0;
4 | }
5 |
6 | html,body{
7 | height: 100%;
8 | width: 100%;
9 | }
10 |
11 | body{
12 | font-family: 'Helvetica Neue',Helvetica,'PingFang SC','Hiragino Sans GB','Microsoft YaHei','Noto Sans CJK SC','WenQuanYi Micro Hei',Arial,sans-serif;
13 |
14 | }
15 |
16 | ul, ol {
17 | list-style: none;
18 | }
19 |
20 | h1, h2, h3, h4, h5, h6 {
21 | text-decoration: none;
22 | font-weight: normal;
23 | font-size: 100%;
24 | }
25 |
26 | s, i, em {
27 | font-style: normal;
28 | text-decoration: none;
29 | }
30 |
31 | fieldset, img, input, button {
32 | border: none;
33 | padding: 0;
34 | margin: 0;
35 | outline-style: none;
36 | font-size: 14px;
37 | font-family: 'Helvetica Neue',Helvetica,'PingFang SC','Hiragino Sans GB','Microsoft YaHei','Noto Sans CJK SC','WenQuanYi Micro Hei',Arial,sans-serif;
38 | }
39 |
40 | a {
41 | text-decoration: none;
42 | color: #259;
43 | }
44 |
45 |
46 | a:link {
47 | text-decoration: none;
48 | }
49 |
50 | a:visited {
51 | text-decoration: none;
52 | }
53 |
54 | a:hover {
55 | text-decoration: none;
56 | }
57 |
58 | a:active {
59 | text-decoration: none;
60 | }
61 |
62 | .color259{
63 | color: #259;
64 | }
65 |
66 |
67 | .show{
68 | display: block;
69 | }
70 |
71 | .hide{
72 | display: none;
73 | }
74 |
75 | .c999{
76 | color: #999;
77 | }
78 |
79 |
80 |
81 | .like-clicked{
82 | background-color: #698EBF!important;
83 | color: white!important;
84 | }
85 |
86 | .like-clicked-i{
87 | border: 6px solid #698EBF!important;
88 | border-bottom: 6px solid white!important;
89 | }
90 |
91 | .like-unclicked{
92 | background-color: #EFF6FA!important;
93 | color: #698ebf!important;
94 | }
95 |
96 | .like-unclicked-i{
97 | border: 6px solid white!important;
98 | border-bottom: 6px solid #698EBF!important;
99 | }
100 |
101 | .loading{
102 | width: 632px;
103 | height: 250px;
104 | background-image: url("http://od6v5lenq.bkt.clouddn.com/1c3d1c87-fc48-4a89-af54-daf7429bf4df.gif");
105 | background-repeat: no-repeat;
106 | background-position: center top;
107 | }
108 |
109 | .text-danger{
110 | color: red;
111 | }
112 |
--------------------------------------------------------------------------------
/src/main/webapp/css/collectionList.css:
--------------------------------------------------------------------------------
1 |
2 | /*主体部分*/
3 | .main{
4 | width: 960px;
5 | margin: 0 auto;
6 | }
7 |
8 | /*内容部分*/
9 | .content{
10 | float: left;
11 | width: 632px;
12 | }
13 |
14 | .content div.divide{
15 | border-bottom: 1px solid #ccc;
16 | }
17 |
18 | .content ul.head{
19 | position: relative;
20 | height: 28px;
21 | }
22 |
23 | .content ul.head li{
24 | position: absolute;
25 | width: 100px;
26 | height: 17px;
27 | padding: 5px 15px;
28 | font-size: 13px;
29 | color: #259;
30 | cursor: pointer;
31 | }
32 |
33 | .content ul.head li:nth-child(1){
34 | top: 0;
35 | left: 0;
36 | }
37 |
38 | .content ul.head li:nth-child(2){
39 | top: 0;
40 | left: 140px;
41 | }
42 |
43 | .content ul.head li.active{
44 | color: #666;
45 | background-color: white;
46 | border: 1px #ccc solid;
47 | border-bottom: none;
48 | height: 18px;
49 | }
50 |
51 | .content li .title{
52 | padding: 15px 5px 10px;
53 | border-bottom: 1px solid #eee;
54 | line-height: 1.7;
55 | font-size: 13px;
56 | color: #666;
57 | }
58 |
59 | .content li div.item{
60 | padding: 10px 5px;
61 | border-bottom: 1px solid #eee;
62 | line-height: 1.7;
63 | }
64 |
65 |
66 |
67 | .content li div.item a,
68 | .content li div.item span{
69 | margin-right: 5px;
70 | color: #999;
71 | font-size: 13px;
72 | }
73 |
74 | .content li div.item a:hover{
75 | color: #698ebf;
76 | text-decoration: underline;
77 | }
78 |
79 | .content li div.item h4 a{
80 | font-weight: bold;
81 | color: #259;
82 | font-size: 14px;
83 | }
84 |
85 | /*更多按钮*/
86 | .content .more-answer{
87 | padding-bottom: 30px;
88 | border-bottom: 1px solid #eee;
89 | }
90 |
91 | .content .more-answer a{
92 | display: block;
93 | font-size: 13px;
94 | margin: 20px 0;
95 | padding: 5px 1px;
96 | color: #666;
97 | text-shadow: 0 1px 0 #fff;
98 | background: linear-gradient(to bottom,#f8f8f9,#e6e6e8);
99 | border: 1px solid #bbb;
100 | box-shadow: 0 1px 0 #fff inset, 0 1px 0 rgba(0,0,0,.1);
101 | line-height: 1.7;
102 | text-decoration: none!important;
103 | text-align: center;
104 | vertical-align: middle;
105 | cursor: pointer;
106 | border-radius: 3px;
107 | box-sizing: border-box;
108 | }
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | /*右侧工具栏部分*/
126 | .sidebar{
127 | float: right;
128 | width: 270px;
129 | height: 600px;
130 | margin-left: 58px;
131 | /*background-color: yellow;*/
132 | }
133 |
134 | /*工具类顶部部分*/
135 | .sidebar-top{
136 | padding-bottom: 16px;
137 | border-bottom: 1px solid #eee;
138 | }
139 |
140 | .sidebar-top ul li{
141 | width: 270px;
142 | height: 28px;
143 | padding-left: 10px;
144 | margin-bottom: 5px;
145 | }
146 |
147 | .sidebar-top ul li a{
148 | display: block;
149 | width: 270px;
150 | height: 28px;
151 | line-height: 28px;
152 | color: #666;
153 | font-size: 13px;
154 | }
155 |
156 | .sidebar-top ul li a:hover{
157 | color: #259;
158 | background: #eff6fa;
159 | border-radius: 3px;
160 | }
161 |
162 | .sidebar-item{
163 | font-size: 13px;
164 | padding: 16px 0 16px 12px;
165 | border-bottom: 1px solid #eee;
166 | }
167 |
168 | .sprite-collection{
169 | display: inline-block;
170 | background-image: url(../image/sprites-1.9.2.4c54885a.png);
171 | background-position: -167px -4px;
172 | margin-right: 2px;
173 | width: 14px;
174 | height: 14px;
175 | vertical-align: -2px;
176 | }
177 |
178 | .sprite-question{
179 | display: inline-block;
180 | background-image: url(../image/sprites-1.9.2.4c54885a.png);
181 | background-position: -183px -4px;
182 | margin-right: 2px;
183 | width: 14px;
184 | height: 14px;
185 | vertical-align: -2px;
186 | }
187 |
188 | .sprite-invite{
189 | display: inline-block;
190 | background-image: url(../image/sprites-1.9.2.4c54885a.png);
191 | background-position: -200px -4px;
192 | margin-right: 2px;
193 | width: 14px;
194 | height: 14px;
195 | vertical-align: -2px;
196 | }
197 |
198 | /*工具栏专栏部分*/
199 | .sidebar-zhuanlan{
200 | padding: 15px 0 15px 10px;
201 | }
202 |
203 | .sidebar-zhuanlan h2{
204 | margin: 16px 0 0;
205 | font-weight: 700;
206 | font-size: 14px;
207 | color: #000;
208 | }
209 |
210 | .sidebar-zhuanlan ul li{
211 | padding: 10px 0 10px;
212 | border-bottom: 1px solid #eee;
213 | line-height: 34px;
214 | color: #666;
215 | font-size: 13px;
216 | }
217 |
218 | .sidebar-zhuanlan ul li a{
219 | display: block;
220 | line-height: 34px;
221 | color: #666;
222 | }
223 |
224 | .sidebar-zhuanlan ul li a:hover{
225 | color: #259;
226 | background: #eff6fa;
227 | border-radius: 3px;
228 | }
229 |
230 | .sprite-zhuanlan{
231 | display: inline-block;
232 | background-image: url(../image/sprites.auto.a740548f.png);
233 | margin-right: 5px;
234 | background-position: 0 0;
235 | width: 25px;
236 | height: 25px;
237 | vertical-align: middle;
238 | }
239 |
240 | /*footer部分*/
241 |
242 | .footer{
243 | padding-top: 10px;
244 | padding-left: 10px;
245 | }
246 |
247 | .footer, .footer a{
248 | /*display: inline-block;*/
249 | line-height: 24px;
250 | color: #666;
251 | font-size: 13px;
252 | }
253 |
254 | .footer a:hover{
255 | text-decoration: underline;
256 | }
257 |
258 |
259 |
260 |
261 |
--------------------------------------------------------------------------------
/src/main/webapp/css/editProfile.css:
--------------------------------------------------------------------------------
1 | .main{
2 | width: 960px;
3 | margin: 20px auto;
4 | padding: 20px 20px 60px;
5 | }
6 |
7 | /*头部标题*/
8 | .edit-header{
9 | position: relative;
10 | font: 700 16px/52px "微软雅黑";
11 | color: #000;
12 | border-bottom: 1px dashed #ccc;
13 | margin-bottom: 20px;
14 | padding-left: 10px;
15 | }
16 |
17 | .edit-header span{
18 | position: absolute;
19 | top: 20px;
20 | left: 0;
21 | height: 8px;
22 | width: 8px;
23 | background-color: #FF6547;
24 | }
25 |
26 |
27 | /*输入框*/
28 | .edit-title{
29 | padding-bottom: 20px;
30 | }
31 |
32 | .edit-title input{
33 | border: 1px solid #d4d4d4;
34 | border-radius: 3px;
35 | color: #34495e;
36 | font-family: Lato,sans-serif;
37 | font-size: 14px;
38 | padding: 8px 5px;
39 | width: 700px;
40 | height: 25px;
41 | }
42 |
43 |
44 |
45 |
46 | .edit-submit{
47 | position: relative;
48 | right: 152px;
49 | bottom: 0;
50 | float: right;
51 | width: 126px;
52 | text-align: center;
53 | border-radius: 3px;
54 | background-color: #00B091;
55 | color: #fff;
56 | font: 14px/36px "微软雅黑";
57 | cursor: pointer;
58 | }
--------------------------------------------------------------------------------
/src/main/webapp/css/login.css:
--------------------------------------------------------------------------------
1 | body{
2 | background: #F7FAFC;
3 | overflow: hidden;
4 | }
5 |
6 | .wrap{
7 | position: absolute;
8 | top: 0;
9 | left: 50%;
10 | margin-left: -150px;
11 | }
12 |
13 | header{
14 | width: 300px;
15 | margin: 0 auto;
16 | text-align: center;
17 | }
18 |
19 | header h1{
20 | padding-top: 60px;
21 | font-size: 74px;
22 | font-weight: 300;
23 | color: #0f88eb;
24 | }
25 |
26 | header p{
27 | padding: 30px 0 25px;
28 | font-size: 18px;
29 | color: #555;
30 | }
31 |
32 | section{
33 | width: 300px;
34 | margin: 0 auto;
35 | }
36 |
37 | section ul{
38 | padding-left: 95px;
39 | margin-bottom: 19px;
40 | overflow: hidden;
41 | }
42 |
43 | section ul li{
44 | float: left;
45 | width: 44px;
46 | margin-right: 28px;
47 | font-size: 18px;
48 | line-height: 32px;
49 | text-align: center;
50 | color: #0f88eb;
51 | cursor: pointer;
52 | }
53 |
54 | .active-header{
55 | border-bottom: 2px solid #0f88eb;
56 | }
57 |
58 | section div.inputs{
59 | border: 1px solid #d5d5d5;
60 | border-radius: 3px;
61 | margin-bottom: 18px;
62 | }
63 |
64 | section div.inputs input +input{
65 | border-top: 1px solid #e8e8e8;
66 | }
67 |
68 | section input{
69 | width: 287px;
70 | height: 48px;
71 | padding-left: 11px;
72 | }
73 |
74 | section input::-webkit-input-placeholder{
75 | margin-left: 11px;
76 | font-size: 14px;
77 | color: #e4e4e4;
78 | }
79 |
80 |
81 | button{
82 | width: 300px;
83 | height: 43px;
84 | line-height: 43px;
85 | border-radius: 3px;
86 | text-align: center;
87 | background-color: #0f88eb;
88 | color: white;
89 | font-size: 15px;
90 | cursor: pointer;
91 | }
92 |
93 | button:hover{
94 | background-color: #55abed;
95 | }
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/src/main/webapp/css/mask.css:
--------------------------------------------------------------------------------
1 |
2 | /*遮罩层处理*/
3 |
4 | .mask{
5 | display: none;
6 | position: fixed;
7 | width: 100%;
8 | height: 100%;
9 | top: 0;
10 | left: 0;
11 | background-color: rgba(0,0,0,.5);
12 | zoom:1001;
13 | }
14 |
15 | .upon-mask{
16 | overflow: hidden;
17 | display: none;
18 | position: fixed;
19 | border-radius: 8px;
20 | width: 550px;
21 | height: 420px;
22 | background-color: #fff;
23 | top: 50%;
24 | left: 50%;
25 | margin-top: -210px;
26 | margin-left: -275px;
27 | box-shadow: 0 0 80px 0 rgba(0,0,0,.4);
28 | }
29 |
30 | .upon-mask h3{
31 | border-radius: 8px 8px 0 0;
32 | padding: 10px 20px;
33 | line-height: 14px;
34 | background: linear-gradient(to bottom,#1D7FE2,#0865C2);
35 | }
36 |
37 | .upon-mask h3 span:first-child{
38 | color: #fff;
39 | text-shadow: 0 1px 1px rgba(0,0,0,.4);
40 | font-size: 15px;
41 | font-weight: 700;
42 | }
43 |
44 | .upon-mask h3 span.close-mask{
45 | position: absolute;
46 | top: 8px;
47 | right: 12px;
48 | font-size: 18px;
49 | font-weight: bold;
50 | color: blue;
51 | cursor: pointer;
52 | width: 16px;
53 | height: 16px;
54 | border-radius: 8px;
55 | background-color: white;
56 | text-align: center;
57 | line-height: 17px;
58 | }
59 |
60 | .upon-mask form{
61 | padding: 10px 20px;
62 | font-size: 13px;
63 | line-height: 1.7;
64 | }
65 |
66 |
67 |
68 | .upon-mask input{
69 | width: 489px;
70 | padding: 8px 10px;
71 | font-size: 13px;
72 | line-height: 15px;
73 | box-shadow: 0 1px 1px rgba(0,0,0,.1) inset;
74 | border-radius: 3px;
75 | background: #fff;
76 | border: 1px solid #ccc;
77 | color: #222;
78 | margin: 10px 0;
79 | }
80 |
81 | .upon-mask div{
82 | margin-top: 5px;
83 | }
84 |
85 |
86 | .upon-mask button{
87 | float: right;
88 | color: #fff;
89 | text-shadow: 0 -1px 0 rgba(0,0,0,.5);
90 | background: #1472cf;
91 | background: -webkit-linear-gradient(top,#1d7fe2,#0865c2);
92 | background: linear-gradient(to bottom,#1d7fe2,#0865c2);
93 | border: 1px solid #0D6EB8;
94 | box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 1px 0 rgba(0,0,0,.2);
95 | font-size: 14px;
96 | line-height: 1.7;
97 | text-decoration: none!important;
98 | text-align: center;
99 | padding: 4px 10px;
100 | cursor: pointer;
101 | border-radius: 3px;
102 | white-space: nowrap;
103 | box-sizing: border-box;
104 | }
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/src/main/webapp/css/nav2.css:
--------------------------------------------------------------------------------
1 | .nav{
2 | height: 60px;
3 | border-bottom: 1px solid rgba(30,35,42,.06);
4 | box-shadow: 0 1px 3px 0 rgba(0,34,77,.05);
5 | margin-bottom: 14px;
6 | }
7 |
8 | .nav .wrap{
9 | width: 1000px;
10 | margin: 0 auto;
11 | }
12 |
13 | .nav a.logo{
14 | float: left;
15 | width: 65px;
16 | padding-right: 36px;
17 | font-size: 30px;
18 | line-height: 60px;
19 | color: #0F88EB;
20 | }
21 |
22 | .nav ul.nav-top{
23 | float: left;
24 | padding-right: 7px;
25 | }
26 |
27 | .nav ul.nav-top li{
28 | float: left;
29 | padding-right: 30px;
30 | font-size: 15px;
31 | line-height: 60px;
32 | }
33 |
34 |
35 | .nav ul.nav-top li a{
36 | color: #8590A6;
37 | }
38 |
39 |
40 | .nav .search-area{
41 | float: left;
42 | /* width: 388px;*/
43 | padding: 12px 0;
44 | position: relative;
45 | }
46 |
47 | .nav .search-area input{
48 | float: left;
49 | width: 314px;
50 | height: 34px;
51 | padding-left: 10px;
52 | border: 1px solid #e7eaf1;
53 | border-radius: 3px;
54 | background: #f7f8fa;
55 | }
56 |
57 |
58 | .nav .search-area button.ask{
59 | float: left;
60 | padding: 0 14px;
61 | border: 1px solid #0f88eb;
62 | border-radius: 3px;
63 | margin-left: 16px;
64 | font-size: 14px;
65 | line-height: 34px;
66 | background-color: #0f88eb;
67 | color: white;
68 | text-align: center;
69 | cursor: pointer;
70 | }
71 |
72 | .nav .search-area button.magnifier{
73 | position: absolute;
74 | width: 16px;
75 | height: 16px;
76 | background: url(../image/sprite-nav2.png) no-repeat 0 0;
77 | top: 22px;
78 | right: 86px;
79 | cursor: pointer;
80 | }
81 |
82 | .nav .nav-right{
83 | float: left;
84 | padding: 15px 0 15px 163px;
85 | }
86 |
87 |
88 |
89 | .nav .nav-right .message{
90 | float: left;
91 | width: 18px;
92 | height: 20px;
93 | background: url(../image/sprite-nav2.png) no-repeat 0 -37px;
94 | margin-right: 41px;
95 | position: relative;
96 | top: 5px;
97 | left: 50px;
98 | }
99 |
100 | .nav .nav-right button.private-letter{
101 | float: left;
102 | width: 20px;
103 | height: 20px;
104 | background: url(../image/sprite-nav2.png) no-repeat 0 -71px;
105 | position: relative;
106 | top: 5px;
107 | left: 0;
108 | }
109 |
110 | .nav .nav-right a.profile{
111 | float: left;
112 | margin-left: 40px;
113 | }
114 |
115 | .nav .nav-right a.profile img{
116 | width: 30px;
117 | height: 30px;
118 | border-radius: 2px;
119 | }
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/src/main/webapp/css/setting.css:
--------------------------------------------------------------------------------
1 |
2 | /*主体部分*/
3 | .main{
4 | width: 960px;
5 | margin: 0 auto;
6 | font-size: 13px;
7 | }
8 |
9 | /*内容部分*/
10 | .content{
11 |
12 | }
13 |
14 | .content div.divide{
15 | border-bottom: 1px solid #ccc;
16 | }
17 |
18 | .content ul.head{
19 | position: relative;
20 | height: 28px;
21 | }
22 |
23 | .content ul.head li{
24 | position: absolute;
25 | height: 17px;
26 | padding: 5px 15px;
27 | font-size: 13px;
28 | color: #259;
29 | cursor: pointer;
30 | }
31 |
32 | .content ul.head li:nth-child(1){
33 | top: 0;
34 | left: 0;
35 | }
36 |
37 | .content ul.head li:nth-child(2){
38 | top: 0;
39 | left: 84px;
40 | }
41 |
42 | .content ul.head li.active{
43 | z-index: 1;
44 | color: #666;
45 | background-color: white;
46 | border: 1px #ccc solid;
47 | border-bottom: none;
48 | height: 18px;
49 | }
50 |
51 | .content ul.body{
52 | padding: 20px 0;
53 | }
54 |
55 | .content ul.body div{
56 | padding: 15px 0;
57 | border-bottom: 1px solid #eee;
58 | }
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | /*遮罩层处理*/
68 |
69 | .mask{
70 | display: none;
71 | position: fixed;
72 | width: 100%;
73 | height: 100%;
74 | top: 0;
75 | left: 0;
76 | background-color: rgba(0,0,0,.5);
77 | zoom:1001;
78 | }
79 |
80 | .upon-mask{
81 | overflow: hidden;
82 | display: none;
83 | position: fixed;
84 | border-radius: 8px;
85 | width: 550px;
86 | height: 420px;
87 | background-color: #fff;
88 | top: 50%;
89 | left: 50%;
90 | margin-top: -210px;
91 | margin-left: -275px;
92 | box-shadow: 0 0 80px 0 rgba(0,0,0,.4);
93 | }
94 |
95 | .upon-mask h3{
96 | border-radius: 8px 8px 0 0;
97 | padding: 10px 20px;
98 | line-height: 14px;
99 | background: linear-gradient(to bottom,#1D7FE2,#0865C2);
100 | }
101 |
102 | .upon-mask h3 span:first-child{
103 | color: #fff;
104 | text-shadow: 0 1px 1px rgba(0,0,0,.4);
105 | font-size: 15px;
106 | font-weight: 700;
107 | }
108 |
109 | .upon-mask h3 span.close-mask{
110 | position: absolute;
111 | top: 8px;
112 | right: 12px;
113 | font-size: 18px;
114 | font-weight: bold;
115 | color: blue;
116 | cursor: pointer;
117 | width: 16px;
118 | height: 16px;
119 | border-radius: 8px;
120 | background-color: white;
121 | text-align: center;
122 | line-height: 17px;
123 | }
124 |
125 | .upon-mask form{
126 | padding: 10px 20px;
127 | font-size: 13px;
128 | line-height: 1.7;
129 | }
130 |
131 |
132 |
133 | .upon-mask input{
134 | width: 489px;
135 | padding: 8px 10px;
136 | font-size: 13px;
137 | line-height: 15px;
138 | box-shadow: 0 1px 1px rgba(0,0,0,.1) inset;
139 | border-radius: 3px;
140 | background: #fff;
141 | border: 1px solid #ccc;
142 | color: #222;
143 | margin: 10px 0;
144 | }
145 |
146 | .upon-mask div{
147 | margin-top: 5px;
148 | }
149 |
150 |
151 | .upon-mask button{
152 | float: right;
153 | color: #fff;
154 | text-shadow: 0 -1px 0 rgba(0,0,0,.5);
155 | background: #1472cf;
156 | background: -webkit-linear-gradient(top,#1d7fe2,#0865c2);
157 | background: linear-gradient(to bottom,#1d7fe2,#0865c2);
158 | border: 1px solid #0D6EB8;
159 | box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 1px 0 rgba(0,0,0,.2);
160 | font-size: 14px;
161 | line-height: 1.7;
162 | text-decoration: none!important;
163 | text-align: center;
164 | padding: 4px 10px;
165 | cursor: pointer;
166 | border-radius: 3px;
167 | white-space: nowrap;
168 | box-sizing: border-box;
169 | }
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
--------------------------------------------------------------------------------
/src/main/webapp/css/writeArticle.css:
--------------------------------------------------------------------------------
1 | body{
2 | height: 1000px;
3 | }
4 |
5 | nav{
6 | height: 45px;
7 | padding: 0 15px;
8 | border-bottom: 1px solid #eee;
9 | margin-bottom: 30px;
10 | line-height: 45px;
11 | }
12 |
13 | nav span:first-child{
14 | float: left;
15 | font-size: 24px;
16 | color: #666;
17 | }
18 |
19 | nav span:nth-child(2){
20 | float: left;
21 | margin-left: 322px;
22 | font-weight: bold;
23 | color: #222;
24 | position: relative;
25 | top: 7px;
26 | left: -15px;
27 | }
28 |
29 | nav button{
30 | float: right;
31 | padding: 6px 22px;
32 | background-color: white;
33 | border: 1px solid #0080ff;
34 | border-radius: 3px;
35 | color: #0080ff;
36 | position: relative;
37 | top: 7px;
38 | right: 10px;
39 | cursor: pointer;
40 | }
41 |
42 |
43 | .main form{
44 | width: 660px;
45 | margin: 0 auto;
46 | }
47 |
48 | .main form input{
49 | height: 36px;
50 | font-size: 30px;
51 | font-weight: bold;
52 | color: #666;
53 | margin-bottom: 10px;
54 | }
55 |
56 | .main form input::placeholder{
57 | font-size: 30px;
58 | font-weight: bold;
59 | }
60 |
61 |
62 |
63 |
64 |
65 |
66 | /*遮罩层处理*/
67 |
68 | .mask{
69 | z-index: 1;
70 | display: none;
71 | position: fixed;
72 | width: 100%;
73 | height: 100%;
74 | top: 0;
75 | left: 0;
76 | background-color: rgba(0,0,0,.5);
77 | zoom:1001;
78 | }
79 |
80 | .upon-mask{
81 | z-index: 2;
82 | overflow: hidden;
83 | display: none;
84 | position: fixed;
85 | border-radius: 8px;
86 | width: 550px;
87 | height: 320px;
88 | background-color: #fff;
89 | top: 50%;
90 | left: 50%;
91 | margin-top: -160px;
92 | margin-left: -275px;
93 | box-shadow: 0 0 80px 0 rgba(0,0,0,.4);
94 | }
95 |
96 | .upon-mask h3{
97 | border-radius: 8px 8px 0 0;
98 | padding: 10px 20px;
99 | line-height: 14px;
100 | background: linear-gradient(to bottom,#1D7FE2,#0865C2);
101 | }
102 |
103 | .upon-mask h3 span:first-child{
104 | color: #fff;
105 | text-shadow: 0 1px 1px rgba(0,0,0,.4);
106 | font-size: 15px;
107 | font-weight: 700;
108 | }
109 |
110 | .upon-mask h3 span#close-mask{
111 | position: absolute;
112 | top: 8px;
113 | right: 12px;
114 | font-size: 18px;
115 | font-weight: bold;
116 | color: blue;
117 | cursor: pointer;
118 | width: 16px;
119 | height: 16px;
120 | border-radius: 8px;
121 | background-color: white;
122 | text-align: center;
123 | line-height: 17px;
124 | }
125 |
126 | .upon-mask form{
127 | padding: 10px 20px;
128 | font-size: 13px;
129 | line-height: 1.7;
130 | }
131 |
132 | .upon-mask form span{
133 | font-size: 14px;
134 | line-height: 1.7;
135 | }
136 |
137 | .upon-mask input[type="text"]{
138 | width: 489px;
139 | padding: 8px 10px;
140 | font-size: 13px;
141 | line-height: 15px;
142 | box-shadow: 0 1px 1px rgba(0,0,0,.1) inset;
143 | border-radius: 3px;
144 | background: #fff;
145 | border: 1px solid #ccc;
146 | color: #222;
147 | margin: 10px 0;
148 | }
149 |
150 | .upon-mask input[type="radio"]{
151 | margin-top: 5px;
152 | }
153 |
154 | .upon-mask div{
155 | margin: 5px 0 5px 0;
156 | }
157 |
158 |
159 | .upon-mask button{
160 | float: right;
161 | color: #fff;
162 | text-shadow: 0 -1px 0 rgba(0,0,0,.5);
163 | background: #1472cf;
164 | background: -webkit-linear-gradient(top,#1d7fe2,#0865c2);
165 | background: linear-gradient(to bottom,#1d7fe2,#0865c2);
166 | border: 1px solid #0D6EB8;
167 | box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 1px 0 rgba(0,0,0,.2);
168 | font-size: 14px;
169 | line-height: 1.7;
170 | text-decoration: none!important;
171 | text-align: center;
172 | padding: 4px 10px;
173 | cursor: pointer;
174 | border-radius: 3px;
175 | white-space: nowrap;
176 | box-sizing: border-box;
177 | }
178 |
--------------------------------------------------------------------------------
/src/main/webapp/css/zhuanlanDetail.css:
--------------------------------------------------------------------------------
1 | body{
2 | height: 1000px;
3 | }
4 |
5 | nav{
6 | height: 45px;
7 | padding: 0 15px;
8 | border-bottom: 1px solid #eee;
9 | margin-bottom: 30px;
10 | line-height: 45px;
11 | }
12 |
13 | nav span:first-child{
14 | float: left;
15 | font-size: 24px;
16 | color: #666;
17 | }
18 |
19 | nav span:nth-child(2){
20 | float: right;
21 | position: relative;
22 | top: 7px;
23 | right: 10px;
24 | }
25 |
26 | .main .zhuanlan-info{
27 | width: 660px;
28 | margin: 0 auto 25px;
29 | text-align: center;
30 | }
31 |
32 | .main .zhuanlan-info img{
33 | width: 100px;
34 | height: 100px;
35 | border-radius: 50px;
36 | margin-bottom: 22px;
37 | }
38 |
39 | .main .zhuanlan-info h3{
40 | font-size: 20px;
41 | color: #333;
42 | margin-bottom: 16px;
43 | }
44 |
45 | .main .zhuanlan-info .follow-count a{
46 | font-size: 14px;
47 | color: gray;
48 | }
49 |
50 | .main .article{
51 | width: 660px;
52 | margin: 0 auto;
53 | padding: 20px 0;
54 | border-top: 1px solid #eee;
55 | }
56 |
57 | .main .article h4{
58 | font-size: 16px;
59 | color: #333;
60 | font-weight: bold;
61 | margin-bottom: 20px;
62 | }
63 |
64 | .main .article-list li{
65 | border-bottom: 1px solid #eee;
66 | padding: 15px 0;
67 | }
68 |
69 | .main .article-list .title{
70 | font-size: 18px;
71 | line-height: 1.7;
72 | color: #222;
73 | font-weight: bold;
74 | }
75 |
76 | .main .article-list .content{
77 | font-size: 16px;
78 | line-height: 1.7;
79 | color: #666;
80 | }
81 |
82 | .main .article-list .content a{
83 | color: #666;
84 | }
85 |
86 | .main .article-list .meta{
87 | margin-top: 5px;
88 | color: gray;
89 | font-size: 14px;
90 | }
91 |
92 | .main .article-list .meta span:nth-child(2){
93 | float: right;
94 | }
95 |
96 | .main .article-list .meta span:nth-child(3){
97 | float: right;
98 | margin-right: 10px;
99 | }
100 |
101 | .main .article .zhuanlanBottom{
102 | width: 340px;
103 | margin: 30px auto;
104 | }
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/src/main/webapp/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/favicon.ico
--------------------------------------------------------------------------------
/src/main/webapp/fonts/icomoon.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/fonts/icomoon.eot
--------------------------------------------------------------------------------
/src/main/webapp/fonts/icomoon.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/fonts/icomoon.ttf
--------------------------------------------------------------------------------
/src/main/webapp/fonts/icomoon.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/fonts/icomoon.woff
--------------------------------------------------------------------------------
/src/main/webapp/image/avatar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/avatar.jpg
--------------------------------------------------------------------------------
/src/main/webapp/image/avatar2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/avatar2.jpg
--------------------------------------------------------------------------------
/src/main/webapp/image/avatar3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/avatar3.jpg
--------------------------------------------------------------------------------
/src/main/webapp/image/avatar4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/avatar4.jpg
--------------------------------------------------------------------------------
/src/main/webapp/image/avatar5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/avatar5.jpg
--------------------------------------------------------------------------------
/src/main/webapp/image/avatar6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/avatar6.jpg
--------------------------------------------------------------------------------
/src/main/webapp/image/collectRight.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/collectRight.jpg
--------------------------------------------------------------------------------
/src/main/webapp/image/sprite-nav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/sprite-nav.png
--------------------------------------------------------------------------------
/src/main/webapp/image/sprite-nav2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/sprite-nav2.png
--------------------------------------------------------------------------------
/src/main/webapp/image/sprite-vote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/sprite-vote.png
--------------------------------------------------------------------------------
/src/main/webapp/image/sprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/sprite.png
--------------------------------------------------------------------------------
/src/main/webapp/image/sprite2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/sprite2.png
--------------------------------------------------------------------------------
/src/main/webapp/image/sprite3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/sprite3.png
--------------------------------------------------------------------------------
/src/main/webapp/image/sprites-1.9.2.4c54885a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/sprites-1.9.2.4c54885a.png
--------------------------------------------------------------------------------
/src/main/webapp/image/sprites.auto.2bb79a7e.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/sprites.auto.2bb79a7e.png
--------------------------------------------------------------------------------
/src/main/webapp/image/sprites.auto.a740548f.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/sprites.auto.a740548f.png
--------------------------------------------------------------------------------
/src/main/webapp/image/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/test.png
--------------------------------------------------------------------------------
/src/main/webapp/image/topic1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/topic1.png
--------------------------------------------------------------------------------
/src/main/webapp/image/topic2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/topic2.jpg
--------------------------------------------------------------------------------
/src/main/webapp/image/topic3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/topic3.png
--------------------------------------------------------------------------------
/src/main/webapp/image/writeArticle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/writeArticle.png
--------------------------------------------------------------------------------
/src/main/webapp/image/zhuanlanBottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fanchaoo/hahu/8cf49f849aaf250579bed7d7841bc1dc73f9e3f5/src/main/webapp/image/zhuanlanBottom.png
--------------------------------------------------------------------------------
/src/main/webapp/js/collectionContent.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 | var collectionId;
4 | var followButton = $("#followCollectionButton");
5 | var unfollowButton = $("#unfollowCollectionButton");
6 |
7 | init();
8 | bindEvent();
9 |
10 | function init(){
11 | var flag;
12 | collectionId = $("#collectionId").attr("data-id");
13 | var formData = new FormData();
14 | formData.append("collectionId",collectionId);
15 | $.ajax({
16 | url:basepath + "judgePeopleFollowCollection",
17 | type:"post",
18 | data:formData,
19 | processData:false,
20 | contentType:false,
21 | async:false,
22 | success:function(response){
23 | flag = response.data;
24 | }
25 | });
26 |
27 | if(flag==true){
28 | followButton.hide();
29 | unfollowButton.show();
30 | }else{
31 | unfollowButton.hide();
32 | followButton.show();
33 | }
34 | }
35 |
36 | function bindEvent(){
37 | //关注按钮
38 | followButton.on("click",function(){
39 | followCollection(collectionId);
40 | followButton.hide();
41 | unfollowButton.show();
42 | });
43 |
44 | //取消关注按钮
45 | unfollowButton.on("click",function(){
46 | unfollowCollection(collectionId);
47 | unfollowButton.hide();
48 | followButton.show();
49 | });
50 | }
51 |
52 | function followCollection(collectionId){
53 | var formData = new FormData();
54 | formData.append("collectionId",collectionId);
55 | $.ajax({
56 | url:basepath + "followCollection",
57 | type:"post",
58 | data:formData,
59 | processData:false,
60 | contentType:false,
61 | success:function(response){
62 | }
63 | });
64 | }
65 |
66 | function unfollowCollection(collectionId){
67 | var formData = new FormData();
68 | formData.append("collectionId",collectionId);
69 | $.ajax({
70 | url:basepath + "unfollowCollection",
71 | type:"post",
72 | data:formData,
73 | processData:false,
74 | contentType:false,
75 | success:function(response){
76 | }
77 | });
78 | }
79 |
80 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/collectionList.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 |
4 | var heads = $(".content ul.head li");
5 | var bodys = $(".content ul.body li");
6 |
7 | heads.each(function(index,element){
8 | $(this).click(function(){
9 | heads.each(function(){
10 | $(this).removeClass("active");
11 | });
12 | heads.eq(index).addClass("active");
13 | bodys.each(function(){
14 | $(this).attr("class","hide");
15 | });
16 | bodys.eq(index).attr("class","show");
17 | });
18 | });
19 |
20 | //渲染模版
21 | $.ajax({
22 | url:basepath + "listCreatingCollection",
23 | type:"get",
24 | data:{},
25 | processData:false,
26 | contentType:false,
27 | success:function(response){
28 | if(response.state==0){
29 | var html = template("collectionListTemplate", response.data);
30 | $("#collectionList").html(html);
31 | }else{
32 | alert("出故障啦~");
33 | }
34 | }
35 | });
36 |
37 |
38 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/explore.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 |
4 | //获取今天数据
5 | function listTodayHotAnswer(){
6 | var todayHotList = $("#todayHotList");
7 | $.ajax({
8 | url:basepath + "listTodayHotAnswer",
9 | type:"post",
10 | data:{},
11 | processData:false,
12 | contentType:false,
13 | success:function(response){
14 | if(response.state==0){
15 | var html = template("todayHotListTemplate",response.data);
16 | todayHotList.append(html);
17 | }else{
18 | alert("出现了错误...");
19 | }
20 | }
21 | });
22 | }
23 |
24 | //获取本月数据
25 | function listMonthHotAnswer(){
26 | var monthHotList = $("#monthHotList");
27 | $.ajax({
28 | url:basepath + "listMonthHotAnswer",
29 | type:"post",
30 | data:{},
31 | processData:false,
32 | contentType:false,
33 | success:function(response){
34 | if(response.state==0){
35 | var html = template("monthHotListTemplate",response.data);
36 | monthHotList.append($(html));
37 | }else{
38 | alert("出现了错误...");
39 | }
40 | }
41 | });
42 | }
43 |
44 | listTodayHotAnswer();
45 | listMonthHotAnswer();
46 |
47 |
48 |
49 | /*tab栏切换*/
50 | var heads = $(".content > .head > li");
51 | var bodys = $(".content > .body > li");
52 |
53 | heads.each(function(index,element){
54 | $(this).click(function(){
55 | heads.each(function(){
56 | $(this).removeClass("active");
57 | });
58 | heads.eq(index).addClass("active");
59 |
60 | bodys.each(function(){
61 | $(this).attr("class","hide");
62 | });
63 | bodys.eq(index).attr("class","show");
64 | });
65 | });
66 |
67 | //feed流中,移入移出的处理
68 | var feedMeta = $(".feed-meta");
69 | feedMeta.mouseover(function(){
70 | $(this).find("div").css("display","inline").show();
71 | }).mouseout(function(){
72 | $(this).find("div").hide();
73 | });
74 |
75 |
76 |
77 |
78 |
79 |
80 | });
81 |
82 |
--------------------------------------------------------------------------------
/src/main/webapp/js/index.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 | window.page = 1;
4 |
5 | $("#userAvatar").attr("src",localStorage.avatarUrl);
6 |
7 | getWeiboUserInfo();
8 |
9 | //feed流中,移入移出的处理
10 | var feedMeta = $(".feed-meta");
11 | feedMeta.mouseover(function(){
12 | $(this).find("div").css("display","inline").show();
13 | }).mouseout(function(){
14 | $(this).find("div").hide();
15 | });
16 |
17 |
18 | template.defaults.imports.$longToDateString = longToDateString;
19 |
20 | getIndexDetail(window.page);
21 |
22 | window.onscroll = function () {
23 | if (getScrollTop() + getClientHeight() == getScrollHeight()) {
24 | getIndexDetail(window.page);
25 | }
26 | }
27 |
28 |
29 | //获取首页某页数据
30 | function getIndexDetail(page){
31 | var feedList = $("#feedList");
32 | var formData = new FormData();
33 | formData.append("page",page);
34 | $.ajax({
35 | url:basepath + "getIndexDetail",
36 | type:"post",
37 | data:formData,
38 | processData:false,
39 | contentType:false,
40 | async:false,
41 | success:function(response){
42 | if(response.state==0){
43 | var html = template("feedListTemplate",response.data);
44 | feedList.append($(html));
45 | }else{
46 | alert("出现了错误...");
47 | }
48 | }
49 | });
50 | window.page++;
51 | }
52 |
53 |
54 | function getWeiboUserInfo(){
55 | var form = new FormData();
56 | $.ajax({
57 | url:basepath + "getWeiboUserInfo",
58 | type:"post",
59 | data:form,
60 | processData:false,
61 | contentType:false,
62 | success:function(response){
63 | if(response.state==0){
64 | console.log(response.data);
65 | localStorage.setItem("userId", response.data.userId);
66 | localStorage.setItem("username", response.data.username);
67 | localStorage.setItem("avatarUrl", response.data.avatarUrl);
68 | }
69 | }
70 | });
71 | }
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/login.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 |
4 |
5 | var headers = $("section > ul > li");
6 | var bodys = $("section > div");
7 |
8 | headers.each(function(index,element){
9 | $(this).on("click",function(){
10 | headers.each(function(){
11 | $(this).removeClass("active-header");
12 | });
13 | $(this).addClass("active-header");
14 |
15 | bodys.each(function(){
16 | $(this).css("display","none");
17 | });
18 | bodys.eq(index).css("display","block");
19 | });
20 | });
21 |
22 |
23 | (function(window,document){
24 | //定义画布宽高和生成点的个数
25 | var WIDTH = window.innerWidth, HEIGHT = window.innerHeight, POINT = 35;
26 |
27 | var canvas = document.getElementById('canvas');
28 | canvas.width = WIDTH,
29 | canvas.height = HEIGHT;
30 | var context = canvas.getContext('2d');
31 | context.strokeStyle = 'rgba(0,0,0,0.02)',
32 | context.strokeWidth = 1,
33 | context.fillStyle = 'rgba(0,0,0,0.05)';
34 | var circleArr = [];
35 |
36 | //线条:开始xy坐标,结束xy坐标,线条透明度
37 | function Line (x, y, _x, _y, o) {
38 | this.beginX = x,
39 | this.beginY = y,
40 | this.closeX = _x,
41 | this.closeY = _y,
42 | this.o = o;
43 | }
44 | //点:圆心xy坐标,半径,每帧移动xy的距离
45 | function Circle (x, y, r, moveX, moveY) {
46 | this.x = x,
47 | this.y = y,
48 | this.r = r,
49 | this.moveX = moveX,
50 | this.moveY = moveY;
51 | }
52 | //生成max和min之间的随机数
53 | function num (max, _min) {
54 | var min = arguments[1] || 0;
55 | return Math.floor(Math.random()*(max-min+1)+min);
56 | }
57 | // 绘制原点
58 | function drawCricle (cxt, x, y, r, moveX, moveY) {
59 | var circle = new Circle(x, y, r, moveX, moveY)
60 | cxt.beginPath()
61 | cxt.arc(circle.x, circle.y, circle.r, 0, 2*Math.PI)
62 | cxt.closePath()
63 | cxt.fill();
64 | return circle;
65 | }
66 | //绘制线条
67 | function drawLine (cxt, x, y, _x, _y, o) {
68 | var line = new Line(x, y, _x, _y, o)
69 | cxt.beginPath()
70 | cxt.strokeStyle = 'rgba(0,0,0,'+ o +')'
71 | cxt.moveTo(line.beginX, line.beginY)
72 | cxt.lineTo(line.closeX, line.closeY)
73 | cxt.closePath()
74 | cxt.stroke();
75 |
76 | }
77 | //初始化生成原点
78 | function init () {
79 | circleArr = [];
80 | for (var i = 0; i < POINT; i++) {
81 | circleArr.push(drawCricle(context, num(WIDTH), num(HEIGHT), num(15, 2), num(10, -10)/40, num(10, -10)/40));
82 | }
83 | draw();
84 | }
85 |
86 | //每帧绘制
87 | function draw () {
88 | context.clearRect(0,0,canvas.width, canvas.height);
89 | for (var i = 0; i < POINT; i++) {
90 | drawCricle(context, circleArr[i].x, circleArr[i].y, circleArr[i].r);
91 | }
92 | for (var i = 0; i < POINT; i++) {
93 | for (var j = 0; j < POINT; j++) {
94 | if (i + j < POINT) {
95 | var A = Math.abs(circleArr[i+j].x - circleArr[i].x),
96 | B = Math.abs(circleArr[i+j].y - circleArr[i].y);
97 | var lineLength = Math.sqrt(A*A + B*B);
98 | var C = 1/lineLength*7-0.009;
99 | var lineOpacity = C > 0.03 ? 0.03 : C;
100 | if (lineOpacity > 0) {
101 | drawLine(context, circleArr[i].x, circleArr[i].y, circleArr[i+j].x, circleArr[i+j].y, lineOpacity);
102 | }
103 | }
104 | }
105 | }
106 | }
107 |
108 | //调用执行
109 | init();
110 | setInterval(function () {
111 | for (var i = 0; i < POINT; i++) {
112 | var cir = circleArr[i];
113 | cir.x += cir.moveX;
114 | cir.y += cir.moveY;
115 | if (cir.x > WIDTH) cir.x = 0;
116 | else if (cir.x < 0) cir.x = WIDTH;
117 | if (cir.y > HEIGHT) cir.y = 0;
118 | else if (cir.y < 0) cir.y = HEIGHT;
119 |
120 | }
121 | draw();
122 | }, 16);
123 | })(window,document);
124 |
125 |
126 |
127 | });
128 |
129 |
--------------------------------------------------------------------------------
/src/main/webapp/js/mask.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 | /*提问模态框处理*/
3 | var openMask = $(".open-mask");
4 | var closeMask = $(".close-mask");
5 | var mask = $(".mask");
6 | var askModal = $("#ask-modal");
7 |
8 | openMask.click(function(){
9 | mask.show();
10 | askModal.show();
11 | });
12 | closeMask.click(function(){
13 | mask.hide();
14 | askModal.hide();
15 | });
16 |
17 | /*富文本编辑器创建*/
18 | var editor = new wangEditor('questionContent');
19 |
20 | editor.config.menus = [
21 | 'bold',
22 | 'img',
23 | 'fullscreen',
24 | ];
25 |
26 | //配置处理图片上传的路径,最好用相对路径
27 | editor.config.uploadImgUrl = 'uploadImage';
28 | //配置图片上传到后台的参数名称
29 | editor.config.uploadImgFileName = 'paramName';
30 | editor.create();
31 |
32 |
33 | /*提问表单处理*/
34 | /* 提问处理 */
35 | var askButton = $("#askButton");
36 | var askForm = $("#askForm");
37 | var questionTitleInput = $("#questionTitle");
38 | var questionContentTextarea = $("#questionContent");
39 | var topicNameStringInput = $("#topicNameString");
40 |
41 | askButton.on("click",function(){
42 | var formData = new FormData();
43 | var v1 = questionTitleInput.val();
44 | var v2 = questionContentTextarea.val();
45 | var v3 = topicNameStringInput.val();
46 | if(v1.trim()==""||v2.trim==""||v3.trim()==""){
47 | return;
48 | }
49 | formData.append("questionTitle",v1);
50 | formData.append("questionContent",v2);
51 | formData.append("topicNameString",v3);
52 | $.ajax({
53 | url:basepath + "ask",
54 | type:"post",
55 | data:formData,
56 | processData:false,
57 | contentType:false,
58 | success:function(response){
59 | if(response.state==0){
60 | window.location.href = basepath + "question/"+response.data;
61 | }else{
62 | alert("出现了错误...");
63 | }
64 | }
65 | });
66 | });
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/maskAddCollection.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 | /*创建收藏夹模态框处理*/
3 | var openMask = $("#toAddCollection");
4 | var closeMask = $(".close-mask");
5 | var mask = $(".mask");
6 | var addCollectionModal = $("#addCollectionModal");
7 |
8 | openMask.click(function(event){
9 | event.preventDefault();
10 | mask.show();
11 | addCollectionModal.show();
12 | });
13 | closeMask.click(function(){
14 | mask.hide();
15 | addCollectionModal.hide();
16 | });
17 |
18 | /*创建收藏夹表单提交*/
19 | var addCollectionButton = $("#addCollectionButton");
20 | var collectionNameInput = $("#collectionName");
21 |
22 | addCollectionButton.on("click",function(){
23 | var formData = new FormData();
24 | formData.append("collectionName",collectionNameInput.val());
25 | $.ajax({
26 | url:basepath + "addCollection",
27 | type:"post",
28 | data:formData,
29 | processData:false,
30 | contentType:false,
31 | success:function(response){
32 | if(response.state==0){
33 | location.reload();
34 | }else{
35 | alert("出现了错误...");
36 | }
37 | }
38 | });
39 | });
40 |
41 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/maskCollectAnswer.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 | var answerId;
3 |
4 | handleModal();
5 |
6 |
7 |
8 | function handleModal(){
9 | /*创建收藏夹模态框处理*/
10 | var openMask = $(".toCollectAnswer");
11 | var closeMask = $(".close-mask");
12 | var mask = $(".mask");
13 | var collectionAnswerModal = $("#collectionAnswerModal");
14 |
15 | openMask.click(function(event){
16 | event.preventDefault();
17 | mask.show();
18 | collectionAnswerModal.show();
19 | answerId = $(this).attr("data-id");
20 | //绑定列表点击事件
21 | bindEvent($("#collectionList"));
22 | });
23 | closeMask.click(function(){
24 | mask.hide();
25 | collectionAnswerModal.hide();
26 | });
27 | }
28 |
29 |
30 | //绑定事件
31 | function bindEvent(ul){
32 | var lis = ul.find("li");
33 | lis.each(function(){
34 | var that = $(this);
35 | var collectionId = that.find("h5").attr("data-id");
36 | that.status = collectionContainAnswer(collectionId,answerId);
37 | //alert(status);
38 | if(that.status == true){
39 | that.find("i").addClass("collect-right");
40 | }else{
41 | that.find("i").removeClass("collect-right");
42 | }
43 | $(this).on("click",function(){
44 | if(that.status==false){
45 | collect(that);
46 | that.status = true;
47 | }else{
48 | uncollect(that);
49 | that.status = false;
50 | }
51 | });
52 | });
53 | }
54 |
55 |
56 | //收藏
57 | function collect(that){
58 | //加特效duang
59 | that.find("i").addClass("collect-right");
60 | //请求接口
61 | var formData = new FormData();
62 | formData.append("collectionId",that.find("h5").attr("data-id"));
63 | formData.append("answerId",answerId);
64 | console.log(answerId);
65 | $.ajax({
66 | url:basepath + "collectAnswer",
67 | type:"post",
68 | data:formData,
69 | processData:false,
70 | contentType:false,
71 | success:function(response){
72 | console.log(JSON.stringify(response));
73 | }
74 | });
75 | }
76 |
77 | //取消收藏
78 | function uncollect(that){
79 | //去特效
80 | that.find("i").removeClass("collect-right");
81 | //请求接口
82 | var formData = new FormData();
83 | formData.append("collectionId",that.find("h5").attr("data-id"));
84 | formData.append("answerId",answerId);
85 | $.ajax({
86 | url:basepath + "uncollectAnswer",
87 | type:"post",
88 | data:formData,
89 | processData:false,
90 | contentType:false,
91 | success:function(response){
92 | console.log(JSON.stringify(response));
93 | }
94 | });
95 | }
96 |
97 | //判断某收藏夹是否包含某答案
98 | function collectionContainAnswer(collectionId,answerId){
99 | var flag;
100 | var formData = new FormData();
101 | formData.append("collectionId",collectionId);
102 | formData.append("answerId",answerId);
103 | $.ajax({
104 | url:basepath + "collectionContainAnswer",
105 | type:"post",
106 | data:formData,
107 | processData:false,
108 | contentType:false,
109 | async: false,
110 | success:function(response){
111 | flag = response.data;
112 | }
113 | });
114 | return flag;
115 | }
116 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/message.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 |
4 |
5 |
6 |
7 |
8 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/nav.js:
--------------------------------------------------------------------------------
1 | var basepath = $("#baseUrl").attr("href");
2 |
3 |
4 | //等待几秒
5 | function sleep(numberMillis) {
6 | var now = new Date();
7 | var exitTime = now.getTime() + numberMillis;
8 | while (true) {
9 | now = new Date();
10 | if (now.getTime() > exitTime)
11 | return;
12 | }
13 | }
14 |
15 |
16 | //long转日期字符串
17 | function longToDateString(num){
18 | var dateType = "";
19 | var date = new Date();
20 | date.setTime(num);
21 | dateType = (date.getMonth(date)+1)+"-"+(date.getDate(date));//yyyy-MM-dd格式日期
22 | time = " "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
23 | return dateType + time;
24 | }
25 |
26 | //获取滚动条当前的位置
27 | function getScrollTop() {
28 | var scrollTop = 0;
29 | if (document.documentElement && document.documentElement.scrollTop) {
30 | scrollTop = document.documentElement.scrollTop;
31 | }
32 | else if (document.body) {
33 | scrollTop = document.body.scrollTop;
34 | }
35 | return scrollTop;
36 | }
37 |
38 | //获取当前可是范围的高度
39 | function getClientHeight() {
40 | var clientHeight = 0;
41 | if (document.body.clientHeight && document.documentElement.clientHeight) {
42 | clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight);
43 | }
44 | else {
45 | clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight);
46 | }
47 | return clientHeight;
48 | }
49 |
50 | //获取文档完整的高度
51 | function getScrollHeight() {
52 | return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
53 | }
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | $(function(){
76 |
77 | //下拉菜单处理
78 | var profile = $(".nav-profile");
79 | var downMenu = $(".nav-dropdown");
80 |
81 | profile.mouseover(function(){
82 | downMenu.show();
83 | }).mouseout(function(){
84 | downMenu.hide();
85 | });
86 |
87 | downMenu.mouseover(function(){
88 | downMenu.show();
89 | }).mouseout(function(){
90 | downMenu.hide();
91 | });
92 |
93 |
94 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/profile.js:
--------------------------------------------------------------------------------
1 | var basepath = $("#baseUrl").attr("href");
2 |
3 | $(function(){
4 | moveSomeHeight();
5 |
6 | var isSelf = $("#isSelf").attr("data-id");
7 | var userId;
8 | var followButton = $("#followUserButton");
9 | var unfollowButton = $("#unfollowUserButton");
10 |
11 |
12 | if(isSelf=='false'){
13 | init();
14 | bindEvent();
15 | }
16 |
17 |
18 | function init(){
19 | var flag;
20 | userId = $("#userId").attr("data-id");
21 | var formData = new FormData();
22 | formData.append("userId",userId);
23 | $.ajax({
24 | url:basepath + "judgePeopleFollowUser",
25 | type:"post",
26 | data:formData,
27 | processData:false,
28 | contentType:false,
29 | async:false,
30 | success:function(response){
31 | flag = response.data;
32 | }
33 | });
34 |
35 | if(flag==true){
36 | followButton.hide();
37 | unfollowButton.show();
38 | }else{
39 | unfollowButton.hide();
40 | followButton.show();
41 | }
42 | }
43 |
44 | function bindEvent(){
45 | //关注按钮
46 | followButton.on("click",function(){
47 | followUser(userId);
48 | followButton.hide();
49 | unfollowButton.show();
50 | });
51 |
52 | //取消关注按钮
53 | unfollowButton.on("click",function(){
54 | unfollowUser(userId);
55 | unfollowButton.hide();
56 | followButton.show();
57 | });
58 | }
59 |
60 | function followUser(userId){
61 | var formData = new FormData();
62 | formData.append("userId",userId);
63 | $.ajax({
64 | url:basepath + "followUser",
65 | type:"post",
66 | data:formData,
67 | processData:false,
68 | contentType:false,
69 | success:function(response){
70 | }
71 | });
72 | }
73 |
74 | function unfollowUser(userId){
75 | var formData = new FormData();
76 | formData.append("userId",userId);
77 | $.ajax({
78 | url:basepath + "unfollowUser",
79 | type:"post",
80 | data:formData,
81 | processData:false,
82 | contentType:false,
83 | success:function(response){
84 | }
85 | });
86 | }
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 | function moveSomeHeight(){
104 | window.scrollTo(0,document.querySelector("#content").offsetTop);
105 | $(".profile").attr("href",basepath + "profile/"+localStorage.userId);
106 | $(".profile-avatar").attr("src",localStorage.avatarUrl);
107 | }
108 |
109 | });
110 |
111 |
--------------------------------------------------------------------------------
/src/main/webapp/js/questionList.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 |
4 | var heads = $(".content ul.head li");
5 | var bodys = $(".content ul.body li");
6 |
7 | heads.each(function(index,element){
8 | $(this).click(function(){
9 | heads.each(function(){
10 | $(this).removeClass("active");
11 | });
12 | heads.eq(index).addClass("active");
13 | bodys.each(function(){
14 | $(this).attr("class","hide");
15 | });
16 | bodys.eq(index).attr("class","show");
17 | });
18 | });
19 |
20 |
21 | var page = 1;
22 | var questionList = $("#questionList");
23 | var moreQuestionButton = $("#moreQuestion");
24 | moreQuestionButton.on("click",function(event){
25 | event.preventDefault();
26 |
27 | var formData = new FormData();
28 | formData.append("page",page);
29 | $.ajax({
30 | url:basepath + "listQuestionByPage",
31 | type:"post",
32 | data:formData,
33 | processData:false,
34 | contentType:false,
35 | success:function(response){
36 | if(response.state==0){
37 | var html = template("questionListTemplate",response.data);
38 | questionList.append($(html));
39 | page = page + 1;
40 | }else{
41 | alert("出现了错误...");
42 | }
43 | }
44 | });
45 |
46 | });
47 |
48 | moreQuestionButton.click();
49 |
50 | });
51 |
52 |
--------------------------------------------------------------------------------
/src/main/webapp/js/setting.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 |
4 | var heads = $(".content ul.head li");
5 | var bodys = $(".content ul.body li");
6 |
7 | heads.each(function(index,element){
8 | $(this).click(function(){
9 | heads.each(function(){
10 | $(this).removeClass("active");
11 | });
12 | heads.eq(index).addClass("active");
13 | bodys.each(function(){
14 | $(this).attr("class","hide");
15 | });
16 | bodys.eq(index).attr("class","show");
17 | });
18 | });
19 |
20 |
21 | /*修改密码模态框处理*/
22 | var openPasswordModal = $(".open-password-modal");
23 | var closeMask = $(".close-mask");
24 | var mask = $(".mask");
25 | var passwordModal = $("#password-modal");
26 |
27 | openPasswordModal.click(function(){
28 | mask.show();
29 | passwordModal.show();
30 | });
31 | closeMask.click(function(){
32 | mask.hide();
33 | passwordModal.hide();
34 | });
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | /*富文本编辑器创建*/
43 | var editor = new wangEditor('textarea');
44 |
45 | editor.config.menus = [
46 | 'bold',
47 | 'img',
48 | 'fullscreen',
49 | ];
50 |
51 | //配置处理图片上传的路径,最好用相对路径
52 | editor.config.uploadImgUrl = 'uploadImage';
53 | //配置图片上传到后台的参数名称
54 | editor.config.uploadImgFileName = 'paramName';
55 | editor.create();
56 |
57 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/topic.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 |
4 |
5 |
6 | //feed流中,移入移出的处理
7 | var feedMeta = $(".feed-meta");
8 | feedMeta.mouseover(function(){
9 | $(this).find("div").css("display","inline").show();
10 | }).mouseout(function(){
11 | $(this).find("div").hide();
12 | });
13 |
14 |
15 |
16 |
17 |
18 |
19 | //点赞按钮处理
20 | var voteUp = $(".vote-up");
21 | var voteDown = $(".vote-down");
22 |
23 | voteUp.click(function(){
24 | $(this).attr("clicked","true");
25 | $(this).css("background-color","#698EBF").css("color","white");
26 | $(this).find("i").css("border","6px solid #698EBF").css("border-bottom","6px solid white");
27 | }).mouseover(function(){
28 | if($(this).attr("clicked")=="false"){
29 | $(this).css("background-color","#698EBF").css("color","white");
30 | $(this).find("i").css("border","6px solid #698EBF").css("border-bottom","6px solid white");
31 | }
32 | }).mouseout(function(){
33 | if($(this).attr("clicked")=="false"){
34 | $(this).css("background-color","#EFF6FA").css("color","#698ebf");
35 | $(this).find("i").css("border","6px solid white").css("border-bottom","6px solid #698EBF");
36 | }
37 | });
38 |
39 | voteDown.click(function(){
40 | $(this).attr("clicked","true");
41 | $(this).css("background-color","#698EBF");
42 | $(this).find("i").css("border","6px solid #698EBF").css("border-top","6px solid white");
43 | }).mouseover(function(){
44 | if($(this).attr("clicked")=="false"){
45 | $(this).css("background-color","#698EBF");
46 | $(this).find("i").css("border","6px solid #698EBF").css("border-top","6px solid white");
47 | }
48 | }).mouseout(function(){
49 | if($(this).attr("clicked")=="false"){
50 | $(this).css("background-color","#EFF6FA");
51 | $(this).find("i").css("border","6px solid white").css("border-top","6px solid #698EBF");
52 | }
53 | });
54 |
55 |
56 |
57 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/topicDetail.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 | var topicId;
4 | var followTopicButton = $("#followTopicButton");
5 | var unfollowTopicButton = $("#unfollowTopicButton");
6 |
7 | init();
8 | bindEvent();
9 |
10 | function init(){
11 | var flag;
12 | topicId = $("#topicId").attr("data-id");
13 | var formData = new FormData();
14 | formData.append("topicId",topicId);
15 | $.ajax({
16 | url:basepath + "judgePeopleFollowTopic",
17 | type:"post",
18 | data:formData,
19 | processData:false,
20 | contentType:false,
21 | async:false,
22 | success:function(response){
23 | flag = response.data;
24 | }
25 | });
26 |
27 | if(flag==true){
28 | followTopicButton.hide();
29 | unfollowTopicButton.show();
30 | }else{
31 | unfollowTopicButton.hide();
32 | followTopicButton.show();
33 | }
34 | }
35 |
36 |
37 | function bindEvent(){
38 | //关注按钮
39 | followTopicButton.on("click",function(){
40 | followTopic(topicId);
41 | followTopicButton.hide();
42 | unfollowTopicButton.show();
43 | });
44 |
45 | //取消关注按钮
46 | unfollowTopicButton.on("click",function(){
47 | unfollowTopic(topicId);
48 | unfollowTopicButton.hide();
49 | followTopicButton.show();
50 | });
51 | }
52 |
53 |
54 | function followTopic(topicId){
55 | var formData = new FormData();
56 | formData.append("topicId",topicId);
57 | $.ajax({
58 | url:basepath + "followTopic",
59 | type:"post",
60 | data:formData,
61 | processData:false,
62 | contentType:false,
63 | success:function(response){
64 | }
65 | });
66 | }
67 |
68 | function unfollowTopic(topicId){
69 | var formData = new FormData();
70 | formData.append("topicId",topicId);
71 | $.ajax({
72 | url:basepath + "unfollowTopic",
73 | type:"post",
74 | data:formData,
75 | processData:false,
76 | contentType:false,
77 | success:function(response){
78 | }
79 | });
80 | }
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | //点赞按钮处理
97 | var voteUp = $(".vote-up");
98 |
99 |
100 | voteUp.each(function(){
101 | var likeState = $(this).attr("clicked");
102 | if(likeState=="true"){
103 | $(this).removeClass("like-unclicked")
104 | $(this).find("i").removeClass("like-unclicked-i");
105 | $(this).addClass("like-clicked")
106 | $(this).find("i").addClass("like-clicked-i");
107 | $(this).attr("disabled","true");
108 | }
109 | });
110 |
111 | voteUp.click(function(){
112 | $(this).removeClass("like-unclicked")
113 | $(this).find("i").removeClass("like-unclicked-i");
114 | $(this).addClass("like-clicked")
115 | $(this).find("i").addClass("like-clicked-i");
116 |
117 | $(this).attr("clicked","true");
118 | $(this).attr("disabled","true");
119 | //发送请求
120 | var formData = new FormData();
121 | formData.append("answerId",$(this).attr("answer-id"));
122 | var that = $(this);
123 | $.ajax({
124 | url:basepath + "likeAnswer",
125 | type:"post",
126 | data:formData,
127 | processData:false,
128 | contentType:false,
129 | success:function(response){
130 | that.html(parseInt(that.text()) + 1 + "");
131 | that.append("");
132 | }
133 | });
134 |
135 | }).mouseover(function(){
136 | if($(this).attr("clicked")=="false"){
137 | $(this).removeClass("like-unclicked")
138 | $(this).find("i").removeClass("like-unclicked-i");
139 | $(this).addClass("like-clicked")
140 | $(this).find("i").addClass("like-clicked-i");
141 | }
142 | }).mouseout(function(){
143 | if($(this).attr("clicked")=="false"){
144 | $(this).removeClass("like-clicked")
145 | $(this).find("i").removeClass("like-clicked-i");
146 | $(this).addClass("like-unclicked")
147 | $(this).find("i").addClass("like-unclicked-i");
148 | }
149 | });
150 |
151 |
152 | });
--------------------------------------------------------------------------------
/src/main/webapp/js/topics.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 |
4 |
5 |
6 | //feed流中,移入移出的处理
7 | var feedMeta = $(".feed-meta");
8 | feedMeta.mouseover(function(){
9 | $(this).find("div").css("display","inline").show();
10 | }).mouseout(function(){
11 | $(this).find("div").hide();
12 | });
13 |
14 |
15 |
16 |
17 |
18 |
19 | //点赞按钮处理
20 | var voteUp = $(".vote-up");
21 | var voteDown = $(".vote-down");
22 |
23 | voteUp.click(function(){
24 | $(this).attr("clicked","true");
25 | $(this).css("background-color","#698EBF").css("color","white");
26 | $(this).find("i").css("border","6px solid #698EBF").css("border-bottom","6px solid white");
27 | }).mouseover(function(){
28 | if($(this).attr("clicked")=="false"){
29 | $(this).css("background-color","#698EBF").css("color","white");
30 | $(this).find("i").css("border","6px solid #698EBF").css("border-bottom","6px solid white");
31 | }
32 | }).mouseout(function(){
33 | if($(this).attr("clicked")=="false"){
34 | $(this).css("background-color","#EFF6FA").css("color","#698ebf");
35 | $(this).find("i").css("border","6px solid white").css("border-bottom","6px solid #698EBF");
36 | }
37 | });
38 |
39 | voteDown.click(function(){
40 | $(this).attr("clicked","true");
41 | $(this).css("background-color","#698EBF");
42 | $(this).find("i").css("border","6px solid #698EBF").css("border-top","6px solid white");
43 | }).mouseover(function(){
44 | if($(this).attr("clicked")=="false"){
45 | $(this).css("background-color","#698EBF");
46 | $(this).find("i").css("border","6px solid #698EBF").css("border-top","6px solid white");
47 | }
48 | }).mouseout(function(){
49 | if($(this).attr("clicked")=="false"){
50 | $(this).css("background-color","#EFF6FA");
51 | $(this).find("i").css("border","6px solid white").css("border-top","6px solid #698EBF");
52 | }
53 | });
54 |
55 |
56 |
57 | });
--------------------------------------------------------------------------------
/src/test/java/com/fc/mapper/TestMapper.java:
--------------------------------------------------------------------------------
1 | package com.fc.mapper;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.test.context.ContextConfiguration;
6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
7 |
8 | @RunWith(SpringJUnit4ClassRunner.class)
9 | @ContextConfiguration(locations = { "classpath:application-context.xml", "classpath:spring-mvc.xml" })
10 | public class TestMapper {
11 |
12 | @Test
13 | public void test10() {
14 | System.out.println("ok");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------