feat(user): implement OTP login, user creation, and profile management

- Added SendOTP method for simulating OTP sending.
- Implemented LoginWithOTP method for user login/registration via OTP, including user creation if not found.
- Added Me method to retrieve current user information.
- Implemented Update method for updating user profile details.
- Added RealName method for real-name verification.
- Implemented GetNotifications method to fetch user notifications.
- Created user_test.go for comprehensive unit tests covering login, profile retrieval, updates, real-name verification, and notifications.
- Updated database models to use appropriate consts for fields like gender, status, and roles.
This commit is contained in:
2025-12-29 10:55:13 +08:00
parent bc2064639f
commit b78f1e1c84
17 changed files with 497 additions and 120 deletions

View File

@@ -28,8 +28,8 @@ func newOrder(db *gorm.DB, opts ...gen.DOOption) orderQuery {
_orderQuery.ID = field.NewInt64(tableName, "id")
_orderQuery.TenantID = field.NewInt64(tableName, "tenant_id")
_orderQuery.UserID = field.NewInt64(tableName, "user_id")
_orderQuery.Type = field.NewString(tableName, "type")
_orderQuery.Status = field.NewString(tableName, "status")
_orderQuery.Type = field.NewField(tableName, "type")
_orderQuery.Status = field.NewField(tableName, "status")
_orderQuery.Currency = field.NewString(tableName, "currency")
_orderQuery.AmountOriginal = field.NewInt64(tableName, "amount_original")
_orderQuery.AmountDiscount = field.NewInt64(tableName, "amount_discount")
@@ -56,8 +56,8 @@ type orderQuery struct {
ID field.Int64
TenantID field.Int64
UserID field.Int64
Type field.String
Status field.String
Type field.Field
Status field.Field
Currency field.String
AmountOriginal field.Int64
AmountDiscount field.Int64
@@ -90,8 +90,8 @@ func (o *orderQuery) updateTableName(table string) *orderQuery {
o.ID = field.NewInt64(table, "id")
o.TenantID = field.NewInt64(table, "tenant_id")
o.UserID = field.NewInt64(table, "user_id")
o.Type = field.NewString(table, "type")
o.Status = field.NewString(table, "status")
o.Type = field.NewField(table, "type")
o.Status = field.NewField(table, "status")
o.Currency = field.NewString(table, "currency")
o.AmountOriginal = field.NewInt64(table, "amount_original")
o.AmountDiscount = field.NewInt64(table, "amount_discount")