Merge branch 'master' of https://e.coding.net/rosydev/baseapi
This commit is contained in:
@@ -1,22 +1,33 @@
|
||||
package tiktok_api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
order_getSettleBillDetailV3_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_getSettleBillDetailV3/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
// GetSettleBillDetailV3 商家结算账单
|
||||
// 已结算的订单才会有数据,数据T+1生成,建议第二天15点之后查询。如因任务积压导致延迟的情况,建议重试。
|
||||
// 1、推荐使用start_index方式查询
|
||||
func (a *API) GetSettleBillDetailV3(param *order_getSettleBillDetailV3_request.OrderAddressModifyParam) {
|
||||
func (a *API) GetSettleBillDetailV3(param *order_getSettleBillDetailV3_request.OrderGetSettleBillDetailV3Param) (map[string]int64, string, error) {
|
||||
request := order_getSettleBillDetailV3_request.New()
|
||||
request.Param = param
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return
|
||||
return nil, "", err
|
||||
}
|
||||
globals.SugarLogger.Debugf("======:%s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("======:%s", err)
|
||||
if result.Code != RequestSuccessCode {
|
||||
return nil, "", errors.New(result.SubMsg)
|
||||
}
|
||||
|
||||
if len(result.Data.Data) == 0 {
|
||||
return nil, "", nil
|
||||
}
|
||||
|
||||
totalShopMoney := make(map[string]int64, 0)
|
||||
for _, v := range result.Data.Data {
|
||||
totalShopMoney[v.ShopOrderId] = v.SettleAmount
|
||||
}
|
||||
|
||||
return totalShopMoney, result.Data.NextStartIndex, nil
|
||||
}
|
||||
|
||||
@@ -6,8 +6,11 @@ import (
|
||||
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"
|
||||
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_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/response"
|
||||
product_auditList_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_auditList/request"
|
||||
product_auditList_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_auditList/response"
|
||||
product_del_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_del/request"
|
||||
product_detail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_detail/request"
|
||||
product_detail_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_detail/response"
|
||||
@@ -8144,3 +8147,76 @@ func (a *API) GetProductUpdateRule2(categoryId int64) bool {
|
||||
}
|
||||
return result.Data.AfterSaleRule.SupplyDayReturnRule.Enable
|
||||
}
|
||||
|
||||
// GetProductAuditList 获取商品的审核记录
|
||||
func (a *API) GetProductAuditList(page, pageSize, status int64) ([]product_auditList_response.RecordsItem, int64, error) {
|
||||
request := product_auditList_request.New()
|
||||
request.Param.PublishStatus = status
|
||||
request.Param.Page = page
|
||||
request.Param.Size = pageSize
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
if result.Code != RequestSuccessCode {
|
||||
return nil, 0, errors.New(result.SubMsg)
|
||||
}
|
||||
|
||||
return result.Data.Records, result.Data.Total, nil
|
||||
}
|
||||
|
||||
// GetRecommendCategory 根据图片预测商品类目,优先四级>三级>二级>1级
|
||||
func (a *API) GetRecommendCategory(picParams []string) int64 {
|
||||
if len(picParams) == 0 {
|
||||
return 0
|
||||
}
|
||||
request := product_GetRecommendCategory_request.New()
|
||||
request.Param.Scene = "smart_publish" // 根据图片获取分类属性
|
||||
picList := make([]product_GetRecommendCategory_request.PicItem, 0, 0)
|
||||
for _, v := range picParams {
|
||||
picList = append(picList, product_GetRecommendCategory_request.PicItem{Url: v})
|
||||
}
|
||||
request.Param.Pic = picList
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
if result.Code != RequestSuccessCode {
|
||||
return 0
|
||||
}
|
||||
|
||||
var firstCid int64
|
||||
var secondCid int64
|
||||
var thirdCid int64
|
||||
var fourthCid int64
|
||||
|
||||
for _, v := range result.Data.CategoryDetails {
|
||||
if v.CategoryDetail.FirstCid != 0 {
|
||||
firstCid = v.CategoryDetail.FirstCid
|
||||
}
|
||||
if v.CategoryDetail.SecondCid != 0 {
|
||||
secondCid = v.CategoryDetail.SecondCid
|
||||
}
|
||||
if v.CategoryDetail.ThirdCid != 0 {
|
||||
thirdCid = v.CategoryDetail.ThirdCid
|
||||
}
|
||||
if v.CategoryDetail.FourthCid != 0 {
|
||||
fourthCid = v.CategoryDetail.FourthCid
|
||||
}
|
||||
}
|
||||
if fourthCid != 0 {
|
||||
return fourthCid
|
||||
}
|
||||
if thirdCid != 0 {
|
||||
return thirdCid
|
||||
}
|
||||
if secondCid != 0 {
|
||||
return secondCid
|
||||
}
|
||||
if firstCid != 0 {
|
||||
return firstCid
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ func TestBatchDecrypt(t *testing.T) {
|
||||
func TestGetSkuList(t *testing.T) {
|
||||
result, err := a.GetSkuDetailList(&product_listV2_request.ProductListV2Param{
|
||||
Status: 0,
|
||||
CheckStatus: 3,
|
||||
CheckStatus: 4,
|
||||
ProductType: 0,
|
||||
StartTime: 0,
|
||||
EndTime: 0,
|
||||
@@ -326,7 +326,6 @@ func TestGetSkuList(t *testing.T) {
|
||||
Size: 100,
|
||||
UpdateStartTime: 0,
|
||||
UpdateEndTime: 0,
|
||||
//StoreId: 65402632,
|
||||
})
|
||||
|
||||
for _, v := range result.Data {
|
||||
@@ -385,3 +384,27 @@ func TestNameeeee(t *testing.T) {
|
||||
func TestGetProductUpdateRule2(t *testing.T) {
|
||||
a.GetProductUpdateRule2(20219)
|
||||
}
|
||||
|
||||
func TestPPPPPPPPPPPPPP(t *testing.T) {
|
||||
aa := "该商品类目选择错误,推荐放置在“面条/挂面(待煮面条)”类目中."
|
||||
|
||||
for _, v := range strings.Split(aa, "“") {
|
||||
fmt.Println(v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetProductAuditList(t *testing.T) {
|
||||
data, _, _ := a.GetProductAuditList(1, 100, 2)
|
||||
updateCategory := make(map[string]string, 0) // 修改分类的Map
|
||||
for _, v := range data {
|
||||
if _, ok := v.AuditReason["综合原因"]; ok {
|
||||
if strings.Contains(v.AuditReason["综合原因"][0], "该商品类目选择错误,推荐放置在") {
|
||||
list := strings.Split(v.AuditReason["综合原因"][0], `“`)
|
||||
list2 := strings.Split(list[1], `”`)
|
||||
categoryNameList := strings.Split(list2[0], "/")
|
||||
updateCategory[utils.Int64ToStr(v.ProductId)] = categoryNameList[len(categoryNameList)-1]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user