1
This commit is contained in:
@@ -252,8 +252,8 @@ func GetComplaintReasons() (complaintReasonList []*dadaapi.ComplaintReason) {
|
|||||||
return complaintReasonList
|
return complaintReasonList
|
||||||
}
|
}
|
||||||
|
|
||||||
func ComplaintRider(ctx *jxcontext.Context, vendorOrderID string, vendorWaybillId string, complaintID int) (err error) {
|
func ComplaintRider(ctx *jxcontext.Context, vendorOrderID string, waybillVendorID string, complaintID int) (err error) {
|
||||||
wayBillList, err := dao.GetComplaintList(dao.GetDB(), vendorOrderID, vendorWaybillId)
|
wayBillList, err := dao.GetComplaintList(dao.GetDB(), vendorOrderID, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -262,7 +262,11 @@ func ComplaintRider(ctx *jxcontext.Context, vendorOrderID string, vendorWaybillI
|
|||||||
}
|
}
|
||||||
p := partner.GetDeliveryPlatformFromVendorID(wayBillList[0].WaybillVendorID).Handler
|
p := partner.GetDeliveryPlatformFromVendorID(wayBillList[0].WaybillVendorID).Handler
|
||||||
if err == nil && len(wayBillList) > 0 {
|
if err == nil && len(wayBillList) > 0 {
|
||||||
err = p.ComplaintRider(wayBillList[0], complaintID, complaintReasonsMap[complaintID])
|
for _, v := range wayBillList {
|
||||||
|
if utils.Int2Str(v.WaybillVendorID) == waybillVendorID {
|
||||||
|
err = p.ComplaintRider(wayBillList[0], complaintID, complaintReasonsMap[complaintID])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cms
|
package cms
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/baidunavi"
|
"git.rosy.net.cn/baseapi/platformapi/baidunavi"
|
||||||
@@ -613,9 +614,9 @@ func GetSToURidingDistance(sLng, sLat, uLng, uLat float64, orderId string) (step
|
|||||||
// GetSToURidingDistance2 获取商家与用户间步行距离
|
// GetSToURidingDistance2 获取商家与用户间步行距离
|
||||||
func GetSToURidingDistance2(sLng, sLat, uLng, uLat float64, orderId string) (wayBill *model.Waybill, err error) {
|
func GetSToURidingDistance2(sLng, sLat, uLng, uLat float64, orderId string) (wayBill *model.Waybill, err error) {
|
||||||
var (
|
var (
|
||||||
origin = fmt.Sprintf("%f,%f", sLng, sLat)
|
//origin = fmt.Sprintf("%f,%f", sLng, sLat)
|
||||||
destination = fmt.Sprintf("%f,%f", uLng, uLat)
|
//destination = fmt.Sprintf("%f,%f", uLng, uLat)
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
)
|
)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@@ -631,7 +632,8 @@ func GetSToURidingDistance2(sLng, sLat, uLng, uLat float64, orderId string) (way
|
|||||||
//if v.Status >= model.WaybillStatusAccepted && v.Status <= model.WaybillStatusCanceled {
|
//if v.Status >= model.WaybillStatusAccepted && v.Status <= model.WaybillStatusCanceled {
|
||||||
// 获取骑行路线图
|
// 获取骑行路线图
|
||||||
if v.OriginalData == "" {
|
if v.OriginalData == "" {
|
||||||
originalData, distance, durationTime, err := GetCyclingLine(origin, destination)
|
//originalData, distance, durationTime, err := GetCyclingLine(origin, destination)
|
||||||
|
originalData, distance, durationTime, err := GetCyclingLine(sLng, sLat, uLng, uLat)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -708,24 +710,56 @@ func GetSToURidingDistance2(sLng, sLat, uLng, uLat float64, orderId string) (way
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetCyclingLine 获取骑行路线
|
// GetCyclingLine 获取骑行路线
|
||||||
func GetCyclingLine(origin, destination string) (polyLineList []string, distance, duration int64, errCode error) {
|
func GetCyclingLine(sLng, sLat, uLng, uLat float64) (polyLineList []string, distance, duration int64, err error) {
|
||||||
for {
|
// 百度
|
||||||
polyLineList, distance, duration, errCode = api.AutonaviAPI.GetCyclingPlan(origin, destination)
|
var coords []*baidunavi.Coordinate
|
||||||
if errCode != nil {
|
coords = append(coords, &baidunavi.Coordinate{
|
||||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "高德地图骑行方案获取错误:", utils.Format4Output(errCode, false))
|
Lng: sLng,
|
||||||
}
|
Lat: sLat,
|
||||||
if errCode != nil && errCode.Error() == autonavi.DAILYQUERYOVERLIMIT {
|
}, &baidunavi.Coordinate{
|
||||||
AutonaviKeyIndex += model.YES
|
Lat: uLat,
|
||||||
if AutonaviKeyIndex >= len(AutonaviKeyList) {
|
Lng: uLng,
|
||||||
AutonaviKeyIndex = model.NO
|
})
|
||||||
}
|
|
||||||
api.AutonaviAPI.SetKey(AutonaviKeyList[AutonaviKeyIndex])
|
|
||||||
} else if errCode != nil {
|
|
||||||
return nil, 0, 0, errCode
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(polyLineList) > model.NO {
|
coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGCJ02, baidunavi.CoordSysBaiDu)
|
||||||
return polyLineList, distance, duration, errCode
|
if err != nil || len(coords) <= model.NO {
|
||||||
}
|
return nil, 0, 0, err
|
||||||
}
|
}
|
||||||
|
data, err := api.BaiDuNaviAPI.DirectionLiteRide(coords)
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, 0, err
|
||||||
|
}
|
||||||
|
path := &baidunavi.RiderPath{}
|
||||||
|
if err := json.Unmarshal([]byte(data.(string)), path); err != nil {
|
||||||
|
return nil, 0, 0, err
|
||||||
|
}
|
||||||
|
distance = int64(path.Result.Routes[0].Distance) // 距离
|
||||||
|
duration = int64(path.Result.Routes[0].Duration) // 时间
|
||||||
|
|
||||||
|
for _, v := range path.Result.Routes[0].Steps {
|
||||||
|
polyLineList = append(polyLineList, strings.Split(v.Path, ";")...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 高德()免费次数太少暂时不用
|
||||||
|
//for {
|
||||||
|
// polyLineList, distance, duration, errCode = api.AutonaviAPI.GetCyclingPlan(origin, destination)
|
||||||
|
// if errCode != nil {
|
||||||
|
// ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "获取骑行路线:", utils.Format4Output(errCode, false))
|
||||||
|
// }
|
||||||
|
// if errCode != nil && (errCode.Error() == autonavi.DAILYQUERYOVERLIMIT || errCode.Error() == autonavi.USERDAILYQUERYOVERLIMIT) {
|
||||||
|
// AutonaviKeyIndex += model.YES
|
||||||
|
// if AutonaviKeyIndex >= len(AutonaviKeyList) {
|
||||||
|
// AutonaviKeyIndex = model.NO
|
||||||
|
// }
|
||||||
|
// api.AutonaviAPI.SetKey(AutonaviKeyList[AutonaviKeyIndex])
|
||||||
|
// } else if errCode != nil {
|
||||||
|
// return nil, 0, 0, errCode
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if len(polyLineList) > model.NO {
|
||||||
|
// return polyLineList, distance, duration, errCode
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user