作者 lyh

gx

... ... @@ -4,10 +4,14 @@ namespace App\Http\Logic\Bside\HomeCount;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\CustomerVisit\CustomerVisit;
use App\Models\HomeCount\Count;
use App\Models\News\News;
use App\Models\Product\Product;
use App\Models\Project\Project;
use App\Models\RankData\RankData as RankDataModel;
use App\Models\Service\Service;
use App\Models\Template\BTemplate;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
... ... @@ -97,9 +101,9 @@ class CountLogic extends BaseLogic
* @time :2023/5/24 14:12
*/
public function with_data_count(){
$product_count = DB::table('gl_product')->where(['project_id' => $this->user['project_id']])->count();
$news_count = DB::table('gl_news')->where(['project_id' => $this->user['project_id']])->count();
$page_count = DB::table('gl_web_template')->where(['project_id' => $this->user['project_id']])->count();
$product_count = (new Product())->where(['project_id' => $this->user['project_id']])->count();
$news_count = (new News())->where(['project_id' => $this->user['project_id']])->count();
$page_count = (new BTemplate())->where(['project_id' => $this->user['project_id']])->count();
$data = [
'product_count' => $product_count,
'news_count' => $news_count,
... ... @@ -130,8 +134,8 @@ class CountLogic extends BaseLogic
* @time :2023/5/24 15:32
*/
public function referrer_count(){
$data = DB::table('gl_customer_visit')
->select('referrer_url', DB::raw('COUNT(*) as count'))
$customerVisitModel = new CustomerVisit();
$data = $customerVisitModel->select('referrer_url', DB::raw('COUNT(*) as count'))
->groupBy('referrer_url')->where(['domain'=>$this->user['domain']])
->orderByDesc('count')->limit(8)->get()->toArray();
$total = DB::table('gl_customer_visit')->count();
... ... @@ -151,8 +155,8 @@ class CountLogic extends BaseLogic
* @time :2023/5/24 15:56
*/
public function access_country_count(){
$data = DB::table('gl_customer_visit')
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
$customerVisitModel = new CustomerVisit();
$data = $customerVisitModel->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
->groupBy('country')->where(['domain'=>$this->user['domain']])
->orderBy('ip','desc')->limit(10)->get()->toArray();
if(!empty($data)){
... ...
... ... @@ -13,4 +13,6 @@ use App\Models\Base;
class BSetting extends Base
{
protected $table = 'gl_web_setting_template';
//连接数据库
protected $connection = 'custom_mysql';
}
... ...