Files
baseapi/platformapi/ebaiapi/shop_test.go
richboo111 c32151cdb4 1
2023-02-14 15:41:32 +08:00

257 lines
7.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package ebaiapi
import (
"testing"
"git.rosy.net.cn/baseapi/utils"
)
func TestShopList(t *testing.T) {
result, err := api.ShopList(SysStatusAll)
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestShopCreate(t *testing.T) {
result, err := api.ShopCreate(map[string]interface{}{
"shop_id": "667550",
"name": "互利超市(金牛区店)",
"supplier_id": "1486975681715",
"province": 32,
"city": 75,
"county": 698,
"address": "成都市金牛区二环路北一段8号",
"phone": 18160030913, // 18980429231,
"service_phone": 18160030913, //18980429231,
"ivr_phone": 18160030913, //18048531223,
"longitude": 104.043677,
"latitude": 30.692361,
"shop_logo": "https://image-star.elemecdn.com/pb/dab294b0d3e9fa4b5fa63007ff02d06e98",
"coord_type": "amap",
"categorys": []map[string]int{
map[string]int{
"category1": 166,
"category2": 222,
},
},
"business_time": []map[string]string{
map[string]string{
"start": "7:00",
"end": "19:00",
},
},
"business_form_id": 1672214913,
})
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestShopGet(t *testing.T) {
result, err := api.ShopGet2("", 2235877567) //2233065879 ,22267134648
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
// result, err = api.ShopGet(testShopID, 0)
// if err != nil {
// t.Fatal(err)
// } else {
// t.Log(utils.Format4Output(result, false))
// }
}
func TestShopAptitudeGet(t *testing.T) {
result, err := api.ShopAptitudeGet("", 335768207)
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestShopUpdate(t *testing.T) {
params := map[string]interface{}{
//KeyName: "好菜鲜生(龙宫市场店)",
//KeyPhone: "13812345678",
KeyBaiduShopID: "2097134681",
//"longitude": 116.307884,
//"latitude": 40.036828,
//"coord_type": "amap",
//"province": "131",
//"city": "131",
//"county": "1960",
//"address": "北京市海淀区上地信息路甲9号",
//"takeout_shop_logo": "https://image-star.elemecdn.com/pb/b79d499b9b0be5deb3ee3ce71bf29ad0a8",
//"baidu_takeout_logo": "https://image-star.elemecdn.com/pb/b79d499b9b0be5deb3ee3ce71bf29ad0a8",
//"ele_takeout_logo": "https://image-star.elemecdn.com/pb/b79d499b9b0be5deb3ee3ce71bf29ad0a8",
//"baidu_takeout_logo" //takeoutShopLogo//baiduTakeoutLogo
}
err := api.ShopUpdate(params)
if err != nil {
t.Fatal(err)
} else {
}
}
func TestShopBusStatusGet(t *testing.T) {
result, err := api.ShopBusStatusGet("", 100000117217, PlatformFlagElm)
if err != nil {
t.Fatal(err)
} else {
t.Log(result)
}
}
func TestShopStatusGet(t *testing.T) {
result, err := api.ShopStatusGet("", 200000081608)
if err != nil {
t.Fatal(err)
} else {
t.Log(result)
}
}
//todo 修改ebai平台与本地映射
func TestShopIDBatchUpdate(t *testing.T) {
err := api.ShopIDBatchUpdate([]string{utils.Int2Str(2235877567)}, []string{"100920"})
if err != nil {
t.Fatal(err)
}
// err = api.ShopIDBatchUpdate([]string{utils.Int2Str(testShopBaiduID)}, []string{testShopID})
// if err != nil {
// t.Fatal(err)
// }
}
func TestSupplierList(t *testing.T) {
result, err := api.SupplierList()
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestShopOpen(t *testing.T) {
err := api.ShopOpen("", 335768207)
if err != nil {
t.Fatal(err)
}
}
func TestShopClose(t *testing.T) {
err := api.ShopClose("", testShopBaiduID)
if err != nil {
t.Fatal(err)
}
}
func TestShopOffline(t *testing.T) {
err := api.ShopOffline("", testShopBaiduID)
if err != nil {
t.Fatal(err)
}
}
func TestShopAnnouncementSet(t *testing.T) {
err := api.ShopAnnouncementSet("", testShopBaiduID, "测试公告123")
if err != nil {
t.Fatal(err)
}
}
func TestShopAptitudeUpload(t *testing.T) {
err := api.ShopAptitudeUpload("", 335768207, map[string]interface{}{
"aptitude": []map[string]interface{}{
map[string]interface{}{
"type_1": 1,
"type_2": 101,
"license_number": "92510106L597085088",
"license_address": "金牛区二环路北一段8号1A-2、A-3、A-4楼",
"long_term_valid": 1,
"legal_representative_name": "张应友",
"license_name": "营业执照",
"photos": []map[string]interface{}{
map[string]interface{}{
"photo_url": "http://image.jxc4.com/image/c436338a2af4d87e30b770cfc1bb8041.jpg",
"waterprinter_url": "http://image.jxc4.com/image/c436338a2af4d87e30b770cfc1bb8041.jpg",
},
},
},
map[string]interface{}{
"type_1": 2,
"type_2": 202,
"license_number": "JY151010601049471-1",
"license_validdate": "2023-10-09",
"license_name": "食品经营许可证",
"license_address": "金牛区二环路北一段8号1A-2、A-3、A-4楼",
"legal_representative_name": "张应友",
"photos": []map[string]interface{}{
map[string]interface{}{
"photo_url": "http://image.jxc4.com/image/93d2126adfd28350385b5067e2770edf.jpg",
"waterprinter_url": "http://image.jxc4.com/image/93d2126adfd28350385b5067e2770edf.jpg",
},
},
},
map[string]interface{}{
"type_1": 3,
"type_2": 301,
"license_number": "510921196608255211",
"long_term_valid": 1,
"license_name": "身份证",
"legal_representative_name": "张应友",
"photos": []map[string]interface{}{
map[string]interface{}{
"photo_url": "http://image.jxc4.com/image/ebdaf32e771a6c050e397624c3fae369.jpg",
"waterprinter_url": "http://image.jxc4.com/image/ebdaf32e771a6c050e397624c3fae369.jpg",
},
map[string]interface{}{
"photo_url": "http://image.jxc4.com/image/75fad719d61326cedd73f17b1af6338b.jpg",
"waterprinter_url": "http://image.jxc4.com/image/75fad719d61326cedd73f17b1af6338b.jpg",
},
},
},
map[string]interface{}{
"type_1": 5,
"type_2": 501,
"photos": []map[string]interface{}{
map[string]interface{}{
"photo_url": "http://image.jxc4.com/image/53bd1275a8a9cd5898912fa78857f284.jpg",
"waterprinter_url": "http://image.jxc4.com/image/53bd1275a8a9cd5898912fa78857f284.jpg",
},
},
},
map[string]interface{}{
"type_1": 5,
"type_2": 502,
"photos": []map[string]interface{}{
map[string]interface{}{
"photo_url": "http://image.jxc4.com/image/74c371be5bf39d795cf6c02507e7ca84.jpg",
"waterprinter_url": "http://image.jxc4.com/image/74c371be5bf39d795cf6c02507e7ca84.jpg",
},
},
},
},
})
if err != nil {
t.Fatal(err)
}
}
func TestShopDeliveryinfoGet(t *testing.T) {
result, err := api.ShopDeliveryinfoGet("", 2233065959)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}