重构项目结构,将 orm 和 rds 包迁移到 web/globals
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"platform/pkg/orm"
|
||||
"platform/web/auth"
|
||||
"platform/web/core"
|
||||
"platform/web/globals/orm"
|
||||
q "platform/web/queries"
|
||||
"time"
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"platform/pkg/orm"
|
||||
"platform/web/auth"
|
||||
"platform/web/core"
|
||||
channel2 "platform/web/domains/channel"
|
||||
"platform/web/globals/orm"
|
||||
q "platform/web/queries"
|
||||
s "platform/web/services"
|
||||
"time"
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"platform/pkg/env"
|
||||
"platform/pkg/rds"
|
||||
"platform/pkg/u"
|
||||
"platform/web/auth"
|
||||
g "platform/web/globals"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
"platform/web/services"
|
||||
@@ -87,7 +87,7 @@ func Identify(c *fiber.Ctx) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = rds.Client.Set(c.Context(), idenKey(id), infoStr, 30*time.Minute).Err()
|
||||
err = g.Redis.Set(c.Context(), idenKey(id), infoStr, 30*time.Minute).Err()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -120,7 +120,7 @@ func IdentifyCallback(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
// 获取 token
|
||||
infoStr, err := rds.Client.Get(c.Context(), idenKey(req.Id)).Result()
|
||||
infoStr, err := g.Redis.Get(c.Context(), idenKey(req.Id)).Result()
|
||||
if err != nil {
|
||||
if errors.Is(err, redis.Nil) {
|
||||
return c.JSON(IdentifyCallbackRes{
|
||||
@@ -179,7 +179,7 @@ func IdentifyCallback(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
// 删除认证中间状态
|
||||
err = rds.Client.Del(c.Context(), idenKey(req.Id)).Err()
|
||||
err = g.Redis.Del(c.Context(), idenKey(req.Id)).Err()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"platform/pkg/orm"
|
||||
"platform/pkg/u"
|
||||
"platform/web/auth"
|
||||
"platform/web/core"
|
||||
resource2 "platform/web/domains/resource"
|
||||
trade2 "platform/web/domains/trade"
|
||||
"platform/web/globals/orm"
|
||||
q "platform/web/queries"
|
||||
s "platform/web/services"
|
||||
"time"
|
||||
@@ -112,7 +112,7 @@ func AllResource(c *fiber.Ctx) error {
|
||||
|
||||
// 查询套餐列表
|
||||
pss := q.ResourcePss.As(q.Resource.Pss.Name())
|
||||
do := q.Resource.Debug().
|
||||
do := q.Resource.
|
||||
Joins(q.Resource.Pss).
|
||||
Where(
|
||||
q.Resource.UserID.Eq(authContext.Payload.Id),
|
||||
|
||||
Reference in New Issue
Block a user