Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e885af295 | ||
|
|
b219123ded | ||
|
|
d3062a0240 | ||
|
|
f9bdc0f707 | ||
|
|
9df7bd891e |
29
act/act.go
Normal file
29
act/act.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package act
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type act struct {
|
||||
}
|
||||
|
||||
type Sql struct {
|
||||
UID uint64 `gorm:"primaryKey;comment:玩家编号"`
|
||||
ActID int `gorm:"primaryKey;comment:活动编号"`
|
||||
Action string `gorm:"type:text;comment:活动配置"`
|
||||
UpdatedAt *gtime.Time `gorm:"index;comment:更新时间"`
|
||||
}
|
||||
|
||||
func New() *act {
|
||||
|
||||
return &act{}
|
||||
}
|
||||
|
||||
func (s *act) CreateTable(name string) {
|
||||
|
||||
//prefix := g.DB().GetPrefix()
|
||||
//
|
||||
//g.DB()
|
||||
//g.DB().Exec(gctx.New())
|
||||
|
||||
}
|
||||
13
act/act.sql
Normal file
13
act/act.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
create table shiningu_game_act
|
||||
(
|
||||
uid bigint not null comment '玩家编号',
|
||||
act_id int not null comment '活动编号',
|
||||
action text null comment '活动配置',
|
||||
updated_at datetime null comment '更新时间',
|
||||
primary key (uid, act_id)
|
||||
)
|
||||
comment '玩家活动数据' charset = utf8mb4;
|
||||
|
||||
create index shiningu_game_act_uid_index
|
||||
on shiningu_game_act (uid);
|
||||
|
||||
19
act/save.go
Normal file
19
act/save.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package act
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
)
|
||||
|
||||
// 查询表格时候存在
|
||||
func (s *act) TableExists(name string) bool {
|
||||
Prefix := g.DB().GetPrefix()
|
||||
get, err := g.DB().TableFields(gctx.New(), Prefix+name)
|
||||
if err != nil {
|
||||
g.Log().Error(gctx.New(), err)
|
||||
}
|
||||
if get != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -11,7 +11,7 @@ var adapterRedisCache = gcache.New()
|
||||
func NewAdapterRedis() gcache.Adapter {
|
||||
|
||||
if adapterRedisClient == nil {
|
||||
adapterRedisClient = gcache.NewAdapterRedis(g.Redis("cache"))
|
||||
adapterRedisClient = gcache.NewAdapterRedis(g.Redis("default"))
|
||||
adapterRedisCache.SetAdapter(adapterRedisClient)
|
||||
}
|
||||
return adapterRedisCache
|
||||
|
||||
77
cmd/make.go
Normal file
77
cmd/make.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var (
|
||||
Make = gcmd.Command{
|
||||
Name: "make",
|
||||
Usage: "make",
|
||||
Brief: "创建模块文件",
|
||||
Arguments: []gcmd.Argument{
|
||||
{Name: "model", Short: "m", Brief: "模块名"},
|
||||
{Name: "id", Short: "i", Brief: "活动id"},
|
||||
{Name: "name", Short: "n", Brief: "服务文件名"},
|
||||
},
|
||||
Examples: "make -m=act -id=1: 创建活动1的接口与服务文件 \n" +
|
||||
"make -m=logic -n=test: 创建test的服务文件",
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
|
||||
//g.Dump(parser.GetOptAll(), parser.GetArgAll())
|
||||
//return
|
||||
var model = parser.GetOpt("model").String()
|
||||
//var name = parser.GetOpt("n").String()
|
||||
this := cMake{}
|
||||
switch model {
|
||||
case "act":
|
||||
var id = parser.GetOpt("id").Int()
|
||||
if id == 0 {
|
||||
return
|
||||
}
|
||||
err = this.Act(id)
|
||||
case "logic":
|
||||
var name = parser.GetOpt("name").String()
|
||||
if name == "" {
|
||||
return
|
||||
}
|
||||
err = this.Logic(name)
|
||||
}
|
||||
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
type cMake struct{}
|
||||
|
||||
func (c *cMake) Api() {
|
||||
|
||||
}
|
||||
|
||||
func (c *cMake) Act(id int) (err error) {
|
||||
filePath := fmt.Sprintf("api/act/v1/act%v.go", id)
|
||||
err = gfile.PutContents(filePath, "package v1\n")
|
||||
|
||||
filePath = fmt.Sprintf("internal/game/act/act%d/act%d.go", id, id)
|
||||
fileStr := gfile.GetContents("internal/cmd/make/act")
|
||||
fileStr = gstr.Replace(fileStr, "{id}", gconv.String(id))
|
||||
err = gfile.PutContents(filePath, fileStr)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cMake) Logic(name string) (err error) {
|
||||
var filePath = fmt.Sprintf("internal/logic/%s/%s.go", name, name)
|
||||
fileStr := gfile.GetContents("internal/cmd/make/logic")
|
||||
fileStr = gstr.Replace(fileStr, "{package}", name)
|
||||
fileStr = gstr.Replace(fileStr, "{name}", gstr.CaseCamel(name))
|
||||
|
||||
err = gfile.PutContents(filePath, fileStr)
|
||||
return
|
||||
}
|
||||
40
cmd/make/act
Normal file
40
cmd/make/act
Normal file
@@ -0,0 +1,40 @@
|
||||
package act{id}
|
||||
|
||||
import (
|
||||
v1 "game_server/api/act/v1"
|
||||
"game_server/internal/service"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
)
|
||||
|
||||
type sAct{id} struct {
|
||||
}
|
||||
|
||||
func New() *sAct{id} {
|
||||
return &sAct{id}{}
|
||||
}
|
||||
|
||||
var (
|
||||
ActId = {id}
|
||||
ctx = gctx.New()
|
||||
)
|
||||
|
||||
type Data struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
}
|
||||
|
||||
func (s *sAct{id}) GetData(uid int64) (data *Data) {
|
||||
get, _ := service.GameAct().Info(uid, ActId)
|
||||
get.Scan(&data)
|
||||
if get.IsEmpty() || data == nil {
|
||||
data = &Data{
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sAct{id}) SetData(uid int64, data interface{}) {
|
||||
service.GameAct().Set(uid, ActId, data)
|
||||
}
|
||||
25
cmd/make/logic
Normal file
25
cmd/make/logic
Normal file
@@ -0,0 +1,25 @@
|
||||
package {package}
|
||||
|
||||
import (
|
||||
"game_server/internal/service"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
)
|
||||
|
||||
type s{name} struct {
|
||||
}
|
||||
|
||||
var (
|
||||
ctx = gctx.New()
|
||||
)
|
||||
|
||||
func New() *s{name} {
|
||||
return &s{name}{}
|
||||
}
|
||||
|
||||
func init() {
|
||||
service.Register{name}(New())
|
||||
}
|
||||
|
||||
func (s *s{name}) Info() {
|
||||
|
||||
}
|
||||
124
cmd/update.go
Normal file
124
cmd/update.go
Normal file
@@ -0,0 +1,124 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/ayflying/utility_go/s3"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/os/gcfg"
|
||||
"github.com/gogf/gf/v2/os/gcmd"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
type serverCfg struct {
|
||||
Name string `json:"name" dc:"服务名"`
|
||||
Address string `json:"address" dc:"服务地址"`
|
||||
Prod bool `json:"prod" dc:"是否生产环境"`
|
||||
S3 string `json:"s3" dc:"使用哪个对象储存中转"`
|
||||
}
|
||||
|
||||
type UpdateReq struct {
|
||||
File *ghttp.UploadFile `json:"file" binding:"required" dc:"文件"`
|
||||
FileUrl string `json:"file_url" dc:"文件地址"`
|
||||
}
|
||||
|
||||
var s3Mod *s3.Mod
|
||||
|
||||
var (
|
||||
Update = gcmd.Command{
|
||||
Name: "update",
|
||||
Usage: "update",
|
||||
Brief: "更新系统",
|
||||
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
|
||||
|
||||
g.Log().Info(ctx, "准备上传更新文件")
|
||||
//加载编辑配置文件
|
||||
g.Cfg("hack").GetAdapter().(*gcfg.AdapterFile).SetFileName("hack/config.yaml")
|
||||
getFileName, err := g.Cfg("hack").Get(ctx, "gfcli.build.name")
|
||||
Filename := getFileName.String()
|
||||
|
||||
var list []*serverCfg
|
||||
serverList := g.Cfg().MustGet(ctx, "server_list")
|
||||
serverList.Scan(&list)
|
||||
|
||||
//如果有p或者prod参数,则删除prod字段为true的服务
|
||||
if parser.GetOpt("a").IsNil() {
|
||||
var temp []*serverCfg
|
||||
for _, v := range list {
|
||||
if v.Prod == false {
|
||||
temp = append(temp, v)
|
||||
}
|
||||
}
|
||||
list = temp
|
||||
} else {
|
||||
g.Dump("升级", parser.GetOpt("a"))
|
||||
}
|
||||
|
||||
g.Dump("需要更新的服务器", list)
|
||||
//获取上传链接
|
||||
var url = make(map[string]string)
|
||||
filename := "linux_amd64/" + Filename
|
||||
|
||||
client := g.Client()
|
||||
client.SetTimeout(time.Minute)
|
||||
client.SetDiscovery(nil)
|
||||
|
||||
//循环服务器,推送更新
|
||||
for _, v := range list {
|
||||
address := v.Address
|
||||
if v.S3 == "" {
|
||||
v.S3 = "default"
|
||||
}
|
||||
|
||||
//查询当前上传地址是否存在
|
||||
if _, ok := url[v.S3]; !ok {
|
||||
url[v.S3], err = UploadS3(v.S3, filename)
|
||||
if err != nil {
|
||||
g.Log().Error(ctx, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
g.Log().Debugf(ctx, "准备同步服务器:%v,url=%v", v.Name, address+"/callback/update")
|
||||
get, err := client.Post(ctx, address+"/callback/update", &UpdateReq{
|
||||
FileUrl: url[v.S3],
|
||||
})
|
||||
if err != nil {
|
||||
g.Log().Debugf(ctx, "切换代理进行上传:err=%v", err)
|
||||
get, err = client.Proxy("http://192.168.50.114:10808").
|
||||
Post(ctx, address+"/callback/update", &UpdateReq{
|
||||
FileUrl: url[v.S3],
|
||||
})
|
||||
}
|
||||
if err != nil {
|
||||
g.Log().Error(ctx, err)
|
||||
}
|
||||
defer get.Close()
|
||||
g.Log().Debugf(ctx, "同步服务器:%v,完成=%v", v.Name, address)
|
||||
}
|
||||
|
||||
return
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func UploadS3(typ string, filename string) (res string, err error) {
|
||||
//updateServerS3Name, _ := g.Config().Get(ctx, "update_server_s3_name")
|
||||
|
||||
s3Mod = s3.New(typ)
|
||||
bucketName := s3Mod.GetCfg().BucketName
|
||||
obj, err := os.Open(filename)
|
||||
ff, err := obj.Stat()
|
||||
_, err = s3Mod.PutObject(obj, filename, bucketName, ff.Size())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
//上传当前文件
|
||||
get, err := s3Mod.GetFileUrl(filename, bucketName)
|
||||
g.Log().Debugf(gctx.New(), "下载地址:%s", get)
|
||||
|
||||
res = get.String()
|
||||
return
|
||||
}
|
||||
101
elasticsearch/elasticsearch.go
Normal file
101
elasticsearch/elasticsearch.go
Normal file
@@ -0,0 +1,101 @@
|
||||
package elasticsearch
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/elastic/go-elasticsearch/v8"
|
||||
)
|
||||
|
||||
var (
|
||||
es *elasticsearch.TypedClient
|
||||
)
|
||||
|
||||
type elastic struct {
|
||||
client *elasticsearch.TypedClient
|
||||
}
|
||||
|
||||
func New(name ...string) *elastic {
|
||||
// ES 配置
|
||||
cfg := elasticsearch.Config{
|
||||
Addresses: []string{
|
||||
"http://ay.cname.com:9200",
|
||||
},
|
||||
}
|
||||
if es == nil {
|
||||
var err error
|
||||
es, err = elasticsearch.NewTypedClient(cfg)
|
||||
if err != nil {
|
||||
fmt.Printf("elasticsearch.NewTypedClient failed, err:%v\n", err)
|
||||
return &elastic{}
|
||||
}
|
||||
}
|
||||
return &elastic{
|
||||
client: es,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// createIndex 创建索引
|
||||
func (s *elastic) CreateIndex(name string) {
|
||||
resp, err := s.client.Indices.
|
||||
Create(name).
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
fmt.Printf("create index failed, err:%v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("index:%#v\n", resp.Index)
|
||||
}
|
||||
|
||||
// indexDocument 索引文档
|
||||
func (s *elastic) IndexDocument(name string, key string, data interface{}) {
|
||||
|
||||
// 添加文档
|
||||
resp, err := s.client.Index(name).
|
||||
Id(key).
|
||||
Document(data).
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
fmt.Printf("indexing document failed, err:%v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("result:%#v\n", resp.Result)
|
||||
}
|
||||
|
||||
// getDocument 获取文档
|
||||
func (s *elastic) GetDocument(name string, id string) (res json.RawMessage) {
|
||||
resp, err := s.client.Get(name, id).
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
fmt.Printf("get document by id failed, err:%v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("fileds:%s\n", resp.Source_)
|
||||
res = resp.Source_
|
||||
return
|
||||
}
|
||||
|
||||
// updateDocument 更新文档
|
||||
func (s *elastic) UpdateDocument(name string, key string, data interface{}) {
|
||||
|
||||
resp, err := s.client.Update(name, key).
|
||||
Doc(data). // 使用结构体变量更新
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
fmt.Printf("update document failed, err:%v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("result:%v\n", resp.Result)
|
||||
}
|
||||
|
||||
// deleteDocument 删除 document
|
||||
func (s *elastic) DeleteDocument(name string, key string) {
|
||||
resp, err := s.client.Delete(name, key).
|
||||
Do(context.Background())
|
||||
if err != nil {
|
||||
fmt.Printf("delete document failed, err:%v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("result:%v\n", resp.Result)
|
||||
}
|
||||
@@ -27,20 +27,32 @@ func Excel2Slice(filePath string, _sheet ...string) [][]string {
|
||||
|
||||
// 字符串转道具类型
|
||||
func (s *Excel) Spilt2Item(str string) (result [][]int64) {
|
||||
var parts []string
|
||||
parts1 := strings.Split(str, "|") // 分割字符串
|
||||
if parts1 == nil {
|
||||
parts1 = []string{str}
|
||||
var shadiao = []string{","}
|
||||
for _, v := range shadiao {
|
||||
str = strings.ReplaceAll(str, v, "|")
|
||||
//parts = append(parts, strings.Split(str, v)...) // 分割字符串
|
||||
}
|
||||
for _, v := range parts1 {
|
||||
parts2 := strings.Split(v, ",") // 分割字符串
|
||||
if parts2 == nil {
|
||||
parts = append(parts, v)
|
||||
} else {
|
||||
parts = append(parts, parts2...)
|
||||
}
|
||||
|
||||
//var parts []string
|
||||
parts := strings.Split(str, "|") // 分割字符串
|
||||
if parts == nil {
|
||||
parts = []string{str}
|
||||
}
|
||||
|
||||
//var parts []string
|
||||
//for _, v := range parts1 {
|
||||
// parts = append(parts, strings.Split(v, ",")...) // 分割字符串
|
||||
//}
|
||||
|
||||
//for _, v := range parts1 {
|
||||
// parts2 := strings.Split(v, ",") // 分割字符串
|
||||
// if parts2 == nil {
|
||||
// parts = append(parts, v)
|
||||
// } else {
|
||||
// parts = append(parts, parts2...)
|
||||
// }
|
||||
//}
|
||||
|
||||
for i := 0; i < len(parts)-1; i += 2 {
|
||||
num1, _ := strconv.ParseInt(parts[i], 10, 64)
|
||||
num2, _ := strconv.ParseInt(parts[i+1], 10, 64)
|
||||
|
||||
8
go.mod
8
go.mod
@@ -16,6 +16,8 @@ require (
|
||||
github.com/BurntSushi/toml v1.4.0 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/elastic/elastic-transport-go/v8 v8.6.0 // indirect
|
||||
github.com/elastic/go-elasticsearch/v8 v8.17.0 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
@@ -50,10 +52,10 @@ require (
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect
|
||||
github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 // indirect
|
||||
go.opentelemetry.io/otel v1.24.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.24.0 // indirect
|
||||
go.opentelemetry.io/otel v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.24.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
||||
golang.org/x/crypto v0.30.0 // indirect
|
||||
golang.org/x/net v0.32.0 // indirect
|
||||
golang.org/x/sys v0.28.0 // indirect
|
||||
|
||||
10
go.sum
10
go.sum
@@ -72,6 +72,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/elastic/elastic-transport-go/v8 v8.6.0 h1:Y2S/FBjx1LlCv5m6pWAF2kDJAHoSjSRSJCApolgfthA=
|
||||
github.com/elastic/elastic-transport-go/v8 v8.6.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
|
||||
github.com/elastic/go-elasticsearch/v8 v8.17.0 h1:e9cWksE/Fr7urDRmGPGp47Nsp4/mvNOrU8As1l2HQQ0=
|
||||
github.com/elastic/go-elasticsearch/v8 v8.17.0/go.mod h1:lGMlgKIbYoRvay3xWBeKahAiJOgmFDsjZC39nmO3H64=
|
||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
@@ -326,12 +330,18 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
|
||||
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
|
||||
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
|
||||
go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo=
|
||||
go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4=
|
||||
go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
|
||||
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
|
||||
go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q=
|
||||
go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s=
|
||||
go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw=
|
||||
go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg=
|
||||
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
|
||||
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
|
||||
go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g=
|
||||
go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
||||
|
||||
10
s3/s3.go
10
s3/s3.go
@@ -45,8 +45,6 @@ func New(_name ...string) *Mod {
|
||||
name = getName.String()
|
||||
}
|
||||
|
||||
get2, err := g.Cfg().Get(ctx, "s3")
|
||||
g.Dump(get2)
|
||||
get, err := g.Cfg().Get(ctx, "s3."+name)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
@@ -276,14 +274,14 @@ func (s *Mod) CopyObject(bucketName string, dstStr string, srcStr string) (err e
|
||||
|
||||
// 原始文件
|
||||
var dst = minio.CopyDestOptions{
|
||||
Bucket: dstStr,
|
||||
Object: bucketName,
|
||||
Bucket: bucketName,
|
||||
Object: dstStr,
|
||||
}
|
||||
|
||||
// 新文件
|
||||
var src = minio.CopySrcOptions{
|
||||
Bucket: srcStr,
|
||||
Object: bucketName,
|
||||
Bucket: bucketName,
|
||||
Object: srcStr,
|
||||
}
|
||||
|
||||
_, err = s.client.CopyObject(ctx, dst, src)
|
||||
|
||||
Reference in New Issue
Block a user