aa
This commit is contained in:
@@ -21,7 +21,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetAliUpcInfo(t *testing.T) {
|
func TestGetAliUpcInfo(t *testing.T) {
|
||||||
result, err := api.GetAliUpcInfo("6901028227278")
|
result, err := api.GetAliUpcInfo("6940863603571")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ func (a *API) CommonShopCategories(parentID, level int) (cityList []*CatInfo, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) CommonBusinessCategories(parentID int) (cityList []*CatInfo, err error) {
|
func (a *API) CommonBusinessCategories(parentID int) (cityList []*CatInfo, err error) {
|
||||||
result, err := a.AccessAPI("common.businesscategories", utils.Params2Map("category_id", parentID))
|
result, err := a.AccessAPI("common.businesscategories", nil)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = utils.Map2StructByJson(result.Data, &cityList, true)
|
err = utils.Map2StructByJson(result.Data, &cityList, true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,24 @@ func TestCommonShopCategoriesGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCommonShopCategories(t *testing.T) {
|
func TestCommonShopCategories(t *testing.T) {
|
||||||
result, err := api.CommonShopCategories(166, 2)
|
/*
|
||||||
|
{
|
||||||
|
"category1": "厨房生鲜",
|
||||||
|
"category2": "蔬菜"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category1": "水果",
|
||||||
|
"category2": "水果店"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category1": "厨房生鲜",
|
||||||
|
"category2": "肉类"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"category1": "厨房生鲜",
|
||||||
|
"category2": "水产"
|
||||||
|
} */
|
||||||
|
result, err := api.CommonShopCategories(277, 2)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
@@ -34,7 +51,7 @@ func TestCommonShopCategories(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCommonBusinessCategories(t *testing.T) {
|
func TestCommonBusinessCategories(t *testing.T) {
|
||||||
result, err := api.CommonBusinessCategories(166)
|
result, err := api.CommonBusinessCategories(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,18 +18,18 @@ func TestShopList(t *testing.T) {
|
|||||||
func TestShopCreate(t *testing.T) {
|
func TestShopCreate(t *testing.T) {
|
||||||
result, err := api.ShopCreate(map[string]interface{}{
|
result, err := api.ShopCreate(map[string]interface{}{
|
||||||
"shop_id": "667550",
|
"shop_id": "667550",
|
||||||
"name": "互利超市(金牛店)",
|
"name": "互利超市(金牛区店)",
|
||||||
"supplier_id": "1486975681715",
|
"supplier_id": "1486975681715",
|
||||||
"province": 32,
|
"province": 32,
|
||||||
"city": 75,
|
"city": 75,
|
||||||
"county": 698,
|
"county": 698,
|
||||||
"address": "成都市金牛区二环路北一段8号",
|
"address": "成都市金牛区二环路北一段8号",
|
||||||
"phone": 18980429231,
|
"phone": 18160030913, // 18980429231,
|
||||||
"service_phone": 18980429231,
|
"service_phone": 18160030913, //18980429231,
|
||||||
"ivr_phone": 18048531223,
|
"ivr_phone": 18160030913, //18048531223,
|
||||||
"longitude": 104.043677,
|
"longitude": 104.043677,
|
||||||
"latitude": 30.692361,
|
"latitude": 30.692361,
|
||||||
"shop_logo": "http://image.jxc4.com/image/4573e7789c647d4961f8955e3733dbd6.tem.jpg",
|
"shop_logo": "https://image-star.elemecdn.com/pb/dab294b0d3e9fa4b5fa63007ff02d06e98",
|
||||||
"coord_type": "amap",
|
"coord_type": "amap",
|
||||||
"categorys": []map[string]int{
|
"categorys": []map[string]int{
|
||||||
map[string]int{
|
map[string]int{
|
||||||
@@ -53,7 +53,7 @@ func TestShopCreate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestShopGet(t *testing.T) {
|
func TestShopGet(t *testing.T) {
|
||||||
result, err := api.ShopGet("", 335768207) //2233065879
|
result, err := api.ShopGet("", 2267237821) //2233065879 ,22267134648
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func TestSkuBrandList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPictureUpload(t *testing.T) {
|
func TestPictureUpload(t *testing.T) {
|
||||||
result, err := api.PictureUpload("https://www.jxcs.net/emoji/ceshi2.gif", nil)
|
result, err := api.PictureUpload("http://image.jxc4.com/image/212c268d26f6237e33ba269d24e2f76b.jpg", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package jdapi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -9,6 +10,10 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
skuNamePat = regexp.MustCompile(`([\((\[【][^\((\[【\))\]】]*[\))\]】])?(.*?)([((].*[))])?\s*约?([1-9][\d\.]*)(g|G|kg|mg|kG|Kg|KG|l|L|ml|mL|Ml|ML|克)\s*([((].*[))])?\s*(?:\/|/|)\s*([^\s()()]{0,2})(\s.*)?$\s*([((].*[))])?$`)
|
||||||
|
)
|
||||||
|
|
||||||
func TestGetRealMobileNumber4Order(t *testing.T) {
|
func TestGetRealMobileNumber4Order(t *testing.T) {
|
||||||
orderId := "921823424000122"
|
orderId := "921823424000122"
|
||||||
desiredMobile := "13722455105"
|
desiredMobile := "13722455105"
|
||||||
@@ -317,9 +322,7 @@ func findTheDifference(s string, t string) byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetJdStoreInfo(t *testing.T) {
|
func TestGetJdStoreInfo(t *testing.T) {
|
||||||
result, err := api.GetJdStoreInfo("11942642")
|
str := "汤臣倍健 辅酶Q10天然维生素E软胶囊 400mg*60粒/瓶"
|
||||||
if err != nil {
|
searchResult := skuNamePat.FindStringSubmatch(str)
|
||||||
t.Fatal(err)
|
fmt.Println(searchResult)
|
||||||
}
|
|
||||||
t.Log(utils.Format4Output(result, false))
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,3 +321,15 @@ func (a *API) AddByStoreAndSkus(stationNo int64, skuIDs []int64) (err error) {
|
|||||||
_, err = a.AccessAPINoPage("OrgSortService/addByStoreAndSkus", jdParams, nil, nil, genNoPageResultParser("status", "message", "", "200"))
|
_, err = a.AccessAPINoPage("OrgSortService/addByStoreAndSkus", jdParams, nil, nil, genNoPageResultParser("status", "message", "", "200"))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除门店商品会员价接口
|
||||||
|
// https://openo2o.jddj.com/staticnew/widgets/resources.html?groupid=205&apiid=73116e2b9f374814880f1272ba301fdf
|
||||||
|
func (a *API) DelVipPrice(outStationNo string, skuIds []*SkuIdEntity, userPin string) (err error) {
|
||||||
|
jdParams := map[string]interface{}{
|
||||||
|
"outStationNo": outStationNo,
|
||||||
|
"skuPriceInfoList": skuIds,
|
||||||
|
"source": utils.GetAPIOperator(userPin),
|
||||||
|
}
|
||||||
|
_, err = a.AccessAPINoPage("vender/delVipPrice", jdParams, nil, nil, genNoPageResultParser("code", "msg", "", "0"))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,13 +13,25 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestGetStationInfoList(t *testing.T) {
|
func TestGetStationInfoList(t *testing.T) {
|
||||||
result, err := api.GetStationInfoList(mustExistStoreID, []int64{mustExistSkuID})
|
result, err := api.GetStationInfoList("12005640", []int64{2023434101})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDelVipPrice(t *testing.T) {
|
||||||
|
err := api.DelVipPrice("667281", []*SkuIdEntity{
|
||||||
|
&SkuIdEntity{
|
||||||
|
OutSkuId: "26074",
|
||||||
|
},
|
||||||
|
}, "")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
// t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
func TestQueryOpenUseable(t *testing.T) {
|
func TestQueryOpenUseable(t *testing.T) {
|
||||||
result, err := api.QueryOpenUseable([]*BaseStockCenterRequest{
|
result, err := api.QueryOpenUseable([]*BaseStockCenterRequest{
|
||||||
&BaseStockCenterRequest{
|
&BaseStockCenterRequest{
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ func New(appID, secret, callbackURL, token string, config ...*platformapi.APICon
|
|||||||
return &API{
|
return &API{
|
||||||
appID: appID,
|
appID: appID,
|
||||||
secret: secret,
|
secret: secret,
|
||||||
|
token: token,
|
||||||
callbackURL: callbackURL,
|
callbackURL: callbackURL,
|
||||||
client: &http.Client{Timeout: curConfig.ClientTimeout},
|
client: &http.Client{Timeout: curConfig.ClientTimeout},
|
||||||
config: &curConfig,
|
config: &curConfig,
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ func init() {
|
|||||||
baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
|
|
||||||
// 菜市
|
// 菜市
|
||||||
// api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "")
|
// api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||||
|
|
||||||
// 果园
|
// 果园
|
||||||
// api = New("4123", "df2c88338b85f830cebce2a9eab56628", "")
|
// api = New("4123", "df2c88338b85f830cebce2a9eab56628", "")
|
||||||
|
|
||||||
//商超
|
//商超
|
||||||
api = New("5873", "41c479790a76f86326f89e8048964739", "") //token_nH_IlcWQKAkZBqklwItNRw
|
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_gYtTGPVDP6pTDLECwp1BFA") //token_nH_IlcWQKAkZBqklwItNRw
|
||||||
cookieStr := `
|
cookieStr := `
|
||||||
acctId=62884810; token=0_0_vJux6rcmm0XIzoI885_aew-gnfofUw9SR-a-QkLw*; brandId=-1; wmPoiId=-1;
|
acctId=62884810; token=0_0_vJux6rcmm0XIzoI885_aew-gnfofUw9SR-a-QkLw*; brandId=-1; wmPoiId=-1;
|
||||||
`
|
`
|
||||||
@@ -41,7 +41,7 @@ func TestAccessAPI(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetOAuthCode(t *testing.T) {
|
func TestGetOAuthCode(t *testing.T) {
|
||||||
result, err := api.GetOAuthCode("11011885")
|
result, err := api.GetOAuthCode("10874383")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestOrderViewStatus(t *testing.T) {
|
func TestOrderViewStatus(t *testing.T) {
|
||||||
result, err := api.OrderViewStatus(33762863658107006)
|
result, err := api.OrderViewStatus(123)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ func TestGetOrderActDetaill(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetOrderIdByDaySeq(t *testing.T) {
|
func TestGetOrderIdByDaySeq(t *testing.T) {
|
||||||
result, err := api.GetOrderIdByDaySeq("7111597", utils.Time2Date(time.Now()), 1, MaxGap4GetOrderIdByDaySeq)
|
result, err := api.GetOrderIdByDaySeq("10874383", utils.Time2Date(time.Now()), 1, MaxGap4GetOrderIdByDaySeq)
|
||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user