This commit is contained in:
邹宗楠
2026-04-07 10:33:34 +08:00
parent 7f72487213
commit 1ad90354d4
4 changed files with 36 additions and 29 deletions

View File

@@ -108,14 +108,24 @@ func TestRetailDiscountBatchSave(t *testing.T) {
} }
func TestRetailDiscountList(t *testing.T) { //56 1001 func TestRetailDiscountList(t *testing.T) { //56 1001
result, err := api.RetailDiscountList("32235182", 56) threefoldDown := 0 // 0-3 折活动数量
if err != nil { threefoldUp := 0 // 3.01-9 折活动
t.Fatal(err) // 获取美团活动
directList, _ := api.RetailDiscountList("32235182", RetailActTypeDirectDown) // 折扣活动
for _, v := range directList {
if (v.ActPrice/v.OriginalPrice)*10 >= 3.01 {
threefoldUp++
} else {
threefoldDown++
} }
//for _, v := range result { }
// globals.SugarLogger.Debugf("%s", utils.Format4Output(v, false)) secKillList, _ := api.RetailDiscountList("32235182", RetailActTypeSecKill) // 爆品活动
//} if secKillList != nil {
t.Log(utils.Format4Output(result, false)) threefoldDown = threefoldDown + len(secKillList)
}
fmt.Println(threefoldDown)
fmt.Println(threefoldDown)
} }
func TestNew(t *testing.T) { func TestNew(t *testing.T) {

View File

@@ -3,7 +3,6 @@ package mtwmapi
import ( import (
"encoding/json" "encoding/json"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"regexp" "regexp"
"strings" "strings"
) )
@@ -624,22 +623,17 @@ func (a *API) RetailCatSkuBatchDelete2(trackInfo, poiCode string, catCodes, catN
} }
type SpuData struct { type SpuData struct {
AppSpuCode string `json:"appSpuCode"` //商家中台系统里商品的编码 AppSpuCode string `json:"app_spu_code"` //商家中台系统里商品的编码
SkuID string `json:"skuID"` //SKU码(商家的规格编码) SkuID string `json:"sku_id"` //SKU码(商家的规格编码)
PurchasePrice string `json:"purchasePrice"` //商品进货价 PurchasePrice string `json:"purchase_price"` //商品进货价
} }
// https://opendj.meituan.com/home/docDetail/821 // https://opendj.meituan.com/home/docDetail/821
// 【代运营】批量更新商品进货价 /retail/purchase/price/update // 【代运营】批量更新商品进货价 /retail/purchase/price/update
func (a *API) BatchSetRestockingPrice(trackInfo, appPoiCode string, spuData []*SpuData) error { func (a *API) BatchSetRestockingPrice(trackInfo, appPoiCode string, spuData []*SpuData) error {
if len(spuData) > 0 {
for _, v := range spuData {
globals.SugarLogger.Debugf("BatchSetRestockingPrice params======%s %s %s", v.PurchasePrice, v.AppSpuCode, v.SkuID)
}
}
_, err := a.AccessAPI2("/retail/purchase/price/update", false, map[string]interface{}{ _, err := a.AccessAPI2("/retail/purchase/price/update", false, map[string]interface{}{
KeyAppPoiCode: appPoiCode, KeyAppPoiCode: appPoiCode,
"spu_data": spuData, "spu_data": string(utils.MustMarshal(spuData)),
}, resultKeyMsg, trackInfo) }, resultKeyMsg, trackInfo)
return err return err
} }

View File

@@ -144,17 +144,20 @@ func TestRetailCatSkuBatchDelete(t *testing.T) {
//批量更新商品进货价 //批量更新商品进货价
func TestBatchSetPrice(t *testing.T) { func TestBatchSetPrice(t *testing.T) {
param := []*SpuData{ param := make([]*SpuData, 0, 0)
{ param = append(param, &SpuData{
AppSpuCode: "25420", AppSpuCode: "6113801",
SkuID: "11395394828", SkuID: "6113801",
PurchasePrice: "50", PurchasePrice: "0.01",
}, })
} err := api.BatchSetRestockingPrice(utils.GetUUID(), "31985068", param)
err := api.BatchSetRestockingPrice(utils.GetUUID(), "12422751", param)
fmt.Println(err) fmt.Println(err)
} }
func Test222(t *testing.T) {
fmt.Println(1 / 50)
}
func TestMap(t *testing.T) { func TestMap(t *testing.T) {
poiCode := "20802261" poiCode := "20802261"
stockList := make([]*BareStoreFoodInfo, 0, 100) stockList := make([]*BareStoreFoodInfo, 0, 100)
@@ -293,7 +296,7 @@ func TestRetailInitData(t *testing.T) {
i := 0 i := 0
for { for {
// 同步商品 // 同步商品
fromFoodList, err1 := api.RetailListAll("21494359", i) fromFoodList, err1 := api.RetailListAll("31985068", i)
for _, v := range fromFoodList { for _, v := range fromFoodList {
if v.AppFoodCode == "mtcode_1902626039134900287" { if v.AppFoodCode == "mtcode_1902626039134900287" {
fmt.Println(v) fmt.Println(v)

View File

@@ -52,13 +52,13 @@ func TestSNSSendGoodsOrder(t *testing.T) {
OutTradeNo string `json:"out_trade_no"` OutTradeNo string `json:"out_trade_no"`
}{ }{
OrderNumberType: 2, OrderNumberType: 2,
TransactionId: "4200003049202603304158365187", TransactionId: "4200003129202603312111844342",
}, },
LogisticsType: 1, LogisticsType: 1,
DeliveryMode: 1, DeliveryMode: 1,
IsAllDelivered: false, IsAllDelivered: false,
ShippingList: append([]ShippingList{}, ShippingList{ ShippingList: append([]ShippingList{}, ShippingList{
TrackingNo: "88512585637609", TrackingNo: "88512672858565",
ExpressCompany: "YD", ExpressCompany: "YD",
ItemDesc: "背心袋", ItemDesc: "背心袋",
Contact: struct { Contact: struct {
@@ -70,7 +70,7 @@ func TestSNSSendGoodsOrder(t *testing.T) {
Payer: struct { Payer: struct {
Openid string `json:"openid"` Openid string `json:"openid"`
}{ }{
Openid: "ojWb10EZ__SL_Sx34Sgp8I90YMNo", Openid: "ojWb10PPi04pA8QvKZqUfoe3eRSs",
}, },
} }