qiurunze123/miaosha · warning · GlobleException
30009
30009
Error message
手机号不存在!
What it means
Thrown by MiaoShaUserService.updatePassword() (miaosha-v1) when getByNickName(nickName) returns null. Maps to ResultStatus.MOBILE_NOT_EXIST (code 30009, message '手机号不存在!' — 'Phone number does not exist'). The lookup goes through a Redis cache (MiaoShaUserKey.getByNickName) then falls back to miaoShaUserDao.getByNickname(). If both miss, the user does not exist in the system. The message is misleading because the lookup key is a nickname, not a phone number — this is a known v1 wording issue corrected to '账号不存在!' in v2.
Source
Thrown at miaosha-v1/src/main/java/com/geekq/miaosha/service/MiaoShaUserService.java:73
MiaoshaUser user = redisService.get(MiaoShaUserKey.getByNickName, "" + nickName, MiaoshaUser.class);
if (user != null) {
return user;
}
//取数据库
user = miaoShaUserDao.getByNickname(nickName);
if (user != null) {
redisService.set(MiaoShaUserKey.getByNickName, "" + nickName, user);
}
return user;
}
// http://blog.csdn.net/tTU1EvLDeLFq5btqiK/article/details/78693323
public boolean updatePassword(String token, String nickName, String formPass) {
//取user
MiaoshaUser user = getByNickName(nickName);
if (user == null) {
throw new GlobleException(MOBILE_NOT_EXIST);
}
//更新数据库
MiaoshaUser toBeUpdate = new MiaoshaUser();
toBeUpdate.setNickname(nickName);
toBeUpdate.setPassword(MD5Utils.formPassToDBPass(formPass, user.getSalt()));
miaoShaUserDao.update(toBeUpdate);
//处理缓存
redisService.delete(MiaoShaUserKey.getByNickName, "" + nickName);
user.setPassword(toBeUpdate.getPassword());
redisService.set(MiaoShaUserKey.token, token, user);
return true;
}
public boolean register(HttpServletResponse response, String userName, String passWord, String salt) {
MiaoshaUser miaoShaUser = new MiaoshaUser();
miaoShaUser.setNickname(userName);
String DBPassWord = MD5Utils.formPassToDBPass(passWord, salt);View on GitHub (pinned to e58017658e)
Solutions
- Verify the user exists via getByNickName(nickName) before presenting the password-change form to the user.
- Ensure the nickname passed to updatePassword() matches the one used at registration time (case-sensitive).
- If the account was deleted, re-register it before attempting a password change.
- Check that the miaosha_user table is populated and the DAO query getByNickname maps the correct column.
Example fix
// before
MiaoshaUser user = getByNickName(nickName);
if (user == null) {
throw new GlobleException(MOBILE_NOT_EXIST);
}
// after — caller validates first
MiaoshaUser existing = miaoShaUserService.getByNickName(nickName);
if (existing == null) {
return ResultGeekQ.error(MOBILE_NOT_EXIST);
}
miaoShaUserService.updatePassword(token, nickName, formPass); Defensive patterns
Strategy: validation
Validate before calling
// Verify user exists before password update
MiaoshaUser user = miaoShaUserService.getByNickName(nickName);
if (user == null) {
return ResultGeekQ.error(ResultStatus.MOBILE_NOT_EXIST);
}
miaoShaUserService.updatePassword(token, nickName, formPass); Try / catch
try {
miaoShaUserService.updatePassword(token, nickName, formPass);
} catch (GlobleException e) {
if (e.getStatus() == ResultStatus.MOBILE_NOT_EXIST) {
return ResultGeekQ.error(MOBILE_NOT_EXIST);
}
throw e;
} Prevention
- Pre-validate user existence via getByNickName() before showing the password-reset form.
- Ensure the nickname field is trimmed and case-normalized before lookup.
- Log which nickname failed to help diagnose stale-account issues.
When it happens
Trigger: Calling updatePassword(token, nickName, formPass) where nickName has no matching row in the miaosha_user table and is not cached in Redis. This occurs when a user tries to change a password for an account that was never registered, was deleted, or when the nickname is mistyped.
Common situations: Stale client holding a token for a deleted account; typo in the nickname field; test environment with an empty user table; Redis was flushed so the cache miss exposes a missing DB row; user was registered in a different data center / shard.
Related errors
AI-assisted analysis of qiurunze123/miaosha@e58017658e (2026-08-14).
Data as JSON: /api/errors/e4ef4be1193ce044.
Report an issue: GitHub.