作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -42,4 +42,16 @@ class MonthCountController extends BaseController @@ -42,4 +42,16 @@ class MonthCountController extends BaseController
42 $lists = $monthCountLogic->getIpPvCount(); 42 $lists = $monthCountLogic->getIpPvCount();
43 $this->response('success',Code::SUCCESS,$lists); 43 $this->response('success',Code::SUCCESS,$lists);
44 } 44 }
  45 +
  46 + /**
  47 + * @remark :获取关键字
  48 + * @name :getKeyword
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2023/7/4 9:58
  52 + */
  53 + public function getKeyword(MonthCountLogic $monthCountLogic){
  54 + $data = $monthCountLogic->getKeywordLists();
  55 + $this->response('success',Code::SUCCESS,$data);
  56 + }
45 } 57 }
@@ -102,8 +102,9 @@ class MonthCountLogic extends BaseLogic @@ -102,8 +102,9 @@ class MonthCountLogic extends BaseLogic
102 ->first(); 102 ->first();
103 $arr['pv'] = $pv_ip->pv_num; 103 $arr['pv'] = $pv_ip->pv_num;
104 $arr['ip'] = $pv_ip->ip_num; 104 $arr['ip'] = $pv_ip->ip_num;
  105 + $arr['rate'] = 0;
105 if($arr['ip'] != 0){ 106 if($arr['ip'] != 0){
106 - $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 10,2); 107 + $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 100,2);
107 } 108 }
108 return $arr; 109 return $arr;
109 } 110 }
@@ -134,7 +135,7 @@ class MonthCountLogic extends BaseLogic @@ -134,7 +135,7 @@ class MonthCountLogic extends BaseLogic
134 ->orderBy('ip','desc')->limit(15)->get()->toArray(); 135 ->orderBy('ip','desc')->limit(15)->get()->toArray();
135 $arr['source_country'] = $source_country; 136 $arr['source_country'] = $source_country;
136 //受访界面前15 137 //受访界面前15
137 - $referrer_url = DB::table('gl_customer_visit_item') 138 + $referrer_url = DB::table('gl_customer_visit')
138 ->select('url',DB::raw('COUNT(*) as num')) 139 ->select('url',DB::raw('COUNT(*) as num'))
139 ->orderBy('num','desc')->where(['domain'=>$domain]) 140 ->orderBy('num','desc')->where(['domain'=>$domain])
140 // ->where('updated_date','>=',$startTime) 141 // ->where('updated_date','>=',$startTime)
@@ -143,7 +144,7 @@ class MonthCountLogic extends BaseLogic @@ -143,7 +144,7 @@ class MonthCountLogic extends BaseLogic
143 ->limit(15)->get()->toArray(); 144 ->limit(15)->get()->toArray();
144 $arr['referrer_url'] = $referrer_url; 145 $arr['referrer_url'] = $referrer_url;
145 //访问断后 146 //访问断后
146 - $referrer_port = DB::table('gl_customer_visit_item') 147 + $referrer_port = DB::table('gl_customer_visit')
147 ->select('device_port',DB::raw('COUNT(*) as num')) 148 ->select('device_port',DB::raw('COUNT(*) as num'))
148 ->orderBy('num','desc')->where(['domain'=>$domain]) 149 ->orderBy('num','desc')->where(['domain'=>$domain])
149 // ->where('updated_date','>=',$startTime) 150 // ->where('updated_date','>=',$startTime)
@@ -166,6 +167,25 @@ class MonthCountLogic extends BaseLogic @@ -166,6 +167,25 @@ class MonthCountLogic extends BaseLogic
166 $startTime = date("Y-m-d", strtotime("-9 months", mktime(0, 0, 0))); 167 $startTime = date("Y-m-d", strtotime("-9 months", mktime(0, 0, 0)));
167 $ensTime = date('Y-m-d',time()); 168 $ensTime = date('Y-m-d',time());
168 $lists = $count->list(['date'=>['between',[$startTime,$ensTime]],'project_id'=>$this->user['project_id']]); 169 $lists = $count->list(['date'=>['between',[$startTime,$ensTime]],'project_id'=>$this->user['project_id']]);
169 - return $this->success($lists); 170 + $groupedData = [];
  171 + foreach ($lists as $k=>$v){
  172 + $month = date('Y-m', strtotime($v['date']));
  173 + if(!isset($groupedData[$month])){
  174 + $groupedData[$month] = [];
  175 + }
  176 + $groupedData[$month][] = $v;
  177 + }
  178 + return $this->success($groupedData);
  179 + }
  180 +
  181 + /**
  182 + * @remark :获取关键字列表
  183 + * @name :getKeywordLists
  184 + * @author :lyh
  185 + * @method :post
  186 + * @time :2023/7/4 10:19
  187 + */
  188 + public function getKeywordLists(){
  189 + $optimizeModel = new index();
170 } 190 }
171 } 191 }