Example #1
0
  @Action(value = "save")
  public String save() {

    System.out.println(model.getNickName());
    userService.saveUser(model);
    return "test";
  }
Example #2
0
  @Action(value = "toIndex")
  public String toIndex() {
    String url = "http://dev.ydcycloud.net/xingongyi/userAction!toIndexHead.action";
    System.out.println("code:" + code);
    if (code == null) return "toIndex_error";

    User user = userService.getUserInfo(code);
    if (user == null) return "toIndex_error";
    String accessToken = getAccessToken();
    setSignatureToSession(url, "toIndex", accessToken);
    request.getSession().setAttribute("user", user);

    return "toIndex";
  }
Example #3
0
  /**
   * 分享给朋友后的回调
   *
   * @return
   */
  @Action(value = "share")
  public String share() {

    System.out.println(model.getUserId() + "===" + projectId);
    Project p = userService.shareProject(model.getUserId(), projectId);
    if (p != null) {
      servletContext.setAttribute("project" + projectId, p);
      int sum = (Integer) servletContext.getAttribute("sum");
      servletContext.setAttribute("sum", sum + 1);
      map.put("status", 0);
    } else {
      map.put("status", -1);
    }
    return null;
  }
Example #4
0
  public String toPray() {
    String url =
        "http://dev.ydcycloud.net/xingongyi/userAction!toPray.action?userId="
            + model.getUserId()
            + "&projectId="
            + projectId;
    if (model.getUserId() == null || request.getSession().getAttribute("user") == null) {
      return "wechatGrant";
    }

    boolean state = userService.checkPray(model.getUserId(), projectId);

    String accessToken = getAccessToken();
    setSignatureToSession(url, "toPray", accessToken);
    request.setAttribute("projectId", projectId);
    request.setAttribute("state", state);
    return "toPray" + projectId;
  }
Example #5
0
  @Action(value = "pray")
  public String pray() {

    System.out.println(model.getUserId() + "====" + projectId);
    map = new HashMap<String, Object>();

    Project p = userService.userPray(model.getUserId(), projectId);
    if (p != null) {
      servletContext.setAttribute("project" + projectId, p);
      int sum = (Integer) servletContext.getAttribute("sum");
      servletContext.setAttribute("sum", sum + 1);
      map.put("status", 0);
    } else {
      map.put("status", -1);
    }
    outJsonString(JsonUtils.map2Json(map));

    return null;
  }