修复GetStoreSkuPriceAndWeight中的bug

This commit is contained in:
gazebo
2020-01-16 15:15:46 +08:00
parent 5cc44aeb95
commit 8f1cc2316c
3 changed files with 11 additions and 2 deletions

View File

@@ -681,7 +681,7 @@ func GetStoreSkuPriceAndWeight(db *DaoDB, vendorStoreID string, vendorID int, ve
SELECT %s vendor_sku_id, t1.id sku_id, t2.price, t1.weight
FROM sku t1
JOIN store_sku_bind t2 ON t2.sku_id = t1.id AND t2.deleted_at = ?
JOIN store_map t3 ON t3.store_id = t2.store_id AND t3.vendor_id = ? AND t3.vendor_store_id = ? AND t2.deleted_at = ?
JOIN store_map t3 ON t3.store_id = t2.store_id AND t3.vendor_id = ? AND t3.vendor_store_id = ? AND t3.deleted_at = ?
%s
WHERE %s IN (`+GenQuestionMarks(len(vendorSkuIDs))+`)`, vendorSkuIDField, sqlThingMap, vendorSkuIDField)
sqlParams := []interface{}{
@@ -694,6 +694,7 @@ func GetStoreSkuPriceAndWeight(db *DaoDB, vendorStoreID string, vendorID int, ve
} else {
sqlParams = append(sqlParams, vendorSkuIDs)
}
globals.SugarLogger.Debugf(sql)
err = GetRows(db, &l, sql, sqlParams...)
return l, err
}

View File

@@ -28,3 +28,11 @@ func TestGetDeletedStoreSkuBind(t *testing.T) {
storeSkuBind := GetDeletedStoreSkuBind(GetDB(), 100123, 30648)
globals.SugarLogger.Debug(utils.Format4Output(storeSkuBind, false))
}
func TestGetStoreSkuPriceAndWeight(t *testing.T) {
storeSkuBind, err := GetStoreSkuPriceAndWeight(GetDB(), "11863739", model.VendorIDJD, []string{"2023508979"})
if err != nil {
t.Fatal(err)
}
globals.SugarLogger.Debug(utils.Format4Output(storeSkuBind, false))
}

View File

@@ -32,7 +32,7 @@ func TestFormalizeStoreStatus(t *testing.T) {
}
func TestGetStoreList4Role(t *testing.T) {
storeList, err := GetStoreList(GetDB(), nil, nil, "NiuBi")
storeList, err := GetStoreList(GetDB(), nil, nil, nil, nil, "NiuBi")
t.Log(utils.Format4Output(storeList, false))
if err != nil {
t.Fatal(err)