feat: sale add create user

This commit is contained in:
zzw
2026-09-02 09:47:34 +08:00
parent ad4bc7de85
commit 540f74f9b7
39 changed files with 2023 additions and 282 deletions
+11
View File
@@ -0,0 +1,11 @@
package dao
type Client struct {
Id int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Code string `gorm:"column:code" json:"code"`
Name string `gorm:"column:name" json:"name"`
AllowedGrants string `gorm:"column:allowed_grants;type:json" json:"allowed_grants"`
SubjectType string `gorm:"column:subject_type" json:"subject_type"`
StoreStaff uint8 `gorm:"column:store_staff" json:"store_staff"`
Status uint8 `gorm:"column:status" json:"status"`
}
+13
View File
@@ -0,0 +1,13 @@
package dao
const (
StatusEnabled uint8 = 1
StatusDisabled uint8 = 2
CredentialTypePassword = "password"
CredentialTypeWecom = "wecom"
CredentialTypeOpenid = "openid"
// ExtraJsonEmpty MySQL JSON 列不能写空串,无扩展字段时用 {}
ExtraJsonEmpty = "{}"
)
+20
View File
@@ -0,0 +1,20 @@
package dao
import "lone-services/pkg/utils"
type Token struct {
Token string `json:"token"`
Refresh string `json:"refresh"`
Info UserLoginSession `json:"info"`
}
type UserLoginSession struct {
Id int64 `json:"id"`
Name string `json:"name"`
Avatar string `json:"avatar"`
Mobile string `json:"mobile"`
Gender uint8 `json:"gender"`
Birthday string `json:"birthday"`
Status uint8 `json:"status"`
LastTime utils.CustomTime `json:"last_time"`
}
+23 -93
View File
@@ -2,107 +2,37 @@ package dao
import "lone-services/pkg/utils"
// UserRow 主用户(表 users
type UserRow struct {
Id int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Mobile string `gorm:"column:mobile" json:"mobile"`
Name string `gorm:"column:name" json:"name"`
Avatar string `gorm:"column:avatar" json:"avatar"`
Gender uint8 `gorm:"column:gender" json:"gender"`
Birthday utils.CustomTime `gorm:"column:birthday;type:date" json:"birthday"`
Status uint8 `gorm:"column:status" json:"status"`
CreatedAt utils.CustomTime `gorm:"column:created_at" json:"created_at"`
UpdatedAt utils.CustomTime `gorm:"column:updated_at" json:"updated_at"`
}
// UserCreate 新建用户
type UserCreate struct {
Id int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Openid string `gorm:"column:openid" json:"openid"`
Username string `gorm:"column:username" json:"username"`
Nickname string `gorm:"column:nickname" json:"nickname"`
Avatar string `gorm:"column:avatar" json:"avatar"`
Mobile string `gorm:"column:mobile" json:"mobile"`
Gender uint8 `gorm:"column:gender" json:"gender"`
Birthday string `gorm:"column:birthday" json:"birthday"`
AppId uint32 `gorm:"column:app_id" json:"app_id"`
Status uint8 `gorm:"column:status" json:"status"`
IsRegistered uint8 `gorm:"column:is_registered" json:"is_registered"`
IsFaceVerified uint8 `gorm:"column:is_face_verified" json:"is_face_verified"`
IsProfileCompleted uint8 `gorm:"column:is_profile_completed" json:"is_profile_completed"`
OnTrialNum int `gorm:"column:on_trial_num" json:"on_trial_num"`
}
type UserCreateByPwd struct {
Id int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Type uint8 `gorm:"column:type" json:"type"`
Account string `gorm:"column:account" json:"account"`
Password string `gorm:"column:password" json:"password"`
Salt string `gorm:"column:salt" json:"salt"`
Mobile string `gorm:"column:mobile" json:"mobile"`
AppId uint32 `gorm:"column:app_id" json:"app_id"`
Status uint8 `gorm:"column:status" json:"status"`
IsRegistered uint8 `gorm:"column:is_registered" json:"is_registered"`
IsFaceVerified uint8 `gorm:"column:is_face_verified" json:"is_face_verified"`
IsProfileCompleted uint8 `gorm:"column:is_profile_completed" json:"is_profile_completed"`
OnTrialNum int `gorm:"column:on_trial_num" json:"on_trial_num"`
}
type UserExist struct {
Id int64 `gorm:"column:id" json:"id"`
}
type UserInfo struct {
Id int64 `gorm:"column:id" json:"id"`
Openid string `gorm:"column:openid" json:"openid"`
Username string `gorm:"column:username" json:"username"`
Nickname string `gorm:"column:nickname" json:"nickname"`
Avatar string `gorm:"column:avatar" json:"avatar"`
Mobile string `gorm:"column:mobile" json:"mobile"`
Gender uint8 `gorm:"column:gender" json:"gender"`
Birthday string `gorm:"column:birthday" json:"birthday"`
Type uint8 `gorm:"column:type" json:"type"`
Account string `gorm:"column:account" json:"account"`
AppId uint32 `gorm:"column:app_id" json:"app_id"`
Status uint8 `gorm:"column:status" json:"status"`
}
type UserLoginRow struct {
UserInfo
Salt string `gorm:"column:salt" json:"-"`
Password string `gorm:"column:password" json:"-"`
}
type Token struct {
Token string `json:"token"`
Refresh string `json:"refresh"`
Info UserLoginSession `json:"info"`
}
type UserLoginSession struct {
Id int64 `json:"id"`
Openid string `json:"openid"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Mobile string `json:"mobile"`
Gender uint8 `json:"gender"`
Birthday string `json:"birthday"`
Type uint8 `json:"type"`
Account string `json:"account"`
AppId uint32 `json:"app_id"`
LastTime utils.CustomTime `json:"last_time"`
}
type UserListRow struct {
Id int64 `gorm:"column:id" json:"id"`
Username string `gorm:"column:username" json:"username"`
Nickname string `gorm:"column:nickname" json:"nickname"`
Avatar string `gorm:"column:avatar" json:"avatar"`
Mobile string `gorm:"column:mobile" json:"mobile"`
OnTrialNum int `gorm:"column:on_trial_num" json:"on_trial_num"`
Gender int `gorm:"column:gender" json:"gender"`
Birthday string `gorm:"column:birthday" json:"birthday"`
Status uint8 `gorm:"column:status" json:"status"`
CreatedAt utils.CustomTime `gorm:"column:created_at" json:"created_at"`
UpdatedAt utils.CustomTime `gorm:"column:updated_at" json:"updated_at"`
Id int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Mobile string `gorm:"column:mobile" json:"mobile"`
Name string `gorm:"column:name" json:"name"`
Avatar string `gorm:"column:avatar" json:"avatar"`
Gender uint8 `gorm:"column:gender" json:"gender"`
Birthday utils.CustomTime `gorm:"column:birthday;type:date" json:"birthday"`
Status uint8 `gorm:"column:status" json:"status"`
}
type UserListItem struct {
Id int64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Name string `json:"name"`
HeadPortrait string `json:"head_portrait"`
Mobile string `json:"mobile"`
OriginMobile string `json:"origin_mobile"`
OnTrialNum int `json:"on_trial_num"`
Gender int `json:"gender"`
Gender uint8 `json:"gender"`
Birthday string `json:"birthday"`
Status uint8 `json:"status"`
CreatedAt utils.CustomTime `json:"created_at"`
+11
View File
@@ -0,0 +1,11 @@
package dao
import "lone-services/pkg/utils"
type UserClient struct {
Id int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId int64 `gorm:"column:user_id" json:"user_id"`
ClientCode string `gorm:"column:client_code" json:"client_code"`
Status uint8 `gorm:"column:status" json:"status"`
OpenedAt utils.CustomTime `gorm:"column:opened_at" json:"opened_at"`
}
@@ -0,0 +1,11 @@
package dao
type UserCredential struct {
Id int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId int64 `gorm:"column:user_id" json:"user_id"`
CredentialType string `gorm:"column:credential_type" json:"credential_type"`
Identifier string `gorm:"column:identifier" json:"identifier"`
Secret string `gorm:"column:secret" json:"secret"`
ExtraJson string `gorm:"column:extra_json;type:json" json:"extra_json"`
Status uint8 `gorm:"column:status" json:"status"`
}