diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt index e557599dcc..a5185554ef 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt @@ -34,6 +34,10 @@ private const val MORNING_PEAK_STOP_MINUTE = 9 * 60 + 30 private const val NIGHT_PEAK_START_MINUTE = 17 * 60 + 30 private const val NIGHT_PEAK_STOP_MINUTE = 19 * 60 + 30 +private const val NORMAL_UPLOAD_COUNT = 1 // 5 +private const val MORNING_PEAK_UPLOAD_COUNT = 1 // 2 +private const val NIGHT_PEAK_UPLOAD_COUNT = 1 // 3 + private const val DISTANCE_MORNING_PEAK_COUNT = "DISTANCE_MORNING_PEAK_COUNT" private const val DISTANCE_NIGHT_PEAK_COUNT = "DISTANCE_NIGHT_PEAK_COUNT" private const val DISTANCE_NORMAL_COUNT = "DISTANCE_NORMAL_COUNT" @@ -167,7 +171,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService if (isMorningPeak()) { val distanceMorningCount = SharedPrefsMgr.getInstance(context).getInt(DISTANCE_MORNING_PEAK_COUNT, 0) val speedMorningCount = SharedPrefsMgr.getInstance(context).getInt(SPEED_MORNING_PEAK_COUNT, 0) - if (blockFromDistance && distanceMorningCount < 2) { + if (blockFromDistance && distanceMorningCount < MORNING_PEAK_UPLOAD_COUNT) { Logger.d(TAG, "按距离策略上报早高峰") SharedPrefsMgr.getInstance(context).putInt(DISTANCE_MORNING_PEAK_COUNT, distanceMorningCount + 1) p.location = latLonFromDistance @@ -175,7 +179,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService apis.tanluApi.uploadRoadCondition(p) return } - if (blockFromSpeed && speedMorningCount < 2) { + if (blockFromSpeed && speedMorningCount < MORNING_PEAK_UPLOAD_COUNT) { Logger.d(TAG, "按速度策略上报早高峰") SharedPrefsMgr.getInstance(context).putInt(SPEED_MORNING_PEAK_COUNT, speedMorningCount + 1) p.location = latLonFromSpeed @@ -185,7 +189,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService } else if (isNightPeak()) { val distanceNightCount = SharedPrefsMgr.getInstance(context).getInt(DISTANCE_NIGHT_PEAK_COUNT, 0) val speedNightCount = SharedPrefsMgr.getInstance(context).getInt(SPEED_NIGHT_PEAK_COUNT, 0) - if (blockFromDistance && distanceNightCount < 3) { + if (blockFromDistance && distanceNightCount < NIGHT_PEAK_UPLOAD_COUNT) { Logger.d(TAG, "按距离策略上报晚高峰") SharedPrefsMgr.getInstance(context).putInt(DISTANCE_NIGHT_PEAK_COUNT, distanceNightCount + 1) p.location = latLonFromDistance @@ -193,7 +197,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService apis.tanluApi.uploadRoadCondition(p) return } - if (blockFromSpeed && speedNightCount < 3) { + if (blockFromSpeed && speedNightCount < NIGHT_PEAK_UPLOAD_COUNT) { Logger.d(TAG, "按速度策略上报晚高峰") SharedPrefsMgr.getInstance(context).putInt(SPEED_NIGHT_PEAK_COUNT, speedNightCount + 1) p.location = latLonFromSpeed @@ -203,7 +207,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService } else { val distanceNormalCount = SharedPrefsMgr.getInstance(context).getInt(DISTANCE_NORMAL_COUNT, 0) val speedNormalCount = SharedPrefsMgr.getInstance(context).getInt(SPEED_NORMAL_COUNT, 0) - if (blockFromDistance && distanceNormalCount < 5) { + if (blockFromDistance && distanceNormalCount < NORMAL_UPLOAD_COUNT) { Logger.d(TAG, "按距离策略上报一般时段") SharedPrefsMgr.getInstance(context).putInt(DISTANCE_NORMAL_COUNT, distanceNormalCount + 1) p.location = latLonFromDistance @@ -211,7 +215,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService apis.tanluApi.uploadRoadCondition(p) return } - if (blockFromSpeed && speedNormalCount < 5) { + if (blockFromSpeed && speedNormalCount < NORMAL_UPLOAD_COUNT) { Logger.d(TAG, "按速度策略上报一般时段") SharedPrefsMgr.getInstance(context).putInt(SPEED_NORMAL_COUNT, speedNormalCount + 1) p.location = latLonFromSpeed