package com.qxueyou.scc.controller; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.qxueyou.scc.base.model.Result; import com.qxueyou.scc.msg.service.IChatroomMsgService; @Controller @RequestMapping(value = "/msg/chatroom/") public class MsgChatroomMsgCtrl { @Autowired IChatroomMsgService service; @RequestMapping(value = "/sendMsg") public @ResponseBody Result send( String chatroomId, String senderId, String imgPath, String alias, String content, Integer type, String userType) { try { if (StringUtils.isEmpty(chatroomId) || StringUtils.isEmpty(senderId) || StringUtils.isEmpty(content)) { return new Result(false, "参数错误"); } return service.doSendMessage(chatroomId, senderId, imgPath, alias, content, type, userType); } catch (Exception e) { e.printStackTrace(); return new Result(false, "系统异常"); } } @RequestMapping(value = "/historyMsg") public @ResponseBody Result historyMsg(String chatroomId, Integer pageNum) { try { return service.getHistoryMes(chatroomId, pageNum); } catch (Exception e) { e.printStackTrace(); return new Result(false, "系统异常"); } } @RequestMapping(value = "/latestMsg") public @ResponseBody Result latestMsg(String chatroomId) { try { return service.latestMsg(chatroomId); } catch (Exception e) { e.printStackTrace(); return new Result(false, "系统异常"); } } }