Merge branch 'master' of https://e.coding.net/rosydev/baseapi
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package ali_logistics_query
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"testing"
|
||||
@@ -18,3 +19,7 @@ func Test(t *testing.T) {
|
||||
globals.SugarLogger.Debugf("result======== %s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("err======== %s", utils.Format4Output(err, false))
|
||||
}
|
||||
|
||||
func TestSkuStatus(t *testing.T) {
|
||||
fmt.Println(2&(4|2|1) != 0)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ func TestPrinterDelList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestQueryOrderInfoByDate(t *testing.T) {
|
||||
printed, waiting, err := api.QueryOrderInfoByDate("550518714", time.Now())
|
||||
printed, waiting, err := api.QueryOrderInfoByDate("922591501", time.Now())
|
||||
if err != nil {
|
||||
t.Fatalf("QueryOrderInfoByDate return error:%v", err)
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func TestDelPrinterSqs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestQueryPrinterStatus(t *testing.T) {
|
||||
status, err := api.QueryPrinterStatus("220502420")
|
||||
status, err := api.QueryPrinterStatus("922591501")
|
||||
if err != nil {
|
||||
t.Fatalf("QueryPrinterStatus return error:%v", err)
|
||||
}
|
||||
|
||||
@@ -25,11 +25,13 @@ func init() {
|
||||
// sandbox
|
||||
// api = New("594ab45a-9a73-4a43-82b0-a64cbd55d883", "06692746f7224695ad4788ce340bc854", "d6b42a35a7414a5490d811654d745c84")
|
||||
// prod
|
||||
api = New("73e2e9f6-b21e-4dcd-8c92-71e4e100b07e", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4")
|
||||
//api = New("73e2e9f6-b21e-4dcd-8c92-71e4e100b07e", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4")
|
||||
// 天天果园
|
||||
//api = New("c45e6510-00ba-4be2-977e-bcb9c9792cc7", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26")
|
||||
// 京东果园
|
||||
//api = New("b1138139-9610-4b80-9a63-a63da4773885", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26")
|
||||
// 果切
|
||||
api = New("0e12f461-2e6b-49ca-bce6-935c6672362d", "f2ed33075faf4773a47e065acd79532b", "aed14cbbecac4456843570e90c5f46ec")
|
||||
|
||||
//prod zs
|
||||
// api = New("6f8d3290-0120-4ad7-8b53-943c67c84f3f", "789279b9ae814ba091ac52815566b54d", "5d668cd227644637bb0fd73ed8118ec8")
|
||||
|
||||
@@ -50,7 +50,7 @@ import (
|
||||
//}
|
||||
//
|
||||
func TestGetStoreInfoByStationNo(t *testing.T) {
|
||||
result, err := api.GetStoreInfoByStationNo2("12028339")
|
||||
result, err := api.GetStoreInfoByStationNo2("12535376")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -113,10 +113,11 @@ func (a *API) AddPrinter(addPrinterParams []*AddPrinterParam) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) DelPrinter(printNos []string) (err error) {
|
||||
func (a *API) DelPrinter(printNos []string, storeId string) (err error) {
|
||||
data, _ := json.Marshal(printNos)
|
||||
_, err = a.AccessAPI("DelPrinter", map[string]interface{}{
|
||||
"print_nos": string(data),
|
||||
"storeId": storeId,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@ func init() {
|
||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
|
||||
// 果园
|
||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
|
||||
//商超
|
||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nH_IlcWQKAkZBqklwItNRw") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nH_IlcWQKAkZBqklwItNRw") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
cookieStr := `
|
||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||
`
|
||||
|
||||
@@ -2,11 +2,11 @@ package mtwmapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
func TestOrderViewStatus(t *testing.T) {
|
||||
@@ -18,7 +18,7 @@ func TestOrderViewStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOrderGetOrderDetail(t *testing.T) {
|
||||
result, err := api.OrderGetOrderDetail(1100280412024133788, false)
|
||||
result, err := api.OrderGetOrderDetail(1100335050573312765, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -183,3 +183,53 @@ func TestOrderDelivering(t *testing.T) {
|
||||
err := api.OrderDelivering(148815413321281654)
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// 88 67 【组合菜】尖椒茄子(茄子500g 青尖椒200g)700g/组(茄子500g 青椒200g)
|
||||
// 90 60
|
||||
func TestLen(t *testing.T) {
|
||||
aa := "【组合菜】尖椒茄子(茄子500g 青尖椒200g)700g/组(茄子500g 青椒200g)"
|
||||
var count int // 中文
|
||||
var punctZh int // 中文标点
|
||||
var punctEn int // 英文标点
|
||||
var punctAZ int // 字母
|
||||
var punctNum int // 字母
|
||||
var spance int // 空格
|
||||
for _, v := range aa {
|
||||
if unicode.Is(unicode.Han, v) { // 中文
|
||||
count++
|
||||
continue
|
||||
}
|
||||
if unicode.IsPunct(v) { // 字符
|
||||
if v >= 1000 {
|
||||
fmt.Println(v)
|
||||
punctZh++
|
||||
} else {
|
||||
punctEn++
|
||||
}
|
||||
continue
|
||||
}
|
||||
if unicode.IsLetter(v) {
|
||||
punctAZ++
|
||||
continue
|
||||
}
|
||||
if unicode.IsNumber(v) {
|
||||
punctNum++
|
||||
continue
|
||||
}
|
||||
if unicode.IsSpace(v) {
|
||||
spance++
|
||||
continue
|
||||
}
|
||||
}
|
||||
fmt.Println("count:= ", count)
|
||||
fmt.Println("count:= ", punctZh)
|
||||
fmt.Println("count:= ", punctEn)
|
||||
fmt.Println("count:= ", punctAZ)
|
||||
fmt.Println("count:= ", punctNum)
|
||||
|
||||
fmt.Println("all = ", (count*2)+(punctZh*2)+punctEn+punctAZ+punctNum+spance)
|
||||
}
|
||||
|
||||
func TestName(t *testing.T) {
|
||||
fmt.Println((10 & 2) != 0)
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ func TestPoiSave(t *testing.T) {
|
||||
//}
|
||||
poiParams := map[string]interface{}{}
|
||||
//utils.FilterMapNilMembers(utils.Struct2FlatMap(result[0]))
|
||||
poiParams["name"] = "京西果园·果切·水果捞(金碧园店)"
|
||||
err := api.PoiSave("9410009", poiParams)
|
||||
poiParams["address"] = "云南省楚雄彝族自治州楚雄市鹿城镇陈家槽子村小吃一条街B21号"
|
||||
err := api.PoiSave("15467875", poiParams)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
|
||||
@@ -271,6 +271,7 @@ func handleRetailBatchResultByRegexp(result interface{}) (failedFoodList []*AppF
|
||||
// https://developer.waimai.meituan.com/home/myquestionDetail/6716
|
||||
// 另外这个接口即使不指定operate_type为1,也可能报错:”商品spu名称在该店内分类中已存在“,原因就是已经存在两个相同的SKU了
|
||||
func (a *API) RetailInitData(trackInfo, poiCode, foodCode string, params map[string]interface{}) (err error) {
|
||||
globals.SugarLogger.Debugf("===========create sku mt : %s,%s,%s,%s", trackInfo, poiCode, foodCode, utils.Format4Output(params, false))
|
||||
_, err = a.AccessAPI2("retail/initdata", false, utils.MergeMaps(map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
KeyAppFoodCode: foodCode,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package material_searchFolder_response
|
||||
|
||||
import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
|
||||
type MaterialSearchFolderResponse struct {
|
||||
doudian_sdk.BaseDoudianOpApiResponse
|
||||
Data *MaterialSearchFolderData `json:"data"`
|
||||
|
||||
@@ -8,7 +8,18 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
var token = `{"access_token":"e8b6c1bc-2477-40ff-bd8e-faf547669d77","expires_in":1671431173,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"3cd84170-73a0-485c-b55a-74e128618693","authority_id":""}`
|
||||
//var token = `{
|
||||
// "access_token": "b668f8cc-d875-4887-a613-5452f05e752e",
|
||||
// "expires_in": 1671432212,
|
||||
// "scope": "SCOPE",
|
||||
// "shop_id": 63141688,
|
||||
// "shop_name": "小时达开放平台专用店",
|
||||
// "refresh_token": "fa64fedf-05a7-4c1b-b6c4-f97f90e10b75",
|
||||
// "authority_id": ""
|
||||
//}`
|
||||
|
||||
//var token = `{"access_token":"e8b6c1bc-2477-40ff-bd8e-faf547669d77","expires_in":1671431173,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"3cd84170-73a0-485c-b55a-74e128618693","authority_id":""}`
|
||||
var token = `{"access_token":"83e52462-ad46-4297-98c4-242ee6b7a5c8","expires_in":1672033612,"scope":"SCOPE","shop_id":63141688,"shop_name":"二期-抖音超市小时达测试店铺","refresh_token":"8f690bc3-3f3e-49bd-bbf7-31c9e868e980","authority_id":""}`
|
||||
var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||
|
||||
// 查询售后单详情
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestApi(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestQueryOrderDetail(t *testing.T) {
|
||||
data, err := a.GetTiktokOrderDetail("5008526050099613284")
|
||||
data, err := a.GetTiktokOrderDetail("5012575500183489614")
|
||||
globals.SugarLogger.Debugf("=====%s", utils.Format4Output(data, false))
|
||||
globals.SugarLogger.Debugf("=====%s", err)
|
||||
}
|
||||
@@ -42,15 +42,15 @@ func TestTimeNow(t *testing.T) {
|
||||
|
||||
func TestSendGoods(t *testing.T) {
|
||||
param := &order_logisticsAdd_request.OrderLogisticsAddParam{
|
||||
OrderId: "4989178132980723098",
|
||||
OrderId: "5013254696638589999",
|
||||
Company: "",
|
||||
CompanyCode: "chengdouruoxi",
|
||||
LogisticsCode: "4989178132980723098111",
|
||||
LogisticsCode: "5013254696638589999",
|
||||
IsRefundReject: false,
|
||||
IsRejectRefund: false,
|
||||
SerialNumberList: nil,
|
||||
AddressId: 0,
|
||||
StoreId: 63114504,
|
||||
StoreId: 63520894,
|
||||
}
|
||||
a.OrderDelivering(param)
|
||||
}
|
||||
|
||||
32
platformapi/tiktok_shop/tiktok_api/delete_test.go
Normal file
32
platformapi/tiktok_shop/tiktok_api/delete_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package tiktok_api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDeleteSku(t *testing.T) {
|
||||
var tiktokId = []int64{
|
||||
3589392977455372474,
|
||||
}
|
||||
for _, v := range tiktokId {
|
||||
if err := a.DeleteStoreCommodity(v); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
func TestTryCatName2Code(t *testing.T) {
|
||||
code := tryCatName2Code("3039")
|
||||
fmt.Println(code)
|
||||
}
|
||||
|
||||
func tryCatName2Code(originName string) (catCodeStr string) {
|
||||
if intValue := utils.Str2Int64WithDefault(originName, 0); intValue > 0 {
|
||||
catCodeStr = utils.Int64ToStr(intValue)
|
||||
if catCodeStr != originName {
|
||||
catCodeStr = ""
|
||||
}
|
||||
}
|
||||
return catCodeStr
|
||||
}
|
||||
@@ -32,8 +32,6 @@ func (a *API) GetTiktokOrderDetail(orderId string) (*order_orderDetail_response.
|
||||
IsSearchable: false,
|
||||
}
|
||||
orderDetail, err := reqParam.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("获取订单详情%s", reqParam.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("获取订单详情:=%s", utils.Format4Output(orderDetail, false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -53,8 +51,6 @@ func (a *API) QueryAfsOrderDetail(afterSaleId string, needOperationRecord bool)
|
||||
param.AfterSaleId = afterSaleId
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("查询售后订单详情%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("查询售后订单详情:=%s", utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -196,3 +196,14 @@ const (
|
||||
TiktokLogisticsINDDELIVERYEXCEPTION = "IND_DELIVERY_EXCEPTION" // 订单配送异常,异常原因
|
||||
TiktokLogisticsCANCELDELIVERY = "CANCEL_DELIVERY" // 订单配送取消
|
||||
)
|
||||
|
||||
// 商品审核状态: 1-未提交;2-待审核;3-审核通过;4-审核未通过;5-封禁;7-审核通过待上架;详见商品状态机:https://op.jinritemai.com/docs/question-docs/92/2070
|
||||
|
||||
const (
|
||||
SkuCheckStatusNotCommit = 1 // 未提交
|
||||
SkuCheckStatusWaitCheck = 2 // 待审核
|
||||
SkuCheckStatusPass = 3 // 审核通过
|
||||
SkuCheckStatusNotPass = 4 // 审核未通过
|
||||
SkuCheckStatusProhibit = 5 // 禁封
|
||||
SkuCheckStatusPassNotPutOn = 7 // 通过待上架
|
||||
)
|
||||
|
||||
@@ -14,5 +14,7 @@ func TestBillDetail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLen(t *testing.T) {
|
||||
fmt.Println(len("【新鲜】带皮猪五花肉约500g/份"))
|
||||
fmt.Println((57 & 1) != 0)
|
||||
fmt.Println((57 & 64) != 0)
|
||||
fmt.Println((0 & 8))
|
||||
}
|
||||
|
||||
@@ -121,11 +121,11 @@ func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2P
|
||||
request.Param = skuParam
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("======CreateStoreCommodity logid: %s,%d", result.LogId, skuParam.MainProductId)
|
||||
globals.SugarLogger.Debugf("======CreateStoreCommodity logid: %s,%d,%d", result.LogId, skuParam.MainProductId, err.Error())
|
||||
return nil, err
|
||||
}
|
||||
if result.Code != RequestSuccessCode {
|
||||
globals.SugarLogger.Debugf("======CreateStoreCommodity logid: %s,%d", result.LogId, skuParam.MainProductId)
|
||||
globals.SugarLogger.Debugf("======CreateStoreCommodity logid: %s,%d,%d", result.LogId, skuParam.MainProductId, result.SubMsg)
|
||||
return nil, errors.New(result.SubMsg)
|
||||
}
|
||||
return result.Data, nil
|
||||
@@ -151,12 +151,14 @@ func (a *API) EditStoreCommodity(sku *product_editV2_request.ProductEditV2Param)
|
||||
request.Param = sku
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("====skuparam %s", utils.Format4Output(sku, false))
|
||||
globals.SugarLogger.Debugf("====result %s", utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("======EditStoreCommodity logid: %s,%d", result.LogId, sku.MainProductId)
|
||||
globals.SugarLogger.Debugf("LogId %s ,err %s", result.LogId, err.Error())
|
||||
return err
|
||||
}
|
||||
if result.Code != RequestSuccessCode {
|
||||
globals.SugarLogger.Debugf("======EditStoreCommodity logid: %s,%d", result.LogId, sku.MainProductId)
|
||||
globals.SugarLogger.Debugf("LogId %s ,err %s", result.LogId, result.SubMsg)
|
||||
return errors.New(result.SubMsg)
|
||||
}
|
||||
return nil
|
||||
@@ -168,8 +170,6 @@ func (a *API) EditStoreCommodityCommit(sku *product_editV2_commit_request.Produc
|
||||
request.Param = sku
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("商品上架=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("商品上架:=%s", utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -187,8 +187,6 @@ func (a *API) DeleteStoreCommodity(productId int64) error {
|
||||
param.DeleteForever = true
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("删除商品=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("删除商品:=%s", utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -206,8 +204,6 @@ func (a *API) ProductSetOffline(productId int64) error {
|
||||
param.ProductId = productId
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("商品下架=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("商品下架:=%s", utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -224,13 +220,10 @@ func (a *API) GetSkuDetail(productId, outProductId string) (*product_detail_resp
|
||||
if productId != "" {
|
||||
param.ProductId = productId
|
||||
}
|
||||
if outProductId != "" {
|
||||
//param.OutProductId = outProductId
|
||||
}
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("获取商品详情=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("获取商品详情:=%s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("=GetSkuDetail By productId %s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("=GetSkuDetail By err %s", utils.Format4Output(err, false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -250,8 +243,8 @@ func (a *API) GetSkuDetailLocalID(productId, outProductId string) (*product_deta
|
||||
}
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("获取商品详情=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("获取商品详情:=%s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("=GetSkuDetail By productId %s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("=GetSkuDetail By err %s", utils.Format4Output(err, false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -511,10 +504,12 @@ func (a *API) CreateSubProduct(mainProductId int64, storeId int64) (int64, error
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("基于店铺主品创建门店子品:err =%s ,%s", utils.Format4Output(err, false), result.LogId)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if result.Code != CallbackSuccessCode {
|
||||
if result.Code != RequestSuccessCode {
|
||||
globals.SugarLogger.Debugf("基于店铺主品创建门店子品:err =%s ,%s", result.SubMsg, result.LogId)
|
||||
return 0, errors.New(result.SubMsg)
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ func TestInt16(t *testing.T) {
|
||||
|
||||
// 查询商品详情(抖音平台id)
|
||||
func TestGetSkuDetail(t *testing.T) {
|
||||
data, err := a.GetSkuDetailLocalID("", "30204")
|
||||
data, err := a.GetSkuDetailLocalID("", "6099286")
|
||||
fmt.Println(err)
|
||||
// 3582171870197365727 3582171870197365727
|
||||
globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false))
|
||||
@@ -232,7 +232,7 @@ func TestGetSkuDetail(t *testing.T) {
|
||||
|
||||
// 查询商品详情本地商品id
|
||||
func TestGetSkuDetailLocalId(t *testing.T) {
|
||||
data, err := a.GetSkuDetail("3579214355667024761", "")
|
||||
data, err := a.GetSkuDetail("3588469215562226655", "")
|
||||
fmt.Println(err)
|
||||
globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false))
|
||||
}
|
||||
@@ -270,16 +270,26 @@ func TestEiduPrice(t *testing.T) {
|
||||
|
||||
// s上架1
|
||||
func TestEditStoreCommodity(t *testing.T) {
|
||||
data, _ := a.GetSkuDetail("3580251132888538614", "")
|
||||
globals.SugarLogger.Debugf("=============%s", data.ProductFormatNew)
|
||||
specPrice, _ := json.Marshal(data.SpecPrices)
|
||||
a.EditStoreCommodity(&product_editV2_request.ProductEditV2Param{
|
||||
ProductId: 1748169491056643,
|
||||
ProductFormatNew: data.ProductFormatNew,
|
||||
SpecPrices: string(specPrice),
|
||||
Specs: "重量|250g",
|
||||
Commit: true,
|
||||
})
|
||||
err := a.EditStoreCommodity(&product_editV2_request.ProductEditV2Param{
|
||||
CategoryLeafId: 22428,
|
||||
Name: "净芹菜约350g/份(净菜芹菜摘叶洗净,保鲜膜包装)",
|
||||
Pic: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/PTWpUjYg_m_78dbc86c51be55406cd2f51bc863b2e0_sx_32178_www800-800",
|
||||
Description: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/PTWpUjYg_m_4fdaab3dd1df6ed4aa8d0990b0e99ee7_sx_456574_www750-3527",
|
||||
PayType: 1,
|
||||
ReduceType: 2,
|
||||
Weight: 350,
|
||||
WeightUnit: 1,
|
||||
DeliveryDelayDay: 9999,
|
||||
Mobile: "18048531223",
|
||||
Commit: true,
|
||||
Specs: "重量|350g",
|
||||
SpecPrices: "[{\"spec_detail_name1\":\"350g\",\"spec_detail_name2\":\"\",\"spec_detail_name3\":\"\",\"stock_num\":9999,\"price\":850,\"code\":\"23010\",\"step_stock_num\":0,\"supplier_id\":\"\",\"outer_sku_id\":\"23010\",\"sku_type\":1,\"stock_num_map\":{\"79226307\":9999},\"delivery_infos\":[{\"info_type\":\"weight\",\"info_value\":\"350\",\"info_unit\":\"g\"}]}]",
|
||||
ProductFormatNew: "{\n\t\"1687\": [\n\t\t{\n\t\t\t\"diy_type\": 0,\n\t\t\t\"name\": \"品牌\",\n\t\t\t\"value\": 789194134\n\t\t}\n\t]\n}",
|
||||
StandardBrandId: 789194134,
|
||||
NeedCheckOut: false,
|
||||
ForceUseQualityList: false,
|
||||
NeedRechargeMode: false})
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// 上架2
|
||||
|
||||
@@ -9,6 +9,7 @@ type Imgs struct {
|
||||
const (
|
||||
TiktokFolder1 = "71580417560930552391570" // 文件夹(京西菜市)
|
||||
TiktokFolder2 = "71482723234545339291960"
|
||||
TiktokFolder3 = "71762017122139835211688" // (方案二测试文件夹)
|
||||
)
|
||||
|
||||
// 商品减库存类型
|
||||
|
||||
@@ -6,8 +6,6 @@ import (
|
||||
material_batchUploadImageSync_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/material_batchUploadImageSync/response"
|
||||
material_createFolder_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/material_createFolder/request"
|
||||
material_createFolder_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/material_createFolder/response"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
// CreateFolder 创建商品库文件夹(存放商品图片素材)
|
||||
@@ -51,6 +49,10 @@ func (a *API) BatchUploadImages(imgs []Imgs) (map[string]material_batchUploadIma
|
||||
Name: imgs[i].Name,
|
||||
Url: imgs[i].Url,
|
||||
}
|
||||
// 测试文件夹
|
||||
if a.accessTokenObj.ShopId == 63141688 {
|
||||
img.FolderId = TiktokFolder3
|
||||
}
|
||||
param = append(param, img)
|
||||
}
|
||||
|
||||
@@ -58,16 +60,15 @@ func (a *API) BatchUploadImages(imgs []Imgs) (map[string]material_batchUploadIma
|
||||
imgParam.Materials = param
|
||||
imgParam.NeedDistinct = true
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("===BatchUploadImages=======result %s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("===BatchUploadImages=======err %s", utils.Format4Output(err, false))
|
||||
if len(result.Data.SuccessMap) > 0 {
|
||||
return result.Data.SuccessMap, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if result.Code != RequestSuccessCode {
|
||||
return nil, errors.New("==============logId" + result.LogId + ":" + result.SubMsg)
|
||||
}
|
||||
if len(result.Data.SuccessMap) > 0 {
|
||||
return result.Data.SuccessMap, nil
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ func init() {
|
||||
}
|
||||
|
||||
func TestCreateFolad(t *testing.T) {
|
||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
|
||||
data, err := a.CreateFolder("测试创建文件夹1019")
|
||||
data, err := a.CreateFolder("shop_63141688")
|
||||
fmt.Println("err=====", err)
|
||||
fmt.Println("LogId====", data.LogId) //2022092811422001020812109607601B77
|
||||
fmt.Println("data====", data.Data.Name) // jxcs_folder
|
||||
|
||||
@@ -447,8 +447,6 @@ func (a *API) BindFenceByStore(param *warehouse_bindFencesByStore_request.Wareho
|
||||
request := warehouse_bindFencesByStore_request.New()
|
||||
request.Param = param
|
||||
response, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("门店绑定电子围栏=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("门店绑定电子围栏:=%s", utils.Format4Output(response, false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user