diff --git a/cmd/update.go b/cmd/update.go index 34d82b5..eaf3c65 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -112,9 +112,24 @@ var ( FileUrl: url[v.S3], }) if err != nil { - Proxy := g.Cfg().MustGet(ctx, "update_proxy", "http://192.168.50.170:10808").String() - g.Log().Debugf(ctx, "切换代理进行上传:err=%v", err) - get, err = client.Proxy(Proxy).Post(ctx, address+"/callback/update", &UpdateReq{ + // 读取HTTP代理环境变量(小写/大写通常都兼容,部分系统可能用大写) + httpProxy := os.Getenv("http_proxy") + if httpProxy == "" { + httpProxy = os.Getenv("HTTP_PROXY") + } + if httpProxy == "" { + // 读取HTTPS代理环境变量 + httpProxy = os.Getenv("https_proxy") + if httpProxy == "" { + httpProxy = os.Getenv("HTTPS_PROXY") + } + } + // 如果没有读取到本地的代理,使用配置上传 + if httpProxy == "" { + httpProxy = g.Cfg().MustGet(ctx, "update_proxy", "http://192.168.50.173:10808").String() + } + g.Log().Debugf(ctx, "切换代理进行上传:ip=%v,err=%v", httpProxy, err) + get, err = client.Proxy(httpProxy).Post(ctx, address+"/callback/update", &UpdateReq{ FileUrl: url[v.S3], }) } diff --git a/internal/logic/gameAct/gameAct.go b/internal/logic/gameAct/gameAct.go index 2209b6a..5056ec7 100644 --- a/internal/logic/gameAct/gameAct.go +++ b/internal/logic/gameAct/gameAct.go @@ -15,6 +15,7 @@ import ( service2 "github.com/ayflying/utility_go/service" "github.com/ayflying/utility_go/tools" "github.com/gogf/gf/v2/container/gset" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" @@ -68,8 +69,8 @@ func (s *sGameAct) Info(uid int64, actId int) (data *g.Var, err error) { Uid: uid, ActId: actId, }).Fields("action").OrderDesc("updated_at").Value() - getDb.Scan(&data) - + // getDb.Scan(&data) + data = gvar.New(getDb) if data == nil || data.IsEmpty() { return } diff --git a/tools/time.go b/tools/time.go index 8ffe862..bad3ff1 100644 --- a/tools/time.go +++ b/tools/time.go @@ -152,3 +152,8 @@ func (m *timeMod) CheckIsBeRwd(createdTime, lastRwdTime time.Time, _now ...time. // 如果是,则说明还没领过,可以领取 return lastRwdTime.Before(refreshToday) } + +// 获取指定时间的本月最后一刻 +func (m *timeMod) EndOfMonth(t time.Time) time.Time { + return time.Date(t.Year(), t.Month()+1, 1, 0, 0, 0, 0, t.Location()).Add(-time.Second) +}