feat: client 增删改查

This commit is contained in:
Blizzard
2025-05-08 23:03:00 +08:00
parent 75e9157e5e
commit ab51ba91bc
41 changed files with 1093 additions and 57 deletions
+15
View File
@@ -0,0 +1,15 @@
package request
import "github.com/mojocn/base64Captcha"
// configJsonBody json request body.
type CaptchaReqBody struct {
Id string
CaptchaType string
VerifyValue string
DriverAudio *base64Captcha.DriverAudio
DriverString *base64Captcha.DriverString
DriverChinese *base64Captcha.DriverChinese
DriverMath *base64Captcha.DriverMath
DriverDigit *base64Captcha.DriverDigit
}
+9
View File
@@ -0,0 +1,9 @@
package request
import common "sundynix-go/model/commom/request"
type GetClientList struct {
common.PageInfo
ClientId string `json:"clientId" form:"clientId"`
Name string `json:"name" form:"name"`
}
+16
View File
@@ -0,0 +1,16 @@
package request
import common "sundynix-go/model/commom/request"
type Login struct {
Account string `json:"account"`
Password string `json:"password"`
Captcha string `json:"captcha"`
CaptchaId string `json:"captchaId"`
}
type GetUserList struct {
common.PageInfo
Account string `json:"account" form:"account"`
Phone string `json:"phone" form:"phone"`
}
+6
View File
@@ -0,0 +1,6 @@
package response
type CaptchaRes struct {
CaptchaId string `json:"captchaId"`
Captcha string `json:"captcha"`
}
+13
View File
@@ -0,0 +1,13 @@
package response
import "sundynix-go/model/system"
type SysUserResponse struct {
User system.User `json:"user"`
}
type LoginResponse struct {
User system.User `json:"user"`
Token string `json:"token"`
ExpiresAt int64 `json:"expiresAt"`
}
+12
View File
@@ -0,0 +1,12 @@
package system
import "sundynix-go/global"
type Client struct {
global.BaseModel
ClientId string `gorm:"size:20;" json:"clientId"`
Name string `gorm:"size:50;" json:"name"`
GrantType string `gorm:"size:50;" json:"grantType"`
AdditionalInfo string `gorm:"type:text" json:"additionalInfo"`
ActiveTimeout uint `json:"activeTimeout"`
}
+21
View File
@@ -0,0 +1,21 @@
package system
import (
"sundynix-go/global"
"time"
)
type SysOperationRecord struct {
global.BaseModel
Ip string `json:"ip" form:"ip" gorm:"column:ip;comment:请求ip"` // 请求ip
Method string `json:"method" form:"method" gorm:"column:method;comment:请求方法"` // 请求方法
Path string `json:"path" form:"path" gorm:"column:path;comment:请求路径"` // 请求路径
Status int `json:"status" form:"status" gorm:"column:status;comment:请求状态"` // 请求状态
Latency time.Duration `json:"latency" form:"latency" gorm:"column:latency;comment:延迟" swaggertype:"string"` // 延迟
Agent string `json:"agent" form:"agent" gorm:"type:text;column:agent;comment:代理"` // 代理
ErrorMessage string `json:"error_message" form:"error_message" gorm:"column:error_message;comment:错误信息"` // 错误信息
Body string `json:"body" form:"body" gorm:"type:text;column:body;comment:请求Body"` // 请求Body
Resp string `json:"resp" form:"resp" gorm:"type:text;column:resp;comment:响应Body"` // 响应Body
UserID int `json:"user_id" form:"user_id" gorm:"column:user_id;comment:用户id"` // 用户id
User User `json:"user"`
}
+19 -1
View File
@@ -1,7 +1,14 @@
package system
import "sundynix-go/global"
import (
"sundynix-go/global"
)
type Login interface {
GetAccount() string
GetUserId() uint
GetUserInfo() any
}
type User struct {
global.BaseModel
ClientId string `gorm:"size:20;" json:"clientId"`
@@ -9,3 +16,14 @@ type User struct {
Password string `gorm:"size:100;" json:"-" form:"password"`
Phone string `gorm:"size:11;" json:"phone" form:"phone"`
}
func (u *User) GetAccount() string {
return u.Account
}
func (u *User) GetUserId() uint {
return u.Id
}
func (u *User) GetUserInfo() any {
return *u
}