This commit is contained in:
shaoyongjun 2023-06-04 23:26:48 +08:00
parent d95c75f5fa
commit cd29e19c84
23 changed files with 31 additions and 28 deletions

View File

@ -6,7 +6,6 @@ import (
"ai-gateway/common/utils" "ai-gateway/common/utils"
"ai-gateway/infrastructure/remote_http" "ai-gateway/infrastructure/remote_http"
"ai-gateway/infrastructure/repository" "ai-gateway/infrastructure/repository"
"code.freebrio.com/fb-go/lib/fbl"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"net/http" "net/http"
) )

View File

@ -3,7 +3,6 @@ package config
import ( import (
"ai-gateway/common/utils" "ai-gateway/common/utils"
"bytes" "bytes"
"code.freebrio.com/fb-go/lib/fbl"
"embed" "embed"
"fmt" "fmt"
"github.com/spf13/viper" "github.com/spf13/viper"

View File

@ -1,8 +1,8 @@
package utils package utils
import ( import (
"code.freebrio.com/fb-go/lib/errors" "code.mylomen.com/syj/lib/errors"
"code.freebrio.com/fb-go/lib/fbl" "gorm.io/gorm/utils"
) )
type Result struct { type Result struct {
@ -42,8 +42,8 @@ func OkEmptyPageResult(anchor any) Result {
return Result{ return Result{
Code: ok.ToInt(), Code: ok.ToInt(),
Data: PageResult[interface{}]{ Data: PageResult[interface{}]{
Anchor: utils.ToString(anchor), Anchor: ToString(anchor),
End: fbl.ToPtr(true), End: ToPtr(true),
List: emptyList, List: emptyList,
}, },
} }

View File

@ -1 +1,5 @@
package utils package utils
func ToPtr[T any](data T) *T {
return &data
}

2
go.mod
View File

@ -3,7 +3,7 @@ module ai-gateway
go 1.20 go 1.20
require ( require (
code.freebrio.com/fb-go/lib v0.4.1 code.mylomen.com/syj/lib v0.0.3
github.com/go-playground/validator v9.31.0+incompatible github.com/go-playground/validator v9.31.0+incompatible
github.com/go-redis/redis/v8 v8.11.5 github.com/go-redis/redis/v8 v8.11.5
github.com/google/uuid v1.3.0 github.com/google/uuid v1.3.0

4
go.sum
View File

@ -45,8 +45,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
code.freebrio.com/fb-go/lib v0.4.1 h1:eu7vpXOGL7pErH85H/smh7WMjumX/e3YHY5+PnpgWQo= code.mylomen.com/syj/lib v0.0.3 h1:haq4eBhYq6Zep29ksjLpspzjng0oBxzQhmJB2jMdjjQ=
code.freebrio.com/fb-go/lib v0.4.1/go.mod h1:w3vdqKmQIGcJSR6x0+Uza0R8mI/PR8WAuDk2vDZSXas= code.mylomen.com/syj/lib v0.0.3/go.mod h1:fM8H0KebN5D0GJN9/tf1++s64DsyFvqpUsduN8gpy3o=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=

View File

@ -3,7 +3,7 @@ package remote_http
import ( import (
"ai-gateway/common/dto" "ai-gateway/common/dto"
"ai-gateway/common/utils" "ai-gateway/common/utils"
"code.freebrio.com/fb-go/lib/context" "code.mylomen.com/syj/lib/context"
"fmt" "fmt"
) )

View File

@ -2,7 +2,7 @@ package remote_http
import ( import (
"ai-gateway/common/dto" "ai-gateway/common/dto"
"code.freebrio.com/fb-go/lib/context" "code.mylomen.com/syj/lib/context"
) )
type aiApi interface { type aiApi interface {

View File

@ -3,14 +3,15 @@ package repository
import ( import (
"ai-gateway/common/config" "ai-gateway/common/config"
"ai-gateway/common/constant" "ai-gateway/common/constant"
"code.mylomen.com/syj/lib/fbl"
"database/sql" "database/sql"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"os" "os"
"time" "time"
fbcontext "code.freebrio.com/fb-go/lib/context" fbcontext "code.mylomen.com/syj/lib/context"
"code.freebrio.com/fb-go/lib/gorm/logger" "code.mylomen.com/syj/lib/gorm/logger"
_ "github.com/spf13/viper/remote" _ "github.com/spf13/viper/remote"
"gorm.io/driver/mysql" "gorm.io/driver/mysql"
@ -40,7 +41,7 @@ func getInstance() *gorm.DB {
}) })
if instanceErr != nil { if instanceErr != nil {
utils.Log().Sugar().Errorf("mysql_getInstance instanceErr: %v", instanceErr) fbl.Log().Sugar().Errorf("mysql_getInstance instanceErr: %v", instanceErr)
os.Exit(-1) os.Exit(-1)
} }

View File

@ -1,6 +1,6 @@
package repository package repository
import "code.freebrio.com/fb-go/lib/context" import "code.mylomen.com/syj/lib/context"
type thirdAgentCorpRepository interface { type thirdAgentCorpRepository interface {
QueryPage(ctx context.GormWithZap, page, size int) *[]FThirdAgentCorpRelationDO QueryPage(ctx context.GormWithZap, page, size int) *[]FThirdAgentCorpRelationDO

View File

@ -2,7 +2,7 @@ package repository
import ( import (
"ai-gateway/common/utils" "ai-gateway/common/utils"
"code.freebrio.com/fb-go/lib/context" "code.mylomen.com/syj/lib/context"
"time" "time"
) )

View File

@ -1,6 +1,6 @@
package repository package repository
import "code.freebrio.com/fb-go/lib/context" import "code.mylomen.com/syj/lib/context"
type thirdAgentInfoRepository interface { type thirdAgentInfoRepository interface {
QueryPage(ctx context.GormWithZap, page, size int) *[]FThirdAgentInfoDO QueryPage(ctx context.GormWithZap, page, size int) *[]FThirdAgentInfoDO

View File

@ -2,7 +2,7 @@ package repository
import ( import (
"ai-gateway/common/utils" "ai-gateway/common/utils"
"code.freebrio.com/fb-go/lib/context" "code.mylomen.com/syj/lib/context"
"time" "time"
) )

View File

@ -1,6 +1,6 @@
package repository package repository
import "code.freebrio.com/fb-go/lib/context" import "code.mylomen.com/syj/lib/context"
type thirdCorpInfoRepository interface { type thirdCorpInfoRepository interface {
QueryPage(ctx context.GormWithZap, page, size int) *[]FThirdCorpInfoDO QueryPage(ctx context.GormWithZap, page, size int) *[]FThirdCorpInfoDO

View File

@ -2,7 +2,7 @@ package repository
import ( import (
"ai-gateway/common/utils" "ai-gateway/common/utils"
"code.freebrio.com/fb-go/lib/context" "code.mylomen.com/syj/lib/context"
"time" "time"
) )

View File

@ -1,6 +1,6 @@
package repository package repository
import "code.freebrio.com/fb-go/lib/context" import "code.mylomen.com/syj/lib/context"
type thirdCorpUserAccountRepository interface { type thirdCorpUserAccountRepository interface {
QueryPage(ctx context.GormWithZap, page, size int) *[]FThirdCorpUserAccountDO QueryPage(ctx context.GormWithZap, page, size int) *[]FThirdCorpUserAccountDO

View File

@ -2,7 +2,7 @@ package repository
import ( import (
"ai-gateway/common/utils" "ai-gateway/common/utils"
"code.freebrio.com/fb-go/lib/context" "code.mylomen.com/syj/lib/context"
"time" "time"
) )

View File

@ -1,6 +1,6 @@
package repository package repository
import "code.freebrio.com/fb-go/lib/context" import "code.mylomen.com/syj/lib/context"
type thirdCorpUserLogRepository interface { type thirdCorpUserLogRepository interface {
QueryList(ctx context.GormWithZap, id uint64, size int) *[]FThirdCorpUserLogDO QueryList(ctx context.GormWithZap, id uint64, size int) *[]FThirdCorpUserLogDO

View File

@ -1,7 +1,7 @@
package repository package repository
import ( import (
"code.freebrio.com/fb-go/lib/context" "code.mylomen.com/syj/lib/context"
"time" "time"
) )

View File

@ -1,6 +1,6 @@
package repository package repository
import "code.freebrio.com/fb-go/lib/context" import "code.mylomen.com/syj/lib/context"
type thirdUserTokenRepository interface { type thirdUserTokenRepository interface {
FindByToken(ctx context.GormWithZap, token string) *FThirdUserTokenDO FindByToken(ctx context.GormWithZap, token string) *FThirdUserTokenDO

View File

@ -1,7 +1,7 @@
package repository package repository
import ( import (
"code.freebrio.com/fb-go/lib/context" "code.mylomen.com/syj/lib/context"
"gorm.io/gorm/clause" "gorm.io/gorm/clause"
"time" "time"
) )

View File

@ -1,6 +1,6 @@
package service package service
import "code.freebrio.com/fb-go/lib/context" import "code.mylomen.com/syj/lib/context"
type limit struct { type limit struct {
} }

View File

@ -6,7 +6,7 @@ import (
"ai-gateway/common/utils" "ai-gateway/common/utils"
"ai-gateway/infrastructure/redis" "ai-gateway/infrastructure/redis"
"ai-gateway/infrastructure/repository" "ai-gateway/infrastructure/repository"
"code.freebrio.com/fb-go/lib/context" "code.mylomen.com/syj/lib/context"
"crypto/sha256" "crypto/sha256"
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"