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 (
|
var (
|
||||||
sqlParams []interface{}
|
sqlParams []interface{}
|
||||||
db = dao.GetDB()
|
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 = ?)"
|
sql += " AND c.sku_id IS NULL AND (a.status = ? AND b.status = ?)"
|
||||||
sqlParams = append(sqlParams, model.SkuStatusNormal, model.SkuStatusNormal)
|
sqlParams = append(sqlParams, model.SkuStatusNormal, model.SkuStatusNormal)
|
||||||
}
|
}
|
||||||
if stock {
|
if stock == 3 {
|
||||||
sql += " AND c.stock = 0"
|
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 = ''"
|
sql += " AND c.location_code = ''"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,6 +401,9 @@ func GetStoresSkusForStore(ctx *jxcontext.Context, storeID int, isFocus, isAct b
|
|||||||
txDB, _ := dao.Begin(db)
|
txDB, _ := dao.Begin(db)
|
||||||
defer dao.Commit(db, txDB)
|
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 {
|
if err = dao.GetRowsTx(txDB, &SkuNames, sql, sqlParams...); err == nil {
|
||||||
skuNamesInfo = &dao.StoreSkuNamesInfo2{
|
skuNamesInfo = &dao.StoreSkuNamesInfo2{
|
||||||
TotalCount: dao.GetLastTotalRowCount2(db, txDB),
|
TotalCount: dao.GetLastTotalRowCount2(db, txDB),
|
||||||
@@ -749,6 +757,14 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, upcs []strin
|
|||||||
sqlParams = append(sqlParams, params["minimumPrice"])
|
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
|
return sql, sqlParams, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -347,7 +347,8 @@ func IntCoordinate2MarsStandard(gpsLng, gpsLat int, coordinateType int) (marsLng
|
|||||||
Type: coordSys,
|
Type: coordSys,
|
||||||
})
|
})
|
||||||
if err != nil {
|
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
|
return utils.Str2Float64(result[0].Lng), utils.Str2Float64(result[0].Lat), nil
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ func (c *StoreSkuController) GetStoreSkus() {
|
|||||||
// @Param priceType query int false "是否查过高价格商品,0是忽略,1是高价,-1是低价"
|
// @Param priceType query int false "是否查过高价格商品,0是忽略,1是高价,-1是低价"
|
||||||
// @Param highestPrice query string false "查询最高价"
|
// @Param highestPrice query string false "查询最高价"
|
||||||
// @Param minimumPrice query string false "查询最低价"
|
// @Param minimumPrice query string false "查询最低价"
|
||||||
|
// @Param minStock query int false "最小库存"
|
||||||
|
// @Param maxStock query int false "最大库存"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /GetStoresSkus [get,post]
|
// @router /GetStoresSkus [get,post]
|
||||||
@@ -1012,8 +1014,9 @@ func (c *StoreSkuController) GetVendorStoreSkus() {
|
|||||||
// @Param token header string false "认证token"
|
// @Param token header string false "认证token"
|
||||||
// @Param storeID query int true "门店ID"
|
// @Param storeID query int true "门店ID"
|
||||||
// @Param isFocus query bool true "是否已关注(认领)"
|
// @Param isFocus query bool true "是否已关注(认领)"
|
||||||
// @Param stock query bool false "库存是否为0"
|
// @Param stock query int false "库存是否为0[1-全查/2-有库存/3-没库存]"
|
||||||
// @Param locationCode query bool false "商品位置是否为空"
|
// @Param locationCode query bool false "商品位置是否为空"
|
||||||
|
// @Param locationCode2 query string false "商品位置编码"
|
||||||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||||||
// @Param categoryID query int false "商品所属类别ID"
|
// @Param categoryID query int false "商品所属类别ID"
|
||||||
// @Param status query int false "查询起始状态(0:不可售,1:可售,-1 全部)"
|
// @Param status query int false "查询起始状态(0:不可售,1:可售,-1 全部)"
|
||||||
@@ -1025,7 +1028,7 @@ func (c *StoreSkuController) GetVendorStoreSkus() {
|
|||||||
// @router /GetStoresSkusForStore [get]
|
// @router /GetStoresSkusForStore [get]
|
||||||
func (c *StoreSkuController) GetStoresSkusForStore() {
|
func (c *StoreSkuController) GetStoresSkusForStore() {
|
||||||
c.callGetStoresSkusForStore(func(params *tStoreSkuGetStoresSkusForStoreParams) (retVal interface{}, errCode string, err error) {
|
c.callGetStoresSkusForStore(func(params *tStoreSkuGetStoresSkusForStoreParams) (retVal interface{}, errCode string, err error) {
|
||||||
retVal, err = cms.GetStoresSkusForStore(params.Ctx, params.StoreID, params.IsFocus, params.IsAct, params.Keyword, params.CategoryID, params.Status, params.Offset, params.PageSize, params.Stock, params.LocationCode)
|
retVal, err = cms.GetStoresSkusForStore(params.Ctx, params.StoreID, params.IsFocus, params.IsAct, params.Keyword, params.CategoryID, params.Status, params.Offset, params.PageSize, params.Stock, params.LocationCode, params.LocationCode2)
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user