mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-14 05:23:09 +00:00
更新大量功能
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
_ "embed"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"x-ui/database"
|
||||
"x-ui/database/model"
|
||||
"x-ui/logger"
|
||||
@@ -110,3 +111,17 @@ func (s *SettingService) GetBasePath() (string, error) {
|
||||
}
|
||||
return basePath, nil
|
||||
}
|
||||
|
||||
func (s *SettingService) GetTimeLocation() (*time.Location, error) {
|
||||
defaultLocation := "Asia/Shanghai"
|
||||
l, err := s.getString("time_location", defaultLocation)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
location, err := time.LoadLocation(l)
|
||||
if err != nil {
|
||||
logger.Errorf("location <%v> not exist, using default location: %v", l, defaultLocation)
|
||||
return time.LoadLocation(defaultLocation)
|
||||
}
|
||||
return location, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user