京东商城订单初接入
This commit is contained in:
@@ -74,7 +74,7 @@ func TestGetCoordinateTownInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetDistricts(t *testing.T) {
|
||||
districtList, err := autonaviAPI.GetDistricts(4, "常熟市")
|
||||
districtList, err := autonaviAPI.GetDistricts(4, "成都")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -149,3 +149,11 @@ func TestBatchWalkingDistance(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestAA(t *testing.T) {
|
||||
result, err := autonaviAPI.GetCoordinateAreaInfo(116.331471, 39.909837)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
31
platformapi/jdshopapi/callback.go
Normal file
31
platformapi/jdshopapi/callback.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package jdshopapi
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
type CallBackResult struct {
|
||||
OrderCreateTime string `json:"orderCreateTime"`
|
||||
OrderType string `json:"orderType"`
|
||||
OrderPaymentType string `json:"orderPaymentType"`
|
||||
VenderID string `json:"venderId"`
|
||||
OrderStatus string `json:"orderStatus"`
|
||||
OrderID string `json:"orderId"`
|
||||
}
|
||||
|
||||
func (a *API) GetCallbackMsg(request *http.Request) (call *CallBackResult, err error) {
|
||||
data, err := ioutil.ReadAll(request.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
values, err := utils.HTTPBody2Values(data, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mapData := utils.URLValues2Map(values)
|
||||
utils.Map2StructByJson(mapData, &call, false)
|
||||
return call, err
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"image/jpeg"
|
||||
"image/png"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
@@ -283,7 +284,7 @@ func TestUpdateWare(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFindSkuStock(t *testing.T) {
|
||||
err := api.FindSkuStock(69411607059)
|
||||
err := api.FindSkuStock(69353673334)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -307,7 +308,7 @@ func TestImageUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchWare4Valid(t *testing.T) {
|
||||
result, err := api.SearchWare4Valid("红薯", 0, 0)
|
||||
result, err := api.SearchWare4Valid("猕猴桃 奇异果", 0, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -384,3 +385,26 @@ func TestFindOpReason(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestAAAA(t *testing.T) {
|
||||
var (
|
||||
lng = 114.893295
|
||||
lat = 25.85793
|
||||
)
|
||||
const (
|
||||
maxRadius = 5000
|
||||
maxStoreCount4User = 5
|
||||
)
|
||||
lng2, _ := ConvertDistanceToLogLat(lng, lat, float64(maxRadius), 90)
|
||||
_, lat2 := ConvertDistanceToLogLat(lng, lat, float64(maxRadius), 0)
|
||||
lng1 := lng - (lng2 - lng)
|
||||
lat1 := lat - (lat2 - lat)
|
||||
fmt.Println(lng1, lng2, lat1, lat2)
|
||||
}
|
||||
|
||||
func ConvertDistanceToLogLat(lng, lat, distance, angle float64) (newLng, newLat float64) {
|
||||
oneDu := 111319.55 // 单位为米
|
||||
newLng = lng + (distance*math.Sin(angle*math.Pi/180))/(oneDu*math.Cos(lat*math.Pi/180)) //将距离转换成经度的计算公式
|
||||
newLat = lat + (distance*math.Cos(angle*math.Pi/180))/oneDu //将距离转换成纬度的计算公式
|
||||
return newLng, newLat
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ type UpdateEntityStoreParam struct {
|
||||
Phone string `json:"phone,omitempty"` //是 门店电话
|
||||
ExtendJSON string `json:"extendJson,omitempty"` //是 扩展属性JSON如:{name1:'value1',name2:'value2'},营业时间必传固定json格式:{\'businessBeginTime\':\'09:00\',\'businessEndTime\':\'22:00\'}' ,可将中间的时间变更
|
||||
ImageFile string `json:"imageFile,omitempty"` //否 门店图片,图片二进制文件流,允许png、jpg、gif、jpeg、bmp图片格式,1M以内。
|
||||
CustomerID string `json:"customerId"` //否 商家门店Id,商家维度不可重复
|
||||
CustomerID string `json:"customerId,omitempty"` //否 商家门店Id,商家维度不可重复
|
||||
Status int `json:"status,omitempty"` //否 商家门店Id,商家维度不可重复
|
||||
}
|
||||
|
||||
type GetAddressCodeResult struct {
|
||||
|
||||
@@ -29,8 +29,8 @@ func TestCreateEntityStore(t *testing.T) {
|
||||
|
||||
func TestUpdateEntityStore(t *testing.T) {
|
||||
err := api.UpdateEntityStore(&UpdateEntityStoreParam{
|
||||
StoreID: 24330156,
|
||||
Name: "京西菜市门店1",
|
||||
StoreID: 24339354,
|
||||
Status: 6,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -47,7 +47,7 @@ func TestGetProvince(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCity(t *testing.T) {
|
||||
result, err := api.GetCity(22)
|
||||
result, err := api.GetCity(2)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -55,7 +55,7 @@ func TestGetCity(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCounty(t *testing.T) {
|
||||
result, err := api.GetCounty(1930)
|
||||
result, err := api.GetCounty(2823)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -63,7 +63,7 @@ func TestGetCounty(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFindSkuSiteStock(t *testing.T) {
|
||||
result, err := api.FindSkuSiteStock(24332466, 69411607059)
|
||||
result, err := api.FindSkuSiteStock(24337902, 69353673334)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func TestFindSkuSiteStock(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateSkuSiteStock(t *testing.T) {
|
||||
err := api.UpdateSkuSiteStock(69411607059, 0, 24332466)
|
||||
err := api.UpdateSkuSiteStock(69353673334, 0, 24337902)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func TestUpdateSkuSiteStock(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestQueryEntityStore(t *testing.T) {
|
||||
result, err := api.QueryEntityStore(11)
|
||||
result, err := api.QueryEntityStore(24339354)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user