1
This commit is contained in:
@@ -20,13 +20,13 @@ func init() {
|
||||
baseapi.Init(sugarLogger)
|
||||
|
||||
// 菜市
|
||||
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
|
||||
// 果园
|
||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
|
||||
//商超
|
||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_u368I2OxTY4ys4wWuVVMOQ") //token_n4TwqCntWWuvQwAawzxC0w
|
||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_qO_Kv9pX4lHVTb2IX19JzQ") //token_n4TwqCntWWuvQwAawzxC0w
|
||||
cookieStr := `
|
||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||
`
|
||||
|
||||
@@ -765,6 +765,12 @@ func (a *API) OrderStatusAndPsInfo(params map[string]interface{}) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
// ApplyCompensation 取消的订单申请订单赔付
|
||||
func (a *API) ApplyCompensation(param *ApplyCompensationRes) (err error) {
|
||||
_, err = a.AccessAPI2("order/applyCompensation", false, utils.Struct2MapByJson(param), resultKeySuccessMsg, "")
|
||||
return err
|
||||
}
|
||||
|
||||
// 获取取消跑腿理由刘表
|
||||
// https://open-shangou.meituan.com/home/docDetail/482
|
||||
func (a *API) GetCancelDeliveryReason(orderId int64, appPoiCode string) (string, error) {
|
||||
@@ -784,21 +790,6 @@ func (a *API) GetCancelDeliveryReason(orderId int64, appPoiCode string) (string,
|
||||
return string(list), nil
|
||||
}
|
||||
|
||||
type DeliveryData struct {
|
||||
Code int `json:"code"`
|
||||
Title string `json:"title"`
|
||||
ReasonList []*ReasonList `json:"reasonList"`
|
||||
Msg string `json:"msg"`
|
||||
DeliveryStatus int `json:"deliveryStatus"`
|
||||
}
|
||||
|
||||
type ReasonList struct {
|
||||
Code string `json:"code"`
|
||||
Content string `json:"content"`
|
||||
PreCancelCode int `json:"preCancelCode"`
|
||||
PreCancelMsg string `json:"preCancelMsg"`
|
||||
}
|
||||
|
||||
// 取消跑腿配送
|
||||
func (a *API) CancelLogisticsByWmOrderId(reasonCode, detailContent, appPoiCode, orderId string) error {
|
||||
param := &CancelOrderParam{
|
||||
@@ -821,19 +812,3 @@ func (a *API) CancelLogisticsByWmOrderId(reasonCode, detailContent, appPoiCode,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ResultMsg struct {
|
||||
Data string `json:"data"`
|
||||
Error *struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
}
|
||||
|
||||
// 取消跑腿配送请求参数
|
||||
type CancelOrderParam struct {
|
||||
ReasonCode string `json:"reason_code"` // 取消原因code 请开发者一定要先调用
|
||||
DetailContent string `json:"detail_content"` // 取消原因
|
||||
AppPoiCode string `json:"app_poi_code"` // 门店号
|
||||
OrderId string `json:"order_id"` // 订单id
|
||||
}
|
||||
|
||||
@@ -5,6 +5,11 @@ import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
ApplyCompensationStatusOne = 110 // 第一次申请赔付
|
||||
ApplyCompensationStatusTwo = 120 // 第二次申请赔付
|
||||
)
|
||||
|
||||
type DistributeOrderDetail struct {
|
||||
WmOrderID int `json:"wm_order_id"`
|
||||
WmPoiID int `json:"wm_poi_id"`
|
||||
@@ -39,6 +44,50 @@ type DistributeOrderDetail struct {
|
||||
DelayPushSecond int `json:"delay_push_second"`
|
||||
}
|
||||
|
||||
type DeliveryData struct {
|
||||
Code int `json:"code"`
|
||||
Title string `json:"title"`
|
||||
ReasonList []*ReasonList `json:"reasonList"`
|
||||
Msg string `json:"msg"`
|
||||
DeliveryStatus int `json:"deliveryStatus"`
|
||||
}
|
||||
|
||||
type ReasonList struct {
|
||||
Code string `json:"code"`
|
||||
Content string `json:"content"`
|
||||
PreCancelCode int `json:"preCancelCode"`
|
||||
PreCancelMsg string `json:"preCancelMsg"`
|
||||
}
|
||||
|
||||
type ResultMsg struct {
|
||||
Data string `json:"data"`
|
||||
Error *struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
}
|
||||
|
||||
// ApplyCompensationRes 申请赔付
|
||||
type ApplyCompensationRes struct {
|
||||
OrderId int64 `json:"order_id"` // 订单id
|
||||
Reason string `json:"reason"` // 原因
|
||||
ApplyStatus int `json:"apply_status"` // 申请状态类型:110-第一次申请;120-第二次申诉。
|
||||
Amount float64 `json:"amount"` // 申请赔付金额,单位是元
|
||||
//FoodData []FoodDataList `json:"food_data"` // 惨损商品列表
|
||||
}
|
||||
type FoodDataList struct {
|
||||
AppSpuCode string `json:"app_spu_code"` // 即商家中台系统里商品的编码
|
||||
SkuId string `json:"sku_id"` // SKU码(商家的规格编码)
|
||||
}
|
||||
|
||||
// 取消跑腿配送请求参数
|
||||
type CancelOrderParam struct {
|
||||
ReasonCode string `json:"reason_code"` // 取消原因code 请开发者一定要先调用
|
||||
DetailContent string `json:"detail_content"` // 取消原因
|
||||
AppPoiCode string `json:"app_poi_code"` // 门店号
|
||||
OrderId string `json:"order_id"` // 订单id
|
||||
}
|
||||
|
||||
//美团骑手修改小费,单位为元,最多小数点后一位
|
||||
//order/receive/processed/w/distribute/tipAmount/v2?ignoreSetRouterProxy=true
|
||||
func (a *API) OrderModityTips(orderID, poiCode string, tipAmount float64) (err error) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
func TestOrderViewStatus(t *testing.T) {
|
||||
@@ -228,54 +227,16 @@ func TestOrderDelivering(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// 88 67 【组合菜】尖椒茄子(茄子500g 青尖椒200g)700g/组(茄子500g 青椒200g)
|
||||
// 90 60
|
||||
func TestLen(t *testing.T) {
|
||||
aa := "【组合菜】尖椒茄子(茄子500g 青尖椒200g)700g/组(茄子500g 青椒200g)"
|
||||
var count int // 中文
|
||||
var punctZh int // 中文标点
|
||||
var punctEn int // 英文标点
|
||||
var punctAZ int // 字母
|
||||
var punctNum int // 字母
|
||||
var spance int // 空格
|
||||
for _, v := range aa {
|
||||
if unicode.Is(unicode.Han, v) { // 中文
|
||||
count++
|
||||
continue
|
||||
}
|
||||
if unicode.IsPunct(v) { // 字符
|
||||
if v >= 1000 {
|
||||
fmt.Println(v)
|
||||
punctZh++
|
||||
} else {
|
||||
punctEn++
|
||||
}
|
||||
continue
|
||||
}
|
||||
if unicode.IsLetter(v) {
|
||||
punctAZ++
|
||||
continue
|
||||
}
|
||||
if unicode.IsNumber(v) {
|
||||
punctNum++
|
||||
continue
|
||||
}
|
||||
if unicode.IsSpace(v) {
|
||||
spance++
|
||||
continue
|
||||
}
|
||||
func TestApplyCompensation(t *testing.T) {
|
||||
param := &ApplyCompensationRes{
|
||||
OrderId: 3500902110034359123,
|
||||
Reason: "申请退款",
|
||||
ApplyStatus: 110,
|
||||
Amount: 35.31,
|
||||
//FoodData: nil,
|
||||
}
|
||||
err := api.ApplyCompensation(param)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
fmt.Println("count:= ", count)
|
||||
fmt.Println("count:= ", punctZh)
|
||||
fmt.Println("count:= ", punctEn)
|
||||
fmt.Println("count:= ", punctAZ)
|
||||
fmt.Println("count:= ", punctNum)
|
||||
|
||||
fmt.Println("all = ", (count*2)+(punctZh*2)+punctEn+punctAZ+punctNum+spance)
|
||||
}
|
||||
|
||||
func TestName(t *testing.T) {
|
||||
data := map[int]int{101: 1, 102: 1, 103: 1}
|
||||
|
||||
fmt.Println(data[1] == 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user