aa
This commit is contained in:
@@ -1283,7 +1283,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o
|
||||
order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng)
|
||||
order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat)
|
||||
}
|
||||
storeList, err := common.GetStoreListByLocation(ctx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false, true)
|
||||
storeList, err := common.GetStoreListByLocation(ctx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false, true, 0)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error())
|
||||
continue
|
||||
|
||||
@@ -1144,3 +1144,15 @@ func RefreshUserMemberStatus(ctx *jxcontext.Context) (err error) {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdateUserLastInfo(ctx *jxcontext.Context, storeID, brandID int) (err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
if user, err := dao.GetUserByID(db, "user_id", ctx.GetUserID()); err == nil {
|
||||
user.LastStoreID = storeID
|
||||
user.LastBrandID = brandID
|
||||
_, err = dao.UpdateEntity(db, user, "LastStoreID", "LastBrandID")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ func GetNearSupplyGoodsStoreByStoreID(ctx *jxcontext.Context, storeID int) (stor
|
||||
return store, err
|
||||
}
|
||||
|
||||
func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, maxRadius int, needWalkDistance, isJds bool) (storeList []*Store4User, err error) {
|
||||
func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, maxRadius int, needWalkDistance, isJds bool, brandID int) (storeList []*Store4User, err error) {
|
||||
const (
|
||||
maxStoreCount4User = 5
|
||||
)
|
||||
@@ -134,14 +134,20 @@ func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, maxRadius
|
||||
WHERE t1.deleted_at = ? AND t1.status <> ? AND t1.lng > ? AND t1.lng < ? AND t1.lat > ? AND t1.lat < ?
|
||||
AND sm.is_order <> ?
|
||||
AND t1.id <> ?
|
||||
`
|
||||
if brandID != 0 {
|
||||
sql += " AND t1.brand_id = ?"
|
||||
sqlParams = append(sqlParams, brandID)
|
||||
}
|
||||
sql += `
|
||||
ORDER BY t1.id
|
||||
`
|
||||
sqlParams = []interface{}{
|
||||
sqlParams = append(sqlParams,
|
||||
model.VendorIDJX, utils.DefaultTimeValue, model.StoreStatusDisabled,
|
||||
utils.DefaultTimeValue, model.StoreStatusDisabled, jxutils.StandardCoordinate2Int(lng1), jxutils.StandardCoordinate2Int(lng2), jxutils.StandardCoordinate2Int(lat1), jxutils.StandardCoordinate2Int(lat2),
|
||||
model.YES,
|
||||
model.MatterStoreID,
|
||||
}
|
||||
)
|
||||
} else {
|
||||
sql = `
|
||||
SELECT t1.*,
|
||||
|
||||
@@ -184,7 +184,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
|
||||
sku.Weight = jxutils.FormatSkuWeight(specQuality, specUnit)
|
||||
order.Skus = append(order.Skus, sku)
|
||||
}
|
||||
storeList, err := common.GetStoreListByLocation(jxcontext.AdminCtx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 3000, false, true)
|
||||
storeList, err := common.GetStoreListByLocation(jxcontext.AdminCtx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 3000, false, true, 0)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error())
|
||||
return order, err
|
||||
|
||||
Reference in New Issue
Block a user