Commit d7315860c90bd065598ff07fcfc2c2889c683a65
1 parent
4a4851ff
Exists in
master
and in
4 other branches
提交sdk
Showing
2 changed files
with
15 additions
and
2 deletions
Show diff stats
src/HttpServer/logic/constdef.go
@@ -43,7 +43,7 @@ const ( | @@ -43,7 +43,7 @@ const ( | ||
43 | 43 | ||
44 | const ( | 44 | const ( |
45 | XIAOXINGXING_SERVERKEY = "33e0c3238c108a36d87025544c6a2d2f" | 45 | XIAOXINGXING_SERVERKEY = "33e0c3238c108a36d87025544c6a2d2f" |
46 | - XIAOXINGXING_SDKURL = "33e0c3238c108a36d87025544c6a2d2f" | 46 | + XIAOXINGXING_SDKURL = "https://testapi-gamesdk.d3games.com/" |
47 | ) | 47 | ) |
48 | 48 | ||
49 | const ( | 49 | const ( |
src/HttpServer/logic/function.go
@@ -3,12 +3,14 @@ package logic | @@ -3,12 +3,14 @@ package logic | ||
3 | import ( | 3 | import ( |
4 | "HttpServer/jsonconf" | 4 | "HttpServer/jsonconf" |
5 | "HttpServer/redishandler" | 5 | "HttpServer/redishandler" |
6 | + "bytes" | ||
6 | "common/logger" | 7 | "common/logger" |
7 | "common/redis" | 8 | "common/redis" |
8 | "crypto/sha1" | 9 | "crypto/sha1" |
9 | "encoding/hex" | 10 | "encoding/hex" |
10 | "encoding/json" | 11 | "encoding/json" |
11 | "errors" | 12 | "errors" |
13 | + "io/ioutil" | ||
12 | "net/http" | 14 | "net/http" |
13 | "sort" | 15 | "sort" |
14 | "strconv" | 16 | "strconv" |
@@ -754,8 +756,19 @@ func GetHashValue(signsum string) string { | @@ -754,8 +756,19 @@ func GetHashValue(signsum string) string { | ||
754 | return sign | 756 | return sign |
755 | } | 757 | } |
756 | 758 | ||
757 | -func DoHttpPost(param []byte) (string, error) { | 759 | +func DoHttpPost(bys []byte) (string, error) { |
760 | + body := bytes.NewBuffer(bys) | ||
761 | + url1 := XIAOXINGXING_SDKURL + "api/server/addcoin" | ||
758 | 762 | ||
763 | + res, err := http.Post(url1, "application/json;charset=utf-8", body) | ||
764 | + if err != nil { | ||
765 | + logger.Error("DoHttpPost failed err=%v", err) | ||
766 | + return "", err | ||
767 | + } | ||
768 | + result, _ := ioutil.ReadAll(res.Body) | ||
769 | + defer res.Body.Close() | ||
770 | + | ||
771 | + return string(result), nil | ||
759 | } | 772 | } |
760 | 773 | ||
761 | func GetCoinFromSdk(uuid int, gameid string, channel string) (int, error) { | 774 | func GetCoinFromSdk(uuid int, gameid string, channel string) (int, error) { |