diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 15132de59..966ebb005 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -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 FROM jingdong_foodlist a LEFT JOIN jingdong_showd b ON a.wmpoiid = b.wmpoiid + LEFT JOIN place c ON c.name = b.bak_info WHERE 1 = 1 ` 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 FROM meituan_foodlist a LEFT JOIN meituan_showd b ON a.wmpoiid = b.wmpoiid + LEFT JOIN place c ON c.name = b.city_name WHERE 1 = 1 ` sql := ` @@ -4636,22 +4638,36 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string ` if vendorID == -1 { //sql += sqlEbai + ` UNION` + //jd sqlParams = append(sqlParams, lng, lat) + if cityCode > 0 { + sqlJD += " AND c.code = ?" + sqlParams = append(sqlParams, cityCode) + } if lng1 > 0 { sqlJD += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?" sqlParams = append(sqlParams, lng1, lat1, lng2, lat2) } + //mt sqlParams = append(sqlParams, lng, lat) + if cityCode > 0 { + sqlMT += " AND c.code = ?" + sqlParams = append(sqlParams, cityCode) + } if lng1 > 0 { sqlMT += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?" sqlParams = append(sqlParams, lng1, lat1, lng2, lat2) } - sql += sqlJD + ` UNION` + sql += sqlJD + ` UNION ALL` sql += sqlMT } else { switch vendorID { case model.VendorIDJD: sqlParams = append(sqlParams, lng, lat) + if cityCode > 0 { + sqlJD += " AND c.code = ?" + sqlParams = append(sqlParams, cityCode) + } if lng1 > 0 { sqlJD += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?" sqlParams = append(sqlParams, lng1, lat1, lng2, lat2) @@ -4659,6 +4675,10 @@ func QueryPageSkus(ctx *jxcontext.Context, vendorID int, vendorStoreIDs []string sql += sqlJD case model.VendorIDMTWM: sqlParams = append(sqlParams, lng, lat) + if cityCode > 0 { + sqlMT += " AND c.code = ?" + sqlParams = append(sqlParams, cityCode) + } if lng1 > 0 { sqlMT += " AND b.lng >= ? AND b.lat >= ? AND b.lng <= ? AND b.lat <= ?" 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) } sql += ` )t1 - LEFT JOIN place t2 ON t2.name = t1.city_name WHERE 1 = 1 ` 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)) + ")" sqlParams = append(sqlParams, vendorStoreIDs) } - if cityCode > 0 { - sql += " AND t2.code = ?" - sqlParams = append(sqlParams, cityCode) - } //if radius > 0 { // sql += " AND ROUND(t1.distance * 1000) < ?"