添加抖音云鼎
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
|||||||
// "authority_id": ""
|
// "authority_id": ""
|
||||||
//}`
|
//}`
|
||||||
|
|
||||||
var token = `{"access_token":"d04f3829-3ee5-4886-bdcd-70f928055cbe","expires_in":1681311682,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"e0b7bc95-067c-4cfb-a59a-1c00344ab851","authority_id":""}`
|
var token = `{"access_token":"b558d5bd-d55d-4322-8602-85ba449cbc79","expires_in":1681667840,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"3a3c0ad2-bcbd-4f55-b7af-6b406dabc47a","authority_id":""}`
|
||||||
|
|
||||||
//var token = `{"access_token":"e3173e9f-266f-4d87-88e7-e7cd837bc9d9","expires_in":1672882632,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"5070aae2-493f-46bd-b5d6-6ea0cd64729f","authority_id":""}`
|
//var token = `{"access_token":"e3173e9f-266f-4d87-88e7-e7cd837bc9d9","expires_in":1672882632,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"5070aae2-493f-46bd-b5d6-6ea0cd64729f","authority_id":""}`
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package tiktok_api
|
package tiktok_api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
brand_list_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/brand_list/request"
|
brand_list_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/brand_list/request"
|
||||||
order_batchDecrypt_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_batchDecrypt/request"
|
|
||||||
order_batchSensitive_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_batchSensitive/request"
|
order_batchSensitive_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_batchSensitive/request"
|
||||||
product_GetRecommendCategory_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_GetRecommendCategory/request"
|
product_GetRecommendCategory_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_GetRecommendCategory/request"
|
||||||
product_addV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/request"
|
product_addV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/request"
|
||||||
@@ -30,8 +30,9 @@ import (
|
|||||||
superm_product_batchRedistributeStoreProduct_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_product_batchRedistributeStoreProduct/request"
|
superm_product_batchRedistributeStoreProduct_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_product_batchRedistributeStoreProduct/request"
|
||||||
superm_product_createSubProduct_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_product_createSubProduct/request"
|
superm_product_createSubProduct_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_product_createSubProduct/request"
|
||||||
superm_product_launchProduct_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_product_launchProduct/request"
|
superm_product_launchProduct_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_product_launchProduct/request"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -329,52 +330,103 @@ func (a *API) GetSkuBrand(categoryId int64, brandName string) (int64, error) {
|
|||||||
return BrandNameMap[brandNameLen], nil
|
return BrandNameMap[brandNameLen], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// OrderUserInfoDecrypt 用户信息解密
|
type YunDecrypt struct {
|
||||||
|
Code string `json:"code"`
|
||||||
|
Data string `json:"data"`
|
||||||
|
Err string `json:"err"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OrderUserInfoDecrypt 用户信息解密(此接口转入云鼎服务器,将不再直接通信)
|
||||||
func (a *API) OrderUserInfoDecrypt(orderId, name, tel, address string) (string, string, string, error) {
|
func (a *API) OrderUserInfoDecrypt(orderId, name, tel, address string) (string, string, string, error) {
|
||||||
request := order_batchDecrypt_request.New()
|
url := "http://ddy.jxc4.com/tt/decrypt"
|
||||||
|
accessToken, err := json.Marshal(a.accessTokenObj.CreateTokenData)
|
||||||
cipherInfos := make([]order_batchDecrypt_request.CipherInfosItem, 0, 0)
|
|
||||||
for i := 1; i <= 3; i++ {
|
|
||||||
cipher := order_batchDecrypt_request.CipherInfosItem{}
|
|
||||||
cipher.AuthId = orderId
|
|
||||||
switch i {
|
|
||||||
case 1: // 姓名
|
|
||||||
cipher.CipherText = name
|
|
||||||
cipherInfos = append(cipherInfos, cipher)
|
|
||||||
case 2: // 手机号
|
|
||||||
cipher.CipherText = tel
|
|
||||||
cipherInfos = append(cipherInfos, cipher)
|
|
||||||
case 3: // 地址
|
|
||||||
cipher.CipherText = address
|
|
||||||
cipherInfos = append(cipherInfos, cipher)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
request.Param.CipherInfos = cipherInfos
|
|
||||||
|
|
||||||
result, err := request.Execute(a.accessTokenObj)
|
|
||||||
globals.SugarLogger.Debugf("OrderUserInfoDecrypt======:%s", utils.Format4Output(result, false))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", "", err
|
return "", "", "", err
|
||||||
}
|
}
|
||||||
if result.Code != RequestSuccessCode {
|
|
||||||
return "", "", "", errors.New(result.SubCode)
|
param := make(map[string]string, 5)
|
||||||
|
param["token"] = string(accessToken)
|
||||||
|
param["encrypt_post_tel"] = tel
|
||||||
|
param["encrypt_post_receiver"] = address
|
||||||
|
param["encrypt_post_name"] = name
|
||||||
|
param["order_id"] = orderId
|
||||||
|
param["app_key"] = a.appKey
|
||||||
|
param["app_secret"] = a.appSecret
|
||||||
|
|
||||||
|
data, err := json.Marshal(param)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", "", nil
|
||||||
|
}
|
||||||
|
payload := strings.NewReader(string(data))
|
||||||
|
req, _ := http.NewRequest("POST", url, payload)
|
||||||
|
req.Header.Add("content-type", "application/json")
|
||||||
|
res, err := http.DefaultClient.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", "", err
|
||||||
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
body, _ := ioutil.ReadAll(res.Body)
|
||||||
|
|
||||||
|
var result *YunDecrypt
|
||||||
|
if err := json.Unmarshal(body, &result); err != nil {
|
||||||
|
return "", "", "", err
|
||||||
|
}
|
||||||
|
if result.Code != "200" {
|
||||||
|
return "", "", "", errors.New(result.Err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
if len(result.Data) != 0 {
|
||||||
userName, userTel, userAddress = "", "", ""
|
var decryData map[string]string
|
||||||
)
|
if err := json.Unmarshal([]byte(result.Data), decryData); err != nil {
|
||||||
for _, v := range result.Data.DecryptInfos {
|
return "", "", "", err
|
||||||
if v.CipherText != "" && v.CipherText == name {
|
|
||||||
userName = v.DecryptText
|
|
||||||
}
|
|
||||||
if v.CipherText != "" && v.CipherText == tel {
|
|
||||||
userTel = v.DecryptText
|
|
||||||
}
|
|
||||||
if v.CipherText != "" && v.CipherText == address {
|
|
||||||
userAddress = v.DecryptText
|
|
||||||
}
|
}
|
||||||
|
return decryData["name"], decryData["tel"], decryData["address"], nil
|
||||||
}
|
}
|
||||||
return userName, userTel, userAddress, err
|
return "", "", "", errors.New("返回值为空")
|
||||||
|
//request := order_batchDecrypt_request.New()
|
||||||
|
//
|
||||||
|
//cipherInfos := make([]order_batchDecrypt_request.CipherInfosItem, 0, 0)
|
||||||
|
//for i := 1; i <= 3; i++ {
|
||||||
|
// cipher := order_batchDecrypt_request.CipherInfosItem{}
|
||||||
|
// cipher.AuthId = orderId
|
||||||
|
// switch i {
|
||||||
|
// case 1: // 姓名
|
||||||
|
// cipher.CipherText = name
|
||||||
|
// cipherInfos = append(cipherInfos, cipher)
|
||||||
|
// case 2: // 手机号
|
||||||
|
// cipher.CipherText = tel
|
||||||
|
// cipherInfos = append(cipherInfos, cipher)
|
||||||
|
// case 3: // 地址
|
||||||
|
// cipher.CipherText = address
|
||||||
|
// cipherInfos = append(cipherInfos, cipher)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//request.Param.CipherInfos = cipherInfos
|
||||||
|
//
|
||||||
|
//result, err := request.Execute(a.accessTokenObj)
|
||||||
|
//globals.SugarLogger.Debugf("OrderUserInfoDecrypt======:%s", utils.Format4Output(result, false))
|
||||||
|
//if err != nil {
|
||||||
|
// return "", "", "", err
|
||||||
|
//}
|
||||||
|
//if result.Code != RequestSuccessCode {
|
||||||
|
// return "", "", "", errors.New(result.SubCode)
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//var (
|
||||||
|
// userName, userTel, userAddress = "", "", ""
|
||||||
|
//)
|
||||||
|
//for _, v := range result.Data.DecryptInfos {
|
||||||
|
// if v.CipherText != "" && v.CipherText == name {
|
||||||
|
// userName = v.DecryptText
|
||||||
|
// }
|
||||||
|
// if v.CipherText != "" && v.CipherText == tel {
|
||||||
|
// userTel = v.DecryptText
|
||||||
|
// }
|
||||||
|
// if v.CipherText != "" && v.CipherText == address {
|
||||||
|
// userAddress = v.DecryptText
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//return userName, userTel, userAddress, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// OrderUserInfoSensitive 用户信息脱敏
|
// OrderUserInfoSensitive 用户信息脱敏
|
||||||
|
|||||||
Reference in New Issue
Block a user