1
This commit is contained in:
@@ -108,14 +108,24 @@ func TestRetailDiscountBatchSave(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRetailDiscountList(t *testing.T) { //56 1001
|
||||
result, err := api.RetailDiscountList("32235182", 56)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
threefoldDown := 0 // 0-3 折活动数量
|
||||
threefoldUp := 0 // 3.01-9 折活动
|
||||
// 获取美团活动
|
||||
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))
|
||||
//}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
secKillList, _ := api.RetailDiscountList("32235182", RetailActTypeSecKill) // 爆品活动
|
||||
if secKillList != nil {
|
||||
threefoldDown = threefoldDown + len(secKillList)
|
||||
}
|
||||
|
||||
fmt.Println(threefoldDown)
|
||||
fmt.Println(threefoldDown)
|
||||
}
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package mtwmapi
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
@@ -624,22 +623,17 @@ func (a *API) RetailCatSkuBatchDelete2(trackInfo, poiCode string, catCodes, catN
|
||||
}
|
||||
|
||||
type SpuData struct {
|
||||
AppSpuCode string `json:"appSpuCode"` //商家中台系统里商品的编码
|
||||
SkuID string `json:"skuID"` //SKU码(商家的规格编码)
|
||||
PurchasePrice string `json:"purchasePrice"` //商品进货价
|
||||
AppSpuCode string `json:"app_spu_code"` //商家中台系统里商品的编码
|
||||
SkuID string `json:"sku_id"` //SKU码(商家的规格编码)
|
||||
PurchasePrice string `json:"purchase_price"` //商品进货价
|
||||
}
|
||||
|
||||
// https://opendj.meituan.com/home/docDetail/821
|
||||
// 【代运营】批量更新商品进货价 /retail/purchase/price/update
|
||||
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{}{
|
||||
KeyAppPoiCode: appPoiCode,
|
||||
"spu_data": spuData,
|
||||
"spu_data": string(utils.MustMarshal(spuData)),
|
||||
}, resultKeyMsg, trackInfo)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -144,17 +144,20 @@ func TestRetailCatSkuBatchDelete(t *testing.T) {
|
||||
|
||||
//批量更新商品进货价
|
||||
func TestBatchSetPrice(t *testing.T) {
|
||||
param := []*SpuData{
|
||||
{
|
||||
AppSpuCode: "25420",
|
||||
SkuID: "11395394828",
|
||||
PurchasePrice: "50",
|
||||
},
|
||||
}
|
||||
err := api.BatchSetRestockingPrice(utils.GetUUID(), "12422751", param)
|
||||
param := make([]*SpuData, 0, 0)
|
||||
param = append(param, &SpuData{
|
||||
AppSpuCode: "6113801",
|
||||
SkuID: "6113801",
|
||||
PurchasePrice: "0.01",
|
||||
})
|
||||
err := api.BatchSetRestockingPrice(utils.GetUUID(), "31985068", param)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
func Test222(t *testing.T) {
|
||||
fmt.Println(1 / 50)
|
||||
}
|
||||
|
||||
func TestMap(t *testing.T) {
|
||||
poiCode := "20802261"
|
||||
stockList := make([]*BareStoreFoodInfo, 0, 100)
|
||||
@@ -293,7 +296,7 @@ func TestRetailInitData(t *testing.T) {
|
||||
i := 0
|
||||
for {
|
||||
// 同步商品
|
||||
fromFoodList, err1 := api.RetailListAll("21494359", i)
|
||||
fromFoodList, err1 := api.RetailListAll("31985068", i)
|
||||
for _, v := range fromFoodList {
|
||||
if v.AppFoodCode == "mtcode_1902626039134900287" {
|
||||
fmt.Println(v)
|
||||
|
||||
@@ -52,13 +52,13 @@ func TestSNSSendGoodsOrder(t *testing.T) {
|
||||
OutTradeNo string `json:"out_trade_no"`
|
||||
}{
|
||||
OrderNumberType: 2,
|
||||
TransactionId: "4200003049202603304158365187",
|
||||
TransactionId: "4200003129202603312111844342",
|
||||
},
|
||||
LogisticsType: 1,
|
||||
DeliveryMode: 1,
|
||||
IsAllDelivered: false,
|
||||
ShippingList: append([]ShippingList{}, ShippingList{
|
||||
TrackingNo: "88512585637609",
|
||||
TrackingNo: "88512672858565",
|
||||
ExpressCompany: "YD",
|
||||
ItemDesc: "背心袋",
|
||||
Contact: struct {
|
||||
@@ -70,7 +70,7 @@ func TestSNSSendGoodsOrder(t *testing.T) {
|
||||
Payer: struct {
|
||||
Openid string `json:"openid"`
|
||||
}{
|
||||
Openid: "ojWb10EZ__SL_Sx34Sgp8I90YMNo",
|
||||
Openid: "ojWb10PPi04pA8QvKZqUfoe3eRSs",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user