Beispiel #1
0
 /**
  * 与某人的私信对话
  *
  * @param req
  * @param resp
  * @return
  * @throws Exception
  */
 public String chat(HkRequest req, HkResponse resp) throws Exception {
   long userId = this.getLoginUser(req).getUserId();
   long mainId = req.getLongAndSetAttr("mainId");
   int sms = req.getIntAndSetAttr("sms");
   PvtChatMain main = this.msgService.getPvtChatMain(userId, mainId);
   if (main == null) {
     return "r:/h4/op/msg.do";
   }
   if (main.getReadflg() == PvtChatMain.READ_N) {
     this.msgService.setRead(userId, mainId);
   }
   SimplePage page = req.getSimplePage(20);
   List<PvtChat> list = null;
   if (sms == 1) { // 过滤查看短信发送的私信
     list =
         this.msgService.getPvtChatList(
             userId, mainId, PvtChat.SmsFLG_Y, page.getBegin(), page.getSize() + 1);
   } else {
     list = this.msgService.getPvtChatList(userId, mainId, page.getBegin(), page.getSize() + 1);
   }
   this.processListForPage(page, list);
   List<PvtChatVo> volist = PvtChatVo.createVoList(list);
   // 对方是否关注你
   Follow follow = this.followService.getFollow(main.getUser2Id(), userId);
   if (follow == null) {
     req.setAttribute("not_follow", true);
   }
   req.setAttribute("volist", volist);
   req.setAttribute("main", main);
   req.setAttribute("list", list);
   req.setAttribute("canSms", this.isCanSms(req, main.getUser2Id())); // 是否可以发送短信
   return this.getWeb4Jsp("msg/chat.jsp");
 }
Beispiel #2
0
 /**
  * 获取最新对话
  *
  * @param request
  * @param response
  * @return
  * @throws Exception
  */
 public String last(HkRequest request, HkResponse response) throws Exception {
   long userId = this.getLoginUser(request).getUserId();
   PvtChatMain main = this.msgService.getLastNoReadPvtChatMain(userId);
   if (main != null) {
     return "r:/h4/op/msg_chat.do?mainId=" + main.getMainId();
   }
   return "r:/h4/op/msg.do";
 }
Beispiel #3
0
 /**
  * 删除与某人的整个对话
  *
  * @param request
  * @param response
  * @return
  * @throws Exception
  */
 public String del(HkRequest request, HkResponse response) throws Exception {
   long userId = this.getLoginUser(request).getUserId();
   long mainId = request.getLong("mainId");
   PvtChatMain main = this.msgService.getPvtChatMain(userId, mainId);
   if (main != null && main.getUserId() == userId) {
     this.msgService.deletePvtChatMain(userId, mainId);
   }
   return null;
 }