- RefreshStoresSkuByVendor

This commit is contained in:
gazebo
2019-05-17 17:09:33 +08:00
parent 40d02beee0
commit 0ed0d40a2d
13 changed files with 362 additions and 12 deletions

View File

@@ -181,6 +181,33 @@ func GetStoreCourierList(db *DaoDB, storeID, status int) (courierStoreList []*mo
return nil, err
}
func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs []int, status int) (storeMapList []*model.StoreMap, err error) {
sql := `
SELECT t1.*
FROM store_map t1
WHERE t1.deleted_at = ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
}
if len(vendorIDs) > 0 {
sql += " AND t1.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
sqlParams = append(sqlParams, vendorIDs)
}
if len(storeIDs) > 0 {
sql += " AND t1.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)
}
if status != model.StoreStatusAll {
sql += " AND t1.status = ?"
sqlParams = append(sqlParams, status)
}
if err = GetRows(db, &storeMapList, sql, sqlParams...); err == nil {
return storeMapList, nil
}
return nil, err
}
// 此函数在检测到一个门店的所有平台状态一样且不为StoreStatusOpened时
// 将平台门店状态全部改为StoreStatusOpened则把京西门店状态改为之前那个统一的平台门店状态
func FormalizeStoreStatus(db *DaoDB, storeID, storeStatus int) (err error) {