huangjiajun před 1 rokem
rodič
revize
f8d27247b8
3 změnil soubory, kde provedl 66 přidání a 2 odebrání
  1. +44
    -0
      tpdaren/api.go
  2. +19
    -0
      tpdaren/tpdaren.go
  3. +3
    -2
      zero_buy/api.go

+ 44
- 0
tpdaren/api.go Zobrazit soubor

@@ -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)
}

+ 19
- 0
tpdaren/tpdaren.go Zobrazit soubor

@@ -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
}

+ 3
- 2
zero_buy/api.go Zobrazit soubor

@@ -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)


Načítá se…
Zrušit
Uložit