aa
This commit is contained in:
@@ -4617,6 +4617,7 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
|
|||||||
a.basic_price, b.address, '' parameter, b.bak_info city_name, b.lng, b.lat, getDistance(?, ?, b.lng, b.lat) distance
|
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
|
FROM jingdong_foodlist a
|
||||||
LEFT JOIN jingdong_showd b ON a.wmpoiid = b.wmpoiid
|
LEFT JOIN jingdong_showd b ON a.wmpoiid = b.wmpoiid
|
||||||
|
LEFT JOIN place c ON c.name = b.bak_info
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
`
|
`
|
||||||
sqlEbai := `
|
sqlEbai := `
|
||||||
@@ -4627,6 +4628,7 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
|
|||||||
a.min_price basic_price, b.address, a.unit parameter, b.city_name, b.lng, b.lat, getDistance(?, ?, b.lng, b.lat) distance
|
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
|
FROM meituan_foodlist a
|
||||||
LEFT JOIN meituan_showd b ON a.wmpoiid = b.wmpoiid
|
LEFT JOIN meituan_showd b ON a.wmpoiid = b.wmpoiid
|
||||||
|
LEFT JOIN place c ON c.name = b.city_name
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
`
|
`
|
||||||
sql := `
|
sql := `
|
||||||
@@ -4636,22 +4638,36 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
|
|||||||
`
|
`
|
||||||
if vendorID == -1 {
|
if vendorID == -1 {
|
||||||
//sql += sqlEbai + ` UNION`
|
//sql += sqlEbai + ` UNION`
|
||||||
|
//jd
|
||||||
sqlParams = append(sqlParams, lng, lat)
|
sqlParams = append(sqlParams, lng, lat)
|
||||||
|
if cityCode > 0 {
|
||||||
|
sqlJD += " AND c.code = ?"
|
||||||
|
sqlParams = append(sqlParams, cityCode)
|
||||||
|
}
|
||||||
if lng1 > 0 {
|
if lng1 > 0 {
|
||||||
sqlJD += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?"
|
sqlJD += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?"
|
||||||
sqlParams = append(sqlParams, lng1, lat1, lng2, lat2)
|
sqlParams = append(sqlParams, lng1, lat1, lng2, lat2)
|
||||||
}
|
}
|
||||||
|
//mt
|
||||||
sqlParams = append(sqlParams, lng, lat)
|
sqlParams = append(sqlParams, lng, lat)
|
||||||
|
if cityCode > 0 {
|
||||||
|
sqlMT += " AND c.code = ?"
|
||||||
|
sqlParams = append(sqlParams, cityCode)
|
||||||
|
}
|
||||||
if lng1 > 0 {
|
if lng1 > 0 {
|
||||||
sqlMT += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?"
|
sqlMT += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?"
|
||||||
sqlParams = append(sqlParams, lng1, lat1, lng2, lat2)
|
sqlParams = append(sqlParams, lng1, lat1, lng2, lat2)
|
||||||
}
|
}
|
||||||
sql += sqlJD + ` UNION`
|
sql += sqlJD + ` UNION ALL`
|
||||||
sql += sqlMT
|
sql += sqlMT
|
||||||
} else {
|
} else {
|
||||||
switch vendorID {
|
switch vendorID {
|
||||||
case model.VendorIDJD:
|
case model.VendorIDJD:
|
||||||
sqlParams = append(sqlParams, lng, lat)
|
sqlParams = append(sqlParams, lng, lat)
|
||||||
|
if cityCode > 0 {
|
||||||
|
sqlJD += " AND c.code = ?"
|
||||||
|
sqlParams = append(sqlParams, cityCode)
|
||||||
|
}
|
||||||
if lng1 > 0 {
|
if lng1 > 0 {
|
||||||
sqlJD += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?"
|
sqlJD += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?"
|
||||||
sqlParams = append(sqlParams, lng1, lat1, lng2, lat2)
|
sqlParams = append(sqlParams, lng1, lat1, lng2, lat2)
|
||||||
@@ -4659,6 +4675,10 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
|
|||||||
sql += sqlJD
|
sql += sqlJD
|
||||||
case model.VendorIDMTWM:
|
case model.VendorIDMTWM:
|
||||||
sqlParams = append(sqlParams, lng, lat)
|
sqlParams = append(sqlParams, lng, lat)
|
||||||
|
if cityCode > 0 {
|
||||||
|
sqlMT += " AND c.code = ?"
|
||||||
|
sqlParams = append(sqlParams, cityCode)
|
||||||
|
}
|
||||||
if lng1 > 0 {
|
if lng1 > 0 {
|
||||||
sqlMT += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?"
|
sqlMT += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?"
|
||||||
sqlParams = append(sqlParams, lng1, lat1, lng2, lat2)
|
sqlParams = append(sqlParams, lng1, lat1, lng2, lat2)
|
||||||
@@ -4675,7 +4695,6 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
|
|||||||
sqlParams = append(sqlParams, pageSize, offset)
|
sqlParams = append(sqlParams, pageSize, offset)
|
||||||
}
|
}
|
||||||
sql += ` )t1
|
sql += ` )t1
|
||||||
LEFT JOIN place t2 ON t2.name = t1.city_name
|
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
`
|
`
|
||||||
if keyword != "" {
|
if keyword != "" {
|
||||||
@@ -4687,10 +4706,6 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string
|
|||||||
sql += " AND t1.store_id IN (" + dao.GenQuestionMarks(len(vendorStoreIDs)) + ")"
|
sql += " AND t1.store_id IN (" + dao.GenQuestionMarks(len(vendorStoreIDs)) + ")"
|
||||||
sqlParams = append(sqlParams, vendorStoreIDs)
|
sqlParams = append(sqlParams, vendorStoreIDs)
|
||||||
}
|
}
|
||||||
if cityCode > 0 {
|
|
||||||
sql += " AND t2.code = ?"
|
|
||||||
sqlParams = append(sqlParams, cityCode)
|
|
||||||
}
|
|
||||||
|
|
||||||
//if radius > 0 {
|
//if radius > 0 {
|
||||||
// sql += " AND ROUND(t1.distance * 1000) < ?"
|
// sql += " AND ROUND(t1.distance * 1000) < ?"
|
||||||
|
|||||||
Reference in New Issue
Block a user