修复 model 生成脚本,统一时间字段类型为 common.LocalDateTime
This commit is contained in:
@@ -299,7 +299,7 @@ func (s *channelService) CreateChannel(
|
||||
step = time.Now()
|
||||
|
||||
now := time.Now()
|
||||
expiration := now.Add(time.Duration(resource.Live) * time.Second)
|
||||
expiration := common.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
|
||||
@@ -426,7 +426,7 @@ func assignEdge(q *q.Query, count int, filter NodeFilterConfig) (*AssignEdgeResu
|
||||
q.Channel.ProxyPort).
|
||||
Where(
|
||||
q.Channel.ProxyID.In(proxyIds...),
|
||||
q.Channel.Expiration.Gt(time.Now())).
|
||||
q.Channel.Expiration.Gt(common.LocalDateTime(time.Now()))).
|
||||
Group(
|
||||
q.Channel.ProxyPort,
|
||||
q.Channel.ProxyID).
|
||||
@@ -547,7 +547,7 @@ func assignPort(
|
||||
userId int32,
|
||||
protocol ChannelProtocol,
|
||||
authType ChannelAuthType,
|
||||
expiration time.Time,
|
||||
expiration common.LocalDateTime,
|
||||
filter NodeFilterConfig,
|
||||
) ([]*PortInfo, []*models.Channel, error) {
|
||||
var step time.Time
|
||||
@@ -745,9 +745,10 @@ func cache(ctx context.Context, channels []*models.Channel) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pipe.Set(ctx, chKey(channel), string(marshal), time.Until(channel.Expiration))
|
||||
expiration := time.Time(channel.Expiration)
|
||||
pipe.Set(ctx, chKey(channel), string(marshal), time.Until(expiration))
|
||||
zList = append(zList, redis.Z{
|
||||
Score: float64(channel.Expiration.Unix()),
|
||||
Score: float64(expiration.Unix()),
|
||||
Member: channel.ID,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user