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
src/HttpServer/logic/function.go
| ... | ... | @@ -3,12 +3,14 @@ package logic |
| 3 | 3 | import ( |
| 4 | 4 | "HttpServer/jsonconf" |
| 5 | 5 | "HttpServer/redishandler" |
| 6 | + "bytes" | |
| 6 | 7 | "common/logger" |
| 7 | 8 | "common/redis" |
| 8 | 9 | "crypto/sha1" |
| 9 | 10 | "encoding/hex" |
| 10 | 11 | "encoding/json" |
| 11 | 12 | "errors" |
| 13 | + "io/ioutil" | |
| 12 | 14 | "net/http" |
| 13 | 15 | "sort" |
| 14 | 16 | "strconv" |
| ... | ... | @@ -754,8 +756,19 @@ func GetHashValue(signsum string) string { |
| 754 | 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 | 774 | func GetCoinFromSdk(uuid int, gameid string, channel string) (int, error) { | ... | ... |