zz 3 anos atrás
pai
commit
87d4ab0e0c

+ 12 - 6
app/Console/Commands/Wechat/AdReport.php

@@ -64,9 +64,11 @@ class AdReport extends Command
         if(date('H:i:s') < '02:00:00'){
             $start = date('Y-m-d H:i:s',time()-3*3600);
         }
-        $result = DB::connection('api_mysql')->table('distribution_channel_weixin_ad_report_orders')
+        $result = DB::connection('api_mysql')->table('distribution_channel_weixin_report_orders')
             ->where('report_status',0)
             ->where('created_at','>=',$start)
+            ->where('type','WECHAT')
+            ->where('action_type','ALL')
             ->select('order_id','appid','openid','price','report_status','created_at','report_type')
             ->get();
         if($result){
@@ -76,7 +78,7 @@ class AdReport extends Command
                 $report_info = DB::table('wechat_advertise_report_record')->where('product_id',$item->order_id)->where('result_status','SUCCESS')->count();
                 if($report_info) {
                     try{
-                        DB::connection('api_mysql')->table('distribution_channel_weixin_ad_report_orders')->where('order_id',$item->order_id)->update([
+                        DB::connection('api_mysql')->table('distribution_channel_weixin_report_orders')->where('order_id',$item->order_id)->update([
                             'report_status'=>1,
                             'updated_at'=>date('Y-m-d H:i:s')
                         ]);
@@ -133,6 +135,10 @@ class AdReport extends Command
             if(!$user_action_set_id) {
                 $data['result_msg'] = $this->error_msg;
                 DB::table('wechat_advertise_report_record')->insert($data);
+                DB::connection('api_mysql')->table('distribution_channel_weixin_report_orders')->where('order_id',$item_array['id'])->update([
+                    'report_status'=>5,
+                    'updated_at'=>date('Y-m-d H:i:s')
+                ]);
                 continue;
             };
             $request_data = [
@@ -182,10 +188,10 @@ class AdReport extends Command
                 DB::table('wechat_advertise_report_record')->insert($data);
                 try{
                     if($data['result_status'] == 'SUCCESS'){
-                        DB::connection('api_mysql')->table('distribution_channel_weixin_ad_report_orders')->where('order_id',$item_array['id'])->update([
-                        'report_status'=>1,
-                        'updated_at'=>date('Y-m-d H:i:s')
-                    ]);
+                        DB::connection('api_mysql')->table('distribution_channel_weixin_report_orders')->where('order_id',$item_array['id'])->update([
+                            'report_status'=>1,
+                            'updated_at'=>date('Y-m-d H:i:s')
+                        ]);
                     }
                 }catch (\Exception $e){\Log::info($e);}
 

+ 10 - 4
app/Console/Commands/Wechat/GdtAdReport.php

@@ -170,6 +170,10 @@ class GdtAdReport extends Command
             if(!$user_action_set_id || !$token) {
                 $data['result_msg'] = $this->error_msg;
                 DB::table('wechat_advertise_gdt_report_record')->insert($data);
+                DB::connection('api_mysql')->table('distribution_channel_weixin_report_orders')->where('order_id',$item['id'])->update([
+                    'report_status'=>5,
+                    'updated_at'=>date('Y-m-d H:i:s')
+                ]);
                 continue;
             };
             $result = $this->request($client, $user_action_set_id, $action_time, $action_type, $item['appid'], $item['openid'], $item['price']*100, $product_name, $product_id,$token,$report_type);
@@ -179,7 +183,7 @@ class GdtAdReport extends Command
             try{
                 DB::table('wechat_advertise_gdt_report_record')->insert($data);
                 if($data['result_status'] == 'SUCCESS'){
-                    DB::connection('api_mysql')->table('distribution_channel_weixin_spread_orders')->where('order_id',$item['id'])->update([
+                    DB::connection('api_mysql')->table('distribution_channel_weixin_report_orders')->where('order_id',$item['id'])->update([
                         'report_status'=>1,
                         'updated_at'=>date('Y-m-d H:i:s')
                     ]);
@@ -195,7 +199,7 @@ class GdtAdReport extends Command
             DB::table('wechat_advertise_gdt_report_record')->insert($data);
             try{
                 if($data['result_status'] == 'SUCCESS'){
-                    DB::connection('api_mysql')->table('distribution_channel_weixin_spread_orders')->where('order_id',$item['id'])->update([
+                    DB::connection('api_mysql')->table('distribution_channel_weixin_report_orders')->where('order_id',$item['id'])->update([
                         'report_status'=>1,
                         'updated_at'=>date('Y-m-d H:i:s')
                     ]);
@@ -211,9 +215,11 @@ class GdtAdReport extends Command
         if (date('H:i:s') < '02:00:00') {
             $start = date('Y-m-d H:i:s', time() - 3 * 3600);
         }
-        $result = DB::connection('api_mysql')->table('distribution_channel_weixin_spread_orders')
+        $result = DB::connection('api_mysql')->table('distribution_channel_weixin_report_orders')
             ->where('report_status', 0)
             ->where('created_at', '>=', $start)
+            ->where('type','WEB')
+            ->where('action_type','ALL')
             ->select('order_id', 'appid', 'openid', 'price', 'report_status', 'created_at','report_type')
             ->get();
         if ($result) {
@@ -225,7 +231,7 @@ class GdtAdReport extends Command
                     ->count();
                 if ($report_info) {
                     try {
-                        DB::connection('api_mysql')->table('distribution_channel_weixin_spread_orders')->where('order_id', $item->order_id)->update([
+                        DB::connection('api_mysql')->table('distribution_channel_weixin_report_orders')->where('order_id', $item->order_id)->update([
                             'report_status' => 1,
                             'updated_at' => date('Y-m-d H:i:s')
                         ]);