重命名包为 core
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user