Skip to content

Commit

Permalink
Update golib package upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
钟永标 committed Jan 12, 2024
1 parent 8af2aba commit b8c8bd4
Show file tree
Hide file tree
Showing 36 changed files with 187 additions and 279 deletions.
3 changes: 2 additions & 1 deletion app.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package zgin

import (
"net/http"

"github.com/ZYallers/golib/utils/logger"
"github.com/ZYallers/zgin/helper/config"
"github.com/ZYallers/zgin/option"
"github.com/ZYallers/zgin/types"
"github.com/gin-gonic/gin"
"net/http"
)

var app *types.App
Expand Down
1 change: 1 addition & 0 deletions cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "1.0.0",
"http_addr": "0.0.0.0:9999",
"log_dir": "/apps/logs/go/zgin",
"trace_log_dir": "/apps/logs/go/trace",
"version_key": "app_version",
"sign_key": "sign",
"sign_time_key": "utime",
Expand Down
18 changes: 0 additions & 18 deletions example/cfg.json

This file was deleted.

48 changes: 0 additions & 48 deletions example/controller/v000/person.go

This file was deleted.

41 changes: 0 additions & 41 deletions example/controller/v100/person.go

This file was deleted.

35 changes: 0 additions & 35 deletions example/main.go

This file was deleted.

14 changes: 0 additions & 14 deletions example/route/000.go

This file was deleted.

10 changes: 0 additions & 10 deletions example/route/100.go

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ZYallers/zgin
go 1.15

require (
github.com/ZYallers/golib v1.2.26
github.com/ZYallers/golib v1.3.26
github.com/arl/statsviz v0.2.2
github.com/gin-gonic/gin v1.5.0
github.com/go-redis/redis v6.15.9+incompatible
Expand Down
3 changes: 2 additions & 1 deletion handler/engine.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package handler

import (
"net/http"

"github.com/ZYallers/zgin/consts"
"github.com/ZYallers/zgin/option"
"github.com/ZYallers/zgin/types"
"github.com/gin-gonic/gin"
"net/http"
)

func WithNoRoute() option.App {
Expand Down
7 changes: 4 additions & 3 deletions handler/expvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"encoding/json"
"expvar"
"fmt"
"github.com/ZYallers/zgin/option"
"github.com/ZYallers/zgin/types"
"github.com/gin-gonic/gin"
"net/http"
"runtime"
"strconv"
"time"

"github.com/ZYallers/zgin/option"
"github.com/ZYallers/zgin/types"
"github.com/gin-gonic/gin"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions handler/pprof.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package handler

import (
"net/http"
"net/http/pprof"

"github.com/ZYallers/zgin/option"
"github.com/ZYallers/zgin/types"
"github.com/gin-gonic/gin"
"net/http"
"net/http/pprof"
)

const (
Expand Down
7 changes: 4 additions & 3 deletions handler/prometheus.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package handler

import (
"os"
"strings"
"sync"

"github.com/ZYallers/zgin/option"
"github.com/ZYallers/zgin/types"
"github.com/gin-gonic/gin"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"os"
"strings"
"sync"
)

var (
Expand Down
7 changes: 4 additions & 3 deletions handler/stats.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package handler

import (
"math/rand"
"strconv"
"time"

"github.com/ZYallers/zgin/option"
"github.com/ZYallers/zgin/types"
"github.com/arl/statsviz"
"github.com/gin-gonic/gin"
"math/rand"
"strconv"
"time"
)

func WithStats(acts gin.Accounts) option.App {
Expand Down
7 changes: 4 additions & 3 deletions handler/swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package handler

import (
"fmt"
"io/ioutil"
"net/http"
"os"

"github.com/ZYallers/golib/funcs/files"
"github.com/ZYallers/zgin/option"
"github.com/ZYallers/zgin/types"
"github.com/gin-gonic/gin"
"io/ioutil"
"net/http"
"os"
)

func WithSwagger() option.App {
Expand Down
3 changes: 2 additions & 1 deletion helper/config/app.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package config

import (
"github.com/spf13/viper"
"path"
"runtime"
"strings"
"sync"

"github.com/spf13/viper"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion helper/dingtalk/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package dingtalk

import (
"os"

"github.com/ZYallers/golib/funcs/nets"
"github.com/ZYallers/zgin/helper/config"
"os"
)

var systemIP, publicIP, hostName, name, httpAddr, gracefulToken, errorToken string
Expand Down
17 changes: 6 additions & 11 deletions helper/dingtalk/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ package dingtalk

import (
"fmt"
"github.com/ZYallers/golib/funcs/nets"
"github.com/ZYallers/golib/utils/curl"
"github.com/gin-gonic/gin"
"strings"
"time"
)

const (
timeout = 3 * time.Second
prefix = "https://oapi.dingtalk.com/robot/send?access_token="
"github.com/ZYallers/golib/funcs/nets"
"github.com/ZYallers/golib/utils/curl"
"github.com/gin-gonic/gin"
)

var headers = map[string]string{"Content-Type": "application/json;charset=utf-8"}

func PushSimpleMessage(msg interface{}, isAtAll bool) {
PushMessage(getGracefulToken(), msg, isAtAll)
}
Expand All @@ -26,7 +20,7 @@ func PushContextMessage(ctx *gin.Context, msg interface{}, reqStr string, stack

func PushMessage(token string, msg interface{}, options ...interface{}) {
defer func() { recover() }()
title := fmt.Sprintf("%v", msg)
title := fmt.Sprint(msg)
if token == "" || title == "" {
return
}
Expand Down Expand Up @@ -66,5 +60,6 @@ func PushMessage(token string, msg interface{}, options ...interface{}) {
"text": map[string]string{"content": strings.Join(text, "\n") + "\n"},
"at": map[string]interface{}{"isAtAll": isAtAll},
}
_, _ = curl.NewRequest(prefix + token).SetHeaders(headers).SetTimeOut(timeout).SetPostData(data).Post()
_, _ = curl.NewRequest("https://oapi.dingtalk.com/robot/send?access_token=" + token).
SetContentType("application/json").SetTimeOut(3 * time.Second).SetPostData(data).Post()
}
5 changes: 3 additions & 2 deletions helper/grace/graceful.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package grace
import (
"context"
"fmt"
"github.com/ZYallers/zgin/helper/dingtalk"
"go.uber.org/zap"
"net/http"
"os"
"os/signal"
"syscall"
"time"

"github.com/ZYallers/zgin/helper/dingtalk"
"go.uber.org/zap"
)

func pushLog(msg string, fn func(string, ...zap.Field)) {
Expand Down
Loading

0 comments on commit b8c8bd4

Please sign in to comment.