user-core-client/README.md

36 lines
924 B
Markdown
Raw Normal View History

2025-08-18 14:28:57 +08:00
# user-core-client
2025-08-20 17:43:52 +08:00
用户中心 SDK
**数据同步**
内部使用Kafka订阅进行同步
```go
type UserCentSync interface {
Start(ctx context.Context) error
Stop(ctx context.Context) error
// SetCallUserListener 设置用户事件回调函数
SetCallUserListener(func (context.Context, *UserEvent) error)
// SetErrorListener 设置错误回调函数
SetErrorListener(func (context.Context, error) error)
}
```
**API调用**
内部使用GRPC调用
```go
type UserCenterApi interface {
// Verify 验证 token 并且返回 token 中的信息
Verify(ctx context.Context, token string) (*TokenClaims, error)
// GetPhoneTextByUID 获取明文手机号 来自于 uid
GetPhoneTextByUID(ctx context.Context, uid int64) (string, error)
// UpdateUserByUID 更新用户信息
UpdateUserByUID(ctx context.Context, uid int64, user *UpdateUserReq) (*User, error)
}
```