重命名包为 core
This commit is contained in:
10
README.md
10
README.md
@@ -1,11 +1,13 @@
|
||||
## todo
|
||||
|
||||
- 微信支付
|
||||
- 移动端适配
|
||||
- channel 接口
|
||||
- 规范化日志
|
||||
- 接口日志采集
|
||||
- channel 接口
|
||||
- 重新梳理逻辑流程,简化循环
|
||||
- 端口分配时加锁
|
||||
- 中间件 Limiter
|
||||
- 每个用户-节点为一条数据,联查白名单
|
||||
- 长效业务接入
|
||||
- 微信支付
|
||||
- 页面 账户总览
|
||||
- 页面 提取记录
|
||||
- 页面 使用记录
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"platform/pkg/env"
|
||||
"platform/pkg/logs"
|
||||
"platform/pkg/orm"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
"time"
|
||||
@@ -36,7 +36,7 @@ func main() {
|
||||
Pss: &m.ResourcePss{
|
||||
Live: 180,
|
||||
Type: 1,
|
||||
Expire: common.LocalDateTime(time.Now().Add(24 * time.Hour * 1000)),
|
||||
Expire: core.LocalDateTime(time.Now().Add(24 * time.Hour * 1000)),
|
||||
DailyLimit: math.MaxInt32,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -34,7 +34,7 @@ func main() {
|
||||
common := []gen.ModelOpt{
|
||||
gen.FieldModify(func(field gen.Field) gen.Field {
|
||||
if field.Type == "time.Time" {
|
||||
field.Type = "common.LocalDateTime"
|
||||
field.Type = "core.LocalDateTime"
|
||||
}
|
||||
return field
|
||||
}),
|
||||
|
||||
7
go.mod
7
go.mod
@@ -7,6 +7,9 @@ require (
|
||||
github.com/alibabacloud-go/dysmsapi-20170525/v4 v4.1.3
|
||||
github.com/alicebob/miniredis/v2 v2.34.0
|
||||
github.com/glebarez/sqlite v1.11.0
|
||||
github.com/go-playground/locales v0.14.1
|
||||
github.com/go-playground/universal-translator v0.18.1
|
||||
github.com/go-playground/validator/v10 v10.26.0
|
||||
github.com/gofiber/fiber/v2 v2.52.6
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/jdcloud-api/jdcloud-sdk-go v1.64.0
|
||||
@@ -41,9 +44,6 @@ require (
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
|
||||
github.com/glebarez/go-sqlite v1.21.2 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.26.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.9.1 // indirect
|
||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
@@ -66,7 +66,6 @@ require (
|
||||
github.com/smartwalle/ncrypto v1.0.4 // indirect
|
||||
github.com/smartwalle/ngx v1.0.9 // indirect
|
||||
github.com/smartwalle/nsign v1.0.9 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/tjfoc/gmsm v1.4.1 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/yuin/gopher-lua v1.1.1 // indirect
|
||||
|
||||
5
go.sum
5
go.sum
@@ -87,6 +87,8 @@ github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9g
|
||||
github.com/glebarez/go-sqlite v1.21.2/go.mod h1:sfxdZyhQjTM2Wry3gVYWaW072Ri1WMdWJi0k6+3382k=
|
||||
github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw=
|
||||
github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
@@ -210,8 +212,7 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
|
||||
github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho=
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package common
|
||||
package core
|
||||
|
||||
type AuthUnAuthorizedErr string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package common
|
||||
package core
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
@@ -3,7 +3,7 @@ package web
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
"reflect"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
@@ -15,7 +15,7 @@ func ErrorHandler(c *fiber.Ctx, err error) error {
|
||||
var message string
|
||||
|
||||
var fiberErr *fiber.Error
|
||||
var serviceErr *common.ServiceErr
|
||||
var serviceErr *core.ServiceErr
|
||||
if errors.As(err, &fiberErr) {
|
||||
code = fiberErr.Code
|
||||
message = fiberErr.Message
|
||||
|
||||
@@ -3,7 +3,7 @@ package handlers
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"platform/web/auth"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
q "platform/web/queries"
|
||||
"platform/web/services"
|
||||
)
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
// region ListAnnouncements
|
||||
|
||||
type ListAnnouncementsRequest struct {
|
||||
common.PageReq
|
||||
core.PageReq
|
||||
}
|
||||
|
||||
func ListAnnouncements(c *fiber.Ctx) error {
|
||||
@@ -53,7 +53,7 @@ func ListAnnouncements(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
// 返回结果
|
||||
return c.JSON(common.PageResp{
|
||||
return c.JSON(core.PageResp{
|
||||
Total: int(total),
|
||||
List: list,
|
||||
Page: req.GetPage(),
|
||||
|
||||
@@ -2,7 +2,7 @@ package handlers
|
||||
|
||||
import (
|
||||
"platform/web/auth"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
q "platform/web/queries"
|
||||
"platform/web/services"
|
||||
"time"
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
// region ListBill
|
||||
|
||||
type ListBillReq struct {
|
||||
common.PageReq
|
||||
core.PageReq
|
||||
BillNo *string `json:"bill_no"`
|
||||
Type *int `json:"type"`
|
||||
CreateAfter *time.Time `json:"create_after"`
|
||||
@@ -42,10 +42,10 @@ func ListBill(c *fiber.Ctx) error {
|
||||
do.Where(q.Bill.Type.Eq(int32(*req.Type)))
|
||||
}
|
||||
if req.CreateAfter != nil {
|
||||
do.Where(q.Bill.CreatedAt.Gte(common.LocalDateTime(*req.CreateAfter)))
|
||||
do.Where(q.Bill.CreatedAt.Gte(core.LocalDateTime(*req.CreateAfter)))
|
||||
}
|
||||
if req.CreateBefore != nil {
|
||||
do.Where(q.Bill.CreatedAt.Lte(common.LocalDateTime(*req.CreateBefore)))
|
||||
do.Where(q.Bill.CreatedAt.Lte(core.LocalDateTime(*req.CreateBefore)))
|
||||
}
|
||||
if req.BillNo != nil && *req.BillNo != "" {
|
||||
do.Where(q.Bill.BillNo.Eq(*req.BillNo))
|
||||
@@ -72,7 +72,7 @@ func ListBill(c *fiber.Ctx) error {
|
||||
}
|
||||
}
|
||||
|
||||
return c.JSON(common.PageResp{
|
||||
return c.JSON(core.PageResp{
|
||||
Total: int(total),
|
||||
Page: req.GetPage(),
|
||||
Size: req.GetSize(),
|
||||
|
||||
@@ -3,7 +3,7 @@ package handlers
|
||||
import (
|
||||
"fmt"
|
||||
"platform/web/auth"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
q "platform/web/queries"
|
||||
s "platform/web/services"
|
||||
"time"
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
// region ListChannels
|
||||
|
||||
type ListChannelsReq struct {
|
||||
common.PageReq
|
||||
core.PageReq
|
||||
AuthType s.ChannelAuthType `json:"auth_type"`
|
||||
ExpireAfter *time.Time `json:"expire_after"`
|
||||
ExpireBefore *time.Time `json:"expire_before"`
|
||||
@@ -46,10 +46,10 @@ func ListChannels(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
if req.ExpireAfter != nil {
|
||||
cond.Where(q.Channel.Expiration.Gte(common.LocalDateTime(*req.ExpireAfter)))
|
||||
cond.Where(q.Channel.Expiration.Gte(core.LocalDateTime(*req.ExpireAfter)))
|
||||
}
|
||||
if req.ExpireBefore != nil {
|
||||
cond.Where(q.Channel.Expiration.Lte(common.LocalDateTime(*req.ExpireBefore)))
|
||||
cond.Where(q.Channel.Expiration.Lte(core.LocalDateTime(*req.ExpireBefore)))
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
@@ -75,7 +75,7 @@ func ListChannels(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
// 返回结果
|
||||
return c.JSON(common.PageResp{
|
||||
return c.JSON(core.PageResp{
|
||||
Total: int(total),
|
||||
Page: req.GetPage(),
|
||||
Size: req.GetSize(),
|
||||
|
||||
@@ -3,7 +3,7 @@ package handlers
|
||||
import (
|
||||
"platform/pkg/u"
|
||||
"platform/web/auth"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
q "platform/web/queries"
|
||||
s "platform/web/services"
|
||||
"time"
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
// region ListResourcePss
|
||||
|
||||
type ListResourcePssReq struct {
|
||||
common.PageReq
|
||||
core.PageReq
|
||||
ResourceNo *string `json:"resource_no"`
|
||||
Active *bool `json:"active"`
|
||||
Type *int `json:"type"`
|
||||
@@ -51,16 +51,16 @@ func ListResourcePss(c *fiber.Ctx) error {
|
||||
do.Where(q.ResourcePss.As(q.Resource.Pss.Name()).Type.Eq(int32(*req.Type)))
|
||||
}
|
||||
if req.CreateAfter != nil {
|
||||
do.Where(q.Resource.CreatedAt.Gte(common.LocalDateTime(*req.CreateAfter)))
|
||||
do.Where(q.Resource.CreatedAt.Gte(core.LocalDateTime(*req.CreateAfter)))
|
||||
}
|
||||
if req.CreateBefore != nil {
|
||||
do.Where(q.Resource.CreatedAt.Lte(common.LocalDateTime(*req.CreateBefore)))
|
||||
do.Where(q.Resource.CreatedAt.Lte(core.LocalDateTime(*req.CreateBefore)))
|
||||
}
|
||||
if req.ExpireAfter != nil {
|
||||
do.Where(q.ResourcePss.As(q.Resource.Pss.Name()).Expire.Gte(common.LocalDateTime(*req.ExpireAfter)))
|
||||
do.Where(q.ResourcePss.As(q.Resource.Pss.Name()).Expire.Gte(core.LocalDateTime(*req.ExpireAfter)))
|
||||
}
|
||||
if req.ExpireBefore != nil {
|
||||
do.Where(q.ResourcePss.As(q.Resource.Pss.Name()).Expire.Lte(common.LocalDateTime(*req.ExpireBefore)))
|
||||
do.Where(q.ResourcePss.As(q.Resource.Pss.Name()).Expire.Lte(core.LocalDateTime(*req.ExpireBefore)))
|
||||
}
|
||||
|
||||
resource, err := q.Resource.Where(do).
|
||||
@@ -85,7 +85,7 @@ func ListResourcePss(c *fiber.Ctx) error {
|
||||
}
|
||||
}
|
||||
|
||||
return c.JSON(common.PageResp{
|
||||
return c.JSON(core.PageResp{
|
||||
Total: int(total),
|
||||
Page: req.GetPage(),
|
||||
Size: req.GetSize(),
|
||||
@@ -116,13 +116,13 @@ func AllResource(c *fiber.Ctx) error {
|
||||
q.Resource.Active.Is(true),
|
||||
q.Resource.Where(
|
||||
pss.Type.Eq(1),
|
||||
pss.Expire.Gte(common.LocalDateTime(time.Now())),
|
||||
pss.Expire.Gte(core.LocalDateTime(time.Now())),
|
||||
).Or(
|
||||
pss.Type.Eq(2),
|
||||
pss.Quota.GtCol(pss.Used),
|
||||
),
|
||||
q.Resource.Where(
|
||||
pss.DailyLast.Lt(common.LocalDateTime(u.Today())),
|
||||
pss.DailyLast.Lt(core.LocalDateTime(u.Today())),
|
||||
).Or(
|
||||
pss.DailyUsed.LtCol(pss.DailyLimit),
|
||||
),
|
||||
|
||||
@@ -2,7 +2,7 @@ package handlers
|
||||
|
||||
import (
|
||||
"platform/web/auth"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
s "platform/web/services"
|
||||
@@ -114,7 +114,7 @@ func UpdatePassword(c *fiber.Ctx) error {
|
||||
|
||||
// 验证手机令牌
|
||||
if req.Phone == "" || req.Code == "" {
|
||||
return common.NewErr("user", "手机号码和验证码不能为空")
|
||||
return core.NewErr("user", "手机号码和验证码不能为空")
|
||||
}
|
||||
err = s.Verifier.VerifySms(c.Context(), req.Phone, req.Code)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,7 +3,7 @@ package handlers
|
||||
import (
|
||||
"net"
|
||||
"platform/web/auth"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
g "platform/web/globals"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
type ListWhitelistReq struct {
|
||||
common.PageReq
|
||||
core.PageReq
|
||||
}
|
||||
|
||||
type ListWhitelistResp struct {
|
||||
@@ -62,7 +62,7 @@ func ListWhitelist(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
// 返回结果
|
||||
return c.JSON(common.PageResp{
|
||||
return c.JSON(core.PageResp{
|
||||
Total: int(total),
|
||||
List: list,
|
||||
Page: req.GetPage(),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,20 +14,20 @@ const TableNameAdmin = "admin"
|
||||
|
||||
// Admin mapped from table <admin>
|
||||
type Admin struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:管理员ID" json:"id"` // 管理员ID
|
||||
Username string `gorm:"column:username;not null;comment:用户名" json:"username"` // 用户名
|
||||
Password string `gorm:"column:password;not null;comment:密码" json:"password"` // 密码
|
||||
Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名
|
||||
Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL
|
||||
Phone string `gorm:"column:phone;comment:手机号码" json:"phone"` // 手机号码
|
||||
Email string `gorm:"column:email;comment:邮箱" json:"email"` // 邮箱
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用
|
||||
LastLogin common.LocalDateTime `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
|
||||
LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址
|
||||
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:管理员ID" json:"id"` // 管理员ID
|
||||
Username string `gorm:"column:username;not null;comment:用户名" json:"username"` // 用户名
|
||||
Password string `gorm:"column:password;not null;comment:密码" json:"password"` // 密码
|
||||
Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名
|
||||
Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL
|
||||
Phone string `gorm:"column:phone;comment:手机号码" json:"phone"` // 手机号码
|
||||
Email string `gorm:"column:email;comment:邮箱" json:"email"` // 邮箱
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用
|
||||
LastLogin core.LocalDateTime `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
|
||||
LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址
|
||||
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Admin's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,14 +14,14 @@ const TableNameAdminRole = "admin_role"
|
||||
|
||||
// AdminRole mapped from table <admin_role>
|
||||
type AdminRole struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:管理员角色ID" json:"id"` // 管理员角色ID
|
||||
Name string `gorm:"column:name;not null;comment:角色名称" json:"name"` // 角色名称
|
||||
Description string `gorm:"column:description;comment:角色描述" json:"description"` // 角色描述
|
||||
Active bool `gorm:"column:active;default:true;comment:是否激活" json:"active"` // 是否激活
|
||||
Sort int32 `gorm:"column:sort;comment:排序" json:"sort"` // 排序
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:管理员角色ID" json:"id"` // 管理员角色ID
|
||||
Name string `gorm:"column:name;not null;comment:角色名称" json:"name"` // 角色名称
|
||||
Description string `gorm:"column:description;comment:角色描述" json:"description"` // 角色描述
|
||||
Active bool `gorm:"column:active;default:true;comment:是否激活" json:"active"` // 是否激活
|
||||
Sort int32 `gorm:"column:sort;comment:排序" json:"sort"` // 排序
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName AdminRole's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,12 +14,12 @@ const TableNameAdminRoleLink = "admin_role_link"
|
||||
|
||||
// AdminRoleLink mapped from table <admin_role_link>
|
||||
type AdminRoleLink struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
AdminID int32 `gorm:"column:admin_id;not null;comment:管理员ID" json:"admin_id"` // 管理员ID
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
AdminID int32 `gorm:"column:admin_id;not null;comment:管理员ID" json:"admin_id"` // 管理员ID
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName AdminRoleLink's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,12 +14,12 @@ const TableNameAdminRolePermissionLink = "admin_role_permission_link"
|
||||
|
||||
// AdminRolePermissionLink mapped from table <admin_role_permission_link>
|
||||
type AdminRolePermissionLink struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName AdminRolePermissionLink's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,16 +14,16 @@ const TableNameAnnouncement = "announcement"
|
||||
|
||||
// Announcement mapped from table <announcement>
|
||||
type Announcement struct {
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Type int32 `gorm:"column:type;not null;default:1" json:"type"`
|
||||
Status int32 `gorm:"column:status;not null;default:1" json:"status"`
|
||||
Sort int32 `gorm:"column:sort;not null" json:"sort"`
|
||||
Pin bool `gorm:"column:pin;not null" json:"pin"`
|
||||
Title string `gorm:"column:title;not null" json:"title"`
|
||||
Content string `gorm:"column:content;not null" json:"content"`
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Type int32 `gorm:"column:type;not null;default:1" json:"type"`
|
||||
Status int32 `gorm:"column:status;not null;default:1" json:"status"`
|
||||
Sort int32 `gorm:"column:sort;not null" json:"sort"`
|
||||
Pin bool `gorm:"column:pin;not null" json:"pin"`
|
||||
Title string `gorm:"column:title;not null" json:"title"`
|
||||
Content string `gorm:"column:content" json:"content"`
|
||||
}
|
||||
|
||||
// TableName Announcement's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,21 +14,21 @@ const TableNameBill = "bill"
|
||||
|
||||
// Bill mapped from table <bill>
|
||||
type Bill struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:账单ID" json:"id"` // 账单ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Info string `gorm:"column:info;comment:产品可读信息" json:"info"` // 产品可读信息
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
TradeID int32 `gorm:"column:trade_id;comment:订单ID" json:"trade_id"` // 订单ID
|
||||
ResourceID int32 `gorm:"column:resource_id;comment:套餐ID" json:"resource_id"` // 套餐ID
|
||||
Type int32 `gorm:"column:type;not null;comment:账单类型:0-充值,1-消费,2-退款" json:"type"` // 账单类型:0-充值,1-消费,2-退款
|
||||
BillNo string `gorm:"column:bill_no;not null;comment:易读账单号" json:"bill_no"` // 易读账单号
|
||||
RefundID int32 `gorm:"column:refund_id;comment:退款ID" json:"refund_id"` // 退款ID
|
||||
Amount float64 `gorm:"column:amount;not null;comment:账单金额" json:"amount"` // 账单金额
|
||||
Trade *Trade `gorm:"foreignKey:TradeID" json:"trade"`
|
||||
Refund *Refund `gorm:"foreignKey:RefundID" json:"refund"`
|
||||
Resource *Resource `gorm:"foreignKey:ResourceID" json:"resource"`
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:账单ID" json:"id"` // 账单ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Info string `gorm:"column:info;comment:产品可读信息" json:"info"` // 产品可读信息
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
TradeID int32 `gorm:"column:trade_id;comment:订单ID" json:"trade_id"` // 订单ID
|
||||
ResourceID int32 `gorm:"column:resource_id;comment:套餐ID" json:"resource_id"` // 套餐ID
|
||||
Type int32 `gorm:"column:type;not null;comment:账单类型:0-充值,1-消费,2-退款" json:"type"` // 账单类型:0-充值,1-消费,2-退款
|
||||
BillNo string `gorm:"column:bill_no;not null;comment:易读账单号" json:"bill_no"` // 易读账单号
|
||||
RefundID int32 `gorm:"column:refund_id;comment:退款ID" json:"refund_id"` // 退款ID
|
||||
Amount float64 `gorm:"column:amount;not null;comment:账单金额" json:"amount"` // 账单金额
|
||||
Trade *Trade `gorm:"foreignKey:TradeID" json:"trade"`
|
||||
Refund *Refund `gorm:"foreignKey:RefundID" json:"refund"`
|
||||
Resource *Resource `gorm:"foreignKey:ResourceID" json:"resource"`
|
||||
}
|
||||
|
||||
// TableName Bill's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,23 +14,23 @@ const TableNameChannel = "channel"
|
||||
|
||||
// Channel mapped from table <channel>
|
||||
type Channel struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:通道ID" json:"id"` // 通道ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
ProxyID int32 `gorm:"column:proxy_id;not null;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||
NodeID int32 `gorm:"column:node_id;comment:节点ID" json:"node_id"` // 节点ID
|
||||
ProxyPort int32 `gorm:"column:proxy_port;not null;comment:转发端口" json:"proxy_port"` // 转发端口
|
||||
UserHost string `gorm:"column:user_host;comment:用户地址" json:"user_host"` // 用户地址
|
||||
NodeHost string `gorm:"column:node_host;comment:节点地址" json:"node_host"` // 节点地址
|
||||
AuthIP bool `gorm:"column:auth_ip;not null;comment:IP认证" json:"auth_ip"` // IP认证
|
||||
AuthPass bool `gorm:"column:auth_pass;not null;comment:密码认证" json:"auth_pass"` // 密码认证
|
||||
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
|
||||
Password string `gorm:"column:password;comment:密码" json:"password"` // 密码
|
||||
Expiration common.LocalDateTime `gorm:"column:expiration;not null;comment:过期时间" json:"expiration"` // 过期时间
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ProxyHost string `gorm:"column:proxy_host;not null" json:"proxy_host"`
|
||||
Protocol int32 `gorm:"column:protocol;comment:协议类型:1-http,2-https,3-socks5" json:"protocol"` // 协议类型:1-http,2-https,3-socks5
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:通道ID" json:"id"` // 通道ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
ProxyID int32 `gorm:"column:proxy_id;not null;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||
NodeID int32 `gorm:"column:node_id;comment:节点ID" json:"node_id"` // 节点ID
|
||||
ProxyPort int32 `gorm:"column:proxy_port;not null;comment:转发端口" json:"proxy_port"` // 转发端口
|
||||
UserHost string `gorm:"column:user_host;comment:用户地址" json:"user_host"` // 用户地址
|
||||
NodeHost string `gorm:"column:node_host;comment:节点地址" json:"node_host"` // 节点地址
|
||||
AuthIP bool `gorm:"column:auth_ip;not null;comment:IP认证" json:"auth_ip"` // IP认证
|
||||
AuthPass bool `gorm:"column:auth_pass;not null;comment:密码认证" json:"auth_pass"` // 密码认证
|
||||
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
|
||||
Password string `gorm:"column:password;comment:密码" json:"password"` // 密码
|
||||
Expiration core.LocalDateTime `gorm:"column:expiration;not null;comment:过期时间" json:"expiration"` // 过期时间
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ProxyHost string `gorm:"column:proxy_host;not null" json:"proxy_host"`
|
||||
Protocol int32 `gorm:"column:protocol;comment:协议类型:1-http,2-https,3-socks5" json:"protocol"` // 协议类型:1-http,2-https,3-socks5
|
||||
}
|
||||
|
||||
// TableName Channel's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,21 +14,21 @@ const TableNameClient = "client"
|
||||
|
||||
// Client mapped from table <client>
|
||||
type Client struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:客户端ID" json:"id"` // 客户端ID
|
||||
ClientID string `gorm:"column:client_id;not null;comment:OAuth2客户端标识符" json:"client_id"` // OAuth2客户端标识符
|
||||
ClientSecret string `gorm:"column:client_secret;not null;comment:OAuth2客户端密钥" json:"client_secret"` // OAuth2客户端密钥
|
||||
RedirectURI string `gorm:"column:redirect_uri;comment:OAuth2 重定向URI" json:"redirect_uri"` // OAuth2 重定向URI
|
||||
GrantCode bool `gorm:"column:grant_code;not null;comment:允许授权码授予" json:"grant_code"` // 允许授权码授予
|
||||
GrantClient bool `gorm:"column:grant_client;not null;comment:允许客户端凭证授予" json:"grant_client"` // 允许客户端凭证授予
|
||||
GrantRefresh bool `gorm:"column:grant_refresh;not null;comment:允许刷新令牌授予" json:"grant_refresh"` // 允许刷新令牌授予
|
||||
Spec int32 `gorm:"column:spec;not null;comment:安全规范:0-web,1-native,2-browser" json:"spec"` // 安全规范:0-web,1-native,2-browser
|
||||
Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称
|
||||
Icon string `gorm:"column:icon;comment:图标URL" json:"icon"` // 图标URL
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
GrantPassword bool `gorm:"column:grant_password;not null" json:"grant_password"`
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:客户端ID" json:"id"` // 客户端ID
|
||||
ClientID string `gorm:"column:client_id;not null;comment:OAuth2客户端标识符" json:"client_id"` // OAuth2客户端标识符
|
||||
ClientSecret string `gorm:"column:client_secret;not null;comment:OAuth2客户端密钥" json:"client_secret"` // OAuth2客户端密钥
|
||||
RedirectURI string `gorm:"column:redirect_uri;comment:OAuth2 重定向URI" json:"redirect_uri"` // OAuth2 重定向URI
|
||||
GrantCode bool `gorm:"column:grant_code;not null;comment:允许授权码授予" json:"grant_code"` // 允许授权码授予
|
||||
GrantClient bool `gorm:"column:grant_client;not null;comment:允许客户端凭证授予" json:"grant_client"` // 允许客户端凭证授予
|
||||
GrantRefresh bool `gorm:"column:grant_refresh;not null;comment:允许刷新令牌授予" json:"grant_refresh"` // 允许刷新令牌授予
|
||||
Spec int32 `gorm:"column:spec;not null;comment:安全规范:0-web,1-native,2-browser" json:"spec"` // 安全规范:0-web,1-native,2-browser
|
||||
Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称
|
||||
Icon string `gorm:"column:icon;comment:图标URL" json:"icon"` // 图标URL
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
GrantPassword bool `gorm:"column:grant_password;not null" json:"grant_password"`
|
||||
}
|
||||
|
||||
// TableName Client's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,12 +14,12 @@ const TableNameClientPermissionLink = "client_permission_link"
|
||||
|
||||
// ClientPermissionLink mapped from table <client_permission_link>
|
||||
type ClientPermissionLink struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
ClientID int32 `gorm:"column:client_id;not null;comment:客户端ID" json:"client_id"` // 客户端ID
|
||||
PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
ClientID int32 `gorm:"column:client_id;not null;comment:客户端ID" json:"client_id"` // 客户端ID
|
||||
PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ClientPermissionLink's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,17 +14,17 @@ const TableNameCoupon = "coupon"
|
||||
|
||||
// Coupon mapped from table <coupon>
|
||||
type Coupon struct {
|
||||
ExpireAt common.LocalDateTime `gorm:"column:expire_at;comment:过期时间" json:"expire_at"` // 过期时间
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:优惠券ID" json:"id"` // 优惠券ID
|
||||
UserID int32 `gorm:"column:user_id;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Status int32 `gorm:"column:status;not null;comment:优惠券状态:0-未使用,1-已使用,2-已过期" json:"status"` // 优惠券状态:0-未使用,1-已使用,2-已过期
|
||||
Code string `gorm:"column:code;not null;comment:优惠券代码" json:"code"` // 优惠券代码
|
||||
Remark string `gorm:"column:remark;comment:优惠券备注" json:"remark"` // 优惠券备注
|
||||
Amount float64 `gorm:"column:amount;not null;comment:优惠券金额" json:"amount"` // 优惠券金额
|
||||
MinAmount float64 `gorm:"column:min_amount;not null;comment:最低消费金额" json:"min_amount"` // 最低消费金额
|
||||
ExpireAt core.LocalDateTime `gorm:"column:expire_at;comment:过期时间" json:"expire_at"` // 过期时间
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:优惠券ID" json:"id"` // 优惠券ID
|
||||
UserID int32 `gorm:"column:user_id;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Status int32 `gorm:"column:status;not null;comment:优惠券状态:0-未使用,1-已使用,2-已过期" json:"status"` // 优惠券状态:0-未使用,1-已使用,2-已过期
|
||||
Code string `gorm:"column:code;not null;comment:优惠券代码" json:"code"` // 优惠券代码
|
||||
Remark string `gorm:"column:remark;comment:优惠券备注" json:"remark"` // 优惠券备注
|
||||
Amount float64 `gorm:"column:amount;not null;comment:优惠券金额" json:"amount"` // 优惠券金额
|
||||
MinAmount float64 `gorm:"column:min_amount;not null;comment:最低消费金额" json:"min_amount"` // 最低消费金额
|
||||
}
|
||||
|
||||
// TableName Coupon's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,21 +14,21 @@ const TableNameNode = "node"
|
||||
|
||||
// Node mapped from table <node>
|
||||
type Node struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:节点ID" json:"id"` // 节点ID
|
||||
Version int32 `gorm:"column:version;not null;comment:节点版本" json:"version"` // 节点版本
|
||||
Name string `gorm:"column:name;not null;comment:节点名称" json:"name"` // 节点名称
|
||||
Host string `gorm:"column:host;not null;comment:节点地址" json:"host"` // 节点地址
|
||||
Prov string `gorm:"column:prov;not null;comment:省份" json:"prov"` // 省份
|
||||
City string `gorm:"column:city;not null;comment:城市" json:"city"` // 城市
|
||||
ProxyID int32 `gorm:"column:proxy_id;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||
ProxyPort int32 `gorm:"column:proxy_port;comment:代理端口" json:"proxy_port"` // 代理端口
|
||||
Status int32 `gorm:"column:status;not null;comment:节点状态:0-离线,1-正常" json:"status"` // 节点状态:0-离线,1-正常
|
||||
Rtt int32 `gorm:"column:rtt;comment:延迟" json:"rtt"` // 延迟
|
||||
Loss int32 `gorm:"column:loss;comment:丢包率" json:"loss"` // 丢包率
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
Isp int32 `gorm:"column:isp;not null;comment:运营商:0-其他,1-电信,2-联通,3-移动" json:"isp"` // 运营商:0-其他,1-电信,2-联通,3-移动
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:节点ID" json:"id"` // 节点ID
|
||||
Version int32 `gorm:"column:version;not null;comment:节点版本" json:"version"` // 节点版本
|
||||
Name string `gorm:"column:name;not null;comment:节点名称" json:"name"` // 节点名称
|
||||
Host string `gorm:"column:host;not null;comment:节点地址" json:"host"` // 节点地址
|
||||
Prov string `gorm:"column:prov;not null;comment:省份" json:"prov"` // 省份
|
||||
City string `gorm:"column:city;not null;comment:城市" json:"city"` // 城市
|
||||
ProxyID int32 `gorm:"column:proxy_id;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||
ProxyPort int32 `gorm:"column:proxy_port;comment:代理端口" json:"proxy_port"` // 代理端口
|
||||
Status int32 `gorm:"column:status;not null;comment:节点状态:0-离线,1-正常" json:"status"` // 节点状态:0-离线,1-正常
|
||||
Rtt int32 `gorm:"column:rtt;comment:延迟" json:"rtt"` // 延迟
|
||||
Loss int32 `gorm:"column:loss;comment:丢包率" json:"loss"` // 丢包率
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
Isp int32 `gorm:"column:isp;not null;comment:运营商:0-其他,1-电信,2-联通,3-移动" json:"isp"` // 运营商:0-其他,1-电信,2-联通,3-移动
|
||||
}
|
||||
|
||||
// TableName Node's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,13 +14,13 @@ const TableNamePermission = "permission"
|
||||
|
||||
// Permission mapped from table <permission>
|
||||
type Permission struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:权限ID" json:"id"` // 权限ID
|
||||
ParentID int32 `gorm:"column:parent_id;comment:父权限ID" json:"parent_id"` // 父权限ID
|
||||
Name string `gorm:"column:name;not null;comment:权限名称" json:"name"` // 权限名称
|
||||
Description string `gorm:"column:description;comment:权限描述" json:"description"` // 权限描述
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:权限ID" json:"id"` // 权限ID
|
||||
ParentID int32 `gorm:"column:parent_id;comment:父权限ID" json:"parent_id"` // 父权限ID
|
||||
Name string `gorm:"column:name;not null;comment:权限名称" json:"name"` // 权限名称
|
||||
Description string `gorm:"column:description;comment:权限描述" json:"description"` // 权限描述
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Permission's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,15 +14,15 @@ const TableNameProduct = "product"
|
||||
|
||||
// Product mapped from table <product>
|
||||
type Product struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:产品ID" json:"id"` // 产品ID
|
||||
Code string `gorm:"column:code;not null;comment:产品代码" json:"code"` // 产品代码
|
||||
Name string `gorm:"column:name;not null;comment:产品名称" json:"name"` // 产品名称
|
||||
Description string `gorm:"column:description;comment:产品描述" json:"description"` // 产品描述
|
||||
Sort int32 `gorm:"column:sort;not null;comment:排序" json:"sort"` // 排序
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:产品状态:1-正常,0-禁用" json:"status"` // 产品状态:1-正常,0-禁用
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:产品ID" json:"id"` // 产品ID
|
||||
Code string `gorm:"column:code;not null;comment:产品代码" json:"code"` // 产品代码
|
||||
Name string `gorm:"column:name;not null;comment:产品名称" json:"name"` // 产品名称
|
||||
Description string `gorm:"column:description;comment:产品描述" json:"description"` // 产品描述
|
||||
Sort int32 `gorm:"column:sort;not null;comment:排序" json:"sort"` // 排序
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:产品状态:1-正常,0-禁用" json:"status"` // 产品状态:1-正常,0-禁用
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Product's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,15 +14,15 @@ const TableNameProxy = "proxy"
|
||||
|
||||
// Proxy mapped from table <proxy>
|
||||
type Proxy struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:代理服务ID" json:"id"` // 代理服务ID
|
||||
Version int32 `gorm:"column:version;not null;comment:代理服务版本" json:"version"` // 代理服务版本
|
||||
Name string `gorm:"column:name;not null;comment:代理服务名称" json:"name"` // 代理服务名称
|
||||
Host string `gorm:"column:host;not null;comment:代理服务地址" json:"host"` // 代理服务地址
|
||||
Type int32 `gorm:"column:type;not null;comment:代理服务类型:0-自有,1-三方" json:"type"` // 代理服务类型:0-自有,1-三方
|
||||
Secret string `gorm:"column:secret;comment:代理服务密钥" json:"secret"` // 代理服务密钥
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:代理服务ID" json:"id"` // 代理服务ID
|
||||
Version int32 `gorm:"column:version;not null;comment:代理服务版本" json:"version"` // 代理服务版本
|
||||
Name string `gorm:"column:name;not null;comment:代理服务名称" json:"name"` // 代理服务名称
|
||||
Host string `gorm:"column:host;not null;comment:代理服务地址" json:"host"` // 代理服务地址
|
||||
Type int32 `gorm:"column:type;not null;comment:代理服务类型:0-自有,1-三方" json:"type"` // 代理服务类型:0-自有,1-三方
|
||||
Secret string `gorm:"column:secret;comment:代理服务密钥" json:"secret"` // 代理服务密钥
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Proxy's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,15 +14,15 @@ const TableNameRefund = "refund"
|
||||
|
||||
// Refund mapped from table <refund>
|
||||
type Refund struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:退款ID" json:"id"` // 退款ID
|
||||
ProductID int32 `gorm:"column:product_id;comment:产品ID" json:"product_id"` // 产品ID
|
||||
Amount float64 `gorm:"column:amount;not null;comment:退款金额" json:"amount"` // 退款金额
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
TradeID int32 `gorm:"column:trade_id;not null;comment:订单ID" json:"trade_id"` // 订单ID
|
||||
Reason string `gorm:"column:reason;comment:退款原因" json:"reason"` // 退款原因
|
||||
Status int32 `gorm:"column:status;not null;comment:退款状态:0-待处理,1-已退款,2-已拒绝" json:"status"` // 退款状态:0-待处理,1-已退款,2-已拒绝
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:退款ID" json:"id"` // 退款ID
|
||||
ProductID int32 `gorm:"column:product_id;comment:产品ID" json:"product_id"` // 产品ID
|
||||
Amount float64 `gorm:"column:amount;not null;comment:退款金额" json:"amount"` // 退款金额
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
TradeID int32 `gorm:"column:trade_id;not null;comment:订单ID" json:"trade_id"` // 订单ID
|
||||
Reason string `gorm:"column:reason;comment:退款原因" json:"reason"` // 退款原因
|
||||
Status int32 `gorm:"column:status;not null;comment:退款状态:0-待处理,1-已退款,2-已拒绝" json:"status"` // 退款状态:0-待处理,1-已退款,2-已拒绝
|
||||
}
|
||||
|
||||
// TableName Refund's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,15 +14,15 @@ const TableNameResource = "resource"
|
||||
|
||||
// Resource mapped from table <resource>
|
||||
type Resource struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:套餐ID" json:"id"` // 套餐ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Active bool `gorm:"column:active;not null;default:true;comment:套餐状态" json:"active"` // 套餐状态
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ResourceNo string `gorm:"column:resource_no;comment:套餐编号" json:"resource_no"` // 套餐编号
|
||||
Type int32 `gorm:"column:type;not null;comment:套餐类型:1-动态,2-隧道,3-独享" json:"type"` // 套餐类型:1-动态,2-隧道,3-独享
|
||||
Pss *ResourcePss `gorm:"foreignKey:ResourceID;references:ID" json:"pss"`
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:套餐ID" json:"id"` // 套餐ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Active bool `gorm:"column:active;not null;default:true;comment:套餐状态" json:"active"` // 套餐状态
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ResourceNo string `gorm:"column:resource_no;comment:套餐编号" json:"resource_no"` // 套餐编号
|
||||
Type int32 `gorm:"column:type;not null;comment:套餐类型:1-动态,2-隧道,3-独享" json:"type"` // 套餐类型:1-动态,2-隧道,3-独享
|
||||
Pss *ResourcePss `gorm:"foreignKey:ResourceID;references:ID" json:"pss"`
|
||||
}
|
||||
|
||||
// TableName Resource's table name
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import "platform/web/core"
|
||||
|
||||
const TableNameResourcePsr = "resource_psr"
|
||||
|
||||
// ResourcePsr mapped from table <resource_psr>
|
||||
type ResourcePsr struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
|
||||
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
|
||||
Live int32 `gorm:"column:live;comment:轮换周期(秒)" json:"live"` // 轮换周期(秒)
|
||||
Conn int32 `gorm:"column:conn;comment:最大连接数" json:"conn"` // 最大连接数
|
||||
Expire common.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
|
||||
Used bool `gorm:"column:used;comment:是否已使用" json:"used"` // 是否已使用
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
|
||||
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
|
||||
Live int32 `gorm:"column:live;comment:轮换周期(秒)" json:"live"` // 轮换周期(秒)
|
||||
Conn int32 `gorm:"column:conn;comment:最大连接数" json:"conn"` // 最大连接数
|
||||
Expire core.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
|
||||
Used bool `gorm:"column:used;comment:是否已使用" json:"used"` // 是否已使用
|
||||
}
|
||||
|
||||
// TableName ResourcePsr's table name
|
||||
|
||||
@@ -4,22 +4,22 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import "platform/web/core"
|
||||
|
||||
const TableNameResourcePss = "resource_pss"
|
||||
|
||||
// ResourcePss mapped from table <resource_pss>
|
||||
type ResourcePss struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
|
||||
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
|
||||
Type int32 `gorm:"column:type;comment:套餐类型:1-包时,2-包量" json:"type"` // 套餐类型:1-包时,2-包量
|
||||
Live int32 `gorm:"column:live;comment:可用时长(秒)" json:"live"` // 可用时长(秒)
|
||||
Quota int32 `gorm:"column:quota;comment:配额数量" json:"quota"` // 配额数量
|
||||
Expire common.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
|
||||
Used int32 `gorm:"column:used;not null;comment:已用数量" json:"used"` // 已用数量
|
||||
DailyLimit int32 `gorm:"column:daily_limit;not null;comment:每日限制" json:"daily_limit"` // 每日限制
|
||||
DailyUsed int32 `gorm:"column:daily_used;not null;comment:今日已用数量" json:"daily_used"` // 今日已用数量
|
||||
DailyLast common.LocalDateTime `gorm:"column:daily_last;comment:今日最后使用时间" json:"daily_last"` // 今日最后使用时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
|
||||
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
|
||||
Type int32 `gorm:"column:type;comment:套餐类型:1-包时,2-包量" json:"type"` // 套餐类型:1-包时,2-包量
|
||||
Live int32 `gorm:"column:live;comment:可用时长(秒)" json:"live"` // 可用时长(秒)
|
||||
Quota int32 `gorm:"column:quota;comment:配额数量" json:"quota"` // 配额数量
|
||||
Expire core.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
|
||||
Used int32 `gorm:"column:used;not null;comment:已用数量" json:"used"` // 已用数量
|
||||
DailyLimit int32 `gorm:"column:daily_limit;not null;comment:每日限制" json:"daily_limit"` // 每日限制
|
||||
DailyUsed int32 `gorm:"column:daily_used;not null;comment:今日已用数量" json:"daily_used"` // 今日已用数量
|
||||
DailyLast core.LocalDateTime `gorm:"column:daily_last;comment:今日最后使用时间" json:"daily_last"` // 今日最后使用时间
|
||||
}
|
||||
|
||||
// TableName ResourcePss's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,23 +14,23 @@ const TableNameTrade = "trade"
|
||||
|
||||
// Trade mapped from table <trade>
|
||||
type Trade struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:订单ID" json:"id"` // 订单ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
InnerNo string `gorm:"column:inner_no;not null;comment:内部订单号" json:"inner_no"` // 内部订单号
|
||||
OuterNo string `gorm:"column:outer_no;comment:外部订单号" json:"outer_no"` // 外部订单号
|
||||
Subject string `gorm:"column:subject;not null;comment:订单主题" json:"subject"` // 订单主题
|
||||
Remark string `gorm:"column:remark;comment:订单备注" json:"remark"` // 订单备注
|
||||
Amount float64 `gorm:"column:amount;not null;comment:订单总金额" json:"amount"` // 订单总金额
|
||||
Payment float64 `gorm:"column:payment;not null;comment:支付金额" json:"payment"` // 支付金额
|
||||
Method int32 `gorm:"column:method;not null;comment:支付方式:1-支付宝,2-微信" json:"method"` // 支付方式:1-支付宝,2-微信
|
||||
Status int32 `gorm:"column:status;not null;comment:订单状态:0-待支付,1-已支付,2-已取消,3-已退款" json:"status"` // 订单状态:0-待支付,1-已支付,2-已取消,3-已退款
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
Type int32 `gorm:"column:type;not null;comment:订单类型:0-充值余额,1-购买产品" json:"type"` // 订单类型:0-充值余额,1-购买产品
|
||||
CancelAt common.LocalDateTime `gorm:"column:cancel_at;comment:取消时间" json:"cancel_at"` // 取消时间
|
||||
PaidAt common.LocalDateTime `gorm:"column:paid_at;comment:支付时间" json:"paid_at"` // 支付时间
|
||||
PayURL string `gorm:"column:pay_url;comment:支付链接" json:"pay_url"` // 支付链接
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:订单ID" json:"id"` // 订单ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
InnerNo string `gorm:"column:inner_no;not null;comment:内部订单号" json:"inner_no"` // 内部订单号
|
||||
OuterNo string `gorm:"column:outer_no;comment:外部订单号" json:"outer_no"` // 外部订单号
|
||||
Subject string `gorm:"column:subject;not null;comment:订单主题" json:"subject"` // 订单主题
|
||||
Remark string `gorm:"column:remark;comment:订单备注" json:"remark"` // 订单备注
|
||||
Amount float64 `gorm:"column:amount;not null;comment:订单总金额" json:"amount"` // 订单总金额
|
||||
Payment float64 `gorm:"column:payment;not null;comment:支付金额" json:"payment"` // 支付金额
|
||||
Method int32 `gorm:"column:method;not null;comment:支付方式:1-支付宝,2-微信" json:"method"` // 支付方式:1-支付宝,2-微信
|
||||
Status int32 `gorm:"column:status;not null;comment:订单状态:0-待支付,1-已支付,2-已取消,3-已退款" json:"status"` // 订单状态:0-待支付,1-已支付,2-已取消,3-已退款
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
Type int32 `gorm:"column:type;not null;comment:订单类型:0-充值余额,1-购买产品" json:"type"` // 订单类型:0-充值余额,1-购买产品
|
||||
CancelAt core.LocalDateTime `gorm:"column:cancel_at;comment:取消时间" json:"cancel_at"` // 取消时间
|
||||
PaidAt core.LocalDateTime `gorm:"column:paid_at;comment:支付时间" json:"paid_at"` // 支付时间
|
||||
PayURL string `gorm:"column:pay_url;comment:支付链接" json:"pay_url"` // 支付链接
|
||||
}
|
||||
|
||||
// TableName Trade's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,27 +14,27 @@ const TableNameUser = "user"
|
||||
|
||||
// User mapped from table <user>
|
||||
type User struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:用户ID" json:"id"` // 用户ID
|
||||
AdminID int32 `gorm:"column:admin_id;comment:管理员ID" json:"admin_id"` // 管理员ID
|
||||
Phone string `gorm:"column:phone;not null;comment:手机号码" json:"phone"` // 手机号码
|
||||
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
|
||||
Email string `gorm:"column:email" json:"email"`
|
||||
Password string `gorm:"column:password;comment:用户密码" json:"password"` // 用户密码
|
||||
Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名
|
||||
Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:用户状态:1-正常,0-禁用" json:"status"` // 用户状态:1-正常,0-禁用
|
||||
Balance float64 `gorm:"column:balance;not null;comment:账户余额" json:"balance"` // 账户余额
|
||||
IDType int32 `gorm:"column:id_type;not null;comment:认证类型:0-未认证,1-个人认证,2-企业认证" json:"id_type"` // 认证类型:0-未认证,1-个人认证,2-企业认证
|
||||
IDNo string `gorm:"column:id_no;comment:身份证号或营业执照号" json:"id_no"` // 身份证号或营业执照号
|
||||
IDToken string `gorm:"column:id_token;comment:身份验证标识" json:"id_token"` // 身份验证标识
|
||||
ContactQQ string `gorm:"column:contact_qq;comment:QQ联系方式" json:"contact_qq"` // QQ联系方式
|
||||
ContactWechat string `gorm:"column:contact_wechat;comment:微信联系方式" json:"contact_wechat"` // 微信联系方式
|
||||
LastLogin common.LocalDateTime `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
|
||||
LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址
|
||||
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:用户ID" json:"id"` // 用户ID
|
||||
AdminID int32 `gorm:"column:admin_id;comment:管理员ID" json:"admin_id"` // 管理员ID
|
||||
Phone string `gorm:"column:phone;not null;comment:手机号码" json:"phone"` // 手机号码
|
||||
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
|
||||
Email string `gorm:"column:email" json:"email"`
|
||||
Password string `gorm:"column:password;comment:用户密码" json:"password"` // 用户密码
|
||||
Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名
|
||||
Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:用户状态:1-正常,0-禁用" json:"status"` // 用户状态:1-正常,0-禁用
|
||||
Balance float64 `gorm:"column:balance;not null;comment:账户余额" json:"balance"` // 账户余额
|
||||
IDType int32 `gorm:"column:id_type;not null;comment:认证类型:0-未认证,1-个人认证,2-企业认证" json:"id_type"` // 认证类型:0-未认证,1-个人认证,2-企业认证
|
||||
IDNo string `gorm:"column:id_no;comment:身份证号或营业执照号" json:"id_no"` // 身份证号或营业执照号
|
||||
IDToken string `gorm:"column:id_token;comment:身份验证标识" json:"id_token"` // 身份验证标识
|
||||
ContactQQ string `gorm:"column:contact_qq;comment:QQ联系方式" json:"contact_qq"` // QQ联系方式
|
||||
ContactWechat string `gorm:"column:contact_wechat;comment:微信联系方式" json:"contact_wechat"` // 微信联系方式
|
||||
LastLogin core.LocalDateTime `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
|
||||
LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址
|
||||
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName User's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,14 +14,14 @@ const TableNameUserRole = "user_role"
|
||||
|
||||
// UserRole mapped from table <user_role>
|
||||
type UserRole struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:角色ID" json:"id"` // 角色ID
|
||||
Name string `gorm:"column:name;not null;comment:角色名称" json:"name"` // 角色名称
|
||||
Description string `gorm:"column:description;comment:角色描述" json:"description"` // 角色描述
|
||||
Active bool `gorm:"column:active;default:true;comment:是否激活" json:"active"` // 是否激活
|
||||
Sort int32 `gorm:"column:sort;comment:排序" json:"sort"` // 排序
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:角色ID" json:"id"` // 角色ID
|
||||
Name string `gorm:"column:name;not null;comment:角色名称" json:"name"` // 角色名称
|
||||
Description string `gorm:"column:description;comment:角色描述" json:"description"` // 角色描述
|
||||
Active bool `gorm:"column:active;default:true;comment:是否激活" json:"active"` // 是否激活
|
||||
Sort int32 `gorm:"column:sort;comment:排序" json:"sort"` // 排序
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName UserRole's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,12 +14,12 @@ const TableNameUserRoleLink = "user_role_link"
|
||||
|
||||
// UserRoleLink mapped from table <user_role_link>
|
||||
type UserRoleLink struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName UserRoleLink's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,12 +14,12 @@ const TableNameUserRolePermissionLink = "user_role_permission_link"
|
||||
|
||||
// UserRolePermissionLink mapped from table <user_role_permission_link>
|
||||
type UserRolePermissionLink struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName UserRolePermissionLink's table name
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -14,13 +14,13 @@ const TableNameWhitelist = "whitelist"
|
||||
|
||||
// Whitelist mapped from table <whitelist>
|
||||
type Whitelist struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:白名单ID" json:"id"` // 白名单ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Host string `gorm:"column:host;not null;comment:IP地址" json:"host"` // IP地址
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
Remark string `gorm:"column:remark;comment:备注" json:"remark"` // 备注
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:白名单ID" json:"id"` // 白名单ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Host string `gorm:"column:host;not null;comment:IP地址" json:"host"` // IP地址
|
||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
Remark string `gorm:"column:remark;comment:备注" json:"remark"` // 备注
|
||||
}
|
||||
|
||||
// TableName Whitelist's table name
|
||||
|
||||
@@ -3,7 +3,7 @@ package services
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
"time"
|
||||
@@ -122,7 +122,7 @@ func (s *authService) OauthPassword(ctx context.Context, _ *m.Client, data *Gran
|
||||
}
|
||||
|
||||
// 更新用户的登录时间
|
||||
user.LastLogin = common.LocalDateTime(time.Now())
|
||||
user.LastLogin = core.LocalDateTime(time.Now())
|
||||
user.LastLoginHost = ip
|
||||
user.LastLoginAgent = agent
|
||||
if err := tx.User.Omit(q.User.AdminID).Save(user); err != nil {
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"platform/pkg/orm"
|
||||
"platform/pkg/rds"
|
||||
"platform/pkg/u"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
g "platform/web/globals"
|
||||
"platform/web/models"
|
||||
q "platform/web/queries"
|
||||
@@ -56,10 +56,10 @@ type ResourceInfo struct {
|
||||
Live int32
|
||||
DailyLimit int32
|
||||
DailyUsed int32
|
||||
DailyLast common.LocalDateTime
|
||||
DailyLast core.LocalDateTime
|
||||
Quota int32
|
||||
Used int32
|
||||
Expire common.LocalDateTime
|
||||
Expire core.LocalDateTime
|
||||
}
|
||||
|
||||
// region RemoveChannel
|
||||
@@ -83,7 +83,7 @@ func (s *channelService) RemoveChannels(ctx context.Context, auth *AuthContext,
|
||||
// 检查权限,如果为用户操作的话,则只能删除自己的通道
|
||||
for _, channel := range channels {
|
||||
if auth.Payload.Type == PayloadUser && auth.Payload.Id != channel.UserID {
|
||||
return common.AuthForbiddenErr("无权限访问")
|
||||
return core.AuthForbiddenErr("无权限访问")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ func (s *channelService) CreateChannel(
|
||||
// 分配端口
|
||||
step = time.Now()
|
||||
|
||||
expiration := common.LocalDateTime(now.Add(time.Duration(resource.Live) * time.Second))
|
||||
expiration := core.LocalDateTime(now.Add(time.Duration(resource.Live) * time.Second))
|
||||
_addr, channels, err := assignPort(q, edgeAssigns, auth.Payload.Id, protocol, authType, expiration, filter)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -315,7 +315,7 @@ func (s *channelService) CreateChannel(
|
||||
|
||||
toUpdate := models.ResourcePss{
|
||||
Used: resource.Used + int32(count),
|
||||
DailyLast: common.LocalDateTime(now),
|
||||
DailyLast: core.LocalDateTime(now),
|
||||
}
|
||||
var last = time.Time(resource.DailyLast)
|
||||
if now.Year() != last.Year() || now.Month() != last.Month() || now.Day() != last.Day() {
|
||||
@@ -360,7 +360,7 @@ func checkUser(auth *AuthContext, resource *ResourceInfo, count int) error {
|
||||
|
||||
// 检查使用人
|
||||
if auth.Payload.Type == PayloadUser && auth.Payload.Id != resource.UserId {
|
||||
return common.AuthForbiddenErr("无权限访问")
|
||||
return core.AuthForbiddenErr("无权限访问")
|
||||
}
|
||||
|
||||
// 检查套餐状态
|
||||
@@ -428,7 +428,7 @@ func assignEdge(q *q.Query, count int, filter NodeFilterConfig) (*AssignEdgeResu
|
||||
q.Channel.ProxyPort).
|
||||
Where(
|
||||
q.Channel.ProxyID.In(proxyIds...),
|
||||
q.Channel.Expiration.Gt(common.LocalDateTime(time.Now()))).
|
||||
q.Channel.Expiration.Gt(core.LocalDateTime(time.Now()))).
|
||||
Group(
|
||||
q.Channel.ProxyPort,
|
||||
q.Channel.ProxyID).
|
||||
@@ -549,7 +549,7 @@ func assignPort(
|
||||
userId int32,
|
||||
protocol ChannelProtocol,
|
||||
authType ChannelAuthType,
|
||||
expiration common.LocalDateTime,
|
||||
expiration core.LocalDateTime,
|
||||
filter NodeFilterConfig,
|
||||
) ([]*PortInfo, []*models.Channel, error) {
|
||||
var step time.Time
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"platform/pkg/testutil"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
g "platform/web/globals"
|
||||
"platform/web/models"
|
||||
"reflect"
|
||||
@@ -109,7 +109,7 @@ func Test_cache(t *testing.T) {
|
||||
|
||||
// 准备测试数据
|
||||
now := time.Now()
|
||||
expiration := common.LocalDateTime(now.Add(24 * time.Hour))
|
||||
expiration := core.LocalDateTime(now.Add(24 * time.Hour))
|
||||
|
||||
testChannels := []*models.Channel{
|
||||
{
|
||||
@@ -341,7 +341,7 @@ func Test_channelService_CreateChannel(t *testing.T) {
|
||||
ResourceID: 1,
|
||||
Type: 1,
|
||||
Live: 180,
|
||||
Expire: common.LocalDateTime(time.Now().AddDate(1, 0, 0)),
|
||||
Expire: core.LocalDateTime(time.Now().AddDate(1, 0, 0)),
|
||||
DailyLimit: 10000,
|
||||
}
|
||||
db.Exec("delete from resource_pss where true")
|
||||
@@ -844,7 +844,7 @@ func Test_channelService_CreateChannel(t *testing.T) {
|
||||
ResourceID: 2,
|
||||
Type: 1,
|
||||
Live: 180,
|
||||
Expire: common.LocalDateTime(time.Now().AddDate(1, 0, 0)),
|
||||
Expire: core.LocalDateTime(time.Now().AddDate(1, 0, 0)),
|
||||
DailyLimit: 10000,
|
||||
}
|
||||
db.Create(resourcePss2)
|
||||
@@ -914,7 +914,7 @@ func Test_channelService_CreateChannel(t *testing.T) {
|
||||
ProxyID: 1,
|
||||
ProxyPort: int32(i + 10000),
|
||||
UserID: 101,
|
||||
Expiration: common.LocalDateTime(expr),
|
||||
Expiration: core.LocalDateTime(expr),
|
||||
}
|
||||
}
|
||||
db.CreateInBatches(channels, 1000)
|
||||
@@ -1040,9 +1040,9 @@ func Test_channelService_RemoveChannels(t *testing.T) {
|
||||
|
||||
// 创建通道
|
||||
channels := []models.Channel{
|
||||
{ID: 1, UserID: 101, ProxyID: 1, ProxyPort: 10001, Protocol: 1, Expiration: common.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 2, UserID: 101, ProxyID: 1, ProxyPort: 10002, Protocol: 1, Expiration: common.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 3, UserID: 101, ProxyID: 2, ProxyPort: 10001, Protocol: 3, Expiration: common.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 1, UserID: 101, ProxyID: 1, ProxyPort: 10001, Protocol: 1, Expiration: core.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 2, UserID: 101, ProxyID: 1, ProxyPort: 10002, Protocol: 1, Expiration: core.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 3, UserID: 101, ProxyID: 2, ProxyPort: 10001, Protocol: 3, Expiration: core.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
}
|
||||
|
||||
// 保存预设数据
|
||||
@@ -1154,9 +1154,9 @@ func Test_channelService_RemoveChannels(t *testing.T) {
|
||||
|
||||
// 创建通道
|
||||
channels := []models.Channel{
|
||||
{ID: 1, UserID: 101, ProxyID: 1, ProxyPort: 10001, Protocol: 1, Expiration: common.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 2, UserID: 101, ProxyID: 1, ProxyPort: 10002, Protocol: 1, Expiration: common.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 3, UserID: 101, ProxyID: 2, ProxyPort: 10001, Protocol: 3, Expiration: common.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 1, UserID: 101, ProxyID: 1, ProxyPort: 10001, Protocol: 1, Expiration: core.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 2, UserID: 101, ProxyID: 1, ProxyPort: 10002, Protocol: 1, Expiration: core.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 3, UserID: 101, ProxyID: 2, ProxyPort: 10001, Protocol: 3, Expiration: core.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
}
|
||||
|
||||
// 保存预设数据
|
||||
@@ -1268,9 +1268,9 @@ func Test_channelService_RemoveChannels(t *testing.T) {
|
||||
|
||||
// 创建通道
|
||||
channels := []models.Channel{
|
||||
{ID: 1, UserID: 101, ProxyID: 1, ProxyPort: 10001, Protocol: 1, Expiration: common.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 2, UserID: 101, ProxyID: 1, ProxyPort: 10002, Protocol: 1, Expiration: common.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 3, UserID: 102, ProxyID: 2, ProxyPort: 10001, Protocol: 3, Expiration: common.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 1, UserID: 101, ProxyID: 1, ProxyPort: 10001, Protocol: 1, Expiration: core.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 2, UserID: 101, ProxyID: 1, ProxyPort: 10002, Protocol: 1, Expiration: core.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
{ID: 3, UserID: 102, ProxyID: 2, ProxyPort: 10001, Protocol: 3, Expiration: core.LocalDateTime(time.Now().Add(24 * time.Hour))},
|
||||
}
|
||||
|
||||
// 保存预设数据
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"platform/pkg/rds"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
"strings"
|
||||
@@ -248,7 +248,7 @@ func createResource(data *CreateResourceData, uid int32) (*m.Resource, error) {
|
||||
Type: data.Type,
|
||||
Live: data.Live,
|
||||
Quota: data.Quota,
|
||||
Expire: common.LocalDateTime(time.Now().Add(time.Duration(data.Expire) * 24 * time.Hour)),
|
||||
Expire: core.LocalDateTime(time.Now().Add(time.Duration(data.Expire) * 24 * time.Hour)),
|
||||
DailyLimit: data.DailyLimit,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"net/http"
|
||||
"platform/pkg/env"
|
||||
"platform/pkg/u"
|
||||
"platform/web/common"
|
||||
"platform/web/core"
|
||||
g "platform/web/globals"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
@@ -275,7 +275,7 @@ func (s *transactionService) CompleteTransaction(ctx context.Context, q *q.Query
|
||||
trade.Status = 1
|
||||
trade.OuterNo = transId
|
||||
trade.Payment = payment
|
||||
trade.PaidAt = common.LocalDateTime(paidAt)
|
||||
trade.PaidAt = core.LocalDateTime(paidAt)
|
||||
trade.PayURL = ""
|
||||
_, err = q.Trade.WithContext(ctx).Updates(trade)
|
||||
if err != nil {
|
||||
@@ -327,7 +327,7 @@ func (s *transactionService) FinishTransaction(ctx context.Context, q *q.Query,
|
||||
Select(q.Trade.Status, q.Trade.CancelAt, q.Trade.PayURL).
|
||||
Updates(m.Trade{
|
||||
Status: 2,
|
||||
CancelAt: common.LocalDateTime(time),
|
||||
CancelAt: core.LocalDateTime(time),
|
||||
PayURL: "",
|
||||
})
|
||||
if err != nil {
|
||||
@@ -388,6 +388,6 @@ type TransactionCompleteResult struct {
|
||||
}
|
||||
|
||||
var (
|
||||
ErrTransactionNotPaid = common.NewErr("transaction", "交易未完成")
|
||||
ErrTransactionNotSupported = common.NewErr("transaction", "不支持的支付方式")
|
||||
ErrTransactionNotPaid = core.NewErr("transaction", "交易未完成")
|
||||
ErrTransactionNotSupported = core.NewErr("transaction", "不支持的支付方式")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user