log
This commit is contained in:
@@ -118,19 +118,20 @@ func CreateFenceByStore(appOrgCode string, storeID int64) (fenceID string, err e
|
|||||||
if err = dao.GetRow(db, &localStore, sqlStr, sqlParam...); err == nil {
|
if err = dao.GetRow(db, &localStore, sqlStr, sqlParam...); err == nil {
|
||||||
globals.SugarLogger.Debug("localStore.DeliveryRangeType==============", localStore.DeliveryRangeType)
|
globals.SugarLogger.Debug("localStore.DeliveryRangeType==============", localStore.DeliveryRangeType)
|
||||||
if localStore.DeliveryRangeType == LocalShapeCircular {
|
if localStore.DeliveryRangeType == LocalShapeCircular {
|
||||||
circular = warehouse_createFence_request.Circular{
|
param = &warehouse_createFence_request.WarehouseCreateFenceParam{
|
||||||
|
FenceInfo: &warehouse_createFence_request.FenceInfo{
|
||||||
|
OutFenceId: utils.Int64ToStr(storeID),
|
||||||
|
Shape: tiktok_api.ShapeCircular,
|
||||||
|
Circular: &warehouse_createFence_request.Circular{
|
||||||
Center: &warehouse_createFence_request.Center{
|
Center: &warehouse_createFence_request.Center{
|
||||||
Longitude: utils.Int2Float64(localStore.Lng),
|
Longitude: utils.Int2Float64(localStore.Lng),
|
||||||
Latitude: utils.Int2Float64(localStore.Lat),
|
Latitude: utils.Int2Float64(localStore.Lat),
|
||||||
},
|
},
|
||||||
Radius: utils.Str2Float64(localStore.DeliveryRange),
|
Radius: utils.Str2Float64(localStore.DeliveryRange),
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("Latitude============%f,%f,%f", circular.Center.Latitude, circular.Center.Longitude, circular.Radius)
|
|
||||||
globals.SugarLogger.Debugf("circular=====%v", circular)
|
|
||||||
param.FenceInfo.Circular = &circular
|
|
||||||
param.FenceInfo.Shape = tiktok_api.ShapeCircular
|
|
||||||
globals.SugarLogger.Debug("圆:lat,lng", circular.Center.Latitude, circular.Center.Longitude)
|
globals.SugarLogger.Debug("圆:lat,lng", circular.Center.Latitude, circular.Center.Longitude)
|
||||||
|
|
||||||
} else if localStore.DeliveryRangeType == LocalShapePolygon {
|
} else if localStore.DeliveryRangeType == LocalShapePolygon {
|
||||||
tempStr := strings.Split(localStore.DeliveryRange, ";")
|
tempStr := strings.Split(localStore.DeliveryRange, ";")
|
||||||
for v := len(tempStr) - 1; v >= 0; v-- {
|
for v := len(tempStr) - 1; v >= 0; v-- {
|
||||||
@@ -141,11 +142,17 @@ func CreateFenceByStore(appOrgCode string, storeID int64) (fenceID string, err e
|
|||||||
}
|
}
|
||||||
vertex = append(vertex, vertices)
|
vertex = append(vertex, vertices)
|
||||||
}
|
}
|
||||||
param.FenceInfo.Polygon.Vertices = vertex
|
param = &warehouse_createFence_request.WarehouseCreateFenceParam{
|
||||||
param.FenceInfo.Shape = tiktok_api.ShapePolygon
|
FenceInfo: &warehouse_createFence_request.FenceInfo{
|
||||||
|
OutFenceId: utils.Int64ToStr(storeID),
|
||||||
|
Shape: tiktok_api.ShapePolygon,
|
||||||
|
Polygon: &warehouse_createFence_request.Polygon{
|
||||||
|
Vertices: vertex,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
globals.SugarLogger.Debug("多边形:vertex", param.FenceInfo.Polygon.Vertices)
|
globals.SugarLogger.Debug("多边形:vertex", param.FenceInfo.Polygon.Vertices)
|
||||||
}
|
}
|
||||||
param.FenceInfo.OutFenceId = utils.Int64ToStr(storeID) //绑定基于此id
|
|
||||||
resp, err := getAPI(appOrgCode, 0, "").CreateFence(param)
|
resp, err := getAPI(appOrgCode, 0, "").CreateFence(param)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|||||||
Reference in New Issue
Block a user