diff --git a/pom.xml b/pom.xml
index 5c16daf..abd4d57 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,6 +27,10 @@
mybatis-spring-boot-starter
2.2.2
+
+ org.springframework.boot
+ spring-boot-starter-freemarker
+
com.alibaba
druid
diff --git a/src/main/java/app/bcms/jchat/web/ChatController.java b/src/main/java/app/bcms/jchat/web/ChatController.java
index 9439115..30abdab 100644
--- a/src/main/java/app/bcms/jchat/web/ChatController.java
+++ b/src/main/java/app/bcms/jchat/web/ChatController.java
@@ -1,10 +1,13 @@
package app.bcms.jchat.web;
-import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
+
+
import javax.servlet.http.HttpServletRequest;
/**
@@ -18,21 +21,32 @@ public class ChatController {
* @return
*/
@RequestMapping("/chat")
- @ResponseBody
- public String home(HttpServletRequest request){
- //获取各种参数
- JSONObject json = new JSONObject();
- json.put("params",request.getParameterMap());
-// json.put("header",request.getHttpServletMapping());
- return json.toString();
+ public String home(Model mv, HttpServletRequest request){
+ String roomId=request.getParameter("room_id");
+ String toid=request.getParameter("toid");
+ String usid=request.getParameter("usid");
+ //
+ mv.addAttribute("room_id",roomId);
+ mv.addAttribute("toid",toid);
+ mv.addAttribute("usid",usid);
+
+ return "chat";
}
/**
- * 需要建立一个模版文件
+ * 保存记录
+ * @param request
* @return
*/
- @RequestMapping("/test")
- public String stest(){
- return "ok";
+ @ResponseBody
+ @PostMapping("/save_message")
+ public String saveRecord(HttpServletRequest request){
+ return "";
+ }
+
+ @ResponseBody
+ @RequestMapping("/chat_record")
+ public String chatRelist(){
+ return "";
}
}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index b768109..c12548b 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -11,3 +11,17 @@ server.port=8090
# logback日志操作
logging.config=classpath:logback-spring.xml
logging.path=./logs/
+# ftl配置
+spring.freemarker.template-loader-path=classpath:/templates/
+spring.freemarker.suffix=.html
+spring.freemarker.cache=false
+spring.freemarker.charset=UTF-8
+spring.freemarker.check-template-location=true
+spring.freemarker.content-type=text/html
+spring.freemarker.expose-request-attributes=false
+spring.freemarker.expose-session-attributes=false
+# 上下文
+spring.freemarker.request-context-attribute=request
+spring.freemarker.settings.template_update_delay=10
+spring.freemarker.settings.default_encoding=UTF-8
+spring.freemarker.settings.classic_compatible=true
\ No newline at end of file
diff --git a/src/main/resources/public/chat.html b/src/main/resources/templates/chat.html
similarity index 94%
rename from src/main/resources/public/chat.html
rename to src/main/resources/templates/chat.html
index 69deccb..110fe1f 100644
--- a/src/main/resources/public/chat.html
+++ b/src/main/resources/templates/chat.html
@@ -88,6 +88,7 @@
-
-
\ No newline at end of file
diff --git a/src/main/resources/public/index.html b/src/main/resources/templates/index.html
similarity index 100%
rename from src/main/resources/public/index.html
rename to src/main/resources/templates/index.html
diff --git a/src/main/resources/public/kefu.html b/src/main/resources/templates/kefu.html
similarity index 100%
rename from src/main/resources/public/kefu.html
rename to src/main/resources/templates/kefu.html