作者 李宇航

合并分支 'master-server' 到 'master'

当月统计每天执行一次



查看合并请求 !647
1 -<?php  
2 -  
3 -namespace App\Console\Commands\MonthlyCount;  
4 -  
5 -use App\Helper\FormGlobalsoApi;  
6 -use App\Models\Domain\DomainInfo;  
7 -use App\Models\Inquiry\InquiryFormData;  
8 -use App\Models\Project\Project;  
9 -use App\Services\ProjectServer;  
10 -use Carbon\Carbon;  
11 -use Illuminate\Console\Command;  
12 -use Illuminate\Support\Facades\DB;  
13 -use Illuminate\Support\Facades\Log;  
14 -  
15 -class InquiryMonthlyCount extends Command  
16 -{  
17 - const STATUS_ERROR = 400;  
18 - public $error = 0;  
19 - /**  
20 - * The name and signature of the console command.  
21 - *  
22 - * @var string  
23 - */  
24 - protected $signature = 'month_count';  
25 -  
26 - /**  
27 - * The console command description.  
28 - *  
29 - * @var string  
30 - */  
31 - protected $description = '询盘月报告统计';  
32 -  
33 - /**  
34 - * @remark :询盘月报告  
35 - * @name :handle  
36 - * @author :lyh  
37 - * @method :post  
38 - * @time :2023/6/30 9:32  
39 - */  
40 - public function handle(){  
41 - $list = DB::table('gl_project')->where('gl_project.extend_type','=',0)  
42 - ->where('gl_project.type','!=',0)  
43 - ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')  
44 - ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')  
45 - ->select($this->selectParam())->get()->toArray();  
46 - // 获取上个月的开始时间  
47 - $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();  
48 - // 获取上个月的结束时间  
49 - $endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();  
50 - $domainInfo = new DomainInfo();  
51 - foreach ($list as $value){  
52 - $value = (array)$value;  
53 - if($value['type'] == Project::TYPE_ZERO){  
54 - continue;  
55 - }  
56 - if(!empty($value['domain'])){  
57 - $info = $domainInfo->read(['id'=>$value['domain']]);  
58 - if($info !== false){  
59 - $value['test_domain'] = $info['domain'];  
60 - }  
61 - }  
62 - $arr = [];  
63 - //按月统计询盘记录  
64 - $arr = $this->inquiryCount($arr,$startTime,$endTime,$value['test_domain'],$value['project_id']);  
65 - $arr = $this->flowCount($arr,$startTime,$endTime,$value['project_id']);  
66 - ProjectServer::useProject($value['project_id']);  
67 - $arr = $this->sourceCount($arr,$value['test_domain'],$startTime,$endTime);  
68 - DB::disconnect('custom_mysql');  
69 - $arr['created_at'] = date('Y-m-d H:i:s');  
70 - $arr['updated_at'] = date('Y-m-d H:i:s');  
71 - $arr['project_id'] = $value['project_id'];  
72 - // 获取当前日期时间  
73 - $arr['month'] = Carbon::now()->subMonth()->format('Y-m');  
74 - try {  
75 - DB::table('gl_month_count')->insert($arr);  
76 - Log::channel('month_count')->error('success:project_id .'.$arr['project_id']);  
77 - }catch (\Exception $e){  
78 - Log::channel('month_count')->error('month_count:error ' . $e->getMessage());  
79 - }  
80 - }  
81 - return true;  
82 - }  
83 -  
84 - /**  
85 - * @param $domain  
86 - * @param $project_id  
87 - * @remark :询盘按月统计  
88 - * @name :inquiryCount  
89 - * @author :lyh  
90 - * @method :post  
91 - * @time :2023/6/30 14:29  
92 - */  
93 - public function inquiryCount(&$arr,&$startTime,&$endTime,$domain,$project_id){  
94 - $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);  
95 - //总数  
96 - $arr['total'] = $inquiry_list['data']['total'] ?? 0;  
97 - //数据详情  
98 - $data = $inquiry_list['data']['data'] ?? 0;  
99 - $arr['month_total'] = 0;  
100 - $countryArr = [];  
101 - $arr['country'] = "";  
102 - if(!empty($data)){  
103 - foreach ($data as $v){  
104 - if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){  
105 - $arr['month_total']++;  
106 - if(isset($countryArr[$v['country']])){  
107 - $countryArr[$v['country']]++;  
108 - }else{  
109 - $countryArr[$v['country']] = 1;  
110 - }  
111 - }  
112 - }  
113 - }  
114 - //加上其他询盘  
115 - ProjectServer::useProject($project_id);  
116 - $arr['total'] += InquiryFormData::count();  
117 - $arr['month_total'] += InquiryFormData::getCount([$startTime, $endTime]);  
118 - $countryData = InquiryFormData::getCountryCount([$startTime, $endTime]);  
119 - foreach ($countryData as $v1){  
120 - if(isset($countryArr[$v1['country']])){  
121 - $countryArr[$v1['country']] += $v1['count'];  
122 - }else{  
123 - $countryArr[$v1['country']] = $v1['count'];  
124 - }  
125 - }  
126 -  
127 - arsort($countryArr);  
128 - $top20 = array_slice($countryArr, 0, 15, true);  
129 - $arr['country'] = json_encode($top20);  
130 - return $arr;  
131 - }  
132 -  
133 - /**  
134 - * @remark :流量统计  
135 - * @name :flowCount  
136 - * @author :lyh  
137 - * @method :post  
138 - * @time :2023/6/30 14:31  
139 - */  
140 - public function flowCount(&$arr,&$startTime,&$endTime,$project_id){  
141 - $pv_ip = DB::table('gl_count')  
142 - ->where(['project_id'=>$project_id])  
143 - ->where('date','>=',$startTime.' 00:00:00')  
144 - ->where('date','<=',$endTime.' 23:59:59')  
145 - ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))  
146 - ->first();  
147 - $arr['pv'] = $pv_ip->pv_num;  
148 - $arr['ip'] = $pv_ip->ip_num;  
149 - if($arr['ip'] != 0){  
150 - $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 10,2);  
151 - }  
152 - return $arr;  
153 - }  
154 -  
155 - /**  
156 - * @remark :来源访问前8  
157 - * @name :sourceCount  
158 - * @author :lyh  
159 - * @method :post  
160 - * @time :2023/6/30 16:14  
161 - */  
162 - public function sourceCount(&$arr,$domain,$startTime,$endTime){  
163 - //访问来源前10  
164 - $source = DB::connection('custom_mysql')->table('gl_customer_visit')  
165 - ->select('referrer_url', DB::raw('COUNT(*) as count'))  
166 - ->groupBy('referrer_url')  
167 - ->whereBetween('updated_date', [$startTime,$endTime])  
168 - ->orderByDesc('count')->limit(10)->get()->toArray();  
169 - $arr['source'] = json_encode($source);  
170 - //访问国家前15  
171 - $source_country = DB::connection('custom_mysql')->table('gl_customer_visit')  
172 - ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))  
173 - ->groupBy('country')  
174 - ->whereBetween('updated_date', [$startTime,$endTime])  
175 - ->orderBy('ip','desc')->limit(15)->get()->toArray();  
176 - $arr['source_country'] = json_encode($source_country);  
177 - //受访界面前15  
178 - $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')  
179 - ->select('url',DB::raw('COUNT(*) as num'))  
180 - ->orderBy('num','desc')  
181 - ->whereBetween('updated_date', [$startTime,$endTime])  
182 - ->groupBy('url')  
183 - ->limit(15)->get()->toArray();  
184 - $arr['referrer_url'] = json_encode($referrer_url);  
185 - //访问端口  
186 - $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')  
187 - ->select('device_port',DB::raw('COUNT(*) as num'))  
188 - ->orderBy('num','desc')  
189 - ->whereBetween('updated_date', [$startTime,$endTime])  
190 - ->groupBy('device_port')  
191 - ->limit(15)->get()->toArray();  
192 - $arr['referrer_port'] = json_encode($referrer_port);  
193 - return $arr;  
194 - }  
195 -  
196 - /**  
197 - * @name :(查询参数设置)selectParam  
198 - * @author :lyh  
199 - * @method :post  
200 - * @time :2023/6/14 15:00  
201 - */  
202 - public function selectParam(){  
203 - $select = [  
204 - 'gl_project.id AS id',  
205 - 'gl_project.type AS type',  
206 - 'gl_project.extend_type AS extend_type',  
207 - 'gl_project_deploy_build.test_domain AS test_domain',  
208 - 'gl_project_deploy_optimize.domain AS domain',  
209 - 'gl_project_deploy_build.project_id AS project_id',  
210 - 'gl_project.cooperate_date AS cooperate_date',  
211 - 'gl_project_deploy_build.service_duration AS service_duration',  
212 - ];  
213 - return $select;  
214 - }  
215 -}  
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :UpgradeProjectCount.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/1/8 9:03
  8 + */
  9 +
  10 +namespace App\Console\Commands\MonthlyCount;
  11 +
  12 +use App\Models\Com\UpdateOldInfo;
  13 +use App\Models\Domain\DomainInfo;
  14 +use App\Models\Project\Project;
  15 +use App\Services\ProjectServer;
  16 +use Illuminate\Console\Command;
  17 +use Illuminate\Support\Facades\DB;
  18 +use App\Models\HomeCount\MonthCount AS MonthCountModel;
  19 +
  20 +class MonthCount extends Command
  21 +{
  22 + /**
  23 + * The name and signature of the console command.
  24 + *
  25 + * @var string
  26 + */
  27 + protected $signature = 'month_counts';
  28 +
  29 + /**
  30 + * The console command description.
  31 + *
  32 + * @var string
  33 + */
  34 + protected $description = '每天生成月统计记录';
  35 +
  36 + public function handle(){
  37 + $list = DB::table('gl_project')->where('gl_project.extend_type','=',0)
  38 + ->where('gl_project.type','!=',0)->where('gl_project.id',1)
  39 + ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
  40 + ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
  41 + ->select($this->selectParam())->get()->toArray();
  42 + foreach ($list as $v) {
  43 + $v = (array)$v;
  44 + if($v['type'] == Project::TYPE_ZERO){
  45 + continue;
  46 + }
  47 + if($v['is_upgrade'] == 1){
  48 + $oldModel = new UpdateOldInfo();
  49 + $info = $oldModel->read(['project_id' => $v['id']]);
  50 + if ($info !== false) {
  51 + $url = $info['old_domain_online'];
  52 + }else{
  53 + continue;
  54 + }
  55 + }else{
  56 + $domainInfo = new DomainInfo();
  57 + if(!empty($v['domain'])){
  58 + $info = $domainInfo->read(['id'=>$v['domain']]);
  59 + if($info !== false){
  60 + $url = $info['domain'];
  61 + }
  62 + }else{
  63 + $url = $v['test_domain'];
  64 + }
  65 + }
  66 + ProjectServer::useProject($v['id']);
  67 + echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL;
  68 + $this->count($v['id'], $url);
  69 + DB::disconnect('custom_mysql');
  70 + }
  71 + }
  72 +
  73 + /**
  74 + * @name :(查询参数设置)selectParam
  75 + * @author :lyh
  76 + * @method :post
  77 + * @time :2023/6/14 15:00
  78 + */
  79 + public function selectParam(){
  80 + $select = [
  81 + 'gl_project.id AS id',
  82 + 'gl_project.type AS type',
  83 + 'gl_project.extend_type AS extend_type',
  84 + 'gl_project_deploy_build.test_domain AS test_domain',
  85 + 'gl_project.is_upgrade AS is_upgrade',
  86 + 'gl_project_deploy_optimize.domain AS domain',
  87 + 'gl_project_deploy_build.project_id AS project_id',
  88 + 'gl_project.cooperate_date AS cooperate_date',
  89 + 'gl_project_deploy_build.service_duration AS service_duration',
  90 + ];
  91 + return $select;
  92 + }
  93 + /**
  94 + * @remark :日统计记录
  95 + * @name :count
  96 + * @author :lyh
  97 + * @method :post
  98 + * @time :2024/1/8 9:05
  99 + */
  100 + public function count($project_id,$url){
  101 + $list = DB::connection('custom_mysql')->table('gl_customer_visit')
  102 + ->select(DB::raw("DATE_FORMAT(updated_date, '%Y-%m') as month"))
  103 + ->groupBy('month')->get()->toArray();
  104 + foreach ($list as $k=>$v){
  105 + $v = (array)$v;
  106 + $monthCountModel = new MonthCountModel();
  107 + $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]);
  108 + // 获取当月开始时间
  109 + $start = date('Y-m-01', strtotime($v['month']));
  110 + // 获取当月结束时间
  111 + $end = date('Y-m-t', strtotime($v['month']));
  112 + $arr['project_id'] = $project_id;
  113 + $res = $this->inquiry($url,$v['month']);
  114 +// $arr['month_total'] = 0;
  115 + if(isset($res['data']['count'])){
  116 + echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
  117 + $arr['month_total'] = $res['data']['count'];
  118 + //获取上一个的count
  119 + $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month'));
  120 + $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]);
  121 + if($previousInfo === false){
  122 + $arr['total'] = $arr['month_total'];
  123 + }else{
  124 + $arr['total'] = $res['data']['count'] + ($previousInfo['total'] ?? 0);
  125 + }
  126 + }
  127 + if(isset($res['data']['data'])){
  128 + $arr['country'] = json_encode($res['data']['data']);
  129 + }
  130 + $arr['month'] = $v['month'];
  131 + $arr = $this->pv_ip($arr,$start,$end,$project_id);
  132 + $arr = $this->sourceCount($arr,$start,$end);
  133 + if($info === false){
  134 + $selectedDate = $start;
  135 + $firstDayOfNextMonth = date('Y-m-01 01:00:00', strtotime("$selectedDate +1 month"));
  136 + $arr['created_at'] = $firstDayOfNextMonth;
  137 + $arr['updated_at'] = $firstDayOfNextMonth;
  138 +// echo date('Y-m-d H:i:s') . '数据:'.json_encode($arr) . PHP_EOL;
  139 + $monthCountModel->insert($arr);
  140 + }else{
  141 + $monthCountModel->edit($arr,['id'=>$info['id']]);
  142 + }
  143 + }
  144 + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
  145 + }
  146 +
  147 + /**
  148 + * @remark :本月询盘总量
  149 + * @name :month_total
  150 + * @author :lyh
  151 + * @method :post
  152 + * @time :2024/1/8 11:02
  153 + */
  154 + public function pv_ip(&$arr,$start,$end,$project_id){
  155 + $pv_ip = DB::table('gl_count')
  156 + ->where(['project_id'=>$project_id])
  157 + ->where('date','>=',$start.' 00:00:00')
  158 + ->where('date','<=',$end.' 23:59:59')
  159 + ->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'))
  160 + ->first();
  161 + $arr['pv'] = $pv_ip->pv_num;
  162 + $arr['ip'] = $pv_ip->ip_num;
  163 + if($arr['ip'] != 0){
  164 + $arr['rate'] = round((($arr['month_total'] ?? 0) / $arr['ip']) * 10,2);
  165 + }
  166 + return $arr;
  167 + }
  168 + /**
  169 + * @remark :来源访问前8
  170 + * @name :sourceCount
  171 + * @author :lyh
  172 + * @method :post
  173 + * @time :2023/6/30 16:14
  174 + */
  175 + public function sourceCount(&$arr,$startTime,$endTime){
  176 + //访问来源前10
  177 + $source = DB::connection('custom_mysql')->table('gl_customer_visit')
  178 + ->select('referrer_url', DB::raw('COUNT(*) as count'))
  179 + ->groupBy('referrer_url')
  180 + ->whereBetween('updated_date', [$startTime,$endTime])
  181 + ->orderByDesc('count')->limit(10)->get()->toArray();
  182 + $arr['source'] = json_encode($source);
  183 + //访问国家前15
  184 + $source_country = DB::connection('custom_mysql')->table('gl_customer_visit')
  185 + ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
  186 + ->groupBy('country')
  187 + ->whereBetween('updated_date', [$startTime,$endTime])
  188 + ->orderBy('ip','desc')->limit(15)->get()->toArray();
  189 + $arr['source_country'] = json_encode($source_country);
  190 + //受访界面前15
  191 + $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')
  192 + ->select('url',DB::raw('COUNT(*) as num'))
  193 + ->orderBy('num','desc')
  194 + ->whereBetween('updated_date', [$startTime,$endTime])
  195 + ->groupBy('url')
  196 + ->limit(15)->get()->toArray();
  197 + $arr['referrer_url'] = json_encode($referrer_url);
  198 + //访问端口
  199 + $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')
  200 + ->select('device_port',DB::raw('COUNT(*) as num'))
  201 + ->orderBy('num','desc')
  202 + ->whereBetween('updated_date', [$startTime,$endTime])
  203 + ->groupBy('device_port')
  204 + ->limit(15)->get()->toArray();
  205 + $arr['referrer_port'] = json_encode($referrer_port);
  206 + return $arr;
  207 + }
  208 +
  209 + public function inquiry($url,$month){
  210 + $url = 'https://'.$url.'/';
  211 + $token = md5($url.date("Y-m-d"));
  212 + $url = 'https://form.globalso.com/api/external-interface/country_con/15243d63ed5a5738?domain='.$url.'&token='.$token.'&source=1,2,3,4&model=month&sta_date='.$month;
  213 + $res = http_get($url,['charset=utf-8']);
  214 + echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
  215 + return $res;
  216 + }
  217 +
  218 +}
