Merge branch 'master' of https://e.coding.net/rosydev/baseapi
This commit is contained in:
@@ -23,10 +23,10 @@ func init() {
|
||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||
|
||||
// 果园
|
||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||
|
||||
//商超
|
||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nH_IlcWQKAkZBqklwItNRw") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nH_IlcWQKAkZBqklwItNRw") //token_nH_IlcWQKAkZBqklwItNRw
|
||||
cookieStr := `
|
||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||
`
|
||||
|
||||
@@ -2,11 +2,11 @@ package mtwmapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
func TestOrderViewStatus(t *testing.T) {
|
||||
@@ -18,7 +18,7 @@ func TestOrderViewStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOrderGetOrderDetail(t *testing.T) {
|
||||
result, err := api.OrderGetOrderDetail(1100280412024133788, false)
|
||||
result, err := api.OrderGetOrderDetail(1100335050573312765, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -183,3 +183,53 @@ func TestOrderDelivering(t *testing.T) {
|
||||
err := api.OrderDelivering(148815413321281654)
|
||||
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
|
||||
}
|
||||
}
|
||||
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) {
|
||||
fmt.Println((10 & 2) != 0)
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ func TestPoiSave(t *testing.T) {
|
||||
//}
|
||||
poiParams := map[string]interface{}{}
|
||||
//utils.FilterMapNilMembers(utils.Struct2FlatMap(result[0]))
|
||||
poiParams["name"] = "京西果园·果切·水果捞(金碧园店)"
|
||||
err := api.PoiSave("9410009", poiParams)
|
||||
poiParams["address"] = "云南省楚雄彝族自治州楚雄市鹿城镇陈家槽子村小吃一条街B21号"
|
||||
err := api.PoiSave("15467875", poiParams)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
|
||||
@@ -271,6 +271,7 @@ func handleRetailBatchResultByRegexp(result interface{}) (failedFoodList []*AppF
|
||||
// https://developer.waimai.meituan.com/home/myquestionDetail/6716
|
||||
// 另外这个接口即使不指定operate_type为1,也可能报错:”商品spu名称在该店内分类中已存在“,原因就是已经存在两个相同的SKU了
|
||||
func (a *API) RetailInitData(trackInfo, poiCode, foodCode string, params map[string]interface{}) (err error) {
|
||||
globals.SugarLogger.Debugf("===========create sku mt : %s,%s,%s,%s", trackInfo, poiCode, foodCode, utils.Format4Output(params, false))
|
||||
_, err = a.AccessAPI2("retail/initdata", false, utils.MergeMaps(map[string]interface{}{
|
||||
KeyAppPoiCode: poiCode,
|
||||
KeyAppFoodCode: foodCode,
|
||||
|
||||
Reference in New Issue
Block a user