This commit is contained in:
邹宗楠
2025-07-30 15:04:03 +08:00
parent 40c1a73751
commit 266af058d6
7 changed files with 1854 additions and 1699 deletions

1689
delete_tt/makabaka_test.go Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -37,8 +37,8 @@ const (
AlibabaUpdateAuthentication = "alipayRealName/modifyCommit" // 阿里修改实名认证
WeChatQueryAuthentication = "wechatRealNameQuery" // 微信实名认证结果查询
AlibabaQueryAuthentication = "alipayRealNameQuery" // 阿里修改实名认证
WeChatAccountStatusQuery = "alipayRealNameQuery" // 微信开户状态差取暖
AlibabaAccountStatusQuery = "alipayRealNameQuery" // 阿里开户状态查询
WeChatAccountStatusQuery = "sme/mrchAuthStateQuery" // 微信开户状态差取暖
AlibabaAccountStatusQuery = "sme/alipayRealNameQuery" // 阿里开户状态查询
SubMerchantQuery = "querySubMerInfo" // 报备查询
)

View File

@@ -77,3 +77,7 @@ func TestSaveAuthentication(t *testing.T) {
}
api.SaveAuthentication(param, "WXPAY")
}
func TestAccountStatusQuery(t *testing.T) {
api.AccountStatusQuery("WECHAT", "793879932", "822651059990E2S")
}

View File

@@ -6,6 +6,39 @@ type ProductListV2Response struct {
doudian_sdk.BaseDoudianOpApiResponse
Data *ProductListV2Data `json:"data"`
}
type ShopCategory struct {
// 店铺装修分类id
LeafCategoryIds []int64 `json:"leaf_category_ids"`
}
type PropertyKey struct {
// 属性id
PropertyId int64 `json:"property_id"`
// 属性名称
PropertyName string `json:"property_name"`
}
type ProductPropertyItem struct {
// 属性key
PropertyKey *PropertyKey `json:"property_key"`
// 属性值列表
PropertyValue []PropertyValueItem `json:"property_value"`
}
type SkuListItem struct {
// 规格图url
Url string `json:"url"`
// 规格名称
Title string `json:"title"`
// skuid
SkuId int64 `json:"sku_id"`
}
type RectifyInfoListItem struct {
// 自动整改信息
RectificationInfo *RectificationInfo `json:"rectification_info"`
// 整改动作
RectifyAction string `json:"rectify_action"`
// 驳回原因
RejectReason string `json:"reject_reason"`
}
type CategoryDetail struct {
// 一级类目
FirstCid int64 `json:"first_cid"`
@@ -24,7 +57,91 @@ type CategoryDetail struct {
// 四级类目名称
FourthCname string `json:"fourth_cname"`
}
type NameSuggestion struct {
// 改后标题
AfterName string `json:"after_name"`
}
type AuditRejectSuggestion struct {
// 34主图建议
Pic34Suggestion *Pic34Suggestion `json:"pic34_suggestion"`
// 1:1主图建议
PicSuggestion *PicSuggestion `json:"pic_suggestion"`
// 标题建议
NameSuggestion *NameSuggestion `json:"name_suggestion"`
// 驳回原因
RejectReason string `json:"reject_reason"`
}
type TitleLimit struct {
// 商品标题最短长度
MinLength int64 `json:"min_length"`
// 商品标题最长长度
MaxLength int64 `json:"max_length"`
}
type PropertyValueItem struct {
// 属性值id
ValueId int64 `json:"value_id"`
// 属性值名称
ValueName string `json:"value_name"`
}
type PicListItem struct {
// 图片下标
Index int64 `json:"index"`
// 图片url
Url string `json:"url"`
// 图片类型
PicType int32 `json:"pic_type"`
}
type RectificationInfo struct {
// 整改图片明细
PicList []PicListItem `json:"pic_list"`
// 整改sku明细
SkuList []SkuListItem `json:"sku_list"`
}
type SpecPricesItem struct {
// skuId
Id int64 `json:"id"`
// skuCode
Code string `json:"code"`
// SKU Barcode
Barcodes []string `json:"barcodes"`
}
type ChannelMainProduct struct {
// 主品的商品id
ProductId int64 `json:"product_id"`
// 店铺id
ShopId int64 `json:"shop_id"`
}
type DataItem struct {
// 商品类目属性信息
ProductProperty []ProductPropertyItem `json:"product_property"`
// 运费模版
FreightId int64 `json:"freight_id"`
// 是否二手数码(成色机)
IsSecondHandDigital bool `json:"is_second_hand_digital"`
// 是否需要核销
NeedCheckOut bool `json:"need_check_out"`
// 驳回修改建议
AuditRejectSuggestion *AuditRejectSuggestion `json:"audit_reject_suggestion"`
// 是否有驳回修改建议
HaveAuditRejectSuggest bool `json:"have_audit_reject_suggest"`
// 自动整改信息
RectifyInfoList []RectifyInfoListItem `json:"rectify_info_list"`
// sku信息
SpecPrices []SpecPricesItem `json:"spec_prices"`
// 标题后缀
NameSuffix string `json:"name_suffix"`
// 标题前缀
NamePrefix string `json:"name_prefix"`
// 标题长度限制,长度计算逻辑:汉字算两个字符,汉字以外的其他字符都算一个字符。
TitleLimit *TitleLimit `json:"title_limit"`
// 销量
SellNum int64 `json:"sell_num"`
// 不可搭配的原因,可搭配时为空
CanNotCombineReason string `json:"can_not_combine_reason"`
// 是否可搭配只有入参传入can_combine为true才有值
CanCombine bool `json:"can_combine"`
// 店铺装修分类
ShopCategory *ShopCategory `json:"shop_category"`
// 商品ID抖店系统生成店铺下唯一
ProductId int64 `json:"product_id"`
// 商品在店铺中状态: 0-在线1-下线2-删除详见商品状态机https://op.jinritemai.com/docs/question-docs/92/2070
@@ -37,7 +154,7 @@ type DataItem struct {
DiscountPrice int64 `json:"discount_price"`
// 商品图片url返回商品主图的第一张图 (主要用来辅助页面展示)
Img string `json:"img"`
// 商品标题规则至少输入8个字16个字符以上~输入30个字60个字符以内。标题不规范会引起商品下架影响您的正常销售详见商品发布规范https://school.jinritemai.com/doudian/web/article/101800?from=shop_article
// 商品标题标题不规范会引起商品下架影响您的正常销售详见商品发布规范https://school.jinritemai.com/doudian/web/article/101800?from=shop_article
Name string `json:"name"`
// 【已废弃】支持的支付方式0货到付款 1在线支付 2两者都支持
PayType int64 `json:"pay_type"`
@@ -69,8 +186,10 @@ type DataItem struct {
IsPackageProduct bool `json:"is_package_product"`
// 商品关联的组合主商品ID当is_package_product=true返回的是组套商品的product_id 当is_package_product=false返回当前商品的product_id补充返回规则参与的组套商品下线会展示目前组合商品支持下线的商品作为子品进行组套删除会展示但重新上架组套商品时会被从列表中删除。
PackageProductList []int64 `json:"package_product_list"`
// 商品关联的组合商品sku_id商品关联的组套主sku_id当is_package_product=true返回的是组套商品的sku_id 当is_package_product=false返回当前商品的sku_id;补充返回规则:参与的组套商品sku_id下线会展示目前组合商品支持下线的商品作为子品进行组套删除会展示但重新上架组套商品时会被从列表中删除。
// 当is_package_product=true返回的是组套商品的子品product_id 当is_package_product=false返回;补充返回规则:参与的组套商品product_id下线会展示目前组合商品支持下线的商品作为子品进行组套删除会展示但重新上架组套商品时会被从列表中删除。
SubProductList []int64 `json:"sub_product_list"`
// 小时达子品绑定的主品信息
ChannelMainProduct *ChannelMainProduct `json:"channel_main_product"`
}
type ProductListV2Data struct {
// 商品数据
@@ -81,4 +200,14 @@ type ProductListV2Data struct {
Page int64 `json:"page"`
// 页数(每页数量)
Size int64 `json:"size"`
// 使用游标时,每次查询会返回该值,作为下次查询的入参使用。
CursorId string `json:"cursor_id"`
}
type Pic34Suggestion struct {
// 修改后图片,需要重新走素材中心转图
AfterPics []string `json:"after_pics"`
}
type PicSuggestion struct {
// 修改后图片,需要重新走素材中心转图
AfterPics []string `json:"after_pics"`
}

View File

@@ -7,7 +7,6 @@ import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"strconv"
"strings"
@@ -18,13 +17,12 @@ func Sign(appKey, appSecret, method string, timestamp int64, paramJson string) s
// 按给定规则拼接参数
paramPattern := "app_key" + appKey + "method" + method + "param_json" + paramJson + "timestamp" + strconv.FormatInt(timestamp, 10) + "v2"
signPattern := appSecret + paramPattern + appSecret
fmt.Println("sign_pattern:" + signPattern)
return Hmac(signPattern, appSecret)
}
func SpiSign(appKey, appSecret, timestamp string, paramJson interface{}, signMethod string) string {
sortedParamStr := Marshal(paramJson)
paramPattern := "app_key" + appKey + "param_json" + sortedParamStr +"timestamp" + timestamp
paramPattern := "app_key" + appKey + "param_json" + sortedParamStr + "timestamp" + timestamp
signPattern := appSecret + paramPattern + appSecret
if signMethod == "hmac-sha256" {
return Hmac(signPattern, appSecret)
@@ -67,5 +65,3 @@ func Marshal(o interface{}) string {
marshal := strings.TrimSpace(buffer.String()) // Trim掉末尾的换行符
return marshal
}

View File

@@ -55,7 +55,7 @@ func TestGetSkuDetail(t *testing.T) {
// 查询商品详情本地商品id
func TestGetSkuDetailLocalId(t *testing.T) {
data, err := a.GetSkuDetail("3749499171854483927", "")
data, err := a.GetSkuDetail("3644301338084557023", "")
fmt.Println(err)
globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false))
}
@@ -175,7 +175,19 @@ func TestBatchDecrypt(t *testing.T) {
fmt.Println(err)
}
var c = []int64{173965249}
var c = []int64{
63325222,
63462817,
63463014,
63463026,
63463365,
63467326,
63467462,
63503199,
63503537,
63504222,
63504497,
}
// 删除已经创建商品,重新同步
func TestDeleteSkuAndUploadSku(t *testing.T) {
@@ -184,8 +196,8 @@ func TestDeleteSkuAndUploadSku(t *testing.T) {
for _, v := range c {
for i := 1; i < 100; i++ {
result, err := a.GetSkuDetailList(&product_listV2_request.ProductListV2Param{
Status: 1,
CheckStatus: 1, // 1-未提交2-待审核3-审核通过4-审核未通过5-封禁7-审核通过待上架
Status: 0,
CheckStatus: 3, // 1-未提交2-待审核3-审核通过4-审核未通过5-封禁7-审核通过待上架
Page: int64(i),
Size: 100,
StoreId: v,
@@ -195,15 +207,21 @@ func TestDeleteSkuAndUploadSku(t *testing.T) {
continue
}
if len(result.Data) == 0 {
globals.SugarLogger.Debugf("====没有商品的门店 %d", v)
break
}
for _, v := range result.Data {
err := a.DeleteStoreCommodity(v.ProductId)
if err != nil {
errList = append(errList, err)
for i2, v2 := range result.Data {
if v2.ProductId == 3592586515512991033 {
fmt.Println("aa")
}
var sonSkuid int64 = 0
if len(v2.SpecPrices) != 0 {
sonSkuid = v2.SpecPrices[0].Id
}
sql := fmt.Sprintf(` UPDATE store_sku_bind SET vendor_son_sku_id = "%d" WHERE dd_id = "%d";`, sonSkuid, v2.ProductId)
fmt.Println(i2-i2, sql)
}
}
}