Merge branch 'master' of new-gitlab.adesk.com:public_project/utility_go

This commit is contained in:
2025-10-30 16:24:46 +08:00
3 changed files with 26 additions and 5 deletions

View File

@@ -112,9 +112,24 @@ var (
FileUrl: url[v.S3], FileUrl: url[v.S3],
}) })
if err != nil { if err != nil {
Proxy := g.Cfg().MustGet(ctx, "update_proxy", "http://192.168.50.170:10808").String() // 读取HTTP代理环境变量小写/大写通常都兼容,部分系统可能用大写)
g.Log().Debugf(ctx, "切换代理进行上传:err=%v", err) httpProxy := os.Getenv("http_proxy")
get, err = client.Proxy(Proxy).Post(ctx, address+"/callback/update", &UpdateReq{ 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], FileUrl: url[v.S3],
}) })
} }

View File

@@ -15,6 +15,7 @@ import (
service2 "github.com/ayflying/utility_go/service" service2 "github.com/ayflying/utility_go/service"
"github.com/ayflying/utility_go/tools" "github.com/ayflying/utility_go/tools"
"github.com/gogf/gf/v2/container/gset" "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/errors/gerror"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx" "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, Uid: uid,
ActId: actId, ActId: actId,
}).Fields("action").OrderDesc("updated_at").Value() }).Fields("action").OrderDesc("updated_at").Value()
getDb.Scan(&data) // getDb.Scan(&data)
data = gvar.New(getDb)
if data == nil || data.IsEmpty() { if data == nil || data.IsEmpty() {
return return
} }

View File

@@ -152,3 +152,8 @@ func (m *timeMod) CheckIsBeRwd(createdTime, lastRwdTime time.Time, _now ...time.
// 如果是,则说明还没领过,可以领取 // 如果是,则说明还没领过,可以领取
return lastRwdTime.Before(refreshToday) 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)
}