This commit is contained in:
richboo111
2023-08-30 15:07:21 +08:00
23 changed files with 301 additions and 120 deletions

View File

@@ -66,7 +66,7 @@ func TestFulllDiscountShippingFeeList(t *testing.T) {
}
func TestRetailDiscountBatchSave(t *testing.T) {
result, _, err := api.RetailDiscountBatchSave2("12944552", 0, []*RetailDiscountActData{
result, _, err := api.RetailDiscountBatchSave2("18822904", 0, []*RetailDiscountActData{
&RetailDiscountActData{
AppFoodCode: "6094573",
StartTime: time.Now().Unix(),

View File

@@ -13,11 +13,12 @@ const (
//#region 获取门店订单的结算信息 bill/list
type Bill struct {
AppPoiCode string `json:"app_poi_code"` // APP方门店id传商家中台系统里门店的编码。如商家在操作绑定门店至开放平台应用中时未绑定三方门店id信息则默认APP方门店id与美团门店id相同。
StartDate int64 `json:"start_date"` // 秒级时间戳
EndDate int64 `json:"end_date"` // 秒级时间戳
Offset int64 `json:"offset"`
Limit int64 `json:"limit"`
AppPoiCode string `json:"app_poi_code"` // APP方门店id传商家中台系统里门店的编码。如商家在操作绑定门店至开放平台应用中时未绑定三方门店id信息则默认APP方门店id与美团门店id相同。
StartDate int64 `json:"start_date"` // 秒级时间戳
EndDate int64 `json:"end_date"` // 秒级时间戳
Offset int64 `json:"offset"`
Limit int64 `json:"limit"`
AccessToken string `json:"access_token"`
}
// GetStoreBillList 获取门店的订单账单

View File

@@ -8,14 +8,15 @@ import (
func TestBillList(t *testing.T) {
now := time.Now()
from := time.Date(now.Year(), now.Month(), now.Day()-7, 0, 0, 0, 0, time.Local)
from := time.Date(now.Year(), now.Month(), now.Day()-2, 0, 0, 0, 0, time.Local)
to := time.Date(now.Year(), now.Month(), now.Day()-1, 23, 59, 59, 59, time.Local)
param := &Bill{
AppPoiCode: "9202390",
StartDate: from.Unix(),
EndDate: to.Unix(),
Offset: 0,
Limit: 200,
AppPoiCode: "18833517",
StartDate: from.Unix(),
EndDate: to.Unix(),
Offset: 0,
Limit: 200,
AccessToken: api.token,
}
data, settleId, err := api.GetStoreBillList(param)

View File

@@ -1,6 +1,7 @@
package mtwmapi
import (
"git.rosy.net.cn/jx-callback/globals"
"time"
"git.rosy.net.cn/baseapi/utils"
@@ -145,3 +146,14 @@ func (a *API) FoodSkuSellStatus(poiCode string, foodData []map[string]interface{
})
return err
}
// GetSkuPurchasePrice 获取商品进货价
func (a *API) GetSkuPurchasePrice(poiCode, skuId string) {
data, err := a.AccessAPI("retail/purchase/price/list", true, map[string]interface{}{
KeyAppPoiCode: poiCode,
"sku_id": skuId,
"page_size": 20,
})
globals.SugarLogger.Debugf("data :== %s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("err :== %s", utils.Format4Output(err, false))
}

View File

@@ -14,3 +14,7 @@ func TestFoodList(t *testing.T) {
}
// t.Log(result)
}
func TestGetSkuPurchasePrice(t *testing.T) {
api.GetSkuPurchasePrice("18048546", "16295939515")
}

View File

@@ -26,7 +26,11 @@ func init() {
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
<<<<<<< HEAD
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_ovSLnyKTsMNx0RxMzJ1C7w") //token_n4TwqCntWWuvQwAawzxC0w
=======
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_v-zI40EPjPfXLmaKdgRPqA") //token_n4TwqCntWWuvQwAawzxC0w
>>>>>>> 1eebd3a457d772f335a41fd04f88e08ffc8e1bc3
cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
`
@@ -64,7 +68,7 @@ func TestGetAccessToken(t *testing.T) {
}
func TestGetAccessToken2(t *testing.T) {
result, err := api.GetAccessToken2("18574879") //refresh_token_pLG7Jw7g9mu7oOzNSuJIUg
result, err := api.GetAccessToken2("18048546") //refresh_token_pLG7Jw7g9mu7oOzNSuJIUg
if err != nil {
t.Fatal(err)
}

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"time"
)
@@ -553,6 +554,7 @@ func (a *API) OrderLogisticsCancel(orderID int64, reason string) (err error) {
return err
}
// OrderLogisticsStatus 获取订单状态
func (a *API) OrderLogisticsStatus(orderID int64) (status int64, err error) {
result, err := a.AccessAPI("order/logistics/status", true, map[string]interface{}{
KeyOrderID: orderID,
@@ -565,6 +567,29 @@ func (a *API) OrderLogisticsStatus(orderID int64) (status int64, err error) {
return utils.Interface2Int64WithDefault(data["logistics_status"], 0), err
}
// OrderLogisticsFee 获取订单配送费
func (a *API) OrderLogisticsFee(orderID int64) (payFee float64, err error) {
result, err := a.AccessAPI("order/logistics/status", true, map[string]interface{}{
KeyOrderID: orderID,
})
globals.SugarLogger.Debugf("=resutl := %s", utils.Format4Output(result, false))
if err != nil {
return 0, err
}
data := result.(map[string]interface{})
// 美团运单,骑手确认订单之后取消的话就需要扣除全部的运单费用了,到店之后取消订单也不支付骑手配送费
if utils.Interface2Int64WithDefault(data["logistics_status"], 0) == utils.Str2Int64WithDefault(WaybillStatusCanceled, 0) {
if utils.Interface2Int64WithDefault(data["dispatcher_reach_poi_time"], 0) != 0 {
return 2, nil
} else if utils.Interface2Int64WithDefault(data["send_time"], 0) != 0 {
return utils.TryInterface2Float64(data["pay_amount"])
} else {
return 0, nil
}
}
return utils.TryInterface2Float64(data["pay_amount"])
}
// 拉取用户真实手机号(必接)
// https://developer.waimai.meituan.com/home/docDetail/222
// limit最大为MaxBatchPullPhoneNumberLimit = 1000

View File

@@ -19,7 +19,7 @@ func TestOrderViewStatus(t *testing.T) {
}
func TestOrderGetOrderDetail(t *testing.T) {
result, err := api.OrderGetOrderDetail(900658760944919842, false)
result, err := api.OrderGetOrderDetail(1100692033635137950, false)
if err != nil {
t.Fatal(err)
}
@@ -35,7 +35,7 @@ func TestOrderGetOrderDetail(t *testing.T) {
}
func TestOrderGetOrderDetail2(t *testing.T) {
result, err := api.OrderGetOrderDetail2(1000533651036489997, false)
result, err := api.OrderGetOrderDetail2(1100687990339131759, false)
if err != nil {
t.Fatal(err)
}
@@ -77,7 +77,18 @@ func TestOrderApplyPartRefund(t *testing.T) {
}
func TestOrderLogisticsStatus(t *testing.T) {
result, err := api.OrderLogisticsStatus(140382472052682640)
result, err := api.OrderLogisticsStatus(1100687990339131759)
if err != nil {
t.Fatal(err)
}
if result == 0 {
t.Fatal("result should have value")
}
t.Log(utils.Format4Output(result, false))
}
func TestOrderLogisticsFee(t *testing.T) {
result, err := api.OrderLogisticsFee(900699454211738469)
if err != nil {
t.Fatal(err)
}

View File

@@ -24,7 +24,7 @@ func TestPoiGetIDs(t *testing.T) {
}
func TestPoiMGet(t *testing.T) {
result, err := api.PoiMGet([]string{"15467875"})
result, err := api.PoiMGet([]string{"18822904"})
t.Log(utils.Format4Output(result, false))
if err != nil {
t.Fatal(err)
@@ -44,10 +44,10 @@ func TestPoiSave(t *testing.T) {
//}
poiParams := map[string]interface{}{}
//utils.FilterMapNilMembers(utils.Struct2FlatMap(result[0]))
poiParams["address"] = "云南省楚雄彝族自治州楚雄市东瓜镇高新区永安路1号四季银座花园城6栋6-4"
poiParams["address"] = "北京市朝阳区百子湾路32号院6号楼-1层C3-1号"
//poiParams["pic_url"] = "http://image.jxc4.com/image/5c9fc4fffb4d5ff1aecf85a2d2543e00.jpg"
//poiParams["name"] = "京西菜市(礼嘉桥村市场店)"
err := api.PoiSave("15467875", poiParams)
err := api.PoiSave("18830143", poiParams)
fmt.Println(err)
}

View File

@@ -132,7 +132,7 @@ func TestReloadStoreSku(t *testing.T) {
}
func TestRetailGet(t *testing.T) {
result, err := api.RetailGet("17886205", "mtcode_1664518383900835894")
result, err := api.RetailGet("18048546", "305011012")
if err != nil {
t.Fatal(err)
}

View File

@@ -25,6 +25,7 @@ const (
PeiSongTypeKuaiDi = "2002" // 快送
PeiSongTypeWholeCity = "2010" // 全城送
PeiSongTypeMixed = "3001" // 混合送(即美团专送+快送)
PeiSongTypeQiKe = "4015" // 企客远距离配送
)
func (a *API) ShippingSave(poiCode string, area string, minPrice, shippingFee float32) (err error) {