Compare commits

...

5 Commits

Author SHA1 Message Date
ayflying
754fd11ad2 自动生成支持新版 2025-03-04 14:49:26 +08:00
ayflying
4bd9d101c7 更新其他库 2025-03-04 14:32:00 +08:00
ayflying
eee58c8da8 更新excel版本库 2025-03-04 14:30:18 +08:00
ayflying
c281b4a30d 导表工具增加json格式 2025-03-04 14:10:32 +08:00
ayflying
74a746bc47 修改路径 2025-02-28 17:45:44 +08:00
32 changed files with 46 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
package act{id}
import (
"game_server/internal/service"
service2 "github.com/ayflying/utility_go/service"
"github.com/gogf/gf/v2/os/gctx"
)
@@ -25,7 +25,7 @@ func init() {
}
func (s *sAct{id}) GetData(uid int64) (data *Data) {
get, _ := service.GameAct().Info(uid, ActId)
get, _ := service2.GameAct().Info(uid, ActId)
get.Scan(&data)
if get.IsEmpty() || get.IsNil() || data == nil {
data = &Data{
@@ -35,5 +35,5 @@ func (s *sAct{id}) GetData(uid int64) (data *Data) {
}
func (s *sAct{id}) SetData(uid int64, data interface{}) {
service.GameAct().Set(uid, ActId, data)
service2.GameAct().Set(uid, ActId, data)
}

View File

@@ -2,7 +2,7 @@ package cmd
import (
"context"
"github.com/ayflying/utility_go/s3"
"github.com/ayflying/utility_go/package/s3"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/os/gcfg"

10
go.mod
View File

@@ -4,11 +4,12 @@ go 1.23.0
require (
github.com/apolloconfig/agollo/v4 v4.4.0
github.com/ayflying/excel2json v1.1.2
github.com/elastic/go-elasticsearch/v8 v8.17.0
github.com/ayflying/excel2json v1.1.3
github.com/elastic/go-elasticsearch/v8 v8.17.1
github.com/go-pay/crypto v0.0.1
github.com/go-pay/gopay v1.5.109
github.com/go-pay/util v0.0.4
github.com/goccy/go-json v0.10.4
github.com/gogf/gf/contrib/config/apollo/v2 v2.8.3
github.com/gogf/gf/v2 v2.8.3
github.com/lionsoul2014/ip2region/binding/golang v0.0.0-20241220152942-06eb5c6e8230
@@ -25,7 +26,7 @@ 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/elastic-transport-go/v8 v8.6.1 // 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
@@ -36,7 +37,6 @@ require (
github.com/go-pay/smap v0.0.2 // indirect
github.com/go-pay/xlog v0.0.3 // indirect
github.com/go-pay/xtime v0.0.2 // indirect
github.com/goccy/go-json v0.10.4 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.6.0 // indirect
@@ -60,7 +60,7 @@ require (
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rs/xid v1.6.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.8.1 // indirect

14
go.sum
View File

@@ -52,8 +52,8 @@ github.com/apolloconfig/agollo/v4 v4.4.0/go.mod h1:6WjI68IzqMk/Y6ghMtrj5AX6Uewo2
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/ayflying/excel2json v1.1.2 h1:ERMDUvN2H/9jQmbFo5Rt1XJAvWdMTzIAsI4p4Fp/wRA=
github.com/ayflying/excel2json v1.1.2/go.mod h1:aNzB271bUAuRq+P4J+S8a3NAltcghLIGR2HdM6akqFU=
github.com/ayflying/excel2json v1.1.3 h1:Qy7HnF5aib7lIknaOqICvvZsSwAieLu6KJFeUccOISo=
github.com/ayflying/excel2json v1.1.3/go.mod h1:aNzB271bUAuRq+P4J+S8a3NAltcghLIGR2HdM6akqFU=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -73,10 +73,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/elastic/elastic-transport-go/v8 v8.6.1 h1:h2jQRqH6eLGiBSN4eZbQnJLtL4bC5b4lfVFRjw2R4e4=
github.com/elastic/elastic-transport-go/v8 v8.6.1/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
github.com/elastic/go-elasticsearch/v8 v8.17.1 h1:bOXChDoCMB4TIwwGqKd031U8OXssmWLT3UrAr9EGs3Q=
github.com/elastic/go-elasticsearch/v8 v8.17.1/go.mod h1:MVJCtL+gJJ7x5jFeUmA20O7rvipX8GcQmo5iBcmaJn4=
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=
@@ -308,6 +308,8 @@ github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=

View File

@@ -2,7 +2,7 @@ package act
import (
"fmt"
"github.com/ayflying/utility_go/aycache"
"github.com/ayflying/utility_go/package/aycache"
"github.com/ayflying/utility_go/service"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/os/gctx"

View File

@@ -2,10 +2,10 @@ package gameAct
import (
"fmt"
"github.com/ayflying/utility_go/aycache"
"github.com/ayflying/utility_go/internal/game/act"
"github.com/ayflying/utility_go/internal/model/do"
"github.com/ayflying/utility_go/internal/model/entity"
"github.com/ayflying/utility_go/package/aycache"
service2 "github.com/ayflying/utility_go/service"
"github.com/ayflying/utility_go/tools"
"github.com/gogf/gf/v2/container/gset"

View File

@@ -1,7 +1,7 @@
package aycache
import (
"github.com/ayflying/utility_go/aycache/drive"
"github.com/ayflying/utility_go/package/aycache/drive"
"github.com/gogf/gf/v2/os/gcache"
)

View File

@@ -3,6 +3,7 @@ package excel
import (
"context"
"github.com/ayflying/excel2json"
"github.com/goccy/go-json"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
@@ -27,6 +28,7 @@ type FileItem struct {
Items []string `json:"items" dc:"道具字段"`
ItemsMap []string `json:"items_map" dc:"道具字段map格式"`
Slice map[string]string `json:"slice" dc:"切片"`
Json []string `json:"json" dc:"json"`
}
type Excel struct {
@@ -78,6 +80,10 @@ func (s *Excel) ExcelLoad(ctx context.Context, fileItem *FileItem, mainPath stri
if len(fileItem.Slice) > 0 {
list = s.sliceFormat(list, fileItem.Slice)
}
//json格式转换
if len(fileItem.Json) > 0 {
list = s.jsonFormat(list, fileItem.Json)
}
//拼接json
tempJson = append(tempJson, list...)
@@ -177,3 +183,20 @@ func (s *Excel) sliceFormat(list []interface{}, Slice map[string]string) []inter
return list
}
func (s *Excel) jsonFormat(list []interface{}, Items []string) []interface{} {
for k2, v2 := range list {
for k3, v3 := range v2.(g.Map) {
if gstr.InArray(Items, k3) {
if _, ok := v3.(string); ok {
var get interface{}
json.Unmarshal([]byte(v3.(string)), &get)
list[k2].(g.Map)[k3] = get
} else {
g.Log().Errorf(gctx.New(), "当前类型断言失败:%v,list=%v", v3, v2)
}
}
}
}
return list
}

View File

@@ -2,7 +2,7 @@ package pay
import (
"context"
playstore2 "github.com/ayflying/utility_go/pay/playstore"
"github.com/ayflying/utility_go/package/pay/playstore"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/text/gstr"
@@ -16,14 +16,14 @@ var (
// GooglePay 是一个处理Google支付的结构体。
type GooglePay struct {
c *playstore2.Client
c *playstore.Client
}
// Init 初始化GooglePay客户端。
// data: 初始化客户端所需的配置数据。
func (p *GooglePay) Init(data []byte) {
var err error
p.c, err = playstore2.New(data)
p.c, err = playstore.New(data)
if err != nil {
panic(err) // 如果初始化失败则panic。
}