{"record":{"id":"d54d86cf58255989","repo":"qiurunze123/miaosha","slug":"30009-d54d86","errorCode":"30009","errorMessage":"账号不存在!","messagePattern":"账号不存在!","errorType":"exception","errorClass":"GlobleException","httpStatus":null,"severity":"warning","filePath":"miaosha-v2/miaosha-service/src/main/java/com/geekq/miaosha/service/MiaoShaUserService.java","lineNumber":83,"sourceCode":"        MiaoshaUser user = redisService.get(MiaoShaUserKey.getByNickName, \"\" + nickName, MiaoshaUser.class);\n        if (user != null) {\n            return user;\n        }\n        //取数据库\n        user = miaoShaUserMapper.getByNickname(nickName);\n        if (user != null) {\n            redisService.set(MiaoShaUserKey.getByNickName, \"\" + nickName, user);\n        }\n        return user;\n    }\n\n\n    // http://blog.csdn.net/tTU1EvLDeLFq5btqiK/article/details/78693323\n    public boolean updatePassword(String token, String nickName, String formPass) {\n        //取user\n        MiaoshaUser user = getByNickName(nickName);\n        if (user == null) {\n            throw new GlobleException(MOBILE_NOT_EXIST);\n        }\n        //更新数据库\n        MiaoshaUser toBeUpdate = new MiaoshaUser();\n        toBeUpdate.setNickname(nickName);\n        toBeUpdate.setPassword(MD5Utils.formPassToDBPass(formPass, user.getSalt()));\n        miaoShaUserMapper.update(toBeUpdate);\n        //处理缓存\n        redisService.delete(MiaoShaUserKey.getByNickName, \"\" + nickName);\n        user.setPassword(toBeUpdate.getPassword());\n        redisService.set(MiaoShaUserKey.token, token, user);\n        return true;\n    }\n\n\n    public boolean register(String userName, String passWord,\n                            HttpServletResponse response, HttpServletRequest request) {\n        MiaoshaUser miaoShaUser = new MiaoshaUser();\n        miaoShaUser.setNickname(userName);","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/qiurunze123/miaosha/blob/e58017658e549b63fc4db2160d2325ccd7f8435b/miaosha-v2/miaosha-service/src/main/java/com/geekq/miaosha/service/MiaoShaUserService.java#L65-L101","documentation":"Thrown by MiaoShaUserService.updatePassword() (miaosha-v2) when getByNickName(nickName) returns null. Maps to ResultStatus.MOBILE_NOT_EXIST (code 30009, message '账号不存在!' — 'Account does not exist'). In v2 the message was corrected from the v1 wording ('手机号不存在!') to '账号不存在!' to accurately reflect that the lookup is by nickname, not phone number. The lookup path is Redis (MiaoShaUserKey.getByNickName) then miaoShaUserMapper.getByNickname().","triggerScenarios":"Calling updatePassword(token, nickName, formPass) where nickName has no matching miaosha_user row and is not in Redis cache. The v2 DAO is miaoShaUserMapper (MyBatis mapper) instead of the v1 miaoShaUserDao.","commonSituations":"Password reset for a deleted or never-registered account; Redis cache flushed exposing a missing DB row; nickname is from miaosha-admin's logininfo table (different schema) rather than miaosha_user; test environment without seed data.","solutions":["Verify the account exists via getByNickName() before allowing the user to reach the password-change step.","Confirm the nickname corresponds to a miaosha_user row, not just an admin logininfo row.","Check miaoShaUserMapper.getByNickname() SQL mapping points to the correct table and column.","Re-register the user if the account was removed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify user exists before password update (v2)\nMiaoshaUser user = miaoShaUserService.getByNickName(nickName);\nif (user == null) {\n    return ResultGeekQ.error(ResultStatus.MOBILE_NOT_EXIST);\n}\nmiaoShaUserService.updatePassword(token, nickName, formPass);","typeGuard":null,"tryCatchPattern":"try {\n    miaoShaUserService.updatePassword(token, nickName, formPass);\n} catch (GlobleException e) {\n    if (e.getStatus() == ResultStatus.MOBILE_NOT_EXIST) {\n        return ResultGeekQ.error(ResultStatus.MOBILE_NOT_EXIST);\n    }\n    throw e;\n}","preventionTips":["Pre-validate user existence via getByNickName() before the password-reset step.","Confirm the nickname maps to a miaosha_user row (not just admin logininfo).","Check miaoShaUserMapper.getByNickname SQL mapping for correct table/column."],"tags":["authentication","password-reset","user-not-found","miaosha-v2"],"backgroundTag":null,"analyzedSha":"e58017658e549b63fc4db2160d2325ccd7f8435b","analyzedAt":"2026-08-14T05:22:03.691Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}