Files
IUQT/acquaintances/idl/user.thrift
2025-08-22 13:47:52 +08:00

621 lines
16 KiB
Thrift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace go user
enum Code {
Success = 1
ParamInvalid = 2
DBErr = 3
ServerError = 4
}
/**
用户基本信息
**/
enum Gender {
Unknown = 0
Male = 1
Female = 2
}
enum user_status {
Disable = 0
Normal = 1
}
struct User {
1: string user_id //id
2: string user_name //用户名
3: Gender gender //性别
4: i64 age //年龄
5: string introduce //个性签名
6: string avatar_image_url //头像地址
7: string birthday //生日
8: i64 area //国家/地区
9: string mobile //手机号
10: string user_password //密码
11: user_status user_status //用户状态
12: string email //用户邮箱
13: string alias //别名
14: string address //详细地址
15: string last_login_ip //上传登录ip
16: string last_login_time //上次登录时间
17: string user_salt //用户加密盐值
}
struct UserInfoReq {
1: string user_name //用户名
2: Gender gender //性别
3: i64 age //年龄
4: string introduce //个性签名
5: string avatar_image_url //头像地址
6: string birthday //生日
7: i64 area //国家/地区
8: string mobile //手机号
9: string email //用户邮箱
10: string alias //别名
11: string address //详细地址
12: string user_id //id
13: string remark //备注
}
struct CreateUserRequest{
1: string name (api.body="name", api.form="name",api.vd="(len($) > 0 && len($) < 100)")
2: Gender gender (api.body="gender", api.form="gender",api.vd="($ == 1||$ == 2)")
3: i64 age (api.body="age", api.form="age")
4: string mobile (api.body="mobile", api.form="mobile",api.vd="(len($) > 0 && len($) < 12)")
5: i64 area (api.body="area", api.form="area",api.vd="$>0")
6: string user_password (api.body="user_password", api.form="user_password",api.vd="(len($) > 0 && len($) < 15)")
7: string avatar_image_url (api.body="avatar_image_url", api.form="avatar_image_url")
}
struct CreateUserResponse{
1: Code code
2: string msg
}
struct InfoUserRequest{
1: string user_id (api.path="user_id",api.query="user_id")
}
struct QueryUserResponse{
1: Code code
2: string msg
3: UserInfoReq userInfo
}
struct DeleteUserRequest{
1: string user_id (api.path="user_id")
}
struct DeleteUserResponse{
1: Code code
2: string msg
}
struct UpdateUserRequest{
1: string user_id (api.path="user_id")
2: string name (api.body="name")
3: Gender gender (api.body="gender")
4: i64 age (api.body="age")
5: string introduce (api.body="introduce")
6: string avatar_image_url (api.body="avatar_image_url")
7: string birthday (api.body="birthday")
8: string user_password (api.body="user_password")
9: i64 area (api.body="area")
10: string mobile (api.body="mobile")
11: string address (api.body="address")
}
struct UpdateUserResponse{
1: Code code
2: string msg
}
struct FindUserResponse{
1: Code code
2: string msg
3: UserInfoReq userInfo
}
struct FindUserRequest{
1: string keyword (api.path="keyword",api.body="keyword")
}
struct LoginUserResponse{
1: Code code
2: string msg
3: UserInfoReq userInfo
4: string token
}
struct LoginUserRequest{
1: string userName (api.path="user_name",api.body="user_name")
2: string password (api.path="password",api.body="password")
}
struct SmsRequest{
1: string phone (api.path="phone",api.body="phone")
2: string type (api.path="type",api.body="type")
}
struct SmsResponse{
1: Code code
2: string msg
}
struct CheckOtpRequest{
1: string phone (api.path="phone",api.body="phone")
2: string otp (api.path="otp",api.body="otp")
3: string type (api.path="type",api.body="type")
}
struct CheckOtpResponse{
1: Code code
2: string msg
}
service UserService {
UpdateUserResponse UpdateUser(1:UpdateUserRequest req)(api.put="/v1/user/") //更新用户信息
DeleteUserResponse DeleteUser(1:DeleteUserRequest req)(api.delete="/v1/user/") //删除用户
QueryUserResponse InfoUser(1: InfoUserRequest req)(api.get="/v1/user/") //查询用户信息
CreateUserResponse CreateUser(1:CreateUserRequest req)(api.post="/v1/user/") //注册用户
FindUserResponse FindUser(1:FindUserRequest req)(api.get="/v1/user/find/") //精确查询用户
LoginUserResponse LoginUser(1:LoginUserRequest req)(api.post="/v1/user/login/") //用户登录
SmsResponse SmsUser(1:SmsRequest req)(api.post="/v1/user/sms/") //用户短信
CheckOtpResponse CheckOtp(1:CheckOtpRequest req)(api.post="/v1/user/check_otp/") //验证码校验
}
/**
用户好友关系
**/
struct CreateUserRelationsReq {
1: string user_id //id
2: string friend_id //好友id
3: string remark //备注
}
struct CreateUserRelationsRes{
1: Code code
2: string msg
}
struct DeleteUserRelationsReq {
1: string user_id //id
2: string friend_id //好友id
}
struct DeleteUserRelationsRes{
1: Code code
2: string msg
}
struct UpdateUserRelationsReq {
1: string user_id //id
2: string friend_id //好友id
3: string remark //备注
}
struct UpdateUserRelationsRes{
1: Code code
2: string msg
}
struct ListUserRelationsReq{
1: string user_id //id
}
struct ListUserRelationsRes{
1: Code code
2: string msg
3: list<UserInfoReq> users
4: i64 total
}
service UserRelationsService {
DeleteUserRelationsRes DeleteUserRelations(1:DeleteUserRelationsReq req)(api.delete="/v1/user/relation/") //删除申请
ListUserRelationsRes ListUserRelations(1: ListUserRelationsReq req)(api.get="/v1/user/relation/") //获取好友列表
CreateUserRelationsRes CreateUserRelations(1:CreateUserRelationsReq req)(api.post="/v1/user/relation/") //发起好友申请
UpdateUserRelationsRes UpdateUserRelations(1:UpdateUserRelationsReq req)(api.put="/v1/user/relation/") //修改好友备注
}
//好友申请
//发起好友申请
struct FriendRelationshipInfo {
1: string applicant_id
2: string target_user_id
3: string application_message
4: i8 status
}
struct CreateFriendRelationshipReq {
1: string applicant_id //发起者id
2: string target_user_id //好友id
3: string application_message //留言
}
struct CreateFriendRelationshipRes{
1: Code code
2: string msg
}
//同意/拒绝好友申请
struct UpdateFriendRelationshipReq {
1: string applicant_id //id
2: string target_user_id //好友id
3: i8 Status //状态
4: i64 id //好友id
}
struct UpdateFriendRelationshipRes{
1: Code code
2: string msg
}
//请求添加好友或被添加好友列表
struct ListFriendRelationshipReq{
1: string user_id //id
}
struct FriendRelationshipListInfo {
1: i64 id
2: string application_message
3: i8 status
4: string user_name
5: string avatar_image_url
6: string user_id
}
struct ListFriendRelationshipRes{
1: Code code
2: string msg
3: list<FriendRelationshipListInfo> FriendRelationshipInfos
4: i64 total
}
service FriendRelationshipService {
CreateFriendRelationshipRes CreateFriendRelationship(1:CreateFriendRelationshipReq req)(api.post="/v1/user/friendRelationship/") //发起好友申请
UpdateFriendRelationshipRes UpdateFriendRelationship(1:UpdateFriendRelationshipReq req)(api.put="/v1/user/friendRelationship/") //同意或拒绝好友申请
ListFriendRelationshipRes ListFriendRelationship(1:ListFriendRelationshipReq req)(api.get="/v1/user/friendRelationship/") //获取好友添加请求列表
ListFriendRelationshipRes ListFriendRelationshipRecord(1:ListFriendRelationshipReq req)(api.get="/v1/user/friendRelationship/record/") //获取好友添加记录列表
}
//聊天群组
//创建群聊
struct ChatGroupInfo{
1: string chat_group_id
2: string chat_group_name
3: string chat_group_image_url
4: string chat_group_Notice
}
struct CreateChatGroupReq {
1: string user_id //创建者id
2: string chat_group_name //群名
}
struct CreateChatGroupRes{
1: Code code
2: string msg
}
//解散群聊
struct DeleteChatGroupReq {
1: string user_id //创建者id
2: string chat_group_id //群号
}
struct DeleteChatGroupRes{
1: Code code
2: string msg
}
//修改群信息
struct UpdateChatGroupReq {
1: string user_id //创建者id
2: string chat_group_id //群号
3: string new_chat_group_name //新群名
4: string chat_group_name_image_url //群头像
5: string chat_group_Notice //群公告
}
struct UpdateChatGroupRes{
1: Code code
2: string msg
}
//加入群聊
struct JoinChatGroupReq {
1: string user_id //申请者id
2: string chat_group_id //群号
}
struct JoinChatGroupRes{
1: Code code
2: string msg
}
//退出群聊
struct ExitChatGroupReq {
1: string user_id //申请者id
2: string chat_group_id //群号
}
struct ExitChatGroupRes{
1: Code code
2: string msg
}
//获取自己加入的群列表
struct ListChatGroupByUserReq {
1: string user_id //id
}
struct ListChatGroupByUserRes{
1: Code code
2: string msg
3: list<ChatGroupInfo> chat_groups
4: i64 total
}
//获取群成员列表
struct ListUserChatGroupReq {
1: string chat_group_id
}
struct ListUserChatGroupRes{
1: Code code
2: string msg
3: list<UserInfoReq> users
4: i64 total
}
service ChatGroupService {
CreateChatGroupRes CreateChatGroup(1:CreateChatGroupReq req)(api.post="/v1/cg/") //创建群聊
DeleteChatGroupRes DeleteChatGroup(1:DeleteChatGroupReq req)(api.delete="/v1/cg/") //删除群
UpdateChatGroupRes UpdateChatGroup(1:UpdateChatGroupReq req)(api.put="/v1/cg/") //修改群信息
ListChatGroupByUserRes ListChatGroupByUser(1: ListChatGroupByUserReq req)(api.get="/v1/cg/") //获取指定用户群列表
ListUserChatGroupRes ListUserChatGroup(1: ListUserChatGroupReq req)(api.get="/v1/cg/users/") //获取指定群用户列表
JoinChatGroupRes JoinChatGroup(1:JoinChatGroupReq req)(api.post="/v1/cg/join/") //入群
ExitChatGroupRes ExitChatGroup(1:ExitChatGroupReq req)(api.post="/v1/cg/exit/") //退出群
}
/*
* 朋友圈
* */
// 动态可见性枚举
enum MomentVisibility {
VISIBILITY_PUBLIC = 1 // 公开
VISIBILITY_FRIENDS_ONLY = 2 // 仅好友可见
VISIBILITY_SELF_ONLY = 3 // 仅自己可见
}
// 动态/评论状态枚举
enum ContentStatus {
CONTENT_STATUS_DELETED = 0 // 已删除
CONTENT_STATUS_NORMAL = 1 // 正常
}
// 朋友圈图片结构体
struct MomentImage {
1: i64 id // ID
2: i64 moment_id // 所属动态ID
3: string image_url // 图片URL
}
// 朋友圈点赞结构体
struct MomentLike {
1: i64 id // 点赞ID
2: i64 moment_id // 动态ID
3: string user_id // 点赞用户ID
4: string created_at // 点赞时间
}
// 朋友圈评论结构体
struct MomentComment {
1: i64 id // 评论ID
2: i64 moment_id // 动态ID
3: string user_id // 评论用户ID
4: UserInfoReq user // 评论用户信息
5: string content // 评论内容
6: i64 parent_id // 父评论ID用于回复
7: string created_at // 创建时间
}
// 朋友圈动态结构体
struct Moment {
1: i64 id // 动态ID
2: string user_id // 发布者用户ID
3: UserInfoReq user // 发布者信息
4: string content // 动态内容
5: MomentVisibility visibility // 可见性
6: string location // 发布地点
7: ContentStatus status // 状态
8: i32 like_count // 点赞数
9: i32 comment_count // 评论数
10: list<MomentFile> files // 动态图片列表
11: string created_at // 创建时间
12: string updated_at // 更新时间
}
// 动态图片结构体
struct MomentFile {
1: i64 id // ID
2: i64 moment_id // 所属动态ID
3: string file_url // 文件URL
4: string file_type // 文件类型
5: i8 sort_order //文件顺序
}
// 发布动态请求
struct CreateMomentRequest {
1: string user_id // 发布者用户ID
2: string content // 动态内容
3: MomentVisibility visibility // 可见性,默认公开
4: string location // 发布地点
5: list<MomentFile> file_urls // 图片URL列表
}
// 发布动态响应
struct CreateMomentResponse {
1: Code code
2: string msg
}
// 获取动态列表请求
struct ListMomentsRequest {
1: string user_id // 当前用户ID
2: i32 page // 页码默认1
3: i32 pageSize // 每页数量默认10
}
// 获取动态列表响应
struct ListMomentsResponse {
1: Code code
2: list<Moment> moments // 动态列表
3: i32 total // 总数量
}
// 删除动态请求
struct DeleteMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
}
// 删除动态响应
struct DeleteMomentResponse {
1: Code code
2: string msg
}
// 点赞动态请求
struct LikeMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
}
// 点赞动态响应
struct LikeMomentResponse {
1: Code code
2: string msg // 提示信息
}
// 取消点赞请求
struct UnlikeMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
}
// 取消点赞响应
struct UnlikeMomentResponse {
1: Code code
2: string msg
}
// 获取动态点赞列表请求
struct ListMomentLikesRequest {
1: i64 moment_id // 动态ID
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认20
}
// 获取动态点赞列表响应
struct ListMomentLikesResponse {
1: Code code
2: list<UserInfoReq> likes // 点赞列表
3: i32 total // 总数量
}
// 评论动态请求
struct CommentMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
3: string content // 评论内容
4: i64 parent_id // 父评论ID用于回复
}
// 评论动态响应
struct CommentMomentResponse {
1: Code code // 是否成功
2: string msg // 提示信息
}
// 获取动态评论列表请求
struct ListMomentCommentsRequest {
1: i64 moment_id // 动态ID
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认10
}
// 获取动态评论列表响应
struct ListMomentCommentsResponse {
1: Code code
2: list<MomentComment> comments // 评论列表
3: i32 total // 总数量
4: string msg // 提示信息
}
// 删除评论请求
struct DeleteCommentRequest {
1: string user_id // 当前用户ID
2: i64 comment_id // 评论ID
}
// 删除评论响应
struct DeleteCommentResponse {
1: Code code
2: string msg
}
struct ListMomentsAppointRequest {
1: string user_id // 当前用户ID
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认10
}
// 获取动态列表响应
struct ListMomentsAppointResponse {
1: Code code
2: list<Moment> moments // 动态列表
3: i32 total // 总数量
}
// 朋友圈服务接口
service MomentsService {
// 发布动态
CreateMomentResponse CreateMoment(1: CreateMomentRequest req)(api.post="/v1/Moments/")
// 获取动态列表
ListMomentsResponse ListMoments(1: ListMomentsRequest req)(api.get="/v1/Moments/list/")
//获取指定用户动态列表
ListMomentsAppointResponse ListMomentsAppoint(1: ListMomentsAppointRequest req)(api.get="/v1/Moments/user/list/")
// 删除动态
DeleteMomentResponse DeleteMoment(1: DeleteMomentRequest req)(api.delete="/v1/Moments/")
// 点赞动态
LikeMomentResponse LikeMoment(1: LikeMomentRequest req)(api.post="/v1/Moments/like/")
// 取消点赞
UnlikeMomentResponse UnlikeMoment(1: UnlikeMomentRequest req)(api.post="/v1/Moments/dislike/")
// 获取动态点赞列表
ListMomentLikesResponse ListMomentLikes(1: ListMomentLikesRequest req)(api.get="/v1/Moments/like/list/")
// 评论动态
CommentMomentResponse CommentMoment(1: CommentMomentRequest req)(api.post="/v1/Moments/comment/")
// 获取动态评论列表
ListMomentCommentsResponse ListMomentComments(1: ListMomentCommentsRequest req)(api.get="/v1/Moments/comment/list/")
// 删除评论
DeleteCommentResponse DeleteComment(1: DeleteCommentRequest req)(api.delete="/v1/Moments/comment/")
}