From bf929446e241fd7faa34d3a3c64eb300a606f551 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 31 Jan 2024 16:46:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=96=E9=9F=B3=E7=A9=BF=E5=B1=B1=E7=94=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cinema_5bms/api.go | 40 ++++++++++++++++++++++++++++++++++++++++ cinema_5bms/cinema.go | 7 +++++++ 2 files changed, 47 insertions(+) create mode 100644 cinema_5bms/api.go create mode 100644 cinema_5bms/cinema.go diff --git a/cinema_5bms/api.go b/cinema_5bms/api.go new file mode 100644 index 0000000..1ce857c --- /dev/null +++ b/cinema_5bms/api.go @@ -0,0 +1,40 @@ +package cinema_5bms + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/comm" + zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" + "fmt" + "github.com/syyongx/php2go" + "strings" + "time" +) + +func SendPost(method string, signSecret string, param map[string]string) (string, error) { + url := "https://www.5bms.com/" + method + param["time"] = zhios_third_party_utils.Int64ToStr(time.Now().Unix()) + param["sign"] = GetSign(param, signSecret) + for k, v := range param { + if strings.Contains(url, "?") { + url += "&" + k + "=" + php2go.URLEncode(v) + } else { + url += "?" + k + "=" + php2go.URLEncode(v) + } + } + get, err := zhios_third_party_utils.CurlPost(url, param, nil) + fmt.Println(string(get)) + fmt.Println(err) + return string(get), err +} +func GetSign(param map[string]string, signSecret string) string { + str := "" + keys := comm.KsortToStr(param) + for _, k := range keys { + if str != "" { + str += "&" + k + "=" + param[k] + } else { + str += k + "=" + param[k] + } + } + str += "&app-secret=" + signSecret + return strings.ToUpper(php2go.Md5(str)) +} diff --git a/cinema_5bms/cinema.go b/cinema_5bms/cinema.go new file mode 100644 index 0000000..39d50c2 --- /dev/null +++ b/cinema_5bms/cinema.go @@ -0,0 +1,7 @@ +package cinema_5bms + +func GetCinema(method string, signSecret string, args map[string]string) (string, error) { + + post, err := SendPost(method, signSecret, args) + return post, err +}