作者 lyh

gx

@@ -16,6 +16,7 @@ use App\Models\HomeCount\MonthCount; @@ -16,6 +16,7 @@ use App\Models\HomeCount\MonthCount;
16 use App\Models\Inquiry\InquiryFormData; 16 use App\Models\Inquiry\InquiryFormData;
17 use App\Models\Project\Project; 17 use App\Models\Project\Project;
18 use App\Models\Visit\Visit; 18 use App\Models\Visit\Visit;
  19 +use App\Models\Visit\VisitItem;
19 use App\Services\ProjectServer; 20 use App\Services\ProjectServer;
20 use Illuminate\Console\Command; 21 use Illuminate\Console\Command;
21 use Illuminate\Support\Carbon; 22 use Illuminate\Support\Carbon;
@@ -133,14 +134,12 @@ class MonthProjectCount extends Command @@ -133,14 +134,12 @@ class MonthProjectCount extends Command
133 * @time :2024/1/8 11:02 134 * @time :2024/1/8 11:02
134 */ 135 */
135 public function pv_ip(&$arr,$start,$end,$project_id){ 136 public function pv_ip(&$arr,$start,$end,$project_id){
136 - $pv_ip = DB::table('gl_count')  
137 - ->where(['project_id'=>$project_id]) 137 + $arr['pv'] = (new VisitItem())->where(['project_id'=>$project_id])
138 ->where('date','>=',$start.' 00:00:00') 138 ->where('date','>=',$start.' 00:00:00')
139 - ->where('date','<=',$end.' 23:59:59')  
140 - ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'),DB::raw('SUM(inquiry_num) as inquiry_num'))  
141 - ->first();  
142 - $arr['pv'] = $pv_ip->pv_num;  
143 - $arr['ip'] = $pv_ip->ip_num; 139 + ->where('date','<=',$end.' 23:59:59')->count();
  140 + $arr['ip'] = (new Visit())->where(['project_id'=>$project_id])
  141 + ->where('date','>=',$start.' 00:00:00')
  142 + ->where('date','<=',$end.' 23:59:59')->count();
144 if($arr['ip'] != 0){ 143 if($arr['ip'] != 0){
145 $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 10,2); 144 $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 10,2);
146 } 145 }