diff --git a/README.md b/README.md index 4048786..c1959b2 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ ```bash $ git clone https://github.com/rosbit/go-wxpay-gateway - $ cd go-wx-gateway + $ cd go-wxpay-gateway $ make ``` 3. 编译成功,会得到3个可执行程序 diff --git a/getsandbox.go b/getsandbox.go index 7a1672f..08725cc 100644 --- a/getsandbox.go +++ b/getsandbox.go @@ -4,8 +4,8 @@ package main import ( - "github.com/rosbit/go-wxpay-gateway/wx-pay-api" - "github.com/rosbit/go-wxpay-gateway/conf" + "go-wxpay-gateway/wx-pay-api" + "go-wxpay-gateway/conf" "fmt" ) diff --git a/go.mod b/go.mod index 14cc45a..6102170 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/rosbit/go-wxpay-gateway +module go-wxpay-gateway go 1.12 diff --git a/main.go b/main.go index b2dd130..636ef1f 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ package main import ( "os" "fmt" - "github.com/rosbit/go-wxpay-gateway/conf" + "go-wxpay-gateway/conf" ) // variables set via go build -ldflags diff --git a/notify-service.go b/notify-service.go index 7593e4f..d0fefe1 100644 --- a/notify-service.go +++ b/notify-service.go @@ -7,8 +7,8 @@ package main import ( lm "github.com/rosbit/logmerger" - "github.com/rosbit/go-wxpay-gateway/conf" - "github.com/rosbit/go-wxpay-gateway/utils" + "go-wxpay-gateway/conf" + "go-wxpay-gateway/utils" ) func StartService() error { diff --git a/rest/rest-close-order.go b/rest/rest-close-order.go index b91ed04..a005c02 100644 --- a/rest/rest-close-order.go +++ b/rest/rest-close-order.go @@ -2,8 +2,8 @@ package rest import ( "net/http" - "github.com/rosbit/go-wxpay-gateway/conf" - "github.com/rosbit/go-wxpay-gateway/wx-pay-api" + "go-wxpay-gateway/conf" + "go-wxpay-gateway/wx-pay-api" ) // POST /queryorder diff --git a/rest/rest-notify.go b/rest/rest-notify.go index 800d76e..abc77c8 100644 --- a/rest/rest-notify.go +++ b/rest/rest-notify.go @@ -5,9 +5,9 @@ import ( "fmt" "log" "io/ioutil" - "github.com/rosbit/go-wxpay-gateway/conf" - "github.com/rosbit/go-wxpay-gateway/wx-pay-api" - "github.com/rosbit/go-wxpay-gateway/utils" + "go-wxpay-gateway/conf" + "go-wxpay-gateway/wx-pay-api" + "go-wxpay-gateway/utils" ) const ( diff --git a/rest/rest-pay.go b/rest/rest-pay.go index 392f5f5..e2cb852 100644 --- a/rest/rest-pay.go +++ b/rest/rest-pay.go @@ -4,8 +4,8 @@ import ( "net/http" "fmt" "encoding/json" - "github.com/rosbit/go-wxpay-gateway/conf" - "github.com/rosbit/go-wxpay-gateway/wx-pay-api" + "go-wxpay-gateway/conf" + "go-wxpay-gateway/wx-pay-api" ) const ( diff --git a/rest/rest-query-order.go b/rest/rest-query-order.go index 98150db..c6b6f33 100644 --- a/rest/rest-query-order.go +++ b/rest/rest-query-order.go @@ -2,8 +2,8 @@ package rest import ( "net/http" - "github.com/rosbit/go-wxpay-gateway/conf" - "github.com/rosbit/go-wxpay-gateway/wx-pay-api" + "go-wxpay-gateway/conf" + "go-wxpay-gateway/wx-pay-api" ) // POST /queryorder diff --git a/rest/rest-refund.go b/rest/rest-refund.go index a5d334b..b9fe138 100644 --- a/rest/rest-refund.go +++ b/rest/rest-refund.go @@ -2,8 +2,8 @@ package rest import ( "net/http" - "github.com/rosbit/go-wxpay-gateway/conf" - "github.com/rosbit/go-wxpay-gateway/wx-pay-api" + "go-wxpay-gateway/conf" + "go-wxpay-gateway/wx-pay-api" ) // POST /refundment diff --git a/rest/sandbox-utils.go b/rest/sandbox-utils.go index 71b13a7..f2cfd1a 100644 --- a/rest/sandbox-utils.go +++ b/rest/sandbox-utils.go @@ -1,17 +1,13 @@ package rest +import ( + "strings" +) + const ( SANDBOX_SUFFIX = "-dev" // pay-app名称有该后缀,表示使用sandbox方式 ) func _IsSandbox(payApp string) (isSandbox bool) { - sl := len(SANDBOX_SUFFIX) - al := len(payApp) - if al <= sl { - return false - } - if payApp[al-sl:] == SANDBOX_SUFFIX { - return true - } - return false + return strings.HasSuffix(payApp, SANDBOX_SUFFIX) } diff --git a/router-gateway.go b/router-gateway.go index 93e99ef..b896e82 100644 --- a/router-gateway.go +++ b/router-gateway.go @@ -11,10 +11,10 @@ import ( "github.com/gernest/alien" "net/http" "fmt" - "github.com/rosbit/go-wxpay-gateway/conf" - "github.com/rosbit/go-wxpay-gateway/rest" - "github.com/rosbit/go-wxpay-gateway/wx-pay-api" - "github.com/rosbit/go-wxpay-gateway/utils" + "go-wxpay-gateway/conf" + "go-wxpay-gateway/rest" + "go-wxpay-gateway/wx-pay-api" + "go-wxpay-gateway/utils" ) func StartService() error { diff --git a/utils/notify-service.go b/utils/notify-service.go index 3a7c7ce..85d433e 100644 --- a/utils/notify-service.go +++ b/utils/notify-service.go @@ -16,7 +16,7 @@ import ( "strconv" "time" "log" - "github.com/rosbit/go-wxpay-gateway/conf" + "go-wxpay-gateway/conf" ) const (