作者 lyh

gx

... ... @@ -46,23 +46,26 @@ class ForwardInquiryCount extends Command
*/
public function handle(){
// 获取上个月的开始时间
$startTime = Carbon::now()->subMonth()->startOfMonth();
$startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
// 获取上个月的结束时间
$endTime = Carbon::now()->subMonth()->endOfMonth();
$endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();
$list = DB::table('gl_inquiry_info')->groupBy('user_name')
->select("user_name",DB::raw('COUNT(*) as count'))
->where()->get();
->where('send_time','>=',$startTime.' 00:00:00')
->where('send_time','<=',$endTime.' 23:59:59')
->get();
if(!empty($list)){
$list = $list->toArray();
$forwardModel = new ForwardCount();
foreach ($list as $v){
$data = [
'date'=>date('Y-m',time()),
'date'=>Carbon::now()->subMonth()->format('Y-m'),
'name'=>$v['user_name'],
'count'=>$v['count']
];
$forwardModel->add($data);
}
}
return true;
}
}
... ...
... ... @@ -39,9 +39,9 @@ class InquiryMonthlyCount extends Command
->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
->select($this->selectParam())->get()->toArray();
// 获取上个月的开始时间
$startTime = Carbon::now()->subMonth()->startOfMonth();
$startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
// 获取上个月的结束时间
$endTime = Carbon::now()->subMonth()->endOfMonth();
$endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();
foreach ($list as $value){
$value = (array)$value;
if($value['domain'] != ''){
... ... @@ -105,8 +105,8 @@ class InquiryMonthlyCount extends Command
public function flowCount(&$arr,&$startTime,&$endTime,$project_id){
$pv_ip = DB::table('gl_count')
->where(['project_id'=>$project_id])
->where('date','>=',$startTime->toDateString().' 00:00:00')
->where('date','<=',$endTime->toDateString().' 23:59:59')
->where('date','>=',$startTime.' 00:00:00')
->where('date','<=',$endTime.' 23:59:59')
->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
->first();
$arr['pv'] = $pv_ip->pv_num;
... ... @@ -129,21 +129,21 @@ class InquiryMonthlyCount extends Command
$source = DB::table('gl_customer_visit')
->select('referrer_url', DB::raw('COUNT(*) as count'))
->groupBy('referrer_url')->where(['domain'=>$domain])
->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()])
->whereBetween('updated_date', [$startTime,$endTime])
->orderByDesc('count')->limit(10)->get()->toArray();
$arr['source'] = json_encode($source);
//访问国家前15
$source_country = DB::table('gl_customer_visit')
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
->groupBy('country')->where(['domain'=>$domain])
->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()])
->whereBetween('updated_date', [$startTime,$endTime])
->orderBy('ip','desc')->limit(15)->get()->toArray();
$arr['source_country'] = json_encode($source_country);
//受访界面前15
$referrer_url = DB::table('gl_customer_visit')
->select('url',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()])
->whereBetween('updated_date', [$startTime,$endTime])
->groupBy('url')
->limit(15)->get()->toArray();
$arr['referrer_url'] = json_encode($referrer_url);
... ... @@ -151,7 +151,7 @@ class InquiryMonthlyCount extends Command
$referrer_port = DB::table('gl_customer_visit')
->select('device_port',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()])
->whereBetween('updated_date', [$startTime,$endTime])
->groupBy('device_port')
->limit(15)->get()->toArray();
$arr['referrer_port'] = json_encode($referrer_port);
... ...
... ... @@ -263,8 +263,6 @@ class InquiryInfoController extends BaseController
* @time :2023/8/18 9:18
*/
public function getInternalCount(InquiryInfoLogic $inquiryInfoLogic){
var_dump(Carbon::now()->subMonth()->startOfMonth()->toDateString());
die();
$list = $inquiryInfoLogic->getManagerCount();
$this->response('success',Code::SUCCESS,$list);
}
... ...
<?php
namespace App\Http\Controllers\Aside\Optimize;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Optimize\KeywordsLogic;
/**
* @remark :关键字查询案例
* @class :KeywordsController.php
* @author :lyh
* @time :2023/7/17 9:51
*/
class KeywordsController extends BaseController
{
/**
* @remark :根据关键词获取案例
* @name :lists
* @author :lyh
* @method :post
* @time :2023/7/17 9:52
*/
public function getSearchKeyword(KeywordsLogic $keywordsLogic){
$lists = $keywordsLogic->keySearchList($this->map);
$this->response('success',Code::SUCCESS,$lists);
}
}
<?php
namespace App\Http\Logic\Aside\Optimize;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Product\Keyword;
use App\Models\Project\Project;
use App\Models\RouteMap;
/**
* @remark :关键词查案例
* @class :KeywordsLogic.php
* @author :lyh
* @time :2023/7/22 11:44
*/
class KeywordsLogic extends BaseLogic
{
const ISSET_TYPE = 1;//去重时写入默认值
public function __construct()
{
parent::__construct();
$this->routeMapModel = new RouteMap();
$this->productKeywordModel = new Keyword();
$this->param = $this->requestAll;
}
/**
* @remark :关键字查询案例
* @name :keySearchList
* @author :lyh
* @method :post
* @time :2023/7/22 11:46
*/
public function keySearchList($map){
$data = [];
$map['search'] = ['like','%'.$map['search'].'%'];
$data = $this->searchRouteMap($map,$data);//查询菜单信息表
$data = $this->searchProductKeyword($map,$data);//查询产品关键词表
$data = array_unique($data);
$lists = [];
if(!empty($data)){
$projectModel = new Project();
$lists = $projectModel->formatQuery(['id'=>['in',$data]])->with('deploy_build')->with('deploy_optimize')->get();
}
return $this->success($lists);
}
/**
* @remark :菜单表中查询route关键字
* @name :searchRouteMap
* @author :lyh
* @method :post
* @time :2023/7/22 16:46
*/
public function searchRouteMap($map,&$data){
$keyList = $this->routeMapModel->list(['route'=>$map['search']],'created_at');
foreach ($keyList as $v){
$data[] = $v['project_id'];
}
return $data;
}
/**
* @remark :搜索产品关键字
* @name :searchProductKeyword
* @author :lyh
* @method :post
* @time :2023/7/22 16:52
*/
public function searchProductKeyword($map,&$data){
$keyList = $this->productKeywordModel->list(['title'=>$map['search']]);
foreach ($keyList as $v){
$data[] = $v['project_id'];
}
return $data;
}
}
... ... @@ -122,9 +122,7 @@ class Base extends Model
* @method post
*/
public function add($data){
if(!isset($data['created_at'])){
$data['created_at'] = date('Y-m-d H:i:s');
}
$data['created_at'] = date('Y-m-d H:i:s');
$data['updated_at'] = $data['created_at'];
return $this->insert($data);
}
... ...
... ... @@ -247,26 +247,6 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/getTimeZone', [Aside\Optimize\InquiryInfoController::class, 'getTimeZone'])->name('admin.inquiry_getTimeZone');
Route::any('/getInternalCount', [Aside\Optimize\InquiryInfoController::class, 'getInternalCount'])->name('admin.inquiry_getInternalCount');
});
//关键词查案例
Route::prefix('keyword')->group(function () {
Route::any('/', [Aside\Optimize\KeywordsController::class, 'getSearchKeyword'])->name('admin.keyword_getSearchKeyword');
});
});
//无需登录验证的路由组
Route::group([], function () {
Route::any('/login', [Aside\LoginController::class, 'login'])->name('admin.login.white');
Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class, 'index'])->name('admin.image_show');
Route::any('/file/{hash}', [\App\Http\Controllers\File\FileController::class, 'index'])->name('admin.file_show');
Route::any('/downLoad/files', [\App\Http\Controllers\File\FileController::class, 'downLoad'])->name('admin.files_downLoad');//导出文件
Route::any('/downLoad/images', [\App\Http\Controllers\File\ImageController::class, 'downLoad'])->name('admin.images_downLoad');//导出图片
Route::any('/domain/exportData', [Aside\Domain\DomainInfoController::class, 'exportData'])->name('admin.domain_exportData');//导出数据
Route::any('/notice/project', [Aside\NoticeController::class, 'project'])->name('admin.notice.project');
Route::any('/sendLoginSms', [Aside\LoginController::class, 'sendLoginSms'])->name('admin.sendLoginSms');//发送验证码
// 公共主题模版
Route::prefix('template')->group(function () {
Route::any('/', [Aside\Template\ATemplateController::class, 'lists'])->name('admin.ATemplate_lists');
... ... @@ -294,4 +274,17 @@ Route::group([], function () {
});
});
//无需登录验证的路由组
Route::group([], function () {
Route::any('/login', [Aside\LoginController::class, 'login'])->name('admin.login.white');
Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class, 'index'])->name('admin.image_show');
Route::any('/file/{hash}', [\App\Http\Controllers\File\FileController::class, 'index'])->name('admin.file_show');
Route::any('/downLoad/files', [\App\Http\Controllers\File\FileController::class, 'downLoad'])->name('admin.files_downLoad');//导出文件
Route::any('/downLoad/images', [\App\Http\Controllers\File\ImageController::class, 'downLoad'])->name('admin.images_downLoad');//导出图片
Route::any('/domain/exportData', [Aside\Domain\DomainInfoController::class, 'exportData'])->name('admin.domain_exportData');//导出数据
Route::any('/notice/project', [Aside\NoticeController::class, 'project'])->name('admin.notice.project');
Route::any('/sendLoginSms', [Aside\LoginController::class, 'sendLoginSms'])->name('admin.sendLoginSms');//发送验证码
});
... ...