禁用与不同步的门店创建活动时排除
This commit is contained in:
@@ -203,7 +203,9 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte
|
||||
sqlVendorStoreCond += " AND ( 1 = 0"
|
||||
}
|
||||
}
|
||||
sqlFrom += "\nLEFT JOIN " + tableName + " " + tableAlias + " ON " + tableAlias + ".vendor_id = ? AND " + tableAlias + ".store_id = t1.id AND " + tableAlias + ".deleted_at = ?"
|
||||
sqlFrom += "\nLEFT JOIN " + tableName + " " + tableAlias + " ON " + tableAlias + ".vendor_id = ? AND " +
|
||||
tableAlias + ".store_id = t1.id AND " + tableAlias + ".deleted_at = ? AND " +
|
||||
tableAlias + ".is_sync <> 0 "
|
||||
sqlFromParams = append(sqlFromParams, vendor, utils.DefaultTimeValue)
|
||||
if cond == 1 {
|
||||
sqlVendorStoreCond += " " + mapCond + " " + tableAlias + ".id IS NOT NULL"
|
||||
@@ -2102,21 +2104,8 @@ func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDi
|
||||
if err = dao.GetRows(dao.GetDB(), &storeList1, sql, sqlParams...); err == nil {
|
||||
var storeList2 []*Store4User
|
||||
for _, v := range storeList1 {
|
||||
isStoreOK := false
|
||||
v.FloatLng = jxutils.IntCoordinate2Standard(v.Lng)
|
||||
v.FloatLat = jxutils.IntCoordinate2Standard(v.Lat)
|
||||
if v.DeliveryRangeType == model.DeliveryRangeTypeRadius {
|
||||
maxDistance := int(utils.Str2Int64WithDefault(v.DeliveryRange, 0))
|
||||
v.Distance = int(jxutils.EarthDistance(lng, lat, v.FloatLng, v.FloatLat) * 1000)
|
||||
isStoreOK = v.Distance <= maxDistance
|
||||
} else {
|
||||
points := jxutils.CoordinateStr2Points(v.DeliveryRange)
|
||||
if utils.IsPointInPolygon(lng, lat, points) {
|
||||
v.Distance = int(jxutils.EarthDistance(lng, lat, v.FloatLng, v.FloatLat) * 1000)
|
||||
isStoreOK = true
|
||||
}
|
||||
}
|
||||
if isStoreOK {
|
||||
if distance := jxutils.Point2StoreDistance(lng, lat, v.Lng, v.Lat, v.DeliveryRangeType, v.DeliveryRange); distance > 0 {
|
||||
v.Distance = distance
|
||||
storeList2 = append(storeList2, v)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user