From f8d27247b8862ed0f97ba2d831524d3325527386 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 28 Jun 2023 17:18:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tpdaren/api.go | 44 ++++++++++++++++++++++++++++++++++++++++++++ tpdaren/tpdaren.go | 19 +++++++++++++++++++ zero_buy/api.go | 5 +++-- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 tpdaren/api.go create mode 100644 tpdaren/tpdaren.go diff --git a/tpdaren/api.go b/tpdaren/api.go new file mode 100644 index 0000000..97b28ee --- /dev/null +++ b/tpdaren/api.go @@ -0,0 +1,44 @@ +package tpdaren + +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" + "github.com/syyongx/php2go" + "github.com/tidwall/gjson" + "time" +) + +/*** +appid:nqrsce +appSecret:KZOl46YF6zposQUFQbIXyXCm2pR0nX5dhkyVCk1EDXE= +7200s +*/ +func TpdarenToken(appid, appSecret string) string { + url := "http://tpdaren.jzjxwh.cn/api/v1/get/token?appid=" + php2go.URLEncode(appid) + "&app_secret=" + php2go.URLEncode(appSecret) + get, _ := zhios_third_party_utils.CurlGet(url, map[string]string{}) + token := gjson.Get(string(get), "data.token").String() + return token +} +func TpdarenSend(method, token string, param map[string]interface{}) (string, error) { + url := "http://tpdaren.jzjxwh.cn/api/v1/" + method + header := map[string]string{ + "token": token, + } + param["timestamp"] = time.Now().Unix() + param["signature"] = getSign(param) + post, err := zhios_third_party_utils.CurlPost(url, zhios_third_party_utils.SerializeStr(param), header) + return string(post), err +} + +func getSign(param map[string]interface{}) string { + str := "" + keys := comm.KsortToStrInterface(param) + for _, k := range keys { + if str == "" { + str += k + "=" + zhios_third_party_utils.AnyToString(param[k]) + } else { + str += "&" + k + "=" + zhios_third_party_utils.AnyToString(param[k]) + } + } + return php2go.Md5(str) +} diff --git a/tpdaren/tpdaren.go b/tpdaren/tpdaren.go new file mode 100644 index 0000000..ac2dab1 --- /dev/null +++ b/tpdaren/tpdaren.go @@ -0,0 +1,19 @@ +package tpdaren + +//剧集列表接口 +func TheaterFindPaging(token string, param map[string]interface{}) (string, error) { + send, err := TpdarenSend("theater/find/paging", token, param) + return send, err +} + +//订单拉取接口 +func OrderFindPaging(token string, param map[string]interface{}) (string, error) { + send, err := TpdarenSend("order/find/paging", token, param) + return send, err +} + +//广告统计接口 +func AdStatisticFindPaging(token string, param map[string]interface{}) (string, error) { + send, err := TpdarenSend("ad/statistic/find/paging", token, param) + return send, err +} diff --git a/zero_buy/api.go b/zero_buy/api.go index 6efd9bc..ebf98a3 100644 --- a/zero_buy/api.go +++ b/zero_buy/api.go @@ -8,11 +8,12 @@ import ( func ZeroBuyUrl(appSecret string, param map[string]string) string { url := " http://h5.hlpay178.cn/#/" + param["deviceID"] = strings.ReplaceAll(param["deviceID"], " ", "") for k, v := range param { if strings.Contains(url, "?") == false { - url += "?" + k + "=" + v + url += "?" + k + "=" + php2go.URLEncode(v) } else { - url += "&" + k + "=" + v + url += "&" + k + "=" + php2go.URLEncode(v) } } sign := GetSign(appSecret, param)