作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -61,7 +61,7 @@ class GeoQuestionRes extends Command
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
continue;
}
if(empty($taskInfo['question']) || empty($taskInfo['keywords']) || empty($taskInfo['url'])){
if(empty($taskInfo['question']) || (empty($taskInfo['keywords']) && empty($taskInfo['url']) && empty($taskInfo['expect_result']))){
$this->output('task id: ' . $task_id . ', error: 任务数据缺失, continue!');
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
continue;
... ... @@ -113,7 +113,6 @@ class GeoQuestionRes extends Command
}
// 命中文案
$hit_data[] = $result['text'];
if(!empty($result['annotations'])){
$url = array_column(array_column($result['annotations'], 'url_citation'), 'url');
$title = array_column(array_column($result['annotations'], 'url_citation'), 'title');
... ...
... ... @@ -68,9 +68,7 @@ class UpdateRoute extends Command
*/
public function handle()
{
ProjectServer::useProject(4132);
return $this->product_action(4132);
DB::disconnect('custom_mysql');
return $this->_action();
}
/**
... ... @@ -156,12 +154,17 @@ class UpdateRoute extends Command
*/
public function _action(){
$projectModel = new Project();
$lists = $projectModel->list(['delete_status'=>0,'extend_type'=>0,'type'=>['!=',0]],'id',['id']);
$keywordModel = new Keyword();
$lists = $projectModel->list(['id'=>['in',[4379,4380,4381,4382,4383]],'delete_status'=>0,'extend_type'=>0,'type'=>['!=',0]],'id',['id']);
foreach ($lists as $v){
ProjectServer::useProject($v['id']);
echo date('Y-m-d H:i:s').' 执行的项目id:'.$v['id'].PHP_EOL;
$keywordModel->edit(['type'=>1],['id'=>['!=',0]]);
$productModel = new Product();
$productModel->edit(['project_id'=>$v['id']],['id'=>['!=',0]]);
$productLists = $productModel->list([],'id',['id','title','route']);
foreach ($productLists as $item){
$route = RouteMap::setRoute($item['route'],'product',$item['id'],$v['id']);
$productModel->edit(['route'=>$route],['id'=>$item['id']]);
}
DB::disconnect('custom_mysql');
}
return true;
... ...
... ... @@ -55,7 +55,7 @@ class RankData extends BaseCommands
->where('gl_project.delete_status',0)
->where('gl_project_deploy_optimize.api_no', '>', 0)
->whereIn('gl_project.type',[2,4])
->whereRaw("FIND_IN_SET('2', gl_project.level) = 0 AND FIND_IN_SET('3', gl_project.level) = 0")
->whereRaw("FIND_IN_SET('2', gl_project.level) = 0")
->select(['gl_project_deploy_optimize.api_no as api_no', 'gl_project_deploy_optimize.project_id as project_id'])
->orderBy('gl_project.id', 'asc')
->get()->toArray();
... ...
... ... @@ -77,23 +77,27 @@ class TicketCount extends Command
$ticketManageCountModel = new TicketDailyManageCount();
foreach ($manageList as $item){
$average_time = null;
$timeout_ratio = null;
$this->output('按人员统计:执行的人员名称/id:'.$item['name'].'/'.$item['manage_id']);
$ticketLogModel = new TicketLog();
$ticket_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1]);
//工单总时长
$timeCount = $ticketLogModel->formatQuery(['engineer_id'=>$item['manage_id'],'is_engineer'=>1])->sum('end_time');
$ticket_end_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1,'end_at'=>['!=',null]]);
$complete_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1,'end_at'=>['!=',null]]);
if(!empty($timeCount)){
$average_time = round($timeCount / $ticket_end_num, 2);
$average_time = round($timeCount / $complete_num, 2);
}
//最快完成的时间
$fastest_time = $ticketLogModel->formatQuery(['engineer_id'=>$item['manage_id'],'is_engineer'=>1,'end_at'=>['!=',null]])->min('end_time');
//最快完成时间
if(!$fastest_time){
$fastest_time = null;
}
//超时工单数量
$timeout_num = $ticketLogModel->counts(['end_at'=>null,'engineer_id'=>$item['manage_id'],'is_engineer'=>1,'plan_end_at'=>['>',date('Y-m-d H:i:s')]]);
$complete_num = $ticketLogModel->counts(['end_at'=>['!=',null],'engineer_id'=>$item['manage_id'],'is_engineer'=>1]);
$timeout_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1,'plan_end_at'=>['>',date('Y-m-d H:i:s')]]);
if(!empty($timeout_num)){
$timeout_ratio = round($timeout_num / $ticket_num, 2);
}
$data = [
'date'=>$date,
'manage_id'=>$item['id'],
... ... @@ -103,7 +107,8 @@ class TicketCount extends Command
'fastest_time'=>$fastest_time ?? null,//最快完成工单时间
'timeout_num'=>$timeout_num,//超时工单数量
'complete_num'=>$complete_num,//完成工单数量
'dept_id'=>$item['dept_id']
'dept_id'=>$item['dept_id'],
'timeout_ratio'=>$timeout_ratio ?? null
];
//查询当前用户是否当日已有记录
$ticketManageInfo = $ticketManageCountModel->read(['date'=>$date,'manage_id'=>$item['id']],['id']);
... ... @@ -134,6 +139,7 @@ class TicketCount extends Command
$date = Carbon::yesterday()->toDateString(); // "2025-08-07"
foreach ($groupList as $item){
$average_time = null;
$timeout_ratio = null;
$this->output('组统计:执行的组/id:'.$item['name'].'/'.$item['id']);
$manageIdArr = $manageHrModel->selectField(['belong_group'=>$item['id'],'status'=>1,'dept_id'=>1],'manage_id');
$ticket_num = $ticketLogModel->counts(['engineer_id'=>['in',$manageIdArr],'is_engineer'=>1]);
... ... @@ -141,12 +147,19 @@ class TicketCount extends Command
if(!empty($timeCount)){
$average_time = round($timeCount / $ticket_num, 2);
}
//超期工单数量
$timeout_num = $ticketLogModel->counts(['engineer_id'=>['in',$manageIdArr],'is_engineer'=>1,'plan_end_at'=>['>',date('Y-m-d H:i:s')]]);
if(!empty($timeout_num)){
$timeout_ratio = round($timeout_num / $ticket_num, 2);
}
$data = [
'date'=>$date,
'dept_id'=>$item['id'],
'dept_name'=>$item['name'],
'ticket_num'=>$ticket_num ?? 0,
'average_time'=>$average_time ?? null
'average_time'=>$average_time ?? null,
'timeout_ratio'=>$timeout_ratio ?? null,
'timeout_num'=>$timeout_num
];
$deptInfo = $ticketDailyDeptModel->read(['date'=>$date,'dept_id'=>$item['id']],['id']);
if($deptInfo === false){
... ... @@ -186,6 +199,11 @@ class TicketCount extends Command
)
->groupBy('p.project_cate')
->pluck('ticket_count', 'project_cate');
$timeout_num = $ticketModel->counts(['end_at'=>null,'plan_end_at'=>['>',date('Y-m-d H:i:s')]]);
$timeout_ratio = null;
if(!empty($timeout_num)){
$timeout_ratio = round($timeout_num / $ticket_num, 2);
}
$data = [
'date' => $date,
'ticket_num'=>$ticket_num,
... ... @@ -194,7 +212,9 @@ class TicketCount extends Command
'processed_num'=>$processed_num,
'average_time'=>$average_time ?? null,
'source'=>json_encode(['a'=>$submit_a_side,'b'=>$submit_b_side],true),
'source_type'=>json_encode($dbResult,true)
'source_type'=>json_encode($dbResult,true),
'timeout_num'=>$timeout_num,
'timeout_ratio'=>$timeout_ratio ?? null
];
$ticketDailyModel = new TicketDailyCount();
$ticketDailyInfo = $ticketDailyModel->read(['date'=>$date],['id']);
... ...
... ... @@ -96,15 +96,11 @@ class GeoQuestionController extends BaseController
$this->request->validate([
'project_id'=>'required',
'question'=>'required',
'keywords'=>'required',
'url'=>'required',
'status'=>'required',
'type'=>'required',
],[
'project_id.required' => '项目ID不能为空',
'question.required' => 'question不能为空',
'keywords.required' => 'keywords不能为空',
'url.required' => 'url不能为空',
'status.required' => 'status不能为空',
'type.required' => 'type类型不能为空',
]);
... ...
... ... @@ -61,6 +61,15 @@ class RenewProjectController extends BaseController
if(!empty($param['search']) && !empty($param['search_type'])){
$map[$this->param['search_type']] = ['like', "%{$this->param['search']}%"];
}
if(isset($param['zone_id']) && !empty($param['zone_id'])){
$map['channel'] = ['like','%"zone_id": "'.$this->map['zone_id'].'"%'];
}
if(isset($param['channel_id']) && !empty($param['channel_id'])){
$map['channel'] = ['like','%"channel_id": "'.$this->map['channel_id'].'"%'];
}
if(isset($param['user_id']) && !empty($param['user_id'])){
$map['channel'] = ['like','%"user_id": "'.$this->map['user_id'].'"%'];
}
//按类型搜索
$map['delete_status'] = 0;
if(empty($param['type'])){
... ...
... ... @@ -25,7 +25,7 @@ class ATemplateController extends BaseController
*/
public function lists(ATemplateLogic $aTemplateLogic){
$templateLabel = new TemplateLabel();
$this->searchLabelName($templateLabel);
$this->map = $this->searchLabelName($templateLabel);
$filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id'];
$lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed);
if(!empty($lists) && !empty($lists['list'])){
... ... @@ -51,7 +51,7 @@ class ATemplateController extends BaseController
$this->map['id'] = ['in',$id_arr];
unset($this->map['label_name']);
}
return true;
return $this->map;
}
/**
... ...
... ... @@ -28,7 +28,7 @@ class ATemplateModuleController extends BaseController
public function lists(TemplateModule $templateModule){
$templateLabel = new TemplateLabel();
$this->map['deleted_status'] = 0;
$this->searchLabelName($templateLabel);
$this->map = $this->searchLabelName($templateLabel);
$lists = $templateModule->lists($this->map,$this->page,$this->row,$this->order);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
... ... @@ -52,7 +52,7 @@ class ATemplateModuleController extends BaseController
$this->map['id'] = ['in',$id_arr];
unset($this->map['label_name']);
}
return true;
return $this->map;
}
... ...
... ... @@ -117,4 +117,16 @@ class GeoQuestionResController extends BaseController
$data = $this->logic->getSearchDate();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取当前项目所有标签
* @name :getLabel
* @author :lyh
* @method :post
* @time :2025/8/19 16:39
*/
public function getLabel(){
$data = $this->logic->getLabelData();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -34,7 +34,6 @@ class AggregateKeywordLogic extends BaseLogic
$this->param['id'] = $this->model->addReturnId($this->param);
// 添加预设功能 同步关键词 迁入到 namespace App\Console\Commands\Product\SetKeywordSync
}
return $this->success(['id'=>$this->param['id']]);
}
... ...
... ... @@ -61,10 +61,11 @@ class TicketLogic extends BaseLogic
$dailyModel = new TicketDailyCount();
$dailyList = $dailyModel->list([],'date',['*'],'desc',5);//取最近5条数据
$manageModel = new TicketDailyManageCount();
$manageList = $manageModel->list(['date'=>$date,'ticket_num'=>['!=',0],'average_time'=>['!=','']],'average_time',['*'],'asc',5);//取最近5条数据
$manageList = $manageModel->list(['dept_id'=>1,'date'=>$date,'ticket_num'=>['!=',0],'average_time'=>['!=','']],'average_time',['*'],'asc');
$manage2List = $manageModel->list(['dept_id'=>2,'date'=>$date,'ticket_num'=>['!=',0],'average_time'=>['!=','']],'average_time',['*'],'asc');
$deptModel = new TicketDailyDeptCount();
$deptList = $deptModel->list(['date'=>$date,'ticket_num'=>['!=',0]],'average_time',['*'],'asc',5);
$data = ['daily'=>$dailyList,'manage'=>$manageList,'dept'=>$deptList];
$deptList = $deptModel->list(['date'=>$date,'ticket_num'=>['!=',0]],'average_time',['*'],'asc');
$data = ['daily'=>$dailyList,'manage'=>$manageList,'manage2'=>$manage2List,'dept'=>$deptList];
return $this->success($data);
}
... ...
... ... @@ -60,10 +60,10 @@ class GeoQuestionResLogic extends BaseLogic
$map['keywords'] = ['like','%'.$map['keywords'].'%'];
}
$query = $this->model->formatQuery($map);
$query = $query->where(function ($q) {
$q->whereRaw('JSON_LENGTH(keywords) > 0')
->orWhereRaw('JSON_LENGTH(url) > 0');
});
// $query = $query->where(function ($q) {
// $q->whereRaw('JSON_LENGTH(keywords) > 0')
// ->orWhereRaw('JSON_LENGTH(url) > 0');
// });
$data = $query->orderByRaw('CHAR_LENGTH(question) ASC')->paginate($row, $filed, 'page', $page);;
return $this->success($data);
}
... ... @@ -144,4 +144,21 @@ class GeoQuestionResLogic extends BaseLogic
return $this->success($dates);
}
/**
* @remark :获取标签列表
* @name :getLabelData
* @author :lyh
* @method :post
* @time :2025/8/19 16:42
*/
public function getLabelData(){
$questionModel = new GeoQuestion();
$labelArr = $questionModel->selectField(['project_id'=>$this->user['project_id']],'label');
$data = [];
foreach ($labelArr as $item){
$arr = explode("\r\n",$item);
$data = array_values(array_unique(array_merge($arr,$data)));
}
return $this->success($data);
}
}
... ...
... ... @@ -67,7 +67,7 @@ class RankDataLogic extends BaseLogic
$speed = Speed::where('project_id', $project_id)->first();
//暂停优化的项目(排名数据显示横杠 - ,关键词排名第一页 、 关键词排名前十页 、 Google收录页面数 、 可查询外链数)
if(!empty($project['level'])){
if (in_array('2', $project['level']) || in_array('3', $project['level'])) {
if (in_array('2', $project['level'])) {// || in_array('3', $project['level'])
$rank['first_page_num'] = $rank['first_ten_pages_num'] = $rank['indexed_pages_num'] = $external_links['total'] = '-';
}
}
... ...
... ... @@ -64,7 +64,8 @@ class Channel extends Base
return $sales_id;
}
$channel_alias = self::where('id', $user['channel_id'])->value('alias');
$channel_alias = $channel_alias . '-' . $user['name'];
$channel_mobile = self::where('id', $user['channel_id'])->value('contact_mobile');
$channel_alias = $channel_alias . '-' . $user['name'].'-'.$channel_mobile;
Cache::put('channel_alias_'.$sales_id,$channel_alias,24 * 3600);
}
return $channel_alias;
... ...
... ... @@ -754,6 +754,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('geo_result')->group(function () {
Route::any('/getList', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class,'getList'])->name('geo_result_getList');
Route::any('/getInfo', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class,'getInfo'])->name('geo_result_getInfo');
Route::any('/getLabel', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class,'getLabel'])->name('geo_result_getLabel');
Route::any('/getType', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getType'])->name('geo_result_getType');//geo设置类型
Route::any('/getCount', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getCount'])->name('geo_result_getCount');//geo设置类型统计数量
Route::any('/countQuantity', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'countQuantity'])->name('geo_result_countQuantity');//geo统计
... ...