1
This commit is contained in:
@@ -1950,7 +1950,21 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
for _, skuBindInfo := range skuBindInfos {
|
for _, skuBindInfo := range skuBindInfos {
|
||||||
// 关注且没有给价时,需要尝试从store_sku_bind中得到已有的单价
|
// 关注且没有给价时,需要尝试从store_sku_bind中得到已有的单价
|
||||||
needGetExistingUnitPrice := skuBindInfo.UnitPrice == 0 && skuBindInfo.IsFocus == 1
|
needGetExistingUnitPrice := skuBindInfo.UnitPrice == 0 && skuBindInfo.IsFocus == 1
|
||||||
|
// 批量关注时补全sku,主要是为了补商品库存
|
||||||
|
if len(skuBindInfo.Skus) > 0 && skuBindInfo.Skus[0].SkuID == 0 {
|
||||||
|
skuList, _ := dao.GetSkus(db, nil, []int{skuBindInfo.NameID}, nil, nil, nil)
|
||||||
|
skuBindInfoSkus := make([]*StoreSkuBindSkuInfo, 0, len(skuList))
|
||||||
|
for _, sl := range skuList {
|
||||||
|
skuBindInfoSkus = append(skuBindInfoSkus, &StoreSkuBindSkuInfo{
|
||||||
|
SkuID: sl.ID,
|
||||||
|
IsSale: skuBindInfo.IsSale,
|
||||||
|
Stock: skuBindInfo.Skus[0].Stock,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
skuBindInfo.Skus = skuBindInfoSkus
|
||||||
|
}
|
||||||
inSkuBinds := skuBindInfo.Skus
|
inSkuBinds := skuBindInfo.Skus
|
||||||
|
|
||||||
var allBinds []*tStoreSkuBindAndSpec
|
var allBinds []*tStoreSkuBindAndSpec
|
||||||
sql := `
|
sql := `
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -247,6 +247,19 @@ func BaiDuCoord2Gaode2(baiduCoordinat []string) []string {
|
|||||||
return gaoCoordinat
|
return gaoCoordinat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GaodeCoord2BaiDu 高德坐标转百度坐标
|
||||||
|
func GaodeCoord2BaiDu(lng, lat float64) (float64, float64) {
|
||||||
|
x := lng
|
||||||
|
y := lat
|
||||||
|
z := math.Sqrt(x*x+y*y) + 0.00002*math.Sin(y*math.Pi)
|
||||||
|
theta := math.Atan2(y, x) + 0.000003*math.Cos(x*math.Pi)
|
||||||
|
|
||||||
|
bdLng := z*math.Cos(theta) + 0.0065
|
||||||
|
bdLat := z*math.Sin(theta) + 0.006
|
||||||
|
|
||||||
|
return bdLng, bdLat
|
||||||
|
}
|
||||||
|
|
||||||
// distance单位为米
|
// distance单位为米
|
||||||
func ConvertDistanceToLogLat(lng, lat, distance, angle float64) (newLng, newLat float64) {
|
func ConvertDistanceToLogLat(lng, lat, distance, angle float64) (newLng, newLat float64) {
|
||||||
oneDu := 111319.55 // 单位为米
|
oneDu := 111319.55 // 单位为米
|
||||||
|
|||||||
@@ -324,10 +324,8 @@ func getOrderPrice(order *model.GoodsOrder) (orderPrice *uuptapi.GetOrderPriceRe
|
|||||||
// toLat = coords[1].Lat
|
// toLat = coords[1].Lat
|
||||||
// toLng = coords[1].Lng
|
// toLng = coords[1].Lng
|
||||||
//}
|
//}
|
||||||
fromLat = jxutils.IntCoordinate2Standard(store.Lat)
|
fromLng, fromLat = jxutils.GaodeCoord2BaiDu(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat))
|
||||||
fromLng = jxutils.IntCoordinate2Standard(store.Lng)
|
toLng, toLat = jxutils.GaodeCoord2BaiDu(jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat))
|
||||||
toLat = jxutils.IntCoordinate2Standard(order.ConsigneeLat)
|
|
||||||
toLng = jxutils.IntCoordinate2Standard(order.ConsigneeLng)
|
|
||||||
|
|
||||||
weight := 4
|
weight := 4
|
||||||
tempWeight := 0
|
tempWeight := 0
|
||||||
|
|||||||
Reference in New Issue
Block a user