@@ -77,7 +77,7 @@ class SuppliersController extends BaseController @@ -77,7 +77,7 @@ class SuppliersController extends BaseController
77 if(isset($res['status_code']) && $res['status_code'] != 200){ 77 if(isset($res['status_code']) && $res['status_code'] != 200){
78 $this->response($res['message'],Code::SYSTEM_ERROR); 78 $this->response($res['message'],Code::SYSTEM_ERROR);
79 } 79 }
80 - return $this->success($res['data']); 80 + return $this->success($res['data'] ?? []);
81 } 81 }
82 /** 82 /**
83 * @remark :按名字搜索公司 83 * @remark :按名字搜索公司
@@ -30,7 +30,6 @@ class MonthCountLogic extends BaseLogic @@ -30,7 +30,6 @@ class MonthCountLogic extends BaseLogic
30 */ 30 */
31 public function getCountLists($map,$order = 'created_at',$filed = ['*']){ 31 public function getCountLists($map,$order = 'created_at',$filed = ['*']){
32 $map['project_id'] = $this->user['project_id']; 32 $map['project_id'] = $this->user['project_id'];
33 - $new = $this->currentMonthCount();  
34 $lists = $this->model->list($map,$order,$filed,'desc',10); 33 $lists = $this->model->list($map,$order,$filed,'desc',10);
35 if(isset($this->project['is_record_china_visit']) && ($this->project['is_record_china_visit'] == 0)){ 34 if(isset($this->project['is_record_china_visit']) && ($this->project['is_record_china_visit'] == 0)){
36 foreach ($lists as $k => $v){ 35 foreach ($lists as $k => $v){
@@ -49,7 +48,6 @@ class MonthCountLogic extends BaseLogic @@ -49,7 +48,6 @@ class MonthCountLogic extends BaseLogic
49 $lists[$k] = $v; 48 $lists[$k] = $v;
50 } 49 }
51 } 50 }
52 - $lists['new'] = $new;  
53 return $this->success($lists); 51 return $this->success($lists);
54 } 52 }
55 53
@@ -156,7 +154,7 @@ class MonthCountLogic extends BaseLogic @@ -156,7 +154,7 @@ class MonthCountLogic extends BaseLogic
156 ->where('referrer_url','!=','') 154 ->where('referrer_url','!=','')
157 ->whereBetween('updated_date', [$startTime,$endTime]) 155 ->whereBetween('updated_date', [$startTime,$endTime])
158 ->orderByDesc('count')->limit(10)->get()->toArray(); 156 ->orderByDesc('count')->limit(10)->get()->toArray();
159 - $arr['source'] = $source; 157 + $arr['source'] = $source ?? [];
160 //访问国家前15 158 //访问国家前15
161 $query = DB::connection('custom_mysql')->table('gl_customer_visit') 159 $query = DB::connection('custom_mysql')->table('gl_customer_visit')
162 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) 160 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
@@ -166,7 +164,7 @@ class MonthCountLogic extends BaseLogic @@ -166,7 +164,7 @@ class MonthCountLogic extends BaseLogic
166 } 164 }
167 $source_country = $query->whereBetween('updated_date', [$startTime,$endTime]) 165 $source_country = $query->whereBetween('updated_date', [$startTime,$endTime])
168 ->orderBy('ip','desc')->limit(15)->get()->toArray(); 166 ->orderBy('ip','desc')->limit(15)->get()->toArray();
169 - $arr['source_country'] = $source_country; 167 + $arr['source_country'] = $source_country ?? [];
170 //受访界面前15 168 //受访界面前15
171 $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit') 169 $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')
172 ->select('url',DB::raw('COUNT(*) as num')) 170 ->select('url',DB::raw('COUNT(*) as num'))
@@ -174,15 +172,15 @@ class MonthCountLogic extends BaseLogic @@ -174,15 +172,15 @@ class MonthCountLogic extends BaseLogic
174 ->whereBetween('updated_date', [$startTime,$endTime]) 172 ->whereBetween('updated_date', [$startTime,$endTime])
175 ->groupBy('url') 173 ->groupBy('url')
176 ->limit(15)->get()->toArray(); 174 ->limit(15)->get()->toArray();
177 - $arr['referrer_url'] = $referrer_url;  
178 - //访问断后 175 + $arr['referrer_url'] = $referrer_url ?? [];
  176 + //访问端口
179 $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit') 177 $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')
180 ->select('device_port',DB::raw('COUNT(*) as num')) 178 ->select('device_port',DB::raw('COUNT(*) as num'))
181 ->orderBy('num','desc') 179 ->orderBy('num','desc')
182 ->whereBetween('updated_date', [$startTime,$endTime]) 180 ->whereBetween('updated_date', [$startTime,$endTime])
183 ->groupBy('device_port') 181 ->groupBy('device_port')
184 ->limit(15)->get()->toArray(); 182 ->limit(15)->get()->toArray();
185 - $arr['referrer_port'] = $referrer_port; 183 + $arr['referrer_port'] = $referrer_port ?? [];
186 return $arr; 184 return $arr;
187 } 185 }
188 186
@@ -144,7 +144,7 @@ class KeywordLogic extends BaseLogic @@ -144,7 +144,7 @@ class KeywordLogic extends BaseLogic
144 continue; 144 continue;
145 } 145 }
146 $this->model = new Keyword(); 146 $this->model = new Keyword();
147 - $info = $this->model->read(['title'=>$v]); 147 + $info = $this->model->read(['title'=>$v],['id']);
148 if($info === false){ 148 if($info === false){
149 $param['project_id'] = $this->user['project_id']; 149 $param['project_id'] = $this->user['project_id'];
150 $param['created_at'] = date('Y-m-d H:i:s'); 150 $param['created_at'] = date('Y-m-d H:i:s');
@@ -44,7 +44,12 @@ class QueryListener @@ -44,7 +44,12 @@ class QueryListener
44 } 44 }
45 } 45 }
46 } 46 }
47 - $log = vsprintf($sql, $event->bindings); 47 + if(strpos($sql,'%Y-%m') === false){
  48 + $log = vsprintf($sql, $event->bindings);
  49 + }else{
  50 + $log = $sql;
  51 + }
  52 +
48 $log = $log.' [ RunTime:'.$event->time.'ms ] '; 53 $log = $log.' [ RunTime:'.$event->time.'ms ] ';
49 Log::debug($log); 54 Log::debug($log);
50 } 55 }