1
This commit is contained in:
@@ -283,7 +283,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct bool, keyword string, categoryID, status, offset, pageSize int, stock, locationCode bool) (skuNamesInfo *dao.StoreSkuNamesInfo2, err error) {
|
||||
func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct bool, keyword string, categoryID, status, offset, pageSize int, stock int, locationCode bool, locationCode2 string) (skuNamesInfo *dao.StoreSkuNamesInfo2, err error) {
|
||||
var (
|
||||
sqlParams []interface{}
|
||||
db = dao.GetDB()
|
||||
@@ -375,10 +375,15 @@ func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct b
|
||||
sql += " AND c.sku_id IS NULL AND (a.status = ? AND b.status = ?)"
|
||||
sqlParams = append(sqlParams, model.SkuStatusNormal, model.SkuStatusNormal)
|
||||
}
|
||||
if stock {
|
||||
if stock == 3 {
|
||||
sql += " AND c.stock = 0"
|
||||
} else if stock == 2 {
|
||||
sql += " AND c.stock <> 0"
|
||||
}
|
||||
if locationCode {
|
||||
if locationCode2 != "" {
|
||||
sql += " AND c.location_code = ?"
|
||||
sqlParams = append(sqlParams, locationCode2)
|
||||
} else if locationCode {
|
||||
sql += " AND c.location_code = ''"
|
||||
}
|
||||
|
||||
@@ -396,6 +401,9 @@ func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct b
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer dao.Commit(db, txDB)
|
||||
|
||||
globals.SugarLogger.Debugf("----sql := %s", sql)
|
||||
globals.SugarLogger.Debugf("----sqlParams := %s", utils.Format4Output(sqlParams, false))
|
||||
|
||||
if err = dao.GetRowsTx(txDB, &SkuNames, sql, sqlParams...); err == nil {
|
||||
skuNamesInfo = &dao.StoreSkuNamesInfo2{
|
||||
TotalCount: dao.GetLastTotalRowCount2(db, txDB),
|
||||
@@ -749,6 +757,14 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []strin
|
||||
sqlParams = append(sqlParams, params["minimumPrice"])
|
||||
}
|
||||
}
|
||||
if _, ok := params["minStock"]; ok {
|
||||
sql += " AND t4.stock >= ? "
|
||||
sqlParams = append(sqlParams, params["minStock"])
|
||||
}
|
||||
if _, ok := params["maxStock"]; ok {
|
||||
sql += " AND t4.stock <= ? "
|
||||
sqlParams = append(sqlParams, params["minStock"])
|
||||
}
|
||||
return sql, sqlParams, err
|
||||
}
|
||||
|
||||
|
||||
@@ -347,7 +347,8 @@ func IntCoordinate2MarsStandard(gpsLng, gpsLat int, coordinateType int) (marsLng
|
||||
Type: coordSys,
|
||||
})
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
globals.SugarLogger.Debugf("--TencentCoordinateChange err := %v", err)
|
||||
return marsLng, marsLat, nil
|
||||
}
|
||||
|
||||
return utils.Str2Float64(result[0].Lng), utils.Str2Float64(result[0].Lat), nil
|
||||
|
||||
Reference in New Issue
Block a user