- delivery fee added.

- fixed scheduler bug
This commit is contained in:
gazebo
2018-07-19 18:05:40 +08:00
parent 56fcb4f4ed
commit a56cb64f8e
8 changed files with 111 additions and 10 deletions

View File

@@ -1,6 +1,8 @@
package jxutils
import (
"fmt"
"math"
"math/rand"
"strings"
"sync"
@@ -8,7 +10,6 @@ import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
)
const (
@@ -55,7 +56,8 @@ func SplitUniversalOrderID(universalOrderID string) (orderID string, vendorID in
} else if orderIDLen == len("3022716176275221584") {
vendorID = model.VendorIDELM
} else {
globals.SugarLogger.Errorf("unkown order type:%v", universalOrderID)
// globals.SugarLogger.Errorf("unkown order type:%v", universalOrderID)
panic(fmt.Sprintf("unkown order type:%v", universalOrderID))
vendorID = model.VendorIDUnknown
}
orderID = universalOrderID
@@ -87,3 +89,15 @@ func GetRealTimeout(beginTime time.Time, timeout time.Duration) time.Duration {
}
return retVal
}
func EarthDistance(lat1, lng1, lat2, lng2 float64) float64 {
radius := 6378.137
rad := math.Pi / 180.0
lat1 = lat1 * rad
lng1 = lng1 * rad
lat2 = lat2 * rad
lng2 = lng2 * rad
theta := lng2 - lng1
dist := math.Acos(math.Sin(lat1)*math.Sin(lat2) + math.Cos(lat1)*math.Cos(lat2)*math.Cos(theta))
return dist * radius
}