SyncStores
This commit is contained in:
@@ -211,7 +211,7 @@ func GetStoreCourierList(db *DaoDB, storeIDs []int, status, auditStatus int) (co
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int, pricePack string) (storeMapList []*model.StoreMap, err error) {
|
||||
func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int, pricePack string, mustDirty bool) (storeMapList []*model.StoreMap, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM store_map t1
|
||||
@@ -242,6 +242,10 @@ func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int,
|
||||
sql += " AND t1.price_percentage_pack = ?"
|
||||
sqlParams = append(sqlParams, pricePack)
|
||||
}
|
||||
if mustDirty {
|
||||
sql += " AND t1.sync_status <> 0"
|
||||
sqlParams = append(sqlParams, pricePack)
|
||||
}
|
||||
sql += " ORDER BY t1.store_id DESC, t1.vendor_id"
|
||||
if err = GetRows(db, &storeMapList, sql, sqlParams...); err == nil {
|
||||
return storeMapList, nil
|
||||
@@ -249,6 +253,10 @@ func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func GetStoresMapList(db *DaoDB, vendorIDs, storeIDs []int, status, isSync int, pricePack string) (storeMapList []*model.StoreMap, err error) {
|
||||
return GetStoresMapList2(db, vendorIDs, storeIDs, status, isSync, pricePack, false)
|
||||
}
|
||||
|
||||
// 此函数在检测到一个门店的所有平台状态一样,且不为StoreStatusOpened时,
|
||||
// 将平台门店状态全部改为StoreStatusOpened,则把京西门店状态改为之前那个统一的平台门店状态
|
||||
func FormalizeStoreStatus(db *DaoDB, storeID, storeStatus int) (err error) {
|
||||
@@ -581,8 +589,8 @@ func GetStorePriceScoreSnapshot(db *DaoDB, snapDate time.Time) (storePriceScoreS
|
||||
return storePriceScoreSnapshot, err
|
||||
}
|
||||
|
||||
func SetStoreMapSyncStatus(db *DaoDB, vendorID int, storeIDs []int, syncStatus int) (num int64, err error) {
|
||||
globals.SugarLogger.Debugf("SetStoreMapSyncStatus, storeIDs:%v, vendorID:%d", storeIDs, vendorID)
|
||||
func SetStoreMapSyncStatus(db *DaoDB, vendorIDs, storeIDs []int, syncStatus int) (num int64, err error) {
|
||||
globals.SugarLogger.Debugf("SetStoreMapSyncStatus, vendorIDs:%v, storeIDs:%v", vendorIDs, storeIDs)
|
||||
|
||||
sql := `
|
||||
UPDATE store_map t1
|
||||
@@ -591,8 +599,12 @@ func SetStoreMapSyncStatus(db *DaoDB, vendorID int, storeIDs []int, syncStatus i
|
||||
sqlParams := []interface{}{
|
||||
syncStatus,
|
||||
}
|
||||
sql += " WHERE t1.deleted_at = ? AND t1.sync_status & ? = 0 AND t1.vendor_id = ?"
|
||||
sqlParams = append(sqlParams, utils.DefaultTimeValue, model.SyncFlagDeletedMask, vendorID)
|
||||
sql += " WHERE t1.is_sync <> 0 AND t1.deleted_at = ? AND t1.sync_status & ? = 0"
|
||||
sqlParams = append(sqlParams, utils.DefaultTimeValue, model.SyncFlagDeletedMask)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user