Merge branch 'master' of https://e.coding.net/rosydev/baseapi
This commit is contained in:
@@ -400,6 +400,7 @@ func (a *API) AccessAPIHavePage(apiStr string, jdParams map[string]interface{},
|
||||
if err := utils.UnmarshalUseNumber(encryptData, &data); err != nil {
|
||||
return nil, totalCount, platformapi.ErrResponseDataFormatWrong
|
||||
}
|
||||
|
||||
innerCode := forceInnerCode2Str(data["code"])
|
||||
if innerCode != "0" {
|
||||
err2 := utils.NewErrorCode(getErrMsgFromData(data), innerCode, 1)
|
||||
@@ -471,7 +472,7 @@ func JDDecodeToData(appSecret, data string) ([]byte, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp, err := utils.AESCBCDecpryt(sDec, []byte(key), []byte(iv))
|
||||
resp, err := utils.AESCBCDecprytJD(sDec, []byte(key), []byte(iv))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -124,12 +124,15 @@ func TestOrderAddTips(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOrderQuery2(t *testing.T) {
|
||||
//orderList, _, err := api.OrderQuery2(&OrderQueryParam{
|
||||
// OrderPurchaseTimeBegin: "2022-11-05 00:00:00",
|
||||
// OrderPurchaseTimeEnd: "2022-11-05 23:59:59",
|
||||
// DeliveryStationNo: "11954632",
|
||||
// PageNo: 1,
|
||||
// PageSize: 99999,
|
||||
//})
|
||||
orderList, _, err := api.OrderQuery2(&OrderQueryParam{
|
||||
OrderPurchaseTimeBegin: "2022-11-05 00:00:00",
|
||||
OrderPurchaseTimeEnd: "2022-11-05 23:59:59",
|
||||
DeliveryStationNo: "11954632",
|
||||
PageNo: 1,
|
||||
PageSize: 99999,
|
||||
OrderID: 2227217383000174,
|
||||
})
|
||||
t.Log(utils.Format4Output(orderList, false))
|
||||
if err != nil {
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestOrderViewStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOrderGetOrderDetail(t *testing.T) {
|
||||
result, err := api.OrderGetOrderDetail(1300248543772157444, false)
|
||||
result, err := api.OrderGetOrderDetail(1100280412024133788, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ type ProductEditV2Param struct {
|
||||
// 充值模式
|
||||
NeedRechargeMode bool `json:"need_recharge_mode"`
|
||||
// 多账号模板
|
||||
AccountTemplateId string `json:"account_template_id"`
|
||||
//AccountTemplateId string `json:"account_template_id"`
|
||||
// 全款预售和sku预售时传递,其他不传: 0 预售结束后发货 1支付完成后发货
|
||||
PresellDeliveryType int64 `json:"presell_delivery_type"`
|
||||
// 白底图url(仅素材中心url有效)
|
||||
|
||||
@@ -22,6 +22,7 @@ func New() *ProductGetProductUpdateRuleRequest {
|
||||
request.SetConfig(doudian_sdk.GlobalConfig)
|
||||
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
|
||||
return request
|
||||
|
||||
}
|
||||
|
||||
func (c *ProductGetProductUpdateRuleRequest) Execute(accessToken *doudian_sdk.AccessToken) (*product_getProductUpdateRule_response.ProductGetProductUpdateRuleResponse, error) {
|
||||
@@ -48,4 +49,8 @@ type ProductGetProductUpdateRuleParam struct {
|
||||
CategoryId int64 `json:"category_id"`
|
||||
// 闪购定制参数,普通发品忽略
|
||||
Senses []int32 `json:"senses"`
|
||||
// 品牌id
|
||||
StandardBrandId int64 `json:"standard_brand_id"`
|
||||
// spu_id
|
||||
SpuId int64 `json:"spu_id"`
|
||||
}
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
package product_getProductUpdateRule_response
|
||||
|
||||
import (
|
||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
)
|
||||
|
||||
type ProductGetProductUpdateRuleResponse struct {
|
||||
doudian_sdk.BaseDoudianOpApiResponse
|
||||
Data *ProductGetProductUpdateRuleData `json:"data"`
|
||||
}
|
||||
type SpuControlRule struct {
|
||||
// 是否支持spu发品
|
||||
SupportSpuProduct bool `json:"support_spu_product"`
|
||||
// 0不管控 1弱管控 2强管控
|
||||
ControlType int64 `json:"control_type"`
|
||||
// 是否支持新建spu
|
||||
SupportCreateSpu bool `json:"support_create_spu"`
|
||||
// 是否支持spu纠错
|
||||
SupportRectifySpu bool `json:"support_rectify_spu"`
|
||||
// 是否支持spu举报
|
||||
SupportReportSpu bool `json:"support_report_spu"`
|
||||
// 是否spu免审
|
||||
NoNeedAuditSpu bool `json:"no_need_audit_spu"`
|
||||
}
|
||||
type StepRule struct {
|
||||
// 是否支持
|
||||
Support bool `json:"support"`
|
||||
@@ -16,6 +34,82 @@ type StepRule struct {
|
||||
// 阶梯发货阶梯部分发货时间最大值
|
||||
StepMaxDelay int64 `json:"step_max_delay"`
|
||||
}
|
||||
type SkuPresellRule struct {
|
||||
// 是否支持
|
||||
Support bool `json:"support"`
|
||||
// 预售门槛价
|
||||
MinPresellPrice int64 `json:"min_presell_price"`
|
||||
// 是否支持支付结束后发货
|
||||
SupportDeliveryAfterPay bool `json:"support_delivery_after_pay"`
|
||||
// 是否支持预售结束后发货
|
||||
SupportDeliveryAfterPresell bool `json:"support_delivery_after_presell"`
|
||||
// 支付结束后规则
|
||||
DeliveryAfterPayConfig *DeliveryAfterPayConfig `json:"delivery_after_pay_config"`
|
||||
// 预售结束后规则
|
||||
DeliveryAfterPresellConfig *DeliveryAfterPresellConfig `json:"delivery_after_presell_config"`
|
||||
}
|
||||
type TimeSkuSpecDetialItem struct {
|
||||
// 规格值
|
||||
SpecValue string `json:"spec_value"`
|
||||
// 是否预售时效
|
||||
IsPresellSpec bool `json:"is_presell_spec"`
|
||||
// product_time_spec_same_day 当日发 product_time_spec_next_day 次日发 product_time_spec_48h 48小时内发货 product_time_spec_5d 5天内发货 product_time_spec_15d 15天内发货 product_time_spec_45d 45天内发货
|
||||
SpecCode string `json:"spec_code"`
|
||||
}
|
||||
type RecommendNameRule struct {
|
||||
// 当前类目id是否命中前缀推荐规则
|
||||
SatisfyPrefix bool `json:"satisfy_prefix"`
|
||||
// 命中规则的属性id详情
|
||||
PropertyIds []int64 `json:"property_ids"`
|
||||
}
|
||||
type TimeSkuSpecDetialItem_4_4 struct {
|
||||
// 规格值
|
||||
SpecValue string `json:"spec_value"`
|
||||
// 是否预售时效
|
||||
IsPresellSpec bool `json:"is_presell_spec"`
|
||||
}
|
||||
type TimeSkuPurePresellRule struct {
|
||||
// 是否支持
|
||||
Support bool `json:"support"`
|
||||
// 发货时效规格名称
|
||||
TimeSkuSpecName string `json:"time_sku_spec_name"`
|
||||
// 发货时效规格选项
|
||||
TimeSkuSpecDetial []TimeSkuSpecDetialItem_4_4 `json:"time_sku_spec_detial"`
|
||||
// 预售门槛价,单位分
|
||||
MinPresellPrice int64 `json:"min_presell_price"`
|
||||
}
|
||||
type AfterSaleRule struct {
|
||||
// 无理由退货规则
|
||||
SupplyDayReturnRule *SupplyDayReturnRule `json:"supply_day_return_rule"`
|
||||
}
|
||||
type ProductSpecRule struct {
|
||||
// totally_use_given_spec:完全使用系统下发规格;partly_use_given_spec部分使用系统下发规格;not_use_given_spec:不管控规格
|
||||
SpecRuleCode string `json:"spec_rule_code"`
|
||||
// 商品规格列表
|
||||
RequiredSpecDetails []RequiredSpecDetailsItem `json:"required_spec_details"`
|
||||
}
|
||||
type ComponentTemplateRule struct {
|
||||
// 是否展示尺码信息
|
||||
IsShow bool `json:"is_show"`
|
||||
// 尺码信息是否必填
|
||||
MustInput bool `json:"must_input"`
|
||||
}
|
||||
type ProductGetProductUpdateRuleData struct {
|
||||
// 履约规则
|
||||
FulfillmentRule *FulfillmentRule `json:"fulfillment_rule"`
|
||||
// 商品标题推荐规则
|
||||
RecommendNameRule *RecommendNameRule `json:"recommend_name_rule"`
|
||||
// 售后服务规则
|
||||
AfterSaleRule *AfterSaleRule `json:"after_sale_rule"`
|
||||
// 参考价相关规则
|
||||
ReferencePriceRule *ReferencePriceRule `json:"reference_price_rule"`
|
||||
// spu管控规则
|
||||
SpuControlRule *SpuControlRule `json:"spu_control_rule"`
|
||||
// 商品规格约束
|
||||
ProductSpecRule *ProductSpecRule `json:"product_spec_rule"`
|
||||
// 商品尺码模板配置规则
|
||||
ComponentTemplateRule *ComponentTemplateRule `json:"component_template_rule"`
|
||||
}
|
||||
type DeliveryAfterPayConfig struct {
|
||||
// 延迟发货时间最小值
|
||||
MinDeliveryDays int64 `json:"min_delivery_days"`
|
||||
@@ -26,6 +120,68 @@ type DeliveryAfterPayConfig struct {
|
||||
// 是否需要人审,可忽略
|
||||
NeedAudit bool `json:"need_audit"`
|
||||
}
|
||||
type FulfillmentRule struct {
|
||||
// 现货发货模式规则
|
||||
NormalRule *NormalRule `json:"normal_rule"`
|
||||
// 阶梯发货模式规则
|
||||
StepRule *StepRule `json:"step_rule"`
|
||||
// 全款预售发货模式规则
|
||||
ProductPresellRule *ProductPresellRule `json:"product_presell_rule"`
|
||||
// SKU预售发货模式规则
|
||||
SkuPresellRule *SkuPresellRule `json:"sku_presell_rule"`
|
||||
// 现货+预售发货规则
|
||||
TimeSkuPresellWithNormalRule *TimeSkuPresellWithNormalRule `json:"time_sku_presell_with_normal_rule"`
|
||||
// 新预售发货模式规则
|
||||
TimeSkuPurePresellRule *TimeSkuPurePresellRule `json:"time_sku_pure_presell_rule"`
|
||||
}
|
||||
type SupplyDayReturnRule struct {
|
||||
// true 支持七天无理由,false 不支持七天无理由
|
||||
Enable bool `json:"enable"`
|
||||
// 可选的无理由退货选项列表
|
||||
Options []OptionsItem `json:"options"`
|
||||
}
|
||||
type ReferencePriceRule struct {
|
||||
// true表示可填写参考价,false表示不可填写参考价
|
||||
IsSupport bool `json:"is_support"`
|
||||
// true表示必填参考价,false表示不必填参考价
|
||||
IsRequired bool `json:"is_required"`
|
||||
// 参考价凭证类型枚举值与对应的显示名称,比如{ "1" : "厂商建议零售价", "2" : "吊牌价", "3" : "定价", "4" : "官网零售价" }
|
||||
CertificateTypes map[int64]string `json:"certificate_types"`
|
||||
// 参考价最高高于最低SKU价格的倍数,比如最低SKU价格为1,此值为10,则参考价不可高于10
|
||||
LowerSkuPriceTimes int64 `json:"lower_sku_price_times"`
|
||||
}
|
||||
type OptionsItem struct {
|
||||
// 天无理由退货文案描述
|
||||
Name string `json:"name"`
|
||||
// 无理由退货的类型
|
||||
Value string `json:"value"`
|
||||
}
|
||||
type PropertyValuesItem struct {
|
||||
// 规格值id
|
||||
SellPropertyValueId int64 `json:"sell_property_value_id"`
|
||||
// 规格值名称
|
||||
SellPropertyValueName string `json:"sell_property_value_name"`
|
||||
}
|
||||
type RequiredSpecDetailsItem struct {
|
||||
// 规格项名称
|
||||
SellPropertyName string `json:"sell_property_name"`
|
||||
// 规格项id
|
||||
SellPropertyId int64 `json:"sell_property_id"`
|
||||
// 规格值选项
|
||||
PropertyValues []PropertyValuesItem `json:"property_values"`
|
||||
// 是否支持备注
|
||||
SupportRemark bool `json:"support_remark"`
|
||||
// 是否可以自定义规格值
|
||||
SupportDiy bool `json:"support_diy"`
|
||||
}
|
||||
type NormalRule struct {
|
||||
// 是否支持
|
||||
Support bool `json:"support"`
|
||||
// 发货时效选项,如当日发、次日发、48小时
|
||||
DelayOptions []int64 `json:"delay_options"`
|
||||
// 是否特殊时间延迟发货,可忽略
|
||||
IsSpecialDelayOption bool `json:"is_special_delay_option"`
|
||||
}
|
||||
type DeliveryAfterPresellConfig struct {
|
||||
// 延迟发货时间最小值
|
||||
MinDeliveryDays int64 `json:"min_delivery_days"`
|
||||
@@ -50,28 +206,6 @@ type ProductPresellRule struct {
|
||||
// 预售结束后规则
|
||||
DeliveryAfterPresellConfig *DeliveryAfterPresellConfig `json:"delivery_after_presell_config"`
|
||||
}
|
||||
type SkuPresellRule struct {
|
||||
// 是否支持
|
||||
Support bool `json:"support"`
|
||||
// 预售门槛价
|
||||
MinPresellPrice int64 `json:"min_presell_price"`
|
||||
// 是否支持支付结束后发货
|
||||
SupportDeliveryAfterPay bool `json:"support_delivery_after_pay"`
|
||||
// 是否支持预售结束后发货
|
||||
SupportDeliveryAfterPresell bool `json:"support_delivery_after_presell"`
|
||||
// 支付结束后规则
|
||||
DeliveryAfterPayConfig *DeliveryAfterPayConfig `json:"delivery_after_pay_config"`
|
||||
// 预售结束后规则
|
||||
DeliveryAfterPresellConfig *DeliveryAfterPresellConfig `json:"delivery_after_presell_config"`
|
||||
}
|
||||
type TimeSkuSpecDetialItem struct {
|
||||
// 规格值
|
||||
SpecValue string `json:"spec_value"`
|
||||
// 是否预售时效
|
||||
IsPresellSpec bool `json:"is_presell_spec"`
|
||||
// product_time_spec_same_day 当日发 product_time_spec_next_day 次日发 product_time_spec_48h 48小时内发货 product_time_spec_5d 5天内发货 product_time_spec_15d 15天内发货 product_time_spec_45d 45天内发货
|
||||
SpecCode string `json:"spec_code"`
|
||||
}
|
||||
type TimeSkuPresellWithNormalRule struct {
|
||||
// 是否支持
|
||||
Support bool `json:"support"`
|
||||
@@ -82,53 +216,3 @@ type TimeSkuPresellWithNormalRule struct {
|
||||
// 预售门槛价,单位分
|
||||
MinPresellPrice int64 `json:"min_presell_price"`
|
||||
}
|
||||
type TimeSkuSpecDetialItem_4_4 struct {
|
||||
// 规格值
|
||||
SpecValue string `json:"spec_value"`
|
||||
// 是否预售时效
|
||||
IsPresellSpec bool `json:"is_presell_spec"`
|
||||
}
|
||||
type TimeSkuPurePresellRule struct {
|
||||
// 是否支持
|
||||
Support bool `json:"support"`
|
||||
// 发货时效规格名称
|
||||
TimeSkuSpecName string `json:"time_sku_spec_name"`
|
||||
// 发货时效规格选项
|
||||
TimeSkuSpecDetial []TimeSkuSpecDetialItem_4_4 `json:"time_sku_spec_detial"`
|
||||
// 预售门槛价,单位分
|
||||
MinPresellPrice int64 `json:"min_presell_price"`
|
||||
}
|
||||
type RecommendNameRule struct {
|
||||
// 当前类目id是否命中前缀推荐规则
|
||||
SatisfyPrefix bool `json:"satisfy_prefix"`
|
||||
// 命中规则的属性id详情
|
||||
PropertyIds []int64 `json:"property_ids"`
|
||||
}
|
||||
type NormalRule struct {
|
||||
// 是否支持
|
||||
Support bool `json:"support"`
|
||||
// 发货时效选项,如当日发、次日发、48小时
|
||||
DelayOptions []int64 `json:"delay_options"`
|
||||
// 是否特殊时间延迟发货,可忽略
|
||||
IsSpecialDelayOption bool `json:"is_special_delay_option"`
|
||||
}
|
||||
type FulfillmentRule struct {
|
||||
// 现货发货模式规则
|
||||
NormalRule *NormalRule `json:"normal_rule"`
|
||||
// 阶梯发货模式规则
|
||||
StepRule *StepRule `json:"step_rule"`
|
||||
// 全款预售发货模式规则
|
||||
ProductPresellRule *ProductPresellRule `json:"product_presell_rule"`
|
||||
// SKU预售发货模式规则
|
||||
SkuPresellRule *SkuPresellRule `json:"sku_presell_rule"`
|
||||
// 现货+预售发货规则
|
||||
TimeSkuPresellWithNormalRule *TimeSkuPresellWithNormalRule `json:"time_sku_presell_with_normal_rule"`
|
||||
// 新预售发货模式规则
|
||||
TimeSkuPurePresellRule *TimeSkuPurePresellRule `json:"time_sku_pure_presell_rule"`
|
||||
}
|
||||
type ProductGetProductUpdateRuleData struct {
|
||||
// 履约规则
|
||||
FulfillmentRule *FulfillmentRule `json:"fulfillment_rule"`
|
||||
// 商品标题推荐规则
|
||||
RecommendNameRule *RecommendNameRule `json:"recommend_name_rule"`
|
||||
}
|
||||
|
||||
@@ -149,16 +149,12 @@ func (a *APIExpress) OrderStatusAndPsInfo(param map[string]interface{}) error {
|
||||
psInfo.TraceMsgs = traceMsgs
|
||||
request.Param = psInfo
|
||||
|
||||
globals.SugarLogger.Debugf("OrderStatusAndPsInfo=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("OrderStatusAndPsInfo=========:%s", utils.Format4Output(request.Param, false))
|
||||
if a.accessTokenObj == nil || a.accessTokenObj.CreateTokenData.AccessToken == "" {
|
||||
a.CreateToken()
|
||||
} else if a.expiresIn < time.Now().Unix() {
|
||||
a.RefreshToken()
|
||||
}
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("OrderStatusAndPsInfo result :%s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("OrderStatusAndPsInfo err :%s", err)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -73,8 +73,6 @@ func (a *API) ApplyMarketAfterSale(skuOrderId, count int64, afterSaleReason int3
|
||||
param.ItemCount = count // 拒收是必填
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("====request.result ==========%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("====request.result = %s", utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -158,8 +156,6 @@ func (a *API) AfterSaleOperate(refundType int32, refundId, remark string, storeI
|
||||
param.Items = refundListParam
|
||||
// 同意退货
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("AfterSaleOperate=========%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("====AfterSaleOperate:=%s", utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -327,8 +323,6 @@ func (a *API) OrderDelivering(param *order_logisticsAdd_request.OrderLogisticsAd
|
||||
request.Param = param
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("OrderDelivering=========%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("OrderDelivering=========%s", utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,7 @@ func TestCategory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCatePropertyV2(t *testing.T) {
|
||||
data, err := a.GetCatePropertyV2(29073)
|
||||
data, err := a.GetCatePropertyV2(33622)
|
||||
fmt.Println("err=====", err)
|
||||
globals.SugarLogger.Debugf("data:=%s", utils.Format4Output(data, false))
|
||||
fmt.Println("data====", data) // 202209281558450102081001701D7B32C5
|
||||
@@ -346,3 +346,35 @@ func Test11111(t *testing.T) {
|
||||
fmt.Println(randNumber)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetProductUpdateRule(t *testing.T) {
|
||||
keys := make(map[int64]bool, 0)
|
||||
data, _ := a.GetShopCategory(0)
|
||||
for _, v1 := range data {
|
||||
if len(v1.Children) > 0 {
|
||||
for _, v2 := range v1.Children {
|
||||
if len(v2.Children) > 0 {
|
||||
for _, v3 := range v2.Children {
|
||||
if len(v3.Children) > 0 {
|
||||
for _, v4 := range v3.Children {
|
||||
if v4.Enable {
|
||||
keys[v4.Id] = a.GetProductUpdateRule(v4.Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
keys[v3.Id] = a.GetProductUpdateRule(v3.Id)
|
||||
}
|
||||
}
|
||||
keys[v2.Id] = a.GetProductUpdateRule(v2.Id)
|
||||
}
|
||||
}
|
||||
keys[v1.Id] = a.GetProductUpdateRule(v1.Id)
|
||||
}
|
||||
globals.SugarLogger.Debugf("====%d", len(keys))
|
||||
globals.SugarLogger.Debugf("====%s", utils.Format4Output(keys, false))
|
||||
}
|
||||
|
||||
func TestNameeeee(t *testing.T) {
|
||||
aa := `667278_/image/4229fbb12a40ddcc7a2d42728f`
|
||||
fmt.Println(strings.Contains(aa, "detail_"))
|
||||
}
|
||||
|
||||
@@ -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 创建商品库文件夹(存放商品图片素材)
|
||||
@@ -26,8 +24,6 @@ func (a *API) CreateFolder(fileName string) (*material_createFolder_response.Mat
|
||||
param.ParentFolderId = "0" // 根目录创建文件夹
|
||||
|
||||
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
|
||||
}
|
||||
@@ -41,7 +37,7 @@ func (a *API) CreateFolder(fileName string) (*material_createFolder_response.Mat
|
||||
//1. 一次上传的数量限制50张图片;
|
||||
//2. 图片大小限10M
|
||||
//3. 素材中心会对素材进行异步审核,对于审核失败的素材,素材中心会在一定时间内将其删除。
|
||||
func (a *API) BatchUploadImages(imgs []Imgs) (*material_batchUploadImageSync_response.MaterialBatchUploadImageSyncData, error) {
|
||||
func (a *API) BatchUploadImages(imgs []Imgs) (map[string]material_batchUploadImageSync_response.SuccessMapItem, error) {
|
||||
request := material_batchUploadImageSync_request.New()
|
||||
var param = make([]material_batchUploadImageSync_request.MaterialsItem, 0, len(imgs))
|
||||
|
||||
@@ -61,13 +57,14 @@ func (a *API) BatchUploadImages(imgs []Imgs) (*material_batchUploadImageSync_res
|
||||
imgParam.NeedDistinct = true
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("批量上传文件到目录=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("批量上传文件到目录:=%s", utils.Format4Output(result, 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(result.SubMsg)
|
||||
return nil, errors.New("==============logId" + result.LogId + ":" + result.SubMsg)
|
||||
}
|
||||
return result.Data, nil
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ func TestCreateFolad(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadImg(t *testing.T) {
|
||||
accesstoken := `{"access_token":"60f530b2-9ab6-4723-b487-c094918f0d21","expires_in":1666257163,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"1220666a-5e88-458c-a8c0-06d949fbbd3f","authority_id":""}`
|
||||
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken)
|
||||
param := []Imgs{
|
||||
{Name: "测试图片1", Url: "https://image.jxc4.com/image/3f8d9759eda4863e28a0fff523f9d477.jpg"},
|
||||
{Name: "测试图片2", Url: "https://image.jxc4.com/image/06a488c740fe9f6e40a7fffe67a39570.jpg"},
|
||||
{Name: "测试图片1", Url: "http://image.jxc4.com/efbfbde919e41435144485bb72bc8bd4.png"},
|
||||
{Name: "测试图片2", Url: "https://image.jxc4.com/image/94859ee145dd3038f040800dd347e7b7.jpg"},
|
||||
{Name: "测试图片3", Url: "https://image.jxc4.com/image/7a71696ddc7c030e31f9edc6cb211ab8.jpg"},
|
||||
{Name: "测试图片detail", Url: "http://image.jxc4.com/image/f22e2e290087f6806ad48d279a7166d0.jpg"},
|
||||
}
|
||||
data, err := a.BatchUploadImages(param)
|
||||
fmt.Println(err)
|
||||
|
||||
@@ -62,8 +62,6 @@ func (a *API) GetStoreDetail(param *shop_getStoreDetail_request.ShopGetStoreDeta
|
||||
request := shop_getStoreDetail_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
|
||||
}
|
||||
@@ -151,8 +149,6 @@ func (a *API) GetStoreList(param *shop_getStoreList_request.ShopGetStoreListPara
|
||||
request := shop_getStoreList_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
|
||||
}
|
||||
@@ -174,8 +170,6 @@ func (a *API) CreateTradeLimitTemplate(param *trade_createTradeLimitTemplate_req
|
||||
request := trade_createTradeLimitTemplate_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
|
||||
}
|
||||
@@ -386,7 +380,6 @@ func (a *API) StoreBindWarehouse(param *warehouse_bindStore_request.WarehouseBin
|
||||
func (a *API) GetWarehouseByStore(storeID int64) (map[int64][]warehouse_getWarehouseByStore_response.WarehouseInfoMapItem, error) {
|
||||
request := warehouse_getWarehouseByStore_request.New()
|
||||
request.Param.StoreIds = append(request.Param.StoreIds, storeID)
|
||||
globals.SugarLogger.Debugf("request.Param.StoreIds==========%d", request.Param.StoreIds)
|
||||
response, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -394,7 +387,6 @@ func (a *API) GetWarehouseByStore(storeID int64) (map[int64][]warehouse_getWareh
|
||||
if response.Code != RequestSuccessCode {
|
||||
return nil, errors.New(response.Msg + "," + response.SubMsg)
|
||||
}
|
||||
globals.SugarLogger.Debugf("response.Data.WarehouseInfoMap==========%v", response.Data.WarehouseInfoMap)
|
||||
if len(response.Data.WarehouseInfoMap) == 0 {
|
||||
return nil, errors.New(fmt.Sprintf("门店%d 暂时未绑定仓库,请进行绑定!", storeID))
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
warehouse_createFence_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_createFence/request"
|
||||
warehouse_setFence_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/warehouse_setFence/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -118,7 +117,6 @@ func TestAPI_CreateTradeLimitTemplate(t *testing.T) {
|
||||
tempDetail.Template.TemplateName += "固定运费模板"
|
||||
}
|
||||
|
||||
globals.SugarLogger.Debugf("%s", utils.Format4Output(tempDetail, false))
|
||||
a.FreightTemplateCreate(tempDetail)
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,19 @@ func AESCBCEncpryt(data, aesKey, iv []byte) (encryptedData []byte, err error) {
|
||||
return encryptedData, nil
|
||||
}
|
||||
|
||||
func AESCBCDecprytJD(encryptedData, aesKey, iv []byte) (decryptedData []byte, err error) {
|
||||
c, err := aes.NewCipher(aesKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cfbdec := cipher.NewCBCDecrypter(c, iv[:c.BlockSize()])
|
||||
decryptedData = make([]byte, len(encryptedData))
|
||||
cfbdec.CryptBlocks(decryptedData, encryptedData)
|
||||
|
||||
//decryptedData = PKCSUnPadding(decryptedData)
|
||||
return decryptedData, nil
|
||||
}
|
||||
|
||||
func AESCBCDecpryt(encryptedData, aesKey, iv []byte) (decryptedData []byte, err error) {
|
||||
c, err := aes.NewCipher(aesKey)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user