| | |
| | | |
| | | var FaceDetectSet = &facedetect{} |
| | | |
| | | type shop struct { |
| | | Url string `mapstructure:"url"` |
| | | } |
| | | var ShopConf = &shop{} |
| | | |
| | | // Init is an exported method that takes the environment starts the viper |
| | | // (external lib) and returns the configuration struct. |
| | | func Init(env string) { |
| | |
| | | viper.UnmarshalKey("dbpersoncompare", DbPersonCompInfo) |
| | | viper.UnmarshalKey("espersoncompare", EsCompServerInfo) |
| | | viper.UnmarshalKey("elastic.basicFS", BasicFS) |
| | | viper.UnmarshalKey("shop", ShopConf) |
| | | } |
| | |
| | | "bytes" |
| | | "encoding/json" |
| | | "github.com/ajg/form" |
| | | "golang.org/x/tools/go/ssa/interp/testdata/src/fmt" |
| | | "io" |
| | | "io/ioutil" |
| | | "net/http" |
| | | "os" |
| | | "strings" |
| | | "github.com/dustin/go-humanize" |
| | | ) |
| | | |
| | | const ( |
| | |
| | | return resultBytes, err |
| | | } |
| | | return resultBytes, nil |
| | | } |
| | | } |
| | | |
| | | |
| | | type WriteCounter struct { |
| | | Total uint64 |
| | | } |
| | | |
| | | func (wc WriteCounter) PrintProgress() { |
| | | fmt.Printf("\r%s", strings.Repeat(" ", 35)) |
| | | fmt.Printf("/rDownloading... %s complete", humanize.Bytes(wc.Total)) |
| | | } |
| | | |
| | | func (wc *WriteCounter) Write(p []byte) (int, error) { |
| | | n := len(p) |
| | | wc.Total = uint64(n) |
| | | wc.PrintProgress() |
| | | return n, nil |
| | | } |
| | | |
| | | //下载文件 |
| | | func DownloadFile(fPath string, url string) error { |
| | | f, err := os.Create(fPath) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | resp, err := http.Get(url) |
| | | if err != nil { |
| | | f.Close() |
| | | return err |
| | | } |
| | | defer resp.Body.Close() |
| | | counter := &WriteCounter{} |
| | | if _, err = io.Copy(f, io.TeeReader(resp.Body, counter)); err != nil { |
| | | f.Close() |
| | | return err |
| | | } |
| | | fmt.Printf("\n") |
| | | f.Close() |
| | | if err = os.Rename(fPath, fPath);err != nil { |
| | | return err |
| | | } |
| | | return nil |
| | | } |
| | | |
| | |
| | | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc |
| | | github.com/dgrijalva/jwt-go v3.2.0+incompatible |
| | | github.com/disintegration/imaging v1.6.2 // indirect |
| | | github.com/dustin/go-humanize v1.0.0 // indirect |
| | | github.com/gin-gonic/gin v1.4.0 |
| | | github.com/gogo/protobuf v1.2.1 |
| | | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b |
| | |
| | | github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= |
| | | github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= |
| | | github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= |
| | | github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= |
| | | github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= |
| | | github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= |
| | | github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= |
| | | github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= |
| | |
| | | |
| | | func findAllMySdk() map[string]Sdk { |
| | | token := "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjQ3NDUwMjU5MjMsInVzZXIiOiJ7XCJpZFwiOlwiZTZjY2QzNmQtNGYxNi00NmZjLTg4ZDUtMDczNjU4NjZkMjA1XCIsXCJwZXJtaXNzaW9uc1wiOltcInByb2R1Y3RNYW5nZTpwdWJsaXNoXCIsXCJjb2RlTWFuZ2U6dmlld1wiLFwiZGV2aWNlTWFuYWdlOmFkZFwiLFwiYWRtaW5NYW5hZ2VcIixcIm9yZGVyTWFuZ2VcIixcImRldmljZU1hbmFnZTp2aWV3XCIsXCJwcm9kdWN0TWFuZ2U6YWRkXCIsXCJhZG1pbk1hbmFnZTp2aWV3XCIsXCJjb2RlTWFuZ2U6YWRkXCIsXCJwcm9kdWN0TWFuZ2U6b2ZmU2FsZVwiLFwib3JkZXJNYW5nZTpjYW5jZWxcIixcInByb2R1Y3RDZW50ZXI6ZG93bmxvYWRcIixcInByb2R1Y3RDZW50ZXI6YnV5XCIsXCJwcm9kdWN0TWFuZ2U6dmlld1wiLFwiYXBpXCIsXCJob21lXCIsXCJvcmRlck1hbmdlOnBheVwiLFwiYWRtaW5NYW5hZ2U6YWRkXCIsXCJvcmRlck1hbmdlOmRvd25sb2FkXCIsXCJwcm9kdWN0Q2VudGVyXCIsXCJkZXZpY2VNYW5hZ2U6dW5iaW5kXCIsXCJvcmRlck1hbmdlOnZpZXdcIixcImFkbWluTWFuYWdlOmVkaXRcIixcImRldmljZU1hbmFnZVwiLFwidmlwTWFuYWdlOmFkZFwiLFwidmlwTWFuYWdlOnZpZXdcIixcInByb2R1Y3RDZW50ZXI6dmlld1wiLFwidmlwTWFuYWdlOmVkaXRcIixcInZpcE1hbmFnZVwiLFwicHJvZHVjdE1hbmdlOmVkaXRcIixcImNvZGVNYW5nZVwiLFwicHJvZHVjdE1hbmdlXCJdLFwidXNlcm5hbWVcIjpcImJhc2ljXCJ9In0.vwjAFkWuEyadRLvIOGK8LFE3MjpY3SQ7j6AlTXnQDG8" |
| | | url := "http://192.168.20.10:7004/data/api-s/sdk/findAllMySdk" |
| | | url := "http://"+config.ShopConf.Url+"/data/api-s/sdk/findAllMySdk" |
| | | fmt.Println("token:", token, "url:", url) |
| | | paramBody := map[string]interface{} { |
| | | "serverId": config.Server.AnalyServerId, |