first commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
)
|
||||
|
||||
type Oss struct {
|
||||
global.BaseModel
|
||||
Name string `json:"name" form:"name" gorm:"column:name;comment:文件名"`
|
||||
Url string `json:"url" form:"url" gorm:"column:url;comment:文件地址"`
|
||||
Tag string `json:"tag" form:"tag" gorm:"column:tag;comment:文件标签"`
|
||||
Key string `json:"key" form:"key" gorm:"column:key;comment:文件key"`
|
||||
Suffix string `json:"suffix" form:"suffix" gorm:"column:suffix;comment:文件后缀"`
|
||||
MD5 string `json:"md5" form:"md5" gorm:"column:md5;comment:文件md5"`
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type CustomClaims struct {
|
||||
BaseClaims
|
||||
BufferTime int64
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
type BaseClaims struct {
|
||||
UUID uuid.UUID
|
||||
ID string
|
||||
Account string
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package request
|
||||
|
||||
import common "sundynix-go/model/commom/request"
|
||||
|
||||
type GetOssFileList struct {
|
||||
common.PageInfo
|
||||
Name string `json:"name" form:"name"`
|
||||
}
|
||||
@@ -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"`
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package request
|
||||
|
||||
type GetMenuTree struct {
|
||||
Category int `json:"category" form:"category"`
|
||||
ParentId string `json:"parentId" form:"parentId"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package request
|
||||
|
||||
import (
|
||||
common "sundynix-go/model/commom/request"
|
||||
)
|
||||
|
||||
type GetOperationRecordList struct {
|
||||
common.PageInfo
|
||||
Ip string `json:"ip" form:"ip"`
|
||||
Method string `json:"method" form:"method"`
|
||||
Path string `json:"path" form:"path"`
|
||||
UserId string `json:"userId" form:"userId"`
|
||||
Status int `json:"status" form:"status"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package request
|
||||
|
||||
import common "sundynix-go/model/commom/request"
|
||||
|
||||
type GetRoleList struct {
|
||||
common.PageInfo
|
||||
Code string `json:"code" form:"code"`
|
||||
Name string `json:"name" form:"name"`
|
||||
}
|
||||
|
||||
type GrantMenu struct {
|
||||
RoleId string `json:"roleId"`
|
||||
MenuIds []string `json:"menuIds"`
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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"`
|
||||
}
|
||||
|
||||
type ChangePwd struct {
|
||||
Id string `json:"id"`
|
||||
NewPwd string `json:"newPwd"`
|
||||
}
|
||||
|
||||
type GrantRole struct {
|
||||
UserId string `json:"userId"`
|
||||
RoleIds []string `json:"roleIds"`
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package response
|
||||
|
||||
type WxCode2SessionResp struct {
|
||||
SessionKey string `json:"session_key"`
|
||||
Unionid string `json:"unionid"`
|
||||
Openid string `json:"openid"`
|
||||
Errcode int32 `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package response
|
||||
|
||||
import "sundynix-go/model/system"
|
||||
|
||||
type UploadFileResponse struct {
|
||||
File system.Oss `json:"file"`
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package response
|
||||
|
||||
type CaptchaRes struct {
|
||||
CaptchaId string `json:"captchaId"`
|
||||
Captcha string `json:"captcha"`
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package response
|
||||
|
||||
import "sundynix-go/model/system"
|
||||
|
||||
type LoginResponse struct {
|
||||
User system.User `json:"user"`
|
||||
Token string `json:"token"`
|
||||
ExpiresAt int64 `json:"expiresAt"`
|
||||
}
|
||||
@@ -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 int64 `json:"activeTimeout"`
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package system
|
||||
|
||||
import "sundynix-go/global"
|
||||
|
||||
type Menu struct {
|
||||
global.BaseModel
|
||||
ParentId string `gorm:"size:100;default:'0'" json:"parentId" form:"parentId"`
|
||||
Category int `json:"category" form:"category"`
|
||||
Name string `gorm:"size:20" json:"name" form:"name"`
|
||||
Title string `gorm:"size:20" json:"title" form:"title"`
|
||||
Code string `gorm:"size:50" json:"code" form:"code"`
|
||||
Path string `gorm:"size:100" json:"path" form:"path"`
|
||||
Permission string `gorm:"size:20" json:"permission" form:"permission"`
|
||||
Locale string `gorm:"size:50" json:"locale" form:"locale"`
|
||||
Icon string `gorm:"size:20" json:"icon" form:"icon"`
|
||||
Sort int `json:"sort" form:"sort"`
|
||||
Children []*Menu `json:"children" gorm:"-"`
|
||||
}
|
||||
@@ -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:"erroMessage" 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 string `json:"userId" form:"user_id" gorm:"column:user_id;comment:用户id"` // 用户id
|
||||
User User `json:"user"`
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package system
|
||||
|
||||
import "sundynix-go/global"
|
||||
|
||||
type Role struct {
|
||||
global.BaseModel
|
||||
Name string `gorm:"size:20" json:"name" form:"name"`
|
||||
Code string `gorm:"size:20" json:"code" form:"code"`
|
||||
Sort int `json:"sort" form:"sort"`
|
||||
Menus []*Menu `gorm:"many2many:role_menu;"`
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package system
|
||||
|
||||
type RoleMenu struct {
|
||||
RoleId string `json:"roleId" gorm:"size:100;column:role_id;comment:角色id"`
|
||||
MenuId string `json:"menuId" gorm:"size:100;column:menu_id;comment:菜单id"`
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
)
|
||||
|
||||
type Login interface {
|
||||
GetAccount() string
|
||||
GetUserId() string
|
||||
GetUserInfo() any
|
||||
}
|
||||
type User struct {
|
||||
global.BaseModel
|
||||
TenantId string `gorm:"size:20;" json:"tenantId" form:"tenantId"`
|
||||
ClientId string `gorm:"size:20;" json:"clientId"`
|
||||
Name string `gorm:"size:20" json:"name" form:"name"`
|
||||
Account string `gorm:"size:11;" json:"account" form:"account"`
|
||||
Password string `gorm:"size:100;" json:"-" form:"password"`
|
||||
NickName string `gorm:"size:20;column:nick_name" json:"nickName" form:"nickName"`
|
||||
Phone string `gorm:"size:20;column:phone" json:"phone" form:"phone"`
|
||||
SessionKey string `gorm:"size:80;column:session_key" json:"sessionKey" form:"sessionKey"`
|
||||
UnionId string `gorm:"size:80;column:union_id" json:"unionId"`
|
||||
MiniOpenId string `gorm:"size:80;column:mini_open_id" json:"miniOpenId" form:"miniOpenId"`
|
||||
SaOpenId string `gorm:"size:80;column:sa_open_id" json:"saOpenId"`
|
||||
AvatarId string `gorm:"size:50;column:avatar_id" json:"avatarId"`
|
||||
Avatar *Oss `gorm:"foreignKey:AvatarId" json:"avatar"`
|
||||
}
|
||||
|
||||
func (u *User) GetAccount() string {
|
||||
return u.Account
|
||||
}
|
||||
func (u *User) GetUserId() string {
|
||||
return u.Id
|
||||
}
|
||||
|
||||
func (u *User) GetUserInfo() any {
|
||||
return *u
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package system
|
||||
|
||||
type UserRole struct {
|
||||
UserId string `json:"userId" gorm:"size:100;column:user_id;comment:用户id"`
|
||||
RoleId string `json:"roleId" gorm:"size:100;column:role_id;comment:角色id"`
|
||||
}
|
||||
Reference in New Issue
Block a user