作者 lyh

gx

@@ -46,23 +46,26 @@ class ForwardInquiryCount extends Command @@ -46,23 +46,26 @@ class ForwardInquiryCount extends Command
46 */ 46 */
47 public function handle(){ 47 public function handle(){
48 // 获取上个月的开始时间 48 // 获取上个月的开始时间
49 - $startTime = Carbon::now()->subMonth()->startOfMonth(); 49 + $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
50 // 获取上个月的结束时间 50 // 获取上个月的结束时间
51 - $endTime = Carbon::now()->subMonth()->endOfMonth(); 51 + $endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();
52 $list = DB::table('gl_inquiry_info')->groupBy('user_name') 52 $list = DB::table('gl_inquiry_info')->groupBy('user_name')
53 ->select("user_name",DB::raw('COUNT(*) as count')) 53 ->select("user_name",DB::raw('COUNT(*) as count'))
54 - ->where()->get(); 54 + ->where('send_time','>=',$startTime.' 00:00:00')
  55 + ->where('send_time','<=',$endTime.' 23:59:59')
  56 + ->get();
55 if(!empty($list)){ 57 if(!empty($list)){
56 $list = $list->toArray(); 58 $list = $list->toArray();
57 $forwardModel = new ForwardCount(); 59 $forwardModel = new ForwardCount();
58 foreach ($list as $v){ 60 foreach ($list as $v){
59 $data = [ 61 $data = [
60 - 'date'=>date('Y-m',time()), 62 + 'date'=>Carbon::now()->subMonth()->format('Y-m'),
61 'name'=>$v['user_name'], 63 'name'=>$v['user_name'],
62 'count'=>$v['count'] 64 'count'=>$v['count']
63 ]; 65 ];
64 $forwardModel->add($data); 66 $forwardModel->add($data);
65 } 67 }
66 } 68 }
  69 + return true;
67 } 70 }
68 } 71 }
@@ -39,9 +39,9 @@ class InquiryMonthlyCount extends Command @@ -39,9 +39,9 @@ class InquiryMonthlyCount extends Command
39 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 39 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
40 ->select($this->selectParam())->get()->toArray(); 40 ->select($this->selectParam())->get()->toArray();
41 // 获取上个月的开始时间 41 // 获取上个月的开始时间
42 - $startTime = Carbon::now()->subMonth()->startOfMonth(); 42 + $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
43 // 获取上个月的结束时间 43 // 获取上个月的结束时间
44 - $endTime = Carbon::now()->subMonth()->endOfMonth(); 44 + $endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();
45 foreach ($list as $value){ 45 foreach ($list as $value){
46 $value = (array)$value; 46 $value = (array)$value;
47 if($value['domain'] != ''){ 47 if($value['domain'] != ''){
@@ -105,8 +105,8 @@ class InquiryMonthlyCount extends Command @@ -105,8 +105,8 @@ class InquiryMonthlyCount extends Command
105 public function flowCount(&$arr,&$startTime,&$endTime,$project_id){ 105 public function flowCount(&$arr,&$startTime,&$endTime,$project_id){
106 $pv_ip = DB::table('gl_count') 106 $pv_ip = DB::table('gl_count')
107 ->where(['project_id'=>$project_id]) 107 ->where(['project_id'=>$project_id])
108 - ->where('date','>=',$startTime->toDateString().' 00:00:00')  
109 - ->where('date','<=',$endTime->toDateString().' 23:59:59') 108 + ->where('date','>=',$startTime.' 00:00:00')
  109 + ->where('date','<=',$endTime.' 23:59:59')
110 ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num')) 110 ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
111 ->first(); 111 ->first();
112 $arr['pv'] = $pv_ip->pv_num; 112 $arr['pv'] = $pv_ip->pv_num;
@@ -129,21 +129,21 @@ class InquiryMonthlyCount extends Command @@ -129,21 +129,21 @@ class InquiryMonthlyCount extends Command
129 $source = DB::table('gl_customer_visit') 129 $source = DB::table('gl_customer_visit')
130 ->select('referrer_url', DB::raw('COUNT(*) as count')) 130 ->select('referrer_url', DB::raw('COUNT(*) as count'))
131 ->groupBy('referrer_url')->where(['domain'=>$domain]) 131 ->groupBy('referrer_url')->where(['domain'=>$domain])
132 - ->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()]) 132 + ->whereBetween('updated_date', [$startTime,$endTime])
133 ->orderByDesc('count')->limit(10)->get()->toArray(); 133 ->orderByDesc('count')->limit(10)->get()->toArray();
134 $arr['source'] = json_encode($source); 134 $arr['source'] = json_encode($source);
135 //访问国家前15 135 //访问国家前15
136 $source_country = DB::table('gl_customer_visit') 136 $source_country = DB::table('gl_customer_visit')
137 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) 137 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
138 ->groupBy('country')->where(['domain'=>$domain]) 138 ->groupBy('country')->where(['domain'=>$domain])
139 - ->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()]) 139 + ->whereBetween('updated_date', [$startTime,$endTime])
140 ->orderBy('ip','desc')->limit(15)->get()->toArray(); 140 ->orderBy('ip','desc')->limit(15)->get()->toArray();
141 $arr['source_country'] = json_encode($source_country); 141 $arr['source_country'] = json_encode($source_country);
142 //受访界面前15 142 //受访界面前15
143 $referrer_url = DB::table('gl_customer_visit') 143 $referrer_url = DB::table('gl_customer_visit')
144 ->select('url',DB::raw('COUNT(*) as num')) 144 ->select('url',DB::raw('COUNT(*) as num'))
145 ->orderBy('num','desc')->where(['domain'=>$domain]) 145 ->orderBy('num','desc')->where(['domain'=>$domain])
146 - ->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()]) 146 + ->whereBetween('updated_date', [$startTime,$endTime])
147 ->groupBy('url') 147 ->groupBy('url')
148 ->limit(15)->get()->toArray(); 148 ->limit(15)->get()->toArray();
149 $arr['referrer_url'] = json_encode($referrer_url); 149 $arr['referrer_url'] = json_encode($referrer_url);
@@ -151,7 +151,7 @@ class InquiryMonthlyCount extends Command @@ -151,7 +151,7 @@ class InquiryMonthlyCount extends Command
151 $referrer_port = DB::table('gl_customer_visit') 151 $referrer_port = DB::table('gl_customer_visit')
152 ->select('device_port',DB::raw('COUNT(*) as num')) 152 ->select('device_port',DB::raw('COUNT(*) as num'))
153 ->orderBy('num','desc')->where(['domain'=>$domain]) 153 ->orderBy('num','desc')->where(['domain'=>$domain])
154 - ->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()]) 154 + ->whereBetween('updated_date', [$startTime,$endTime])
155 ->groupBy('device_port') 155 ->groupBy('device_port')
156 ->limit(15)->get()->toArray(); 156 ->limit(15)->get()->toArray();
157 $arr['referrer_port'] = json_encode($referrer_port); 157 $arr['referrer_port'] = json_encode($referrer_port);
@@ -263,8 +263,6 @@ class InquiryInfoController extends BaseController @@ -263,8 +263,6 @@ class InquiryInfoController extends BaseController
263 * @time :2023/8/18 9:18 263 * @time :2023/8/18 9:18
264 */ 264 */
265 public function getInternalCount(InquiryInfoLogic $inquiryInfoLogic){ 265 public function getInternalCount(InquiryInfoLogic $inquiryInfoLogic){
266 - var_dump(Carbon::now()->subMonth()->startOfMonth()->toDateString());  
267 - die();  
268 $list = $inquiryInfoLogic->getManagerCount(); 266 $list = $inquiryInfoLogic->getManagerCount();
269 $this->response('success',Code::SUCCESS,$list); 267 $this->response('success',Code::SUCCESS,$list);
270 } 268 }
1 -<?php  
2 -  
3 -namespace App\Http\Controllers\Aside\Optimize;  
4 -  
5 -use App\Enums\Common\Code;  
6 -use App\Http\Controllers\Aside\BaseController;  
7 -use App\Http\Logic\Aside\Optimize\KeywordsLogic;  
8 -  
9 -/**  
10 - * @remark :关键字查询案例  
11 - * @class :KeywordsController.php  
12 - * @author :lyh  
13 - * @time :2023/7/17 9:51  
14 - */  
15 -class KeywordsController extends BaseController  
16 -{  
17 - /**  
18 - * @remark :根据关键词获取案例  
19 - * @name :lists  
20 - * @author :lyh  
21 - * @method :post  
22 - * @time :2023/7/17 9:52  
23 - */  
24 - public function getSearchKeyword(KeywordsLogic $keywordsLogic){  
25 - $lists = $keywordsLogic->keySearchList($this->map);  
26 - $this->response('success',Code::SUCCESS,$lists);  
27 - }  
28 -}  
1 -<?php  
2 -  
3 -namespace App\Http\Logic\Aside\Optimize;  
4 -  
5 -use App\Http\Logic\Aside\BaseLogic;  
6 -use App\Models\Product\Keyword;  
7 -use App\Models\Project\Project;  
8 -use App\Models\RouteMap;  
9 -  
10 -/**  
11 - * @remark :关键词查案例  
12 - * @class :KeywordsLogic.php  
13 - * @author :lyh  
14 - * @time :2023/7/22 11:44  
15 - */  
16 -class KeywordsLogic extends BaseLogic  
17 -{  
18 - const ISSET_TYPE = 1;//去重时写入默认值  
19 -  
20 - public function __construct()  
21 - {  
22 - parent::__construct();  
23 - $this->routeMapModel = new RouteMap();  
24 - $this->productKeywordModel = new Keyword();  
25 - $this->param = $this->requestAll;  
26 - }  
27 -  
28 - /**  
29 - * @remark :关键字查询案例  
30 - * @name :keySearchList  
31 - * @author :lyh  
32 - * @method :post  
33 - * @time :2023/7/22 11:46  
34 - */  
35 - public function keySearchList($map){  
36 - $data = [];  
37 - $map['search'] = ['like','%'.$map['search'].'%'];  
38 - $data = $this->searchRouteMap($map,$data);//查询菜单信息表  
39 - $data = $this->searchProductKeyword($map,$data);//查询产品关键词表  
40 - $data = array_unique($data);  
41 - $lists = [];  
42 - if(!empty($data)){  
43 - $projectModel = new Project();  
44 - $lists = $projectModel->formatQuery(['id'=>['in',$data]])->with('deploy_build')->with('deploy_optimize')->get();  
45 - }  
46 - return $this->success($lists);  
47 - }  
48 -  
49 - /**  
50 - * @remark :菜单表中查询route关键字  
51 - * @name :searchRouteMap  
52 - * @author :lyh  
53 - * @method :post  
54 - * @time :2023/7/22 16:46  
55 - */  
56 - public function searchRouteMap($map,&$data){  
57 - $keyList = $this->routeMapModel->list(['route'=>$map['search']],'created_at');  
58 - foreach ($keyList as $v){  
59 - $data[] = $v['project_id'];  
60 - }  
61 - return $data;  
62 - }  
63 -  
64 - /**  
65 - * @remark :搜索产品关键字  
66 - * @name :searchProductKeyword  
67 - * @author :lyh  
68 - * @method :post  
69 - * @time :2023/7/22 16:52  
70 - */  
71 - public function searchProductKeyword($map,&$data){  
72 - $keyList = $this->productKeywordModel->list(['title'=>$map['search']]);  
73 - foreach ($keyList as $v){  
74 - $data[] = $v['project_id'];  
75 - }  
76 - return $data;  
77 - }  
78 -}  
@@ -122,9 +122,7 @@ class Base extends Model @@ -122,9 +122,7 @@ class Base extends Model
122 * @method post 122 * @method post
123 */ 123 */
124 public function add($data){ 124 public function add($data){
125 - if(!isset($data['created_at'])){  
126 - $data['created_at'] = date('Y-m-d H:i:s');  
127 - } 125 + $data['created_at'] = date('Y-m-d H:i:s');
128 $data['updated_at'] = $data['created_at']; 126 $data['updated_at'] = $data['created_at'];
129 return $this->insert($data); 127 return $this->insert($data);
130 } 128 }
@@ -247,26 +247,6 @@ Route::middleware(['aloginauth'])->group(function () { @@ -247,26 +247,6 @@ Route::middleware(['aloginauth'])->group(function () {
247 Route::any('/getTimeZone', [Aside\Optimize\InquiryInfoController::class, 'getTimeZone'])->name('admin.inquiry_getTimeZone'); 247 Route::any('/getTimeZone', [Aside\Optimize\InquiryInfoController::class, 'getTimeZone'])->name('admin.inquiry_getTimeZone');
248 Route::any('/getInternalCount', [Aside\Optimize\InquiryInfoController::class, 'getInternalCount'])->name('admin.inquiry_getInternalCount'); 248 Route::any('/getInternalCount', [Aside\Optimize\InquiryInfoController::class, 'getInternalCount'])->name('admin.inquiry_getInternalCount');
249 }); 249 });
250 -  
251 - //关键词查案例  
252 - Route::prefix('keyword')->group(function () {  
253 - Route::any('/', [Aside\Optimize\KeywordsController::class, 'getSearchKeyword'])->name('admin.keyword_getSearchKeyword');  
254 - });  
255 -  
256 -  
257 -});  
258 -  
259 -//无需登录验证的路由组  
260 -Route::group([], function () {  
261 - Route::any('/login', [Aside\LoginController::class, 'login'])->name('admin.login.white');  
262 - Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class, 'index'])->name('admin.image_show');  
263 - Route::any('/file/{hash}', [\App\Http\Controllers\File\FileController::class, 'index'])->name('admin.file_show');  
264 - Route::any('/downLoad/files', [\App\Http\Controllers\File\FileController::class, 'downLoad'])->name('admin.files_downLoad');//导出文件  
265 - Route::any('/downLoad/images', [\App\Http\Controllers\File\ImageController::class, 'downLoad'])->name('admin.images_downLoad');//导出图片  
266 - Route::any('/domain/exportData', [Aside\Domain\DomainInfoController::class, 'exportData'])->name('admin.domain_exportData');//导出数据  
267 - Route::any('/notice/project', [Aside\NoticeController::class, 'project'])->name('admin.notice.project');  
268 - Route::any('/sendLoginSms', [Aside\LoginController::class, 'sendLoginSms'])->name('admin.sendLoginSms');//发送验证码  
269 -  
270 // 公共主题模版 250 // 公共主题模版
271 Route::prefix('template')->group(function () { 251 Route::prefix('template')->group(function () {
272 Route::any('/', [Aside\Template\ATemplateController::class, 'lists'])->name('admin.ATemplate_lists'); 252 Route::any('/', [Aside\Template\ATemplateController::class, 'lists'])->name('admin.ATemplate_lists');
@@ -294,4 +274,17 @@ Route::group([], function () { @@ -294,4 +274,17 @@ Route::group([], function () {
294 }); 274 });
295 }); 275 });
296 276
  277 +//无需登录验证的路由组
  278 +Route::group([], function () {
  279 + Route::any('/login', [Aside\LoginController::class, 'login'])->name('admin.login.white');
  280 + Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class, 'index'])->name('admin.image_show');
  281 + Route::any('/file/{hash}', [\App\Http\Controllers\File\FileController::class, 'index'])->name('admin.file_show');
  282 + Route::any('/downLoad/files', [\App\Http\Controllers\File\FileController::class, 'downLoad'])->name('admin.files_downLoad');//导出文件
  283 + Route::any('/downLoad/images', [\App\Http\Controllers\File\ImageController::class, 'downLoad'])->name('admin.images_downLoad');//导出图片
  284 + Route::any('/domain/exportData', [Aside\Domain\DomainInfoController::class, 'exportData'])->name('admin.domain_exportData');//导出数据
  285 + Route::any('/notice/project', [Aside\NoticeController::class, 'project'])->name('admin.notice.project');
  286 + Route::any('/sendLoginSms', [Aside\LoginController::class, 'sendLoginSms'])->name('admin.sendLoginSms');//发送验证码
  287 +
  288 +});
  289 +
297 290