瀏覽代碼

Merge branch 'crm_book_stats' into stabble

zz 5 年之前
父節點
當前提交
626473230d

+ 23 - 4
app/Http/Controllers/Wap/User/CrmBooklistController.php

@@ -14,6 +14,7 @@ class CrmBooklistController extends Controller
     public function index(Request $request)
     {
         $month = date('n');
+        $this->statsDetail($this->getUserColumnValue('id'),'entrance');
         return view('crm.entrance')->with(compact('month'));
     }
 
@@ -28,11 +29,12 @@ class CrmBooklistController extends Controller
                 $books = collect($item)->sortByDesc('recommend_index')->values()->transform(function ($item) {
                     $item['star'] =  intval(($item['recommend_index'] - 50) / 10);
                     $item['link'] = sprintf(
-                        '%s://site%s.%s.com/detail?id=%s',
+                        '%s://site%s.%s.com/detail?id=%s&crm=%s',
                         env('PROTOCOL'),
                         encodeDistributionChannelId($this->getUserColumnValue('channel_id')),
                         env('CUSTOM_HOST'),
-                        Hashids::encode($item['bid'])
+                        Hashids::encode($item['bid']),
+                        'crm_book_show_'.$item['bid']
                     );
                     return $item;
                 })->take(4)->all();
@@ -40,6 +42,7 @@ class CrmBooklistController extends Controller
             })->all();
         $annually_monthly_user = new AnnuallyMonthlyUser();
         $is_annually_monthly_user = $annually_monthly_user->is_monthly || $annually_monthly_user->is_annually;
+        $this->statsDetail($this->getUserColumnValue('id'),'bookshow');
         return view('crm.bookshow')->with(compact('book_models','is_annually_monthly_user'));
     }
 
@@ -52,15 +55,17 @@ class CrmBooklistController extends Controller
             $booklists = (new CrmBookAutoRecommendService)->getRecommendBooksFromRedis();
             $books =  collect($booklists)->where('category_id', $category_id)->transform(function ($item) {
                 $item['link'] = sprintf(
-                    '%s://site%s.%s.com/detail?id=%s',
+                    '%s://site%s.%s.com/detail?id=%s&crm=%s',
                     env('PROTOCOL'),
                     encodeDistributionChannelId($this->getUserColumnValue('channel_id')),
                     env('CUSTOM_HOST'),
-                    Hashids::encode($item['bid'])
+                    Hashids::encode($item['bid']),
+                    'crm_book_list_'.$item['bid']
                 );
                 return $item;
             })->all();
         }
+        $this->statsDetail($this->getUserColumnValue('id'),'booklist');
         return view('crm.booklist', compact('books', 'month')); #->with(compact('books', 'month'));
     }
 
@@ -71,4 +76,18 @@ class CrmBooklistController extends Controller
             return $user->$column;
         }
     }
+
+
+    private function statsDetail($uid,$page,$bid=0)
+    {
+        try{
+            DB::table('crm_visit_detail')->insert([
+                'uid'=>$uid,'page'=>$page,
+                'bid'=>$bid,'day'=>date('Y-m-d'),
+                'created_at'=>date('Y-m-d H:i:s'),
+                'updated_at'=>date('Y-m-d H:i:s')
+            ]);
+        }catch (\Exception $e){}
+
+    }
 }

+ 2 - 0
app/Http/Controllers/Wap/Web/WelcomeController.php

@@ -2232,6 +2232,8 @@ class WelcomeController extends BaseController
         //渠道自己导粉
         $other_crm_config = Redis::hmget('channel:setting:' . $this->distribution_channel_id, ['crm_status', 'crm_link']);
         if (empty($other_crm_config[0]) && empty($other_crm_config[1])) return '';
+        $get_info = UserBindHkWelfareService::isHasGet($this->uid);
+        if ($get_info) return '';
         if($this->is_paid || $this->distribution_channel_id == 6687)
             return ['title' => '点击领取200书币>>', 'link' => $other_crm_config[1]];
         return '';