Package com.skyline.user.model

Examples of com.skyline.user.model.User


   */
  // FIXME 不要返回String
  @RequestMapping(value = "/login", method = RequestMethod.POST)
  public String loginExecute(String email, String password, String requestFrom) {
    String loginIp = WebHelper.initRequest(null).getRemoteAddr();
    User user = basicUserService.login(email, password, loginIp);
    WebHelper.initRequest(null).setAttribute("REQUEST_FROM",
        StringUtils.trimToEmpty(requestFrom));
    if (user != null) {
      List<Fan> idols = attentionService.queryAttentionByType(user.getId(), IdolType.USER);
      AuthorityUtil.initalAuthorityMatrix(null, user.getId(), idols);
      WebHelper.setSessionAttribute(null, Constant.SESSION_USER, user);
      WebHelper.setSessionAttribute(null, Constant.SESSION_IDOLS, idols);
      LOGGER.debug("登录成功,目标地址:"+requestFrom);
      if (StringUtils.isEmpty(requestFrom)) {
        // return loginedView;
View Full Code Here


  @RequestMapping("/ajaxlogin")
  @ResponseBody
  public boolean ajaxLogin(String email, String password) {
    String loginIp = WebHelper.initRequest(null).getRemoteAddr();
    // logger.debug(email + ":::" + password);
    User user = basicUserService.login(email, password, loginIp);
    WebHelper.saveToken(null);
    if (user != null) {
      List<Fan> idols = attentionService.queryAttentionByType(user.getId(), IdolType.USER);
      AuthorityUtil.initalAuthorityMatrix(null, user.getId(), idols);
      WebHelper.setSessionAttribute(null, Constant.SESSION_USER, user);
      WebHelper.setSessionAttribute(null, Constant.SESSION_IDOLS, idols);
      return true;
    } else {
      return false;
View Full Code Here

  }

  @RequestMapping("/getlogineduser")
  @ResponseBody
  public User getLoginedUser() {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null) {
      user = new User();
      user.setId(Long.valueOf(0));
      user.setNickname("游客");
      user.setPortrait("portrait");
    }
    // u.getPortrait()
    return user;
  }
View Full Code Here

    try {
      Long userid = Long.valueOf(0);
      String nickname = "游客";
      String portrait = "portrait";

      User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
      if (user != null) {
        userid = user.getId();
        nickname = user.getNickname();
        portrait = user.getPortrait();
      }
      LOGGER.debug("commentType:"+commentType+";shareResourceId:"+shareResourceId+";shareOwnerId:"+shareOwnerId+";shareCommentType:"+shareCommentType);
      commentservice.commentResource(userid, nickname, portrait, commentContent, refComment, resourceid, resourceName, commentType,
          resourceOwner);
      // 当shareResourceId != null && shareOwnerId != null &&
View Full Code Here

   */
  @RequestMapping(value = "/{commentType}/delete", method = RequestMethod.POST)
  public @ResponseBody
  String deleteComment(@PathVariable CommentType commentType, long commentid,long resourceid) {
    try {
      User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
      Long userid = Long.valueOf(0);
      if (user != null) {
        userid = user.getId();
      }
      commentservice.deleteComment(resourceid, commentid, commentType, userid);
      return "success";
    } catch (Exception e) {
      LOGGER.error("删除评论出错:", e);
View Full Code Here

      String idolPortrait, IdolType idolType) {
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("loginStatus", false);

    try {
      User user = (User) WebHelper.getSessionAttribute(null,
          Constant.SESSION_USER);
      if (user == null) {
        map.put("loginStatus", false);
        return map;
      }
      if (attentionService.isFan(idolId, user.getId())) {
       
        return null;
      }
      attentionService.payAttention(idolId, idolNickname, idolPortrait,
          user.getId(), user.getNickname(), user.getPortrait(),
          idolType);
      map.put("loginStatus", true);
      return map;

    } catch (Exception e) {
View Full Code Here

   *            需要访问的用户
   * @return
   */
  public static Integer getAuthority(HttpServletRequest request, Long userId) {
    Map<Long, Integer> authorityMatrix = getAuthorityMatrix(request);
    User curUser = (User) WebHelper.getSessionAttribute(request, Constant.SESSION_USER);
    if (authorityMatrix == null || curUser == null) {
      return Authority.PUBLIC;
    }
    Integer authority = authorityMatrix.get(userId);
    // 如果authority == null,则表示被请求的用户不在请求用户的权限矩阵中
    if (authority != null) {
      return authority;
    }
    // 同城暂时不用
    // if (areTheyInSameCity()) {
    // return Authority.
    // } else
    if (isFan(curUser.getId(), userId)) {
      return Authority.ONLY_TO_FANS;
    } else if (isManager()) {
      return Authority.ADMIN;
    } else {
      return Authority.PUBLIC;
View Full Code Here

  @RequestMapping(value = "/delattention", method = RequestMethod.POST)
  public @ResponseBody
  Map<String, Object> ajaxdelAttention(Long idolId, IdolType idolType) {
    Map<String, Object> map = new HashMap<String, Object>();
    try {
      User user = (User) WebHelper.getSessionAttribute(null,
          Constant.SESSION_USER);
      if (user == null) {
        map.put("loginStatus", false);
        return map;
      }
      if (attentionService.isFan(idolId, user.getId())) {
        System.out.println("已经关注");
        attentionService.cancelAttention(idolId, user.getId());
        System.out.println("估计删除成功");
        map.put("loginStatus", true);
        map.put("IsFanFlag", false);
        map.put("FansCount", attentionService.countFans(idolId));
        return map;
View Full Code Here

  @RequestMapping(value = "/isattention", method = RequestMethod.POST)
  public @ResponseBody
  Map<String, Object> ajaxisAttention(Long idolId, IdolType idolType) {
    Map<String, Object> map = new HashMap<String, Object>();
    try {
      User user = (User) WebHelper.getSessionAttribute(null,
          Constant.SESSION_USER);
      if (user == null) {
        map.put("UserStatus", false);
        map.put("IsFanFlag", false);
        return map;
      } else if (idolId.equals(user.getId())) {
        map.put("UserStatus", "Me");
        return map;
      } else if (attentionService.isFan(idolId, user.getId())) {
        /**
         * session 设置
         */
        // WebHelper.setSessionAttribute(null,
        // Constant.SESSION_ATTENTION_FLAG, true);
View Full Code Here

   */
  // FIXME 不要用数字,令人费解
  @RequestMapping(value = "/add", method = RequestMethod.POST)
  public @ResponseBody
  Integer addShare(ShareType shareType, Long resourceId) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user != null && user.getId() != 0) {
      return shareService.addShare(user.getId(), user.getNickname(), user.getPortrait(),
          shareType, resourceId);
    } else {
      return 2;
    }

View Full Code Here

TOP

Related Classes of com.skyline.user.model.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.