This commit is contained in:
suyl
2021-05-20 11:32:59 +08:00
parent 32906db9e1
commit 48a2fb0a8f
2 changed files with 9 additions and 3 deletions

View File

@@ -4537,7 +4537,7 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
sqlParams := []interface{}{}
sqlJD := `
SELECT 0 vendor_id, b.orgcode org_code, a.wmpoiid store_id, b.name store_name, a.Base sku_id, a.name sku_name, a.month_saled month_sales,
a.basic_price, b.address, '' parameter, b.bak_info city_name, b.lng, b.lat
a.basic_price, b.address, '' parameter, b.bak_info city_name, b.lng, b.lat, getDistance(?, ?, b.lng, b.lat) distance
FROM jingdong_foodlist a
LEFT JOIN jingdong_showd b ON a.wmpoiid = b.wmpoiid
WHERE 1 = 1
@@ -4547,7 +4547,7 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
`
sqlMT := `
SELECT 1 vendor_id, '' org_code, a.wmpoiid store_id, b.name store_name, '' sku_id, a.name sku_name, a.month_saled month_sales,
a.min_price basic_price, b.address, a.unit parameter, b.city_name, b.lng, b.lat
a.min_price basic_price, b.address, a.unit parameter, b.city_name, b.lng, b.lat, getDistance(?, ?, b.lng, b.lat) distance
FROM meituan_foodlist a
LEFT JOIN meituan_showd b ON a.wmpoiid = b.wmpoiid
WHERE 1 = 1
@@ -4617,6 +4617,12 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
} else {
sql += " ORDER BY t1.month_sales"
}
case 2:
if sortType < 0 {
sql += " ORDER BY t1.distance DESC"
} else {
sql += " ORDER BY t1.distance"
}
}
}
sql += `