|
@@ -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){}
|
|
|
+
|
|
|
+ }
|
|
|
}
|