Commit 5625c73b authored by Quxl's avatar Quxl

优化注册校验

parent 8d0cfc7f
......@@ -20,6 +20,7 @@ import com.egolm.film.bean.Fc_member;
import com.egolm.film.common.EmailService;
import com.egolm.film.common.Messages;
import com.egolm.film.config.Common;
import com.egolm.film.config.XException;
import com.egolm.film.config.interceptor.LocaleSessionInterceptor;
import io.swagger.annotations.Api;
......@@ -62,6 +63,9 @@ public class MemberOpenApiController {
member.setCreate_time(System.currentTimeMillis());
member.setLang(locale == null ? "zh" : locale.getLanguage());
member.setState(1);
if(memberService.exists(email)) {
throw new XException(messages.get("sys.err.user_exists"));
}
memberService.saveMember(member);
return Rjx.jsonOk();
}
......
......@@ -6,6 +6,11 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel
public class ApplyModel {
/**
* 会员影片表主键
*/
private String id;
/**
* 基本信息
*/
......@@ -519,4 +524,12 @@ public class ApplyModel {
this.film_apply_country = film_apply_country;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
......@@ -21,4 +21,6 @@ public interface MemberService {
List<Map<String, Object>> queryListByMemberID(Integer member_id);
boolean exists(String email);
}
......@@ -57,4 +57,9 @@ public class MemberServiceImpl implements MemberService {
return jdbcTemplate.queryForList(sql, member_id);
}
@Override
public boolean exists(String email) {
return jdbcTemplate.queryForInt("select count(*) from fc_member where email = ?", email) > 0;
}
}
......@@ -17,10 +17,6 @@ public class Common {
return new String(text);
}
public static void main(String[] args) {
System.out.println(getGenerateString(8));
}
public static String encodePassword(String password, String salt) {
return StringUtil.toMD5HexString(StringUtil.toMD5HexString(password + salt).toLowerCase().substring(4, 24)).toLowerCase();
}
......
......@@ -5,5 +5,6 @@ sys.err=System error
sys.err.user_disabled=User disabled
sys.err.user_pwd_err=User or password error
sys.err.user_pwd_null=User and passowrd can not be null
sys.err.user_exists=User already exists
msg.test=Test
\ No newline at end of file
......@@ -5,5 +5,6 @@ sys.err=\u7CFB\u7EDF\u9519\u8BEF
sys.err.user_disabled=\u7528\u6237\u5DF2\u7ECF\u7981\u7528
sys.err.user_pwd_err=\u7528\u6237\u6216\u5BC6\u7801\u9519\u8BEF
sys.err.user_pwd_null=\u7528\u6237\u540D\u548C\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A
sys.err.user_exists=\u7528\u6237\u5DF2\u5B58\u5728
msg.test=\u6D4B\u8BD5
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment