1
This commit is contained in:
@@ -48,7 +48,7 @@ type ProductDetailParam struct {
|
||||
// 商品ID,抖店系统生成,店铺下唯一;长度19位。
|
||||
ProductId string `json:"product_id"`
|
||||
// 外部商家编码,商家自定义字段
|
||||
//OutProductId string `json:"out_product_id"`
|
||||
OutProductId string `json:"out_product_id"`
|
||||
//// true:读取草稿数据;false:读取线上数据;不传默认为false
|
||||
//ShowDraft string `json:"show_draft"`
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
var token = `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}`
|
||||
|
||||
var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}`
|
||||
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
|
||||
|
||||
// 查询售后单详情
|
||||
|
||||
@@ -7,9 +7,12 @@ import (
|
||||
)
|
||||
|
||||
func TestBillDetail(t *testing.T) {
|
||||
var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}`
|
||||
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
|
||||
|
||||
a.GetSettleBillDetailV3(&order_getSettleBillDetailV3_request.OrderGetSettleBillDetailV3Param{
|
||||
Size: 10,
|
||||
OrderId: "5035210591285239695",
|
||||
OrderId: "6922140885578684202",
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -281,6 +281,9 @@ 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)
|
||||
if err != nil {
|
||||
@@ -571,6 +574,60 @@ func (a *API) GetProductAuditList(page, pageSize, status int64) ([]product_audit
|
||||
return result.Data.Records, result.Data.Total, nil
|
||||
}
|
||||
|
||||
// GetRecommendCategoryByName 根据名称预测商品类目,优先四级>三级>二级>1级
|
||||
func (a *API) GetRecommendCategoryByName(name string) (int64, error) {
|
||||
if name == "" {
|
||||
return 0, errors.New("抖音根据名称预测分类,名称不能为空")
|
||||
}
|
||||
request := product_GetRecommendCategory_request.New()
|
||||
request.Param.Scene = "category_infer"
|
||||
request.Param.Name = name
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if result.Code != RequestSuccessCode {
|
||||
return 0, errors.New(result.SubMsg + ":" + result.LogId)
|
||||
}
|
||||
|
||||
if len(result.Data.CategoryDetails) == 0 {
|
||||
return 0, errors.New("抖音根据图片获取分类,返回值为0")
|
||||
}
|
||||
|
||||
var firstCid int64
|
||||
var secondCid int64
|
||||
var thirdCid int64
|
||||
var fourthCid int64
|
||||
|
||||
index := len(result.Data.CategoryDetails) - 1
|
||||
if result.Data.CategoryDetails[index].CategoryDetail.FirstCid != 0 {
|
||||
firstCid = result.Data.CategoryDetails[index].CategoryDetail.FirstCid
|
||||
}
|
||||
if result.Data.CategoryDetails[index].CategoryDetail.SecondCid != 0 {
|
||||
secondCid = result.Data.CategoryDetails[index].CategoryDetail.SecondCid
|
||||
}
|
||||
if result.Data.CategoryDetails[index].CategoryDetail.ThirdCid != 0 {
|
||||
thirdCid = result.Data.CategoryDetails[index].CategoryDetail.ThirdCid
|
||||
}
|
||||
if result.Data.CategoryDetails[index].CategoryDetail.FourthCid != 0 {
|
||||
fourthCid = result.Data.CategoryDetails[index].CategoryDetail.FourthCid
|
||||
}
|
||||
if fourthCid != 0 {
|
||||
return fourthCid, nil
|
||||
}
|
||||
if thirdCid != 0 {
|
||||
return thirdCid, nil
|
||||
}
|
||||
if secondCid != 0 {
|
||||
return secondCid, nil
|
||||
}
|
||||
if firstCid != 0 {
|
||||
return firstCid, nil
|
||||
}
|
||||
return 0, errors.New("抖音获取推荐分类异常")
|
||||
}
|
||||
|
||||
// GetRecommendCategory 根据图片预测商品类目,优先四级>三级>二级>1级
|
||||
func (a *API) GetRecommendCategory(picParams []string) (int64, error) {
|
||||
if len(picParams) == 0 {
|
||||
@@ -637,6 +694,8 @@ func (a *API) CreateSubProduct(mainProductId int64, storeId int64) (int64, error
|
||||
request.Param.StoreId = storeId
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("=========result := %s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("=========result := %s", utils.Format4Output(err, false))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -18,9 +18,18 @@ func TestN2ame(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRecommendCategory(t *testing.T) {
|
||||
img, _, err := GetTiktokImgListTest(a, "668707", "", "", "http://img20.360buyimg.com/vc/jfs/t1/8979/39/8591/236012/5c0e45f3E1537c120/a66aafc95cf66977.jpg", "http://img20.360buyimg.com/vc/jfs/t1/23027/3/955/82830/5c0e45f3E0855eeae/ae65ee9555a29579.jpg")
|
||||
fmt.Println(err)
|
||||
data, err := a.GetRecommendCategory(strings.Split(img, "|"))
|
||||
//img, _, err := GetTiktokImgListTest(a, "668707", "", "", "http://img20.360buyimg.com/vc/jfs/t1/8979/39/8591/236012/5c0e45f3E1537c120/a66aafc95cf66977.jpg", "http://img20.360buyimg.com/vc/jfs/t1/23027/3/955/82830/5c0e45f3E0855eeae/ae65ee9555a29579.jpg")
|
||||
//fmt.Println(err)
|
||||
//img := []string{
|
||||
// //"https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_f229ad3ce7a93d906a2412709e363825_sx_762890_www750-3527",
|
||||
// "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_7457cda4c101d05bcd2a1258b61d2ba1_sx_223234_www800-800",
|
||||
// //"https://p3-aio.ecombdimg.com/obj/ecom-shop-material/v1_GhxlaZ_70852585116381186630419_c55b8401b00e96e4114431a1dbd7c99c_sx_582346_www1000-1000",
|
||||
//}
|
||||
var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}`
|
||||
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
|
||||
|
||||
name := "广茄 "
|
||||
data, err := a.GetRecommendCategoryByName(name)
|
||||
fmt.Println(data)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
@@ -55,7 +55,10 @@ func TestGetSkuDetail(t *testing.T) {
|
||||
|
||||
// 查询商品详情本地商品id
|
||||
func TestGetSkuDetailLocalId(t *testing.T) {
|
||||
data, err := a.GetSkuDetail("3592382914735826936", "")
|
||||
var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}`
|
||||
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
|
||||
|
||||
data, err := a.GetSkuDetail("3592503538749683119", "")
|
||||
fmt.Println(err)
|
||||
globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false))
|
||||
}
|
||||
|
||||
@@ -285,10 +285,8 @@ func TestGetWarehouseByStore(t *testing.T) {
|
||||
storeIDs := []int64{87542533}
|
||||
need := []int64{}
|
||||
errList := errlist.New()
|
||||
var str = `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}`
|
||||
var apis = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", str)
|
||||
for _, v := range storeIDs {
|
||||
resp, err := apis.GetWarehouseByStore(v)
|
||||
resp, err := a.GetWarehouseByStore(v)
|
||||
if resp.WarehouseInfoMap[utils.Int64ToStr(v)] == nil || len(resp.WarehouseInfoMap[utils.Int64ToStr(v)][0].OutFenceIds) == 0 {
|
||||
need = append(need, v)
|
||||
} else {
|
||||
@@ -483,10 +481,8 @@ func TestCreateWarehouse(t *testing.T) {
|
||||
|
||||
// 批量创建区域仓
|
||||
func TestBatchCreateWarehouse(t *testing.T) {
|
||||
token3 := `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}`
|
||||
a2 := New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token3)
|
||||
|
||||
data, err := a2.BatchCreateWarehouse(&warehouse_createBatch_request.WarehouseCreateBatchParam{
|
||||
data, err := a.BatchCreateWarehouse(&warehouse_createBatch_request.WarehouseCreateBatchParam{
|
||||
OutWarehouseList: []warehouse_createBatch_request.OutWarehouseListItem{
|
||||
{
|
||||
OutWarehouseId: "668841",
|
||||
@@ -507,9 +503,7 @@ func TestBatchCreateWarehouse(t *testing.T) {
|
||||
|
||||
//查询四级地址全量省份信息
|
||||
func TestGetProvince(t *testing.T) {
|
||||
token3 := `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}`
|
||||
a2 := New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token3)
|
||||
retVal, err := a2.GetProvince()
|
||||
retVal, err := a.GetProvince()
|
||||
fmt.Println(utils.Format4Output(retVal, false))
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
@@ -39,8 +39,6 @@ func Test(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetShipmentInfo(t *testing.T) {
|
||||
var token = `{"access_token":"719db06b-3fbf-461b-8cf2-e5ae70293cdc","expires_in":1695876413,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8c478de3-8fbd-4535-a78c-06792b8a20a4","authority_id":""}`
|
||||
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
|
||||
data, err := a.GetShipmentInfo(6922112012008166892, 0, ShipmentTypeInvoice)
|
||||
globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(data, false))
|
||||
globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(err, false))
|
||||
|
||||
Reference in New Issue
Block a user