Example #1
0
  @Transactional
  public Chat postImage(int userId, String picture) {
    Chat result = null;
    Chat chat = new Chat();
    User user = (User) userDao.findOne(userId);
    chat.setUser(user);
    chat.setPicture(picture);
    chat.setSendTime(LocalDateTime.now(ZoneId.of("UTC+8")));
    result = chatDao.save(chat);

    return result;
  }
Example #2
0
  @Transactional
  public Chat postChat(int userId, String messages, Character showUserInfo) {
    Chat result = null;
    Chat chat = new Chat();
    User user = (User) userDao.findOne(userId);

    chat.setMessages(messages);
    chat.setShowUserInfo(showUserInfo);
    chat.setUser(user);
    chat.setSendTime(LocalDateTime.now(ZoneId.of("UTC+8")));
    result = chatDao.save(chat);

    return result;
  }