淘宝联盟
This commit is contained in:
@@ -3,16 +3,13 @@ package jdshopapi
|
|||||||
import (
|
import (
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
"crypto/md5"
|
"encoding/base64"
|
||||||
"encoding/binary"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"math"
|
"math"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateShopCategory(t *testing.T) {
|
func TestCreateShopCategory(t *testing.T) {
|
||||||
@@ -105,12 +102,11 @@ func TestTryGetCookie(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAAADS(t *testing.T) {
|
func TestAAADS(t *testing.T) {
|
||||||
now := time.Now().Unix()
|
key, _ := base64.StdEncoding.DecodeString("DW+rL8hlSFt65gUnDXW13A==")
|
||||||
fmt.Println(utils.Int64ToStr(now))
|
data, _ := base64.StdEncoding.DecodeString("Zh1/Gnb3GWkt7slPocCh5EjgfCrivUMrEjQZT+ND2fsDZYGXIny8NazZJ7UA8DgMpuJf9vBPlf3C8l8oT7aYebJMhAEx8kRFdQip8yEFqbzTfHfnNnMsI4Wkh1Ij06iLiZITnPUdWsuHjwI7BKKmZFDloiOkn3p+gtACFThm7B03SfPmvOdokdIQvDa1nEzPL/2DkfhAwDPxzgGHI0HaAQ==")
|
||||||
result := md5.Sum([]byte("2108849168000062" + utils.Int64ToStr(now)))
|
iv, _ := base64.StdEncoding.DecodeString("BBYl0UZhgnV59eP6MkxeeQ==")
|
||||||
chanIndex := int(int64(binary.LittleEndian.Uint32(result[8:])) % int64(2000))
|
result, _ := Decrypt(data, key, iv)
|
||||||
|
fmt.Println(string(result))
|
||||||
fmt.Println(chanIndex)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Decrypt(decryptBytes, key, iv []byte) ([]byte, error) {
|
func Decrypt(decryptBytes, key, iv []byte) ([]byte, error) {
|
||||||
@@ -205,7 +201,7 @@ func TestUpdateBasic(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateExpand(t *testing.T) {
|
func TestUpdateExpand(t *testing.T) {
|
||||||
str := "https://wx.jxc4.com/jxcsRegist?mobile=15520595380"
|
str := "https://wx.jxc4.com/jxcsRegist?mobile=15520595380"
|
||||||
fmt.Println(str[:strings.LastIndex(str,"?")])
|
fmt.Println(str[:strings.LastIndex(str, "?")])
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateGisFence(t *testing.T) {
|
func TestCreateGisFence(t *testing.T) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func TestMiniCode(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGenerateLink(t *testing.T) {
|
func TestGenerateLink(t *testing.T) {
|
||||||
result, err := api.GenerateLink(2, 1, strings.ToLower("12521"))
|
result, err := api.GenerateLink(2, 2, strings.ToLower("9999999999999"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ func TestOrderList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCouponList(t *testing.T) {
|
func TestCouponList(t *testing.T) {
|
||||||
result, err := api.CouponList(4, utils.Str2Time("2021-03-19").Unix(), utils.Str2Time("2021-03-25").Unix(), 1, "000000001")
|
result, err := api.CouponList(4, utils.Str2Time("2021-04-18").Unix(), utils.Str2Time("2021-04-23").Unix(), 1, "9999999999999")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
17
platformapi/tbunionapi/sku.go
Normal file
17
platformapi/tbunionapi/sku.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package tbunionapi
|
||||||
|
|
||||||
|
import "git.rosy.net.cn/baseapi/utils"
|
||||||
|
|
||||||
|
//物料精选
|
||||||
|
func (a *API) OptimusMaterial(materialID, adzoneID, pageNo, pageSize int) (activityInfoGetResult *ActivityInfoGetResult, err error) {
|
||||||
|
result, err := a.AccessAPI("taobao.tbk.dg.optimus.material", false, map[string]interface{}{
|
||||||
|
"material_id": materialID,
|
||||||
|
"adzone_id": adzoneID,
|
||||||
|
"page_no": pageNo,
|
||||||
|
"page_size": pageSize,
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result, &activityInfoGetResult, false)
|
||||||
|
}
|
||||||
|
return activityInfoGetResult, err
|
||||||
|
}
|
||||||
14
platformapi/tbunionapi/sku_test.go
Normal file
14
platformapi/tbunionapi/sku_test.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package tbunionapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestOptimusMaterial(t *testing.T) {
|
||||||
|
result, err := api.OptimusMaterial(13366, 111339100149, 1, 20)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
141
platformapi/tbunionapi/tbunionapi.go
Normal file
141
platformapi/tbunionapi/tbunionapi.go
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
package tbunionapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/md5"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi"
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi"
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"net/http"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
prodURL = "http://gw.api.taobao.com/router/rest"
|
||||||
|
testURL = "http://gw.api.tbsandbox.com/router/rest"
|
||||||
|
sigKey = "sign"
|
||||||
|
)
|
||||||
|
|
||||||
|
type API struct {
|
||||||
|
platformapi.APICookie
|
||||||
|
|
||||||
|
appKey string
|
||||||
|
appSecret string
|
||||||
|
client *http.Client
|
||||||
|
config *platformapi.APIConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(appKey, appSecret string, config ...*platformapi.APIConfig) *API {
|
||||||
|
curConfig := platformapi.DefAPIConfig
|
||||||
|
if len(config) > 0 {
|
||||||
|
curConfig = *config[0]
|
||||||
|
}
|
||||||
|
return &API{
|
||||||
|
appKey: appKey,
|
||||||
|
appSecret: appSecret,
|
||||||
|
client: &http.Client{Timeout: curConfig.ClientTimeout},
|
||||||
|
config: &curConfig,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *API) signParam(params map[string]interface{}) (sig string) {
|
||||||
|
var valueList []string
|
||||||
|
for k, v := range params {
|
||||||
|
if k != sigKey {
|
||||||
|
if str := fmt.Sprint(v); str != "" {
|
||||||
|
valueList = append(valueList, fmt.Sprintf("%s%s", k, str))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort.Sort(sort.StringSlice(valueList))
|
||||||
|
valueList = append(valueList, fmt.Sprintf("%s", a.appSecret))
|
||||||
|
var valueList2 = make([]string, len(valueList)+1)
|
||||||
|
at := copy(valueList2, valueList[:0])
|
||||||
|
at += copy(valueList2[at:], []string{a.appSecret})
|
||||||
|
copy(valueList2[at:], valueList[0:])
|
||||||
|
sig = strings.Join(valueList2, "")
|
||||||
|
binSig := md5.Sum([]byte(sig))
|
||||||
|
sig = fmt.Sprintf("%X", binSig)
|
||||||
|
return sig
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *API) AccessAPI(action string, isPost bool, bizParams map[string]interface{}) (retVal map[string]interface{}, err error) {
|
||||||
|
params := make(map[string]interface{})
|
||||||
|
params["app_key"] = a.appKey
|
||||||
|
params["method"] = action
|
||||||
|
params["sign_method"] = "md5"
|
||||||
|
params["timestamp"] = utils.Time2Str(time.Now())
|
||||||
|
params["v"] = "2.0"
|
||||||
|
params["format"] = "json"
|
||||||
|
params = utils.MergeMaps(params, bizParams)
|
||||||
|
signStr := a.signParam(params)
|
||||||
|
params[sigKey] = signStr
|
||||||
|
//fullURL := utils.GenerateGetURL(prodURL, action, nil)
|
||||||
|
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||||
|
func() *http.Request {
|
||||||
|
var request *http.Request
|
||||||
|
if !isPost {
|
||||||
|
request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(prodURL, "", params), nil)
|
||||||
|
} else {
|
||||||
|
request, _ = http.NewRequest(http.MethodPost, prodURL, strings.NewReader(utils.Map2URLValues(params).Encode()))
|
||||||
|
}
|
||||||
|
return request
|
||||||
|
},
|
||||||
|
a.config,
|
||||||
|
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
||||||
|
if jsonResult1 == nil {
|
||||||
|
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
if jsonResult1["error_response"] != nil {
|
||||||
|
errLevel = platformapi.ErrLevelGeneralFail
|
||||||
|
err = utils.NewErrorCode(jsonResult1["error_response"].(map[string]interface{})["msg"].(string), utils.Int64ToStr(utils.MustInterface2Int64(jsonResult1["error_response"].(map[string]interface{})["code"])))
|
||||||
|
baseapi.SugarLogger.Debugf("jdeclp AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||||
|
}
|
||||||
|
retVal = jsonResult1
|
||||||
|
}
|
||||||
|
return errLevel, err
|
||||||
|
})
|
||||||
|
return retVal, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{}, isPost bool) (retVal map[string]interface{}, err error) {
|
||||||
|
if a.GetCookieCount() == 0 {
|
||||||
|
return nil, fmt.Errorf("需要设置Store Cookie才能使用此方法")
|
||||||
|
}
|
||||||
|
data, _ := json.Marshal(bizParams)
|
||||||
|
err = platformapi.AccessPlatformAPIWithRetry(a.client,
|
||||||
|
func() *http.Request {
|
||||||
|
var request *http.Request
|
||||||
|
if isPost {
|
||||||
|
request, _ = http.NewRequest(http.MethodPost, fullURL, strings.NewReader(string(data)))
|
||||||
|
request.Header.Set("Content-Type", "application/json;charset=utf-8")
|
||||||
|
} else {
|
||||||
|
request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", bizParams), nil)
|
||||||
|
}
|
||||||
|
a.FillRequestCookies(request)
|
||||||
|
return request
|
||||||
|
},
|
||||||
|
a.config,
|
||||||
|
func(response *http.Response, bodyStr string, jsonResult1 map[string]interface{}) (errLevel string, err error) {
|
||||||
|
if jsonResult1 == nil {
|
||||||
|
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
||||||
|
}
|
||||||
|
if strings.Contains(bodyStr, "登录") || strings.Contains(bodyStr, "访问的内容") {
|
||||||
|
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("cookie可能过期了!")
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
|
if jsonResult1["error_response"] != nil {
|
||||||
|
errLevel = platformapi.ErrLevelGeneralFail
|
||||||
|
err = utils.NewErrorCode(jsonResult1["error_response"].(map[string]interface{})["zh_desc"].(string), jsonResult1["error_response"].(map[string]interface{})["code"].(string))
|
||||||
|
baseapi.SugarLogger.Debugf("jdeclp AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||||
|
}
|
||||||
|
retVal = jsonResult1
|
||||||
|
}
|
||||||
|
return errLevel, err
|
||||||
|
})
|
||||||
|
return retVal, err
|
||||||
|
}
|
||||||
22
platformapi/tbunionapi/tbunionapi_test.go
Normal file
22
platformapi/tbunionapi/tbunionapi_test.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package tbunionapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
api *API
|
||||||
|
sugarLogger *zap.SugaredLogger
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
logger, _ := zap.NewDevelopment()
|
||||||
|
sugarLogger = logger.Sugar()
|
||||||
|
baseapi.Init(sugarLogger)
|
||||||
|
|
||||||
|
api = New("32724809", "2c2bce02eab860d486f68aa59a0127d9")
|
||||||
|
api.SetCookieWithStr(`
|
||||||
|
t=948ba2dc83b4b34e02a9d87212e574a8; cna=A9cHGZw1jjgCAd3tly+uuYIG; account-path-guide-s1=true; 1172080007-payment-time=true; xlly_s=1; cookie2=1a1a1b2e0fdeaea7c73f238a708b2bd5; v=0; _tb_token_=7e385ebeee37e; alimamapwag=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgNi4xOyBXaW42NDsgeDY0KSBBcHBsZVdlYktpdC81MzcuMzYgKEtIVE1MLCBsaWtlIEdlY2tvKSBDaHJvbWUvOTAuMC40NDMwLjg1IFNhZmFyaS81MzcuMzY%3D; cookie32=5887051fc70ab30be7a2655652e82dc6; alimamapw=RkAFUwICU1JQXAA%2BBw0GVlcDAAYGBwIEXVYBAgZUBA9RUQNTAABQUQZXAQY%3D; cookie31=MTE3MjA4MDAwNyxxcTM2NTE3NjI4NixmZW5nLnNoaUByb3N5Lm5ldC5jbixUQg%3D%3D; login=Vq8l%2BKCLz3%2F65A%3D%3D; isg=BCEhHCMG5XUeJUmGx-aU4ApDMO07zpXAI2znAoP2HSiH6kG8yx6lkE8oSB7sOS34; l=eB_opK6mjKn7XdlbBOfanurza77OSIRYYuPzaNbMiOCPOw1B5qD5W615yR86C3GVh6DMR3-XtET6BeYBqQAonxvTabLUOWMmn; tfstk=cqS5BpaGtbcW084E4TwqzMaD6QtdwgM6dzOlFNn8Yx8HAC1cwcR6wP_n9mL9h
|
||||||
|
`)
|
||||||
|
}
|
||||||
122
platformapi/tbunionapi/union.go
Normal file
122
platformapi/tbunionapi/union.go
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
package tbunionapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
JxAdzoneID = 111339100149
|
||||||
|
)
|
||||||
|
|
||||||
|
//创建推广位
|
||||||
|
func (a *API) AdzoneCreate(sid int64, adzoneName string) (err error) {
|
||||||
|
_, err = a.AccessAPI("taobao.tbk.adzone.create", false, map[string]interface{}{
|
||||||
|
"site_id": sid,
|
||||||
|
"adzone_name": adzoneName,
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
type ActivityInfoGetResult struct {
|
||||||
|
TbkActivityInfoGetResponse struct {
|
||||||
|
Data struct {
|
||||||
|
ClickURL string `json:"click_url"`
|
||||||
|
ShortClickURL string `json:"short_click_url"`
|
||||||
|
WxMiniprogramPath string `json:"wx_miniprogram_path"`
|
||||||
|
WxQrcodeURL string `json:"wx_qrcode_url"`
|
||||||
|
} `json:"data"`
|
||||||
|
RequestID string `json:"request_id"`
|
||||||
|
} `json:"tbk_activity_info_get_response"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//官方活动转链
|
||||||
|
func (a *API) ActivityInfoGet(uid, actMaterialID string, adzoneID int64) (activityInfoGetResult *ActivityInfoGetResult, err error) {
|
||||||
|
result, err := a.AccessAPI("taobao.tbk.activity.info.get", false, map[string]interface{}{
|
||||||
|
"union_id": uid,
|
||||||
|
"activity_material_id": actMaterialID,
|
||||||
|
"adzone_id": adzoneID,
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result, &activityInfoGetResult, false)
|
||||||
|
}
|
||||||
|
return activityInfoGetResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//订单查询
|
||||||
|
func (a *API) AllOrders(beginTime, endTime string) (activityInfoGetResult *ActivityInfoGetResult, err error) {
|
||||||
|
result, err := a.AccessAPI("taobao.tbk.order.details.get", false, map[string]interface{}{
|
||||||
|
"start_time": beginTime,
|
||||||
|
"end_time": endTime,
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result, &activityInfoGetResult, false)
|
||||||
|
}
|
||||||
|
return activityInfoGetResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//新用户订单查询
|
||||||
|
func (a *API) NewUserAllOrders(actID string) (activityInfoGetResult *ActivityInfoGetResult, err error) {
|
||||||
|
result, err := a.AccessAPI("taobao.tbk.dg.newuser.order.get", false, map[string]interface{}{
|
||||||
|
"activity_id": actID,
|
||||||
|
"start_time": "2021-04-20 00:00:00",
|
||||||
|
"end_time": "2021-04-25 00:00:00",
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result, &activityInfoGetResult, false)
|
||||||
|
}
|
||||||
|
return activityInfoGetResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//返利订单查询
|
||||||
|
func (a *API) RebateOrderGet(beginTime string) (activityInfoGetResult *ActivityInfoGetResult, err error) {
|
||||||
|
result, err := a.AccessAPI("taobao.tbk.rebate.order.get", false, map[string]interface{}{
|
||||||
|
"fields": "tb_trade_parent_id,tb_trade_id,num_iid,item_title,item_num,price,pay_price,seller_nick,seller_shop_title,commission,commission_rate,unid,create_time,earning_time",
|
||||||
|
"start_time": beginTime,
|
||||||
|
"span": 600,
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result, &activityInfoGetResult, false)
|
||||||
|
}
|
||||||
|
return activityInfoGetResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
type GatewayUnionpubResult struct {
|
||||||
|
Eventbusourceplatform string `json:"eventBuSourcePlatform"`
|
||||||
|
Pagesourcebu string `json:"pageSourceBu"`
|
||||||
|
Eventenname string `json:"eventEnName"`
|
||||||
|
Pagename string `json:"pageName"`
|
||||||
|
Pageurl string `json:"pageUrl"`
|
||||||
|
Pagestarttime string `json:"pageStartTime"`
|
||||||
|
Pageid string `json:"pageId"`
|
||||||
|
Pageendtime string `json:"pageEndTime"`
|
||||||
|
Pagepicturl string `json:"pagePictUrl"`
|
||||||
|
UdfTempStore struct {
|
||||||
|
} `json:"udf_temp_store"`
|
||||||
|
Terminaltype string `json:"terminalType"`
|
||||||
|
Pageurlmd5 string `json:"pageUrlMd5"`
|
||||||
|
Busourceplatform string `json:"buSourcePlatform"`
|
||||||
|
Eventperiodtype int `json:"eventPeriodType"`
|
||||||
|
Eventid string `json:"eventId"`
|
||||||
|
Lensid string `json:"lensId"`
|
||||||
|
Tobizshowforcetop int `json:"toBizShowForceTop"`
|
||||||
|
Pagetracetype string `json:"pageTraceType"`
|
||||||
|
Eventname string `json:"eventName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询饿了么活动(扒的)
|
||||||
|
func (a *API) GatewayUnionpub() (gatewayUnionpubResult []*GatewayUnionpubResult, err error) {
|
||||||
|
result, err := a.AccessStorePage("https://pub.alimama.com/openapi/param2/1/gateway.unionpub/xt.entry.json", map[string]interface{}{
|
||||||
|
"floorId": 38766,
|
||||||
|
"t": time.Now().UnixNano(),
|
||||||
|
"_tb_token_": "7e385ebeee37e",
|
||||||
|
"pageSize": 20,
|
||||||
|
"refpid": "mm_1172080007_0_0",
|
||||||
|
"pageNum": 0,
|
||||||
|
"variableMap": "{\"traceType\":\"4\",\"terminalType\":\"\",\"filterQuery\":\"\"}",
|
||||||
|
}, false)
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result["data"].(map[string]interface{})["resultList"], &gatewayUnionpubResult, false)
|
||||||
|
}
|
||||||
|
return gatewayUnionpubResult, err
|
||||||
|
}
|
||||||
54
platformapi/tbunionapi/union_test.go
Normal file
54
platformapi/tbunionapi/union_test.go
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
package tbunionapi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAdzoneCreate(t *testing.T) {
|
||||||
|
err := api.AdzoneCreate(2293250207, "999999")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
//t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestActivityInfoGet(t *testing.T) {
|
||||||
|
result, err := api.ActivityInfoGet("999999", "20150318020002597", 999999)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAllOrders(t *testing.T) {
|
||||||
|
result, err := api.AllOrders("2021-04-23 00:00:00", "2021-04-23 23:59:59")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNewUserAllOrders(t *testing.T) {
|
||||||
|
result, err := api.NewUserAllOrders("20150318020002597")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestRebateOrderGet(t *testing.T) {
|
||||||
|
result, err := api.RebateOrderGet("2021-04-05 09:10:00")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGatewayUnionpub(t *testing.T) {
|
||||||
|
result, err := api.GatewayUnionpub()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user