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

@@ -29,9 +29,9 @@ func newContentPrice(db *gorm.DB, opts ...gen.DOOption) contentPriceQuery {
_contentPriceQuery.TenantID = field.NewInt64(tableName, "tenant_id")
_contentPriceQuery.UserID = field.NewInt64(tableName, "user_id")
_contentPriceQuery.ContentID = field.NewInt64(tableName, "content_id")
_contentPriceQuery.Currency = field.NewString(tableName, "currency")
_contentPriceQuery.Currency = field.NewField(tableName, "currency")
_contentPriceQuery.PriceAmount = field.NewInt64(tableName, "price_amount")
_contentPriceQuery.DiscountType = field.NewString(tableName, "discount_type")
_contentPriceQuery.DiscountType = field.NewField(tableName, "discount_type")
_contentPriceQuery.DiscountValue = field.NewInt64(tableName, "discount_value")
_contentPriceQuery.DiscountStartAt = field.NewTime(tableName, "discount_start_at")
_contentPriceQuery.DiscountEndAt = field.NewTime(tableName, "discount_end_at")
@@ -51,9 +51,9 @@ type contentPriceQuery struct {
TenantID field.Int64
UserID field.Int64
ContentID field.Int64
Currency field.String
Currency field.Field
PriceAmount field.Int64
DiscountType field.String
DiscountType field.Field
DiscountValue field.Int64
DiscountStartAt field.Time
DiscountEndAt field.Time
@@ -79,9 +79,9 @@ func (c *contentPriceQuery) updateTableName(table string) *contentPriceQuery {
c.TenantID = field.NewInt64(table, "tenant_id")
c.UserID = field.NewInt64(table, "user_id")
c.ContentID = field.NewInt64(table, "content_id")
c.Currency = field.NewString(table, "currency")
c.Currency = field.NewField(table, "currency")
c.PriceAmount = field.NewInt64(table, "price_amount")
c.DiscountType = field.NewString(table, "discount_type")
c.DiscountType = field.NewField(table, "discount_type")
c.DiscountValue = field.NewInt64(table, "discount_value")
c.DiscountStartAt = field.NewTime(table, "discount_start_at")
c.DiscountEndAt = field.NewTime(table, "discount_end_at")