This commit is contained in:
邹宗楠
2022-11-11 17:23:01 +08:00
parent 0c4c9a7f84
commit 8d172ad781
4 changed files with 7935 additions and 72 deletions

View File

@@ -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"`
}

View File

@@ -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"`
}

File diff suppressed because it is too large Load Diff

View File

@@ -346,3 +346,37 @@ 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 TestCcccc(t *testing.T) {
v, ok := CategoryIsSupplyDayReturnRule[20008]
if ok {
fmt.Println(v)
}
}