コード例 #1
0
ファイル: User.java プロジェクト: liupd/jfinalbbs
 public int updateByEmail(String email, String newPass) {
   return Db.update(
       "update user u set u.password = ?, u.token = ? where u.email = ?",
       newPass,
       StrUtil.getUUID(),
       email);
 }
コード例 #2
0
 // 编辑模块
 public void edit() {
     String method = getRequest().getMethod();
     Integer id = getParaToInt("id");
     if(method.equalsIgnoreCase(Constants.RequestMethod.GET)) {
     	Section oneSection=Section.me.findById(id);
         setAttr("section", oneSection);
         
         String section_admin=oneSection.getStr("section_admin");
         
         if(!StrUtil.isBlank(section_admin)){
         	
         	User oneUser= User.me.findById(section_admin);
             
             if(oneUser!=null){
             	
                 setAttr("section_admin_name",oneUser.getStr("nickname"));
             }	
         }
         
         render("edit.html");
     } else if(method.equalsIgnoreCase(Constants.RequestMethod.POST)) {
         String name = getPara("name");
         Integer show_status = getParaToInt("show_status");
         String tab = getPara("tab");
         
         String desc_text = getPara("desc_text");
         String image_logo = getPara("image_logo");
         String section_admin = getPara("section_admin");
         String section_admin_name = getPara("section_admin_name");
         
         //效验版主
         if(!StringUtils.isNullOrEmpty(section_admin_name)){
         
         	User oneUser= User.me.findByNickname(section_admin_name);
             
             if(oneUser==null){
             	setAttr("msg","绑定的版主不存在!");
             	render("add.html");
             	return;
             }else{
             	section_admin=oneUser.getStr("id");
             }
         }
         
         Section section = Section.me.findById(id);
         section.set("name", name)
         	.set("show_status", show_status)
         	.set("tab", tab)
     		.set("desc_text", desc_text)
     		.set("image_logo", image_logo)
     		.set("section_admin", section_admin)
         	.update();
         // clear cache
         clearCache(Constants.CacheName.SECTIONLIST, null);
         clearCache(Constants.CacheName.SECTIONSHOWLIST, null);
         redirect(Constants.getBaseUrl() + "/admin/section/index");
     }
 }
コード例 #3
0
 public void setDefault() {
     String tab = getPara("tab");
     if(StrUtil.isBlank(tab)) {
         error("设置失败");
     } else {
         Section defaultSection = Section.me.findDefault();
         if(!tab.equals(defaultSection.getStr("tab"))) {
             defaultSection.set("default_show", 0).update();
             Section section = Section.me.findByTab(tab);
             section.set("default_show", 1).update();
             clearCache(Constants.CacheName.SECTIONLIST, null);
             clearCache(Constants.CacheName.DEFAULTSECTION, null);
         }
         success();
     }
 }
コード例 #4
0
 public void checkUserExist(){
 	
 	String name=getPara("nickname");
 	if(!StrUtil.isBlank(name)){
         
     	User oneUser= User.me.findByNickname(name);
         
         if(oneUser==null){
         	success(0,"没有找到");
         }else{
         	success(1,oneUser.getStr("id"));
         }
     }else{
     	success(-1,"");
     }
 	
 }