Browse Source

'添加log'

zhuchengjie 2 years ago
parent
commit
c841f1d5db
1 changed files with 10 additions and 7 deletions
  1. 10 7
      app/Console/Commands/FixPushUserChannel.php

+ 10 - 7
app/Console/Commands/FixPushUserChannel.php

@@ -2,15 +2,10 @@
 
 namespace App\Console\Commands;
 
-use App\Modules\Book\Models\BookConfig;
-use App\Modules\Book\Services\BookConfigService;
 use App\Modules\Push\Models\QappPushUser;
-use GuzzleHttp\Cookie\SetCookie;
 use Illuminate\Console\Command;
-use GuzzleHttp\Client;
-use App\Modules\Book\Models\Book;
-use App\Modules\Book\Models\Chapter;
 use DB;
+use Log;
 
 class FixPushUserChannel extends Command
 {
@@ -59,11 +54,19 @@ class FixPushUserChannel extends Command
             ->get();
         if(!$qapp_push_users->isEmpty()){
             try {
+                $i = $j = 0;
                 foreach($qapp_push_users as $item){
+                    $j++;
                     if($item->distribution_channel_id != $item->channel_id && $item->app_id != $item->appId){
-                        DB::table('qapp_push_user')->where('id',$item->id)->update(['app_id' => $item->appId, 'channel_id' => $item->distribution_channel_id]);
+                        DB::table('qapp_push_user')->where('id',$item->id)->update([
+                            'app_id' => $item->appId,
+                            'channel_id' => $item->distribution_channel_id,
+                            'update_at' => date('Y-m-d H:i:s')
+                        ]);
+                        $i++;
                     }
                 }
+                \Log::info('FixPushUserChannel_count:'.$j.' fix_count:'.$i);
             } catch (\Exception $e) {
                 \Log::info('FixPushUserChannel_error:channel_id'.$channel_id.' distribution_channel_id:'.$distribution_channel_id);
                 \Log::info('FixPushUserChannel_error:'.$e->getMessage());