Beispiel #1
0
 /**
  * 管理员更新用户信息,不包含密码等安全信息
  *
  * @return
  */
 @Action(
     value = "UpdateUserTunpwd",
     results = {@Result(name = "json", type = "json")})
 public String UpdateUserTunpwd() {
   this.CheckLogin();
   if (!this.isSlogin()) {
     UserT user = new UserT();
     user.setUserid(this.getUserid());
     user.setUsername(this.getUsername().trim());
     user.setEmail(this.getEmail().trim());
     user.setPoints(Double.parseDouble(this.getPoints().trim()));
     user.setUserstate(this.getUserstate());
     user.setGrade(this.getGrade());
     user.setGradename(this.getGradename());
     user.setState(this.getState());
     if (this.getGrade().equals("0")) {
       user.setGradetime(null);
     } else {
       user.setGradetime(BaseTools.systemtime());
     }
     if (this.getUsertService().updateUserTunpwd(user) > 0) {
       this.setSucflag(true);
       return "json";
     }
   }
   this.setSucflag(false);
   return "json";
 }
Beispiel #2
0
 /**
  * 管理员增加用户
  *
  * @return
  */
 @Action(
     value = "adminregister",
     results = {@Result(name = "json", type = "json")})
 public String adminregister() {
   MD5Code md5 = new MD5Code();
   UserT u = new UserT();
   u.setUsername(this.getUsername().trim());
   u.setEmail(this.getEmail().trim());
   u = this.getUsertService().checkUserByUsername(u);
   if (u != null) {
     this.setMsg("4"); // 表示用户已经存在
     return "json";
   } else {
     u = new UserT();
     u.setUsername(this.getUsername().trim());
     u.setEmail(this.getEmail().trim());
     u = this.getUsertService().checkUserByEmail(u);
     if (u != null) {
       this.setMsg("5"); // 表示用户邮箱存在
       return "json";
     }
     UserT user = new UserT();
     user.setUserid(this.getSerial().Serialid(Serial.USER));
     user.setUid(md5.getMD5ofStr(user.getUserid()));
     user.setUsername(this.getUsername().trim());
     user.setRealname(null);
     user.setEmail(this.getEmail().trim());
     user.setTelno(null);
     user.setMobile(null);
     user.setQuestion(null);
     user.setAnswer(null);
     user.setPassword(md5.getMD5ofStr("111111")); // 默认密码6个1
     user.setUserstate(this.getUserstate());
     user.setPoints(Double.parseDouble(this.getPoints().trim()));
     user.setPostingcount(0);
     user.setSex(null);
     user.setRegisttime(BaseTools.systemtime());
     user.setDisablebegin(null);
     user.setDisableend(null);
     user.setSection(null);
     user.setPosition(null);
     user.setGroupid(null);
     user.setParttime1(null);
     user.setParttime2(null);
     user.setParttime3(null);
     user.setParttime4(null);
     user.setParttime5(null);
     user.setParttime6(null);
     user.setHobby(null);
     user.setQq(null);
     user.setMsn(null);
     user.setOthercontract(null);
     user.setAddress(null);
     user.setPostcode(null);
     user.setBirthday(null);
     user.setGrade(this.getGrade());
     user.setGradename(this.getGradename().trim());
     if (this.getGrade().equals("0")) {
       user.setGradetime(null);
     } else {
       user.setGradetime(BaseTools.systemtime());
     }
     user.setState(this.getState());
     user.setRolemid("0");
     user.setRolemname("");
     if (this.getUsertService().save(user) > 0) {
       // 重新获取后台登录时保存的加密session key
       this.setParam(
           ActionContext.getContext().getSession().get(BaseTools.BACK_SESSION_KEY).toString());
       this.setSucflag(true);
       return "json";
     }
     this.setSucflag(false);
     return "json";
   }
 }