poi_page.PackagePriceUpdate

This commit is contained in:
gazebo
2019-12-30 16:30:21 +08:00
parent 548225b04b
commit 4d8c4d67d4
6 changed files with 75 additions and 11 deletions

View File

@@ -64,7 +64,7 @@ func TestFulllDiscountShippingFeeList(t *testing.T) {
}
func TestRetailDiscountBatchSave(t *testing.T) {
result, err := api.RetailDiscountBatchSave(testPoiCode, []*RetailDiscountActData{&RetailDiscountActData{
result, err := api.RetailDiscountBatchSave(testPoiCode, RetailActTypeDirectDown, []*RetailDiscountActData{&RetailDiscountActData{
AppFoodCode: "1140",
UserType: UserTypeAll,
StartTime: time.Now().Unix(),
@@ -81,7 +81,7 @@ func TestRetailDiscountBatchSave(t *testing.T) {
}
func TestRetailDiscountList(t *testing.T) {
result, err := api.RetailDiscountList(testPoiCode)
result, err := api.RetailDiscountList(testPoiCode, RetailActTypeDirectDown)
if err != nil {
t.Fatal(err)
}
@@ -89,7 +89,7 @@ func TestRetailDiscountList(t *testing.T) {
}
func TestRetailDiscountDelete(t *testing.T) {
err := api.RetailDiscountDelete(testPoiCode, []string{"329187452"})
err := api.RetailDiscountDelete(testPoiCode, RetailActTypeDirectDown, []string{"329187452"})
if err != nil {
t.Fatal(err)
}

View File

@@ -49,7 +49,9 @@ func init() {
// api.SetCookie("w_latlng", "30702250,104052315")
cookieStr := `
_lx_utm=utm_source%3D60066; _lxsdk=6A074A0B834664A32E0735231E4FD9C4263666B70A7FEC663F9945110C52EFB3; _lxsdk_cuid=16b8ca9baf5c8-03bbc09a88c9e4-2d604637-3d10d-16b8ca9baf5c8; _lxsdk_s=16b8ca9b8f4-58-f63-4b4%7C18087777%7C19; au_trace_key_net=default; cssVersion=b05eaa31; iuuid=6A074A0B834664A32E0735231E4FD9C4263666B70A7FEC663F9945110C52EFB3; mt_c_token=jeZimbpuoKnPsfoHbT3_CR_w_W0AAAAApQgAAGU0Z9sTXiFzlp-8N8q-UWFdq5xSvYzWOjNhbNK0RGq9m6YaRNc7FtHjpkqFkJ_x2w; oops=jeZimbpuoKnPsfoHbT3_CR_w_W0AAAAApQgAAGU0Z9sTXiFzlp-8N8q-UWFdq5xSvYzWOjNhbNK0RGq9m6YaRNc7FtHjpkqFkJ_x2w; openh5_uuid=6A074A0B834664A32E0735231E4FD9C4263666B70A7FEC663F9945110C52EFB3; token=jeZimbpuoKnPsfoHbT3_CR_w_W0AAAAApQgAAGU0Z9sTXiFzlp-8N8q-UWFdq5xSvYzWOjNhbNK0RGq9m6YaRNc7FtHjpkqFkJ_x2w; userId=69979334; userName=thepool; uuid=6A074A0B834664A32E0735231E4FD9C4263666B70A7FEC663F9945110C52EFB3; wm_order_channel=default; terminal=i; w_utmz="utm_campaign=(direct)&utm_source=5000&utm_medium=(none)&utm_content=(none)&utm_term=(none)"; w_latlng=30694640,104057119; w_visitid=956b412d-c47c-4fec-ae99-7b7cb0c9ab45; w_token=jeZimbpuoKnPsfoHbT3_CR_w_W0AAAAApQgAAGU0Z9sTXiFzlp-8N8q-UWFdq5xSvYzWOjNhbNK0RGq9m6YaRNc7FtHjpkqFkJ_x2w
_lxsdk_cuid=16eb02a8a02c8-0a92cb9af9798c-3d375b01-15f900-16eb02a8a02c8; _lxsdk=16eb02a8a02c8-0a92cb9af9798c-3d375b01-15f900-16eb02a8a02c8; device_uuid=!aaa93749-2445-4e1e-b178-956ac0ea5e45; pushToken=0sMxJkF87HeJFNGInMgnpvQ3ohIqeo_UMZ8VDif29S6s*; _lx_utm=utm_source%3DBaidu%26utm_medium%3Dorganic; wpush_server_url=wss://wpush.meituan.com; acctId=26599188; token=0o7UnNs2yauqdj86R145ow78W9cT9krlWpKPmCan2z7Q*; brandId=-1; wmPoiId=-1; isOfflineSelfOpen=0; city_id=0; isChain=1; existBrandPoi=true; ignore_set_router_proxy=true; region_id=; region_version=0; newCategory=false; bsid=PgNahlgfXvqnBiqv9tIi9zg7LDWtV8n70tkl_GhfueXgrLxV9BEb1rP9emUMnUUKPI6rANs_Y-chSdYLZS3KCA; cityId=510100; provinceId=510000; city_location_id=0; location_id=0; JSESSIONID=uht6v2iau9s6fx86r1ue6vzd; set_info=%7B%22wmPoiId%22%3A-1%2C%22ignoreSetRouterProxy%22%3Atrue%7D; igateApp=shangouepc; LX_SC_CONSTANT=c_nehoktcu; shopCategory=food; _lxsdk_s=16f40af4486-049-a66-a48%7C26337904%7C37
`
api.SetCookieWithStr(cookieStr)
}

View File

@@ -46,7 +46,7 @@ func (a *API) OrderModityTips(orderID, poiCode string, tipAmount float64) (err e
"wmPoiId": poiCode,
"tipAmount": tipAmount,
}
_, err = a.AccessUserPage2("order/receive/processed/w/distribute/tipAmount/v2", params, true)
_, err = a.AccessUserPage2("v2/order/receive/processed/w/distribute/tipAmount/v2", params, true)
return err
}
@@ -60,7 +60,7 @@ func (a *API) GetDistributeOrderDetail(orderID, poiCode string) (distributeOrder
params := map[string]interface{}{
"orderInfos": []string{string(utils.MustMarshal(params1))},
}
result, err2 := a.AccessUserPage2("order/receive/processed/r/distribute/list/v2", params, false)
result, err2 := a.AccessUserPage2("v2/order/receive/processed/r/distribute/list/v2", params, false)
if err2 != nil {
return distributeOrderDetail, err
}

View File

@@ -0,0 +1,37 @@
package mtwmapi
import "git.rosy.net.cn/baseapi/utils"
type PackagePriceItem struct {
Label string `json:"label"`
Value int `json:"value"`
}
type PackagePriceInfo struct {
PackagePayType int `json:"packagePayType"`
PackagePrice int `json:"packagePrice"`
PackagePriceRange []*PackagePriceItem `json:"packagePriceRange"`
WmPoiID int `json:"wmPoiId"`
Message string `json:"message"`
}
func (a *API) PackagePriceUpdate(poiCode string, packetPayType, packetPrice int) (err error) {
params := map[string]interface{}{
"wmPoiId": poiCode,
"packetPayType": packetPayType,
"packetPrice": packetPrice,
}
_, err = a.AccessUserPage2("reuse/sc/product/packageprice/w/update", params, true)
return err
}
func (a *API) PackagePriceGet(poiCode string) (priceInfo *PackagePriceInfo, err error) {
params := map[string]interface{}{
"wmPoiId": poiCode,
}
result, err := a.AccessUserPage2("reuse/sc/product/packageprice/r/get", params, true)
if err == nil {
err = utils.Map2StructByJson(result, &priceInfo, false)
}
return priceInfo, err
}

View File

@@ -98,3 +98,18 @@ func TestPoiOpen(t *testing.T) {
t.Fatal(err)
}
}
func TestPackagePriceUpdate(t *testing.T) {
err := api.PackagePriceUpdate("2461723", 1, 50)
if err != nil {
t.Fatal(err)
}
}
func TestPackagePriceGet(t *testing.T) {
priceInfo, err := api.PackagePriceGet("2461723")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(priceInfo, false))
}

View File

@@ -12,7 +12,7 @@ import (
const (
userURL = "http://i.waimai.meituan.com"
orderURL = "https://shangoue.meituan.com/v2"
orderURL = "https://shangoue.meituan.com"
)
const (
@@ -38,11 +38,21 @@ type ListShopItem struct {
WmPoiScore int `json:"wmPoiScore"`
}
func getRootURL(subURL string) (rootURL string) {
if strings.Index(subURL, "order/receive/processed/r/distribute") >= 0 {
return orderURL
var (
actionHostMap = map[string]string{
"v2/order/receive/processed/w/distribute/tipAmount/v2": orderURL,
"v2/order/receive/processed/r/distribute/list/v2": orderURL,
"reuse/sc/product/packageprice/w/update": orderURL,
"reuse/sc/product/packageprice/r/get": orderURL,
}
return userURL
)
func getRootURL(subURL string) (rootURL string) {
rootURL = actionHostMap[subURL]
if rootURL == "" {
rootURL = userURL
}
return rootURL
}
func (a *API) AccessUserPage2(subURL string, params map[string]interface{}, isPost bool) (retVal map[string]interface{}, err error) {