feat(user): 更新用户表字段及认证接口

- 将用户表中的 `han_note_id` 注释更新为 "小憨书号"
- 将用户表中的 `phone` 字段改为 `email` 并更新注释
- 更新分布式ID生成器中相关SQL表名引用从 `leaf_alloc` 到 `leaf`
- 在HTTP客户端配置文件中新增认证API请求示例
- 修改Feign接口方法名以匹配邮箱查询逻辑
- 调整RPC服务调用方法名保持一致性
This commit is contained in:
2025-10-12 00:49:35 +08:00
parent eaa5586211
commit e5c79f1abc
7 changed files with 42 additions and 10 deletions

View File

@@ -44,7 +44,7 @@ public class UserRpcService {
FindUserByEmailReqDTO findUserByEmailReqDTO = new FindUserByEmailReqDTO();
findUserByEmailReqDTO.setEmail(email);
Response<FindUserByEmailRspDTO> response = userFeignApi.findByPhone(findUserByEmailReqDTO);
Response<FindUserByEmailRspDTO> response = userFeignApi.findByEmail(findUserByEmailReqDTO);
if (!response.isSuccess()) {
return null;

View File

@@ -13,7 +13,7 @@ import java.util.List;
@Mapper
public interface IDAllocMapper {
@Select("SELECT biz_tag, max_id, step, update_time FROM leaf_alloc")
@Select("SELECT biz_tag, max_id, step, update_time FROM leaf")
@Results(value = {
@Result(column = "biz_tag", property = "key"),
@Result(column = "max_id", property = "maxId"),
@@ -22,7 +22,7 @@ public interface IDAllocMapper {
})
List<LeafAlloc> getAllLeafAllocs();
@Select("SELECT biz_tag, max_id, step FROM leaf_alloc WHERE biz_tag = #{tag}")
@Select("SELECT biz_tag, max_id, step FROM leaf WHERE biz_tag = #{tag}")
@Results(value = {
@Result(column = "biz_tag", property = "key"),
@Result(column = "max_id", property = "maxId"),
@@ -30,12 +30,12 @@ public interface IDAllocMapper {
})
LeafAlloc getLeafAlloc(@Param("tag") String tag);
@Update("UPDATE leaf_alloc SET max_id = max_id + step WHERE biz_tag = #{tag}")
@Update("UPDATE leaf SET max_id = max_id + step WHERE biz_tag = #{tag}")
void updateMaxId(@Param("tag") String tag);
@Update("UPDATE leaf_alloc SET max_id = max_id + #{leafAlloc.step} WHERE biz_tag = #{leafAlloc.key}")
@Update("UPDATE leaf SET max_id = max_id + #{leafAlloc.step} WHERE biz_tag = #{leafAlloc.key}")
void updateMaxIdByCustomStep(@Param("leafAlloc") LeafAlloc leafAlloc);
@Select("SELECT biz_tag FROM leaf_alloc")
@Select("SELECT biz_tag FROM leaf")
List<String> getAllTags();
}

View File

@@ -27,13 +27,13 @@ public interface UserFeignApi {
Response<Long> registerUser(@RequestBody RegisterUserReqDTO registerUserReqDTO);
/**
* 根据手机号查询用户信息
* 根据邮箱号查询用户信息
*
* @param findUserByEmailReqDTO 查询信息请求
* @return 响应
*/
@PostMapping(value = PREFIX + "/findByEmail")
Response<FindUserByEmailRspDTO> findByPhone(@RequestBody FindUserByEmailReqDTO findUserByEmailReqDTO);
Response<FindUserByEmailRspDTO> findByEmail(@RequestBody FindUserByEmailReqDTO findUserByEmailReqDTO);
/**
* 更新密码

27
http-client/gateApi.http Normal file
View File

@@ -0,0 +1,27 @@
### 获取验证码
POST http://localhost:8000/auth/verification/code/send
Content-Type: application/json
{
"email": "ssw010723@gmail.com"
}
### 登录/注册
POST http://localhost:8000/auth/login
Content-Type: application/json
{
"email": "ssw010723@gmail.com",
"code": "135466",
"type": 1
}
### 修改密码
POST http://localhost:8000/auth/password/update
Content-Type: application/json
Authorization: Bearer {{token}}
{
"newPassword": "wwgb1314"
}

View File

View File

@@ -0,0 +1,5 @@
{
"dev": {
"token": "4bXpiBbjXEDFE4ZpqjCOHu1rP81qepl2ROOygrxRGb61K536ckLuyAwfyQHSMcyRdUzf8CxntLEMfbU2ynbYx9nJKlx4vpWZrHqv2mI4iMhnShQ4mPBi7OPPgZi22O2f"
}
}

View File

@@ -1,13 +1,13 @@
CREATE TABLE `t_user`
(
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`han_note_id` varchar(15) NOT NULL COMMENT '书号(唯一凭证)',
`han_note_id` varchar(15) NOT NULL COMMENT '书号(唯一凭证)',
`password` varchar(64) DEFAULT NULL COMMENT '密码',
`nickname` varchar(24) NOT NULL COMMENT '昵称',
`avatar` varchar(120) DEFAULT NULL COMMENT '头像',
`birthday` date DEFAULT NULL COMMENT '生日',
`background_img` varchar(120) DEFAULT NULL COMMENT '背景图',
`phone` varchar(11) NOT NULL COMMENT '手机',
`email` varchar(32) NOT NULL COMMENT '邮箱',
`sex` tinyint DEFAULT '0' COMMENT '性别(0女 1男)',
`status` tinyint NOT NULL DEFAULT '0' COMMENT '状态(0启用 1禁用)',
`introduction` varchar(100) DEFAULT NULL COMMENT '个人简介',