Merge branch 'master' of e.coding.net:rosydev/baseapi
This commit is contained in:
@@ -12,7 +12,8 @@ const (
|
|||||||
TiktokTokenUrl = "oauth/access_token/"
|
TiktokTokenUrl = "oauth/access_token/"
|
||||||
TiktokRefreshTokenUrl = "oauth/renew_refresh_token/"
|
TiktokRefreshTokenUrl = "oauth/renew_refresh_token/"
|
||||||
|
|
||||||
salt = "TUsUuzcfWriQ8ZXUQOrxPcScjEGlgMSjJaDMCtVy"
|
salt = "TUsUuzcfWriQ8ZXUQOrxPcScjEGlgMSjJaDMCtVy" //京西菜市
|
||||||
|
salt2 = "Ab25GOMdO2FukyGvgW8HtEzwQtBgNak6ffKUyebD" //京西到家
|
||||||
ResponseCodeSuccess = "SUCCESS"
|
ResponseCodeSuccess = "SUCCESS"
|
||||||
ResponseCodeFail = "FAIL"
|
ResponseCodeFail = "FAIL"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,8 +32,11 @@ func (a *API) Sign(paramsMap map[string]interface{}) string {
|
|||||||
paramsArr = append(paramsArr, value)
|
paramsArr = append(paramsArr, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if a.clientKey == TiktokJXDJAppID {
|
||||||
paramsArr = append(paramsArr, salt)
|
paramsArr = append(paramsArr, salt2)
|
||||||
|
} else {
|
||||||
|
paramsArr = append(paramsArr, salt)
|
||||||
|
}
|
||||||
sort.Strings(paramsArr)
|
sort.Strings(paramsArr)
|
||||||
return fmt.Sprintf("%x", md5.Sum([]byte(strings.Join(paramsArr, "&"))))
|
return fmt.Sprintf("%x", md5.Sum([]byte(strings.Join(paramsArr, "&"))))
|
||||||
}
|
}
|
||||||
@@ -59,8 +62,10 @@ func (a *API) CreateOrderByTicktock(param *TickTokCreateOrder) (string, string,
|
|||||||
// 获取抖音token
|
// 获取抖音token
|
||||||
func (a *API) GetTiktokToken() error {
|
func (a *API) GetTiktokToken() error {
|
||||||
tokenReq := make(map[string]interface{}, 3)
|
tokenReq := make(map[string]interface{}, 3)
|
||||||
tokenReq["appid"] = TiktokAppId
|
tokenReq["appid"] = a.clientKey
|
||||||
tokenReq["secret"] = TiktokSecret
|
tokenReq["secret"] = a.clientSecret
|
||||||
|
//tokenReq["appid"] = TiktokAppId
|
||||||
|
//tokenReq["secret"] = TiktokSecret
|
||||||
tokenReq["grant_type"] = "client_credential"
|
tokenReq["grant_type"] = "client_credential"
|
||||||
globals.SugarLogger.Debug("=============", tokenReq)
|
globals.SugarLogger.Debug("=============", tokenReq)
|
||||||
result, err := a.AccessAPI2(GetTiktokToken, tokenReq)
|
result, err := a.AccessAPI2(GetTiktokToken, tokenReq)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const (
|
|||||||
TiktokAppId = "tta6a1d01c399f264201"
|
TiktokAppId = "tta6a1d01c399f264201"
|
||||||
TiktokSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad"
|
TiktokSecret = "5c08a0465cf0f996af254a03b6c2548defef87ad"
|
||||||
TiktokJXDJAppID = "ttaceeda5333d7a7ab01"
|
TiktokJXDJAppID = "ttaceeda5333d7a7ab01"
|
||||||
tiktokJXDJSecret = "5c8492ec2744fb72bb6cc356983f3cfc317f85d4"
|
TiktokJXDJSecret = "5c8492ec2744fb72bb6cc356983f3cfc317f85d4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OauthAccessTokenResData access_token
|
// OauthAccessTokenResData access_token
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ func TestCode343(t *testing.T) {
|
|||||||
fmt.Println(data)
|
fmt.Println(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCode343(t *testing.T) {
|
//func TestCode343(t *testing.T) {
|
||||||
a := New("5c8492ec2744fb72bb6cc356983f3cfc317f85d4", "ttaceeda5333d7a7ab01")
|
// a := New("5c8492ec2744fb72bb6cc356983f3cfc317f85d4", "ttaceeda5333d7a7ab01")
|
||||||
data, err := a.GetTiktokOauth("-j_QmmDM7B-mjKKk9wcijMeUTAV75mNXbJI4rqabt1IMkDGEmmw1M0-azYJwoXNOrWaDeXlw4xNivEd-uobXuuZrtt7bNn-6AMzf8jvkXp6Jm3LPcP56KisO9w4")
|
// data, err := a.GetTiktokOauth("-j_QmmDM7B-mjKKk9wcijMeUTAV75mNXbJI4rqabt1IMkDGEmmw1M0-azYJwoXNOrWaDeXlw4xNivEd-uobXuuZrtt7bNn-6AMzf8jvkXp6Jm3LPcP56KisO9w4")
|
||||||
fmt.Println(err)
|
// fmt.Println(err)
|
||||||
fmt.Println(data)
|
// fmt.Println(data)
|
||||||
}
|
//}
|
||||||
|
|
||||||
func TestCode22(t *testing.T) {
|
func TestCode22(t *testing.T) {
|
||||||
fmt.Println(2&4 != 0)
|
fmt.Println(2&4 != 0)
|
||||||
@@ -59,7 +59,7 @@ func TestCode22(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetToken(t *testing.T) {
|
func TestGetToken(t *testing.T) {
|
||||||
a := New("5c08a0465cf0f996af254a03b6c2548defef87ad", "tta6a1d01c399f264201")
|
a := New("5c8492ec2744fb72bb6cc356983f3cfc317f85d4", "ttaceeda5333d7a7ab01")
|
||||||
//a := New("5c08a0465cf0f996af254a03b6c2548defef87ad", "tta6a1d01c399f264201")
|
//a := New("5c08a0465cf0f996af254a03b6c2548defef87ad", "tta6a1d01c399f264201")
|
||||||
err := a.GetTiktokToken()
|
err := a.GetTiktokToken()
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package tonglianpayapi
|
|||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -209,15 +208,9 @@ func (a *API) PayRefund(param *PayRefundParam) (result *PayRefundResult, err err
|
|||||||
params["remark"] = param.Remark
|
params["remark"] = param.Remark
|
||||||
params["oldtrxid"] = param.OldTrxID
|
params["oldtrxid"] = param.OldTrxID
|
||||||
retVal, err := a.AccessAPI("unitorder/refund", params)
|
retVal, err := a.AccessAPI("unitorder/refund", params)
|
||||||
|
|
||||||
globals.SugarLogger.Debug("PayRefund打印输出 err", err)
|
|
||||||
globals.SugarLogger.Debug("PayRefund打印输出 trxamt", params["trxamt"])
|
|
||||||
globals.SugarLogger.Debug("PayRefund打印输出 oldtrxid", params["oldtrxid"]) //nil
|
|
||||||
globals.SugarLogger.Debug("PayRefund打印输出 oldreqsn", params["oldreqsn"])
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
utils.Map2StructByJson(retVal, &result, false)
|
utils.Map2StructByJson(retVal, &result, false)
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debug("PayRefund打印输出 result", result)
|
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user