소스 검색

report fix

zz 4 년 전
부모
커밋
b0725a8786

+ 54 - 0
app/Console/Commands/Channel/ReportUserAndOrderToChannel.php

@@ -0,0 +1,54 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: z-yang
+ * Date: 2020/12/24
+ * Time: 16:47
+ */
+
+namespace App\Console\Commands\Channel;
+
+use Illuminate\Console\Command;
+use DB;
+
+class ReportUserAndOrderToChannel extends Command
+{
+    /**
+     * 执行命令   php artisan generate_order_day_stat
+     *
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'channel:ReportUserAndOrderToChannel {--type=}';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = '检测渠道账号状态';
+
+    /**
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle(){
+
+    }
+
+    private function  reportOrders(){
+
+    }
+
+    private function reportUsers($date){
+        $result = DB::table('report_to_channel_users')->where('created_at','>=',$date)
+            ->where('report_status',0)
+            ->select('id','uid','distribution_channel_id','register_ip','user_agent','user_created_at')->get();
+        if(!$result)return ;
+        foreach ($result as $item){
+
+        }
+    }
+}

+ 2 - 1
app/Jobs/AsyncOrderStats.php

@@ -9,6 +9,7 @@
 
 namespace App\Jobs;
 
+use App\Modules\Channel\Services\ReportToChannelUserAndOrderService;
 use App\Modules\Subscribe\Services\OrderService;
 use GuzzleHttp\Client;
 use Illuminate\Bus\Queueable;
@@ -97,7 +98,7 @@ class AsyncOrderStats implements ShouldQueue
     }
 
    private function reportToChannel(){
-       $link = $this->getReportUrl($this->distribution_channel_id);
+       $link = ReportToChannelUserAndOrderService::getReportUrl($this->order_info->distribution_channel_id,ReportToChannelUserAndOrderService::$order_type);
        if(!$link) return ;
        $uid = $this->uid;
        $distribution_channel_id = $this->order_info->distribution_channel_id;

+ 2 - 5
app/Jobs/AsyncUserRegister.php

@@ -8,6 +8,7 @@
 
 namespace App\Jobs;
 
+use App\Modules\Channel\Services\ReportToChannelUserAndOrderService;
 use DB;
 use GuzzleHttp\Client;
 use Illuminate\Bus\Queueable;
@@ -53,7 +54,7 @@ class AsyncUserRegister implements ShouldQueue
     }
 
     private function reportToChannel(){
-        $link = $this->getReportUrl($this->distribution_channel_id);
+        $link = ReportToChannelUserAndOrderService::getReportUrl($this->distribution_channel_id,ReportToChannelUserAndOrderService::$user_type);
         if(!$link) return ;
         $client = new Client(['timeout'=>3.0]);
         try{
@@ -85,8 +86,4 @@ class AsyncUserRegister implements ShouldQueue
     }
 
 
-    private function getReportUrl($distribution_channel_id){
-        return '';
-    }
-
 }

+ 17 - 0
app/Modules/Channel/Models/ReportToChannelOrders.php

@@ -0,0 +1,17 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: z-yang
+ * Date: 2020/12/24
+ * Time: 17:02
+ */
+
+namespace App\Modules\Channel\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ReportToChannelOrders extends Model
+{
+    protected $table = 'report_to_channel_orders';
+    protected $fillable = ['uid','distribution_channel_id','price','order_created_at','report_status','error_msg'];
+}

+ 19 - 0
app/Modules/Channel/Models/ReportToChannelUsers.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: z-yang
+ * Date: 2020/12/24
+ * Time: 17:01
+ */
+
+namespace App\Modules\Channel\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ReportToChannelUsers extends Model
+{
+    protected $table = 'report_to_channel_users';
+    protected $fillable = ['id','uid','distribution_channel_id',
+        'register_ip','user_agent','user_created_at','report_status','error_msg'
+    ];
+}

+ 29 - 0
app/Modules/Channel/Services/ReportToChannelUserAndOrderService.php

@@ -0,0 +1,29 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: z-yang
+ * Date: 2020/12/24
+ * Time: 17:04
+ */
+
+namespace App\Modules\Channel\Services;
+
+
+
+class ReportToChannelUserAndOrderService
+{
+    public static $user_type = 'user';
+    public static $order_type = 'user';
+
+    const SUCCESS = 'success';
+
+    public static function getReportUrl($distribution_channel_id,$type){
+        return '';
+    }
+
+
+
+    public static function createUserErrorRecord($uid,$distribution_channel_id,$register_ip,$user_agent,$user_created_at){
+
+    }
+}