diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index 13913f3c6..804046047 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -4,6 +4,7 @@ import ( "fmt" "regexp" "strconv" + "strings" "time" "git.rosy.net.cn/baseapi/utils" @@ -1846,12 +1847,10 @@ func GetAddressRiderInfo(db *DaoDB, address string, randNumber int64) (*CourierI param := []interface{}{time.Now().AddDate(-1, 0, 0), model.OrderStatusFinished, model.OrderDeliveryTypePlatform, "%" + fmt.Sprintf("%s", address) + "%", randNumber, 1} courier := &CourierInfo{} - if err := GetRow(db, courier, sql, param); err != nil { - return nil, err - } + err := GetRow(db, courier, sql, param) - if courier.CourierName == "" || courier.CourierMobile == "" || len(courier.CourierMobile) != 11 { - info, err := GetAddressRiderInfo(db, address, randNumber+1) + if (err != nil && strings.Contains(err.Error(), "no row found")) || courier.CourierName == "" || courier.CourierMobile == "" || len(courier.CourierMobile) != 11 { + info, err := GetAddressRiderInfo(db, address, randNumber-1) if err != nil { return nil, err }