소스 검색

uv统计添加失败的推送

zhuchengjie 3 년 전
부모
커밋
426e11ec44
2개의 변경된 파일10개의 추가작업 그리고 8개의 파일을 삭제
  1. 9 7
      app/Console/Commands/Push/PushStats.php
  2. 1 1
      app/Modules/Push/Models/QappPushTask.php

+ 9 - 7
app/Console/Commands/Push/PushStats.php

@@ -43,13 +43,15 @@ class PushStats extends Command
             $cachePv = PushCache::getPushyPv($pushId, $date);
             $cacheUv = PushCache::getPushUv($pushId, $date);
 
-            myLog('pushStats')->info('', compact('date', 'pushId', 'pv', 'uv', 'cachePv', 'cacheUv'));
-
-            // 更新pv uv
-            QappPushTask::updatePushTask($pushId, [
-                'pv' => $pv + $cachePv,
-                'uv' => $uv + $cacheUv,
-            ]);
+            if(!empty($cachePv) || !empty($cacheUv)){
+                myLog('pushStats')->info('', compact('date', 'pushId', 'pv', 'uv', 'cachePv', 'cacheUv'));
+
+                // 更新pv uv
+                QappPushTask::updatePushTask($pushId, [
+                    'pv' => $pv + $cachePv,
+                    'uv' => $uv + $cacheUv,
+                ]);
+            }
         }
 
         return true;

+ 1 - 1
app/Modules/Push/Models/QappPushTask.php

@@ -76,7 +76,7 @@ class QappPushTask extends Model
      */
     public static function getAllValidTasks()
     {
-        $result = self::where('status', PushConst::STATUS_SUCCESS)
+        $result = self::whereIn('status', [PushConst::STATUS_SUCCESS,PushConst::STATUS_FAIL])
             ->where('select_user_status', PushConst::SELECT_USER_OK)
             ->where('push_time', '<=', date('Y-m-d H:i:s'))
             ->orderBy('push_time', 'ASC')