更新SSO请求地址

This commit is contained in:
余 欣怀 2023-02-21 20:58:53 +08:00
parent 1bd1a66cfe
commit 58afabebe9
35 changed files with 86 additions and 74 deletions

View File

@ -15,11 +15,11 @@
``` ```
### 2.引入 ### 2.引入
```go ```go
go get -u golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk go get -u golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk
``` ```
或 Go Module 或 Go Module
```go ```go
import "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" import "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
``` ```
### 3.服务端认证及返回处理 ### 3.服务端认证及返回处理
@ -34,9 +34,9 @@ package applications
import ( import (
"github.com/astaxie/beego" "github.com/astaxie/beego"
"github.com/astaxie/beego/context" "github.com/astaxie/beego/context"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/credentials" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth/credentials"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/signers" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth/signers"
"golib.gaore.com/GaoreGo/grlogs" "golib.gaore.com/GaoreGo/grlogs"
) )
@ -81,7 +81,7 @@ func init() {
在`services`目录下以服务归类新建文件夹, 如`jedi`为短信服务,以 `RpcRequest``BaseResponse` 以基类写好请求子类和响应子类。一个请求接口对应一对请求和响应类。 在`services`目录下以服务归类新建文件夹, 如`jedi`为短信服务,以 `RpcRequest``BaseResponse` 以基类写好请求子类和响应子类。一个请求接口对应一对请求和响应类。
```go ```go
import "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" import "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
const ( const (
HOST = "jedi" // 如果非全域名会自动补全.gaore.com , 如jedi 会自动补全jedi.goare.com, 也可以打全域名 test.uu89.com HOST = "jedi" // 如果非全域名会自动补全.gaore.com , 如jedi 会自动补全jedi.goare.com, 也可以打全域名 test.uu89.com
@ -132,8 +132,8 @@ GET param_1=111&param_2=10086&param_3=false
package jedi package jedi
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
// 定义请求体 // 定义请求体

View File

@ -1,6 +1,6 @@
package auth package auth
import "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" import "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/utils"
var debug utils.Debug var debug utils.Debug

View File

@ -4,8 +4,8 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/utils"
"net/http" "net/http"
"net/url" "net/url"
"sort" "sort"

View File

@ -4,8 +4,8 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/utils"
"net/http" "net/http"
"net/url" "net/url"
"strconv" "strconv"

View File

@ -4,8 +4,8 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/utils"
"net/http" "net/http"
"net/url" "net/url"
"strconv" "strconv"

View File

@ -2,10 +2,10 @@ package auth
import ( import (
"errors" "errors"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/credentials" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth/credentials"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/signers" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth/signers"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
"net/http" "net/http"
) )

View File

@ -4,7 +4,7 @@ import (
"crypto/hmac" "crypto/hmac"
"crypto/sha1" "crypto/sha1"
"encoding/base64" "encoding/base64"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/credentials" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth/credentials"
) )
type AccessKeySigner struct { type AccessKeySigner struct {

View File

@ -4,7 +4,7 @@ import (
"crypto/hmac" "crypto/hmac"
"crypto/sha256" "crypto/sha256"
"encoding/base64" "encoding/base64"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/credentials" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth/credentials"
) )
type AliAppcodeSigner struct { type AliAppcodeSigner struct {

View File

@ -3,7 +3,7 @@ package signers
import ( import (
"crypto/md5" "crypto/md5"
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/credentials" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth/credentials"
) )
type StsTokenSigner struct { type StsTokenSigner struct {

View File

@ -5,11 +5,11 @@ import (
"context" "context"
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/credentials" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/auth/credentials"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/utils"
"net" "net"
"net/http" "net/http"
"net/http/httputil" "net/http/httputil"
@ -24,7 +24,7 @@ import (
var Version = "0.0.1" var Version = "0.0.1"
var defaultConnectTimeout = 5 * time.Second var defaultConnectTimeout = 5 * time.Second
var defaultReadTimeout = 10 * time.Second var defaultReadTimeout = 10 * time.Second
var defaultDomain = ".gaore.com" var defaultDomain = ".gaore.com.hk"
var DefaultUserAgent = fmt.Sprintf("GaoreGoSdk (%s;%s) Golang/%s Core/%s", runtime.GOOS, runtime.GOARCH, strings.Trim(runtime.Version(), "go"), Version) var DefaultUserAgent = fmt.Sprintf("GaoreGoSdk (%s;%s) Golang/%s Core/%s", runtime.GOOS, runtime.GOARCH, strings.Trim(runtime.Version(), "go"), Version)
var debug utils.Debug var debug utils.Debug

View File

@ -1,7 +1,7 @@
package sdk package sdk
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/utils"
"net/http" "net/http"
"time" "time"
) )

View File

@ -3,7 +3,7 @@ package requests
import ( import (
"errors" "errors"
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/utils"
"io" "io"
"math/cmplx" "math/cmplx"
"reflect" "reflect"
@ -236,7 +236,7 @@ func defaultBaseRequest() (request *baseRequest) {
Method: GET, Method: GET,
QueryParams: make(map[string]string), QueryParams: make(map[string]string),
Headers: map[string]string{ Headers: map[string]string{
"Gr-Sdk-Client": "golang/1.14", "Gr-Sdk-Client": "golang/1.19.4",
"Gr-Sdk-Invoke-Type": "normal", "Gr-Sdk-Invoke-Type": "normal",
"Accept-Encoding": Json, "Accept-Encoding": Json,
}, },

View File

@ -2,7 +2,7 @@ package requests
import ( import (
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/utils"
"io" "io"
"strings" "strings"
) )

View File

@ -4,7 +4,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strings" "strings"

View File

@ -1,8 +1,8 @@
package apk package apk
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type AddApkRequest struct { type AddApkRequest struct {

View File

@ -1,8 +1,8 @@
package apk package apk
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type AddTopRequest struct { type AddTopRequest struct {

View File

@ -2,8 +2,8 @@ package apk
import ( import (
"encoding/json" "encoding/json"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
) )
const ( const (

View File

@ -1,8 +1,8 @@
package apk package apk
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type RefreshApkRequest struct { type RefreshApkRequest struct {

View File

@ -1,8 +1,8 @@
package apk package apk
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
"time" "time"
) )

View File

@ -1,8 +1,8 @@
package callback package callback
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
) )
const ( const (

View File

@ -1,8 +1,8 @@
package callback package callback
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
const OS_ANDROID = 2 const OS_ANDROID = 2

View File

@ -4,7 +4,7 @@
```go ```go
import ( import (
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/services/jedi" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/services/jedi"
) )
func main() { func main() {

View File

@ -1,8 +1,8 @@
package jedi package jedi
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"strings" "strings"
) )

View File

@ -1,8 +1,8 @@
package jedi package jedi
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type SendSmsRequest struct { type SendSmsRequest struct {

View File

@ -3,8 +3,8 @@ package mail
import ( import (
"crypto/md5" "crypto/md5"
"fmt" "fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"time" "time"
) )

View File

@ -1,8 +1,8 @@
package mail package mail
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type PostEmailRequest struct { type PostEmailRequest struct {

View File

@ -1,8 +1,8 @@
package mkt package mkt
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
) )
const ( const (

View File

@ -1,8 +1,8 @@
package mkt package mkt
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
// PkgNoticeRequest 打包通知请求信息 // PkgNoticeRequest 打包通知请求信息

View File

@ -1,8 +1,8 @@
package sso package sso
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
) )
const ( const (
@ -11,6 +11,18 @@ const (
var HOST = requests.Host{ var HOST = requests.Host{
Default: "sso", Default: "sso",
Func: func(s string) string {
host := map[string]string{
requests.RELEASE: "sso.gaore.com.hk",
requests.PRE: "sso.gaore.com",
requests.TEST: "sso.gaore.com",
}
if s, ok := host[s]; ok {
return s
} else {
return "sso.gaore.com.hk"
}
},
} }
type Client struct { type Client struct {

View File

@ -1,8 +1,8 @@
package sso package sso
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type CodeAuthRequest struct { type CodeAuthRequest struct {

View File

@ -1,8 +1,8 @@
package sso package sso
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type GetUserInfoRequest struct { type GetUserInfoRequest struct {

View File

@ -1,8 +1,8 @@
package sso package sso
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type RefreshTokenRequest struct { type RefreshTokenRequest struct {

View File

@ -1,8 +1,8 @@
package sso package sso
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type SearchUserRequest struct { type SearchUserRequest struct {

View File

@ -1,8 +1,8 @@
package www package www
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
) )
const ( const (

View File

@ -1,8 +1,8 @@
package www package www
import ( import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/haiwai-common-sdk-go/sdk/responses"
) )
type GetPwdRequest struct { type GetPwdRequest struct {