将 LocalDateTime 迁移到 orm
This commit is contained in:
@@ -42,10 +42,10 @@ type ResourceInfo struct {
|
||||
Live int32
|
||||
DailyLimit int32
|
||||
DailyUsed int32
|
||||
DailyLast core.LocalDateTime
|
||||
DailyLast orm.LocalDateTime
|
||||
Quota int32
|
||||
Used int32
|
||||
Expire core.LocalDateTime
|
||||
Expire orm.LocalDateTime
|
||||
}
|
||||
|
||||
// region RemoveChannel
|
||||
@@ -362,7 +362,7 @@ func findChannels(q *q.Query, proxies []*m.Proxy) (channels []*m.Channel, err er
|
||||
q.Channel.ProxyPort).
|
||||
Where(
|
||||
q.Channel.ProxyID.In(proxyIds...),
|
||||
q.Channel.Expiration.Gt(core.LocalDateTime(time.Now()))).
|
||||
q.Channel.Expiration.Gt(orm.LocalDateTime(time.Now()))).
|
||||
Group(
|
||||
q.Channel.ProxyPort,
|
||||
q.Channel.ProxyID).
|
||||
@@ -520,7 +520,7 @@ func calcChannels(
|
||||
ProxyHost: proxy.Host,
|
||||
ProxyPort: int32(port),
|
||||
Protocol: int32(protocol),
|
||||
Expiration: core.LocalDateTime(expiration),
|
||||
Expiration: orm.LocalDateTime(expiration),
|
||||
}
|
||||
|
||||
switch authType {
|
||||
@@ -575,7 +575,7 @@ func calcChannels(
|
||||
func updateResource(rid string, resource *ResourceInfo, count int, now time.Time) (err error) {
|
||||
toUpdate := m.ResourcePss{
|
||||
Used: resource.Used + int32(count),
|
||||
DailyLast: core.LocalDateTime(now),
|
||||
DailyLast: orm.LocalDateTime(now),
|
||||
}
|
||||
var last = time.Time(resource.DailyLast)
|
||||
if now.Year() != last.Year() || now.Month() != last.Month() || now.Day() != last.Day() {
|
||||
|
||||
Reference in New Issue
Block a user