作者 ZhengBing He

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

@@ -77,14 +77,16 @@ class AiBlogAutoPublish extends Command @@ -77,14 +77,16 @@ class AiBlogAutoPublish extends Command
77 $this->output("项目{$project->id}未到执行时间" . $next_auto_date); 77 $this->output("项目{$project->id}未到执行时间" . $next_auto_date);
78 continue; 78 continue;
79 } 79 }
80 - //核心关键词+网站关键词 80 + //核心关键词+网站关键词+白帽关键词
81 $main_keywords = ProjectKeyword::where('project_id', $project->id)->value('main_keyword'); 81 $main_keywords = ProjectKeyword::where('project_id', $project->id)->value('main_keyword');
82 $main_keywords = explode("\r\n", $main_keywords); 82 $main_keywords = explode("\r\n", $main_keywords);
  83 + $seo_keywords = ProjectKeyword::where('project_id', $project->id)->value('seo_keywords');
  84 + $seo_keywords = explode("\r\n", $seo_keywords);
83 ProjectServer::useProject($project->id); 85 ProjectServer::useProject($project->id);
84 $site_keywords = WebSetting::where('project_id', $project->id)->value('keyword'); 86 $site_keywords = WebSetting::where('project_id', $project->id)->value('keyword');
85 DB::disconnect('custom_mysql'); 87 DB::disconnect('custom_mysql');
86 $site_keywords = explode(",", $site_keywords); 88 $site_keywords = explode(",", $site_keywords);
87 - $keywords = array_filter(array_merge($main_keywords, $site_keywords)); 89 + $keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords));
88 $keywords = array_map('trim', $keywords); 90 $keywords = array_map('trim', $keywords);
89 if (empty($keywords)) { 91 if (empty($keywords)) {
90 $this->output("项目{$project->id}未获取到关键词"); 92 $this->output("项目{$project->id}未获取到关键词");
@@ -87,6 +87,9 @@ class CountProject extends Command @@ -87,6 +87,9 @@ class CountProject extends Command
87 //剩余服务时常 87 //剩余服务时常
88 $arr['service_day'] = $projectInfo['remain_day']; 88 $arr['service_day'] = $projectInfo['remain_day'];
89 $arr = $this->inquiry($arr,$domain, $project_id,$projectInfo['is_upgrade'] ?? 0); 89 $arr = $this->inquiry($arr,$domain, $project_id,$projectInfo['is_upgrade'] ?? 0);
  90 + if($arr === false){
  91 + continue;
  92 + }
90 //查询当天数据是否存在 存在则更新 93 //查询当天数据是否存在 存在则更新
91 $info = $count->read(['date'=>$v['updated_date'],'project_id'=>$project_id]); 94 $info = $count->read(['date'=>$v['updated_date'],'project_id'=>$project_id]);
92 if($info === false){ 95 if($info === false){
@@ -146,7 +149,7 @@ class CountProject extends Command @@ -146,7 +149,7 @@ class CountProject extends Command
146 public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){ 149 public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){
147 $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade); 150 $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade);
148 if($inquiry_list == false){ 151 if($inquiry_list == false){
149 - return false; 152 + return $arr;
150 } 153 }
151 // echo date('Y-m-d H:i:s') . '拉取询盘状态:' .json_encode($inquiry_list) . PHP_EOL; 154 // echo date('Y-m-d H:i:s') . '拉取询盘状态:' .json_encode($inquiry_list) . PHP_EOL;
152 if($inquiry_list['status'] == self::STATUS_ERROR){ 155 if($inquiry_list['status'] == self::STATUS_ERROR){
@@ -14,6 +14,8 @@ use App\Models\Devops\ServersIp; @@ -14,6 +14,8 @@ use App\Models\Devops\ServersIp;
14 use App\Models\Domain\DomainCreateTask; 14 use App\Models\Domain\DomainCreateTask;
15 use App\Models\Project\CountryCustom; 15 use App\Models\Project\CountryCustom;
16 use App\Models\Project\Project; 16 use App\Models\Project\Project;
  17 +use App\Models\ProjectAssociation\ProjectAssociation;
  18 +use App\Models\Workchat\MessagePush;
17 use Illuminate\Console\Command; 19 use Illuminate\Console\Command;
18 use App\Models\Domain\DomainInfo as DomainInfoModel; 20 use App\Models\Domain\DomainInfo as DomainInfoModel;
19 use Illuminate\Support\Facades\Log; 21 use Illuminate\Support\Facades\Log;
@@ -69,6 +71,7 @@ class DomainInfo extends Command @@ -69,6 +71,7 @@ class DomainInfo extends Command
69 $projectModel = new Project(); 71 $projectModel = new Project();
70 $serverIpModel = new ServersIp(); 72 $serverIpModel = new ServersIp();
71 $domainCreateTaskModel = new DomainCreateTask(); 73 $domainCreateTaskModel = new DomainCreateTask();
  74 + $end_day = date('Y-m-d H:i:s', strtotime('+1 month'));//域名1月后到期
72 $list = $domainModel->where('status', '=', 1)->get(); 75 $list = $domainModel->where('status', '=', 1)->get();
73 foreach ($list as $v) { 76 foreach ($list as $v) {
74 $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']); 77 $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']);
@@ -90,7 +93,7 @@ class DomainInfo extends Command @@ -90,7 +93,7 @@ class DomainInfo extends Command
90 $v->save(); 93 $v->save();
91 } 94 }
92 95
93 - if (empty($v['domain_end_time']) || $v['domain_end_time'] < date('Y-m-d H:i:s')) { 96 + if (empty($v['domain_end_time']) || $v['domain_end_time'] < $end_day) {
94 //获取主站域名有效期并更新 97 //获取主站域名有效期并更新
95 $valid_time = $this->getDomainValidTime($v['domain']); 98 $valid_time = $this->getDomainValidTime($v['domain']);
96 if ($valid_time['start'] && $valid_time['end']) { 99 if ($valid_time['start'] && $valid_time['end']) {
@@ -99,6 +102,12 @@ class DomainInfo extends Command @@ -99,6 +102,12 @@ class DomainInfo extends Command
99 $v->save(); 102 $v->save();
100 } 103 }
101 } 104 }
  105 +
  106 + //域名到期提醒
  107 + if ($v->domain_end_time && $v->domain_end_time < $end_day) {
  108 + $is_end = $v->domain_end_time < date('Y-m-d H:i:s') ? 1 : 0;
  109 + $this->domainChatMessage($v['project_id'], $v['id'], $v['domain'], $is_end);
  110 + }
102 } else { 111 } else {
103 //除自建站项目外,记录已解析到别的ip的域名 112 //除自建站项目外,记录已解析到别的ip的域名
104 if (!check_domain_record($v['domain'], $servers_ip_info)) { 113 if (!check_domain_record($v['domain'], $servers_ip_info)) {
@@ -125,7 +134,7 @@ class DomainInfo extends Command @@ -125,7 +134,7 @@ class DomainInfo extends Command
125 $v->save(); 134 $v->save();
126 } 135 }
127 136
128 - if (empty($v['domain_end_time']) || $v['domain_end_time'] < date('Y-m-d H:i:s')) { 137 + if (empty($v['domain_end_time']) || $v['domain_end_time'] < $end_day) {
129 //获取主站域名有效期并更新 138 //获取主站域名有效期并更新
130 $valid_time = $this->getDomainValidTime($v['domain']); 139 $valid_time = $this->getDomainValidTime($v['domain']);
131 if ($valid_time['start'] && $valid_time['end']) { 140 if ($valid_time['start'] && $valid_time['end']) {
@@ -135,6 +144,12 @@ class DomainInfo extends Command @@ -135,6 +144,12 @@ class DomainInfo extends Command
135 } 144 }
136 } 145 }
137 146
  147 + //域名到期提醒
  148 + if ($v->domain_end_time && $v->domain_end_time < $end_day) {
  149 + $is_end = $v->domain_end_time < date('Y-m-d H:i:s') ? 1 : 0;
  150 + $this->domainChatMessage($v['project_id'], $v['id'], $v['domain'], $is_end);
  151 + }
  152 +
138 if ($v['amp_status'] == 1) { 153 if ($v['amp_status'] == 1) {
139 $domain_array = parse_url($v['domain']); 154 $domain_array = parse_url($v['domain']);
140 $host = $domain_array['host'] ?? $domain_array['path']; 155 $host = $domain_array['host'] ?? $domain_array['path'];
@@ -177,7 +192,7 @@ class DomainInfo extends Command @@ -177,7 +192,7 @@ class DomainInfo extends Command
177 $projectModel = new Project(); 192 $projectModel = new Project();
178 $serverIpModel = new ServersIp(); 193 $serverIpModel = new ServersIp();
179 $domainCreateTaskModel = new DomainCreateTask(); 194 $domainCreateTaskModel = new DomainCreateTask();
180 - $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 195 + $end_day = date('Y-m-d H:i:s', strtotime('+3 day'));//3天后到期
181 $list = $domainModel->where('status', '=', 1)->where('type', '!=', 2)->where('certificate_end_time', '<', $end_day)->get()->toArray(); 196 $list = $domainModel->where('status', '=', 1)->where('type', '!=', 2)->where('certificate_end_time', '<', $end_day)->get()->toArray();
182 foreach ($list as $v) { 197 foreach ($list as $v) {
183 $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']); 198 $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']);
@@ -230,7 +245,7 @@ class DomainInfo extends Command @@ -230,7 +245,7 @@ class DomainInfo extends Command
230 $projectModel = new Project(); 245 $projectModel = new Project();
231 $serverIpModel = new ServersIp(); 246 $serverIpModel = new ServersIp();
232 $domainCreateTaskModel = new DomainCreateTask(); 247 $domainCreateTaskModel = new DomainCreateTask();
233 - $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 248 + $end_day = date('Y-m-d H:i:s', strtotime('+3 day'));//3天后到期
234 $list = $domainModel->where('status', '=', 1)->where('amp_status', 1)->where('amp_type', '!=', 2)->where('amp_certificate_end_time', '<', $end_day)->get()->toArray(); 249 $list = $domainModel->where('status', '=', 1)->where('amp_status', 1)->where('amp_type', '!=', 2)->where('amp_certificate_end_time', '<', $end_day)->get()->toArray();
235 foreach ($list as $v) { 250 foreach ($list as $v) {
236 $domain_array = parse_url($v['domain']); 251 $domain_array = parse_url($v['domain']);
@@ -287,7 +302,7 @@ class DomainInfo extends Command @@ -287,7 +302,7 @@ class DomainInfo extends Command
287 $projectModel = new Project(); 302 $projectModel = new Project();
288 $serverIpModel = new ServersIp(); 303 $serverIpModel = new ServersIp();
289 $domainCreateTaskModel = new DomainCreateTask(); 304 $domainCreateTaskModel = new DomainCreateTask();
290 - $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 305 + $end_day = date('Y-m-d H:i:s', strtotime('+3 day'));//3天后到期
291 $list = $customModel->where('status', 1)->where('is_create', 1)->where('type', '=', 1)->where('certificate_end_time', '<', $end_day)->get()->toArray(); 306 $list = $customModel->where('status', 1)->where('is_create', 1)->where('type', '=', 1)->where('certificate_end_time', '<', $end_day)->get()->toArray();
292 foreach ($list as $v) { 307 foreach ($list as $v) {
293 $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id']); 308 $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id']);
@@ -379,4 +394,38 @@ class DomainInfo extends Command @@ -379,4 +394,38 @@ class DomainInfo extends Command
379 } 394 }
380 return ['start' => $start, 'end' => $end]; 395 return ['start' => $start, 'end' => $end];
381 } 396 }
  397 +
  398 + /**
  399 + * 推送域名到期微信消息提醒
  400 + * @param $project_id
  401 + * @param $domain_id
  402 + * @param $domain
  403 + * @param $is_end
  404 + * @author Akun
  405 + * @date 2025/08/14 9:56
  406 + */
  407 + public function domainChatMessage($project_id, $domain_id, $domain, $is_end)
  408 + {
  409 + //项目是否有绑定群
  410 + $friend_id = ProjectAssociation::where('project_id', $project_id)
  411 + ->where('status', ProjectAssociation::STATUS_NORMAL)
  412 + ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)
  413 + ->value('friend_id');
  414 + if ($friend_id) {
  415 + $tips = $is_end ? ' 已经到期' : ' 即将到期';
  416 + $message = '【域名到期提醒】' . PHP_EOL . '域名 ' . $domain . $tips . ',请及时处理。';
  417 + $param = [
  418 + 'project_id' => $project_id,
  419 + 'friend_id' => $friend_id,
  420 + 'type' => MessagePush::TYPE_DOMAIN,
  421 + 'content' => $message,
  422 + 'ref_ids' => $domain_id,
  423 + 'send_time' => date('Y-m-d 14:00:00'),
  424 + 'status' => 0,
  425 + ];
  426 + //写入一条推送消息 自动消费
  427 + $messagePushModel = new MessagePush();
  428 + $messagePushModel->add($param);
  429 + }
  430 + }
382 } 431 }
@@ -35,7 +35,7 @@ class RemainDay extends Command @@ -35,7 +35,7 @@ class RemainDay extends Command
35 * 按照达标天数收费的项目(白帽) 35 * 按照达标天数收费的项目(白帽)
36 */ 36 */
37 protected $bm_projectId = [ 37 protected $bm_projectId = [
38 - 4247,4299,4310,4215,4038,4084,4148 38 + 4247,4299,4310,4215,4038,4084,4148,4178
39 ]; 39 ];
40 40
41 41
@@ -83,7 +83,7 @@ class RemainDay extends Command @@ -83,7 +83,7 @@ class RemainDay extends Command
83 * @time :2025/4/2 10:48 83 * @time :2025/4/2 10:48
84 */ 84 */
85 public function saveRemainDay(){ 85 public function saveRemainDay(){
86 - $list = $this->project->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR,Project::TYPE_SIX]]],'id',['id','type','uptime','remain_day','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day']); 86 + $list = $this->project->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR,Project::TYPE_SIX]]],'id',['id','type','level','uptime','remain_day','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day']);
87 foreach ($list as $item){ 87 foreach ($list as $item){
88 $deploy_build = $this->deployBuild->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']); 88 $deploy_build = $this->deployBuild->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']);
89 echo 'start->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL; 89 echo 'start->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
@@ -120,7 +120,7 @@ class RemainDay extends Command @@ -120,7 +120,7 @@ class RemainDay extends Command
120 //白帽版本的系统 120 //白帽版本的系统
121 if($deploy_build['seo_plan'] == 1){ 121 if($deploy_build['seo_plan'] == 1){
122 if($deploy_build['seo_service_duration'] != 0){ 122 if($deploy_build['seo_service_duration'] != 0){
123 - if(in_array($item['id'],$this->bm_projectId)){ 123 + if(in_array($item['id'],$this->bm_projectId) || (strpos($item['level'], '19') !== false)){
124 $compliance_day = (int)$item['bm_finish_remain_day']; 124 $compliance_day = (int)$item['bm_finish_remain_day'];
125 $seo_remain_day = $deploy_build['seo_service_duration'] - (int)$item['bm_finish_remain_day']; 125 $seo_remain_day = $deploy_build['seo_service_duration'] - (int)$item['bm_finish_remain_day'];
126 }else{ 126 }else{
@@ -113,6 +113,14 @@ class GeoQuestionRes extends Command @@ -113,6 +113,14 @@ class GeoQuestionRes extends Command
113 } 113 }
114 // 命中文案 114 // 命中文案
115 $hit_data[] = $result['text']; 115 $hit_data[] = $result['text'];
  116 +
  117 + if(!empty($result['annotations'])){
  118 + $url = array_column(array_column($result['annotations'], 'url_citation'), 'url');
  119 + $title = array_column(array_column($result['annotations'], 'url_citation'), 'title');
  120 + $hit_data = array_merge($url, $title, $hit_data);
  121 + }
  122 + $hit = 0;
  123 + //todo::与预期结果是否复合
116 if(!empty($taskInfo['expect_result'])){ 124 if(!empty($taskInfo['expect_result'])){
117 $str = "客户提出的问题:{$question},客户得到的回复:{$result['text']},客户需要预期:{$taskInfo['expect_result']},请分析得到的回复和预期是否一致,仅回复我是或者否"; 125 $str = "客户提出的问题:{$question},客户得到的回复:{$result['text']},客户需要预期:{$taskInfo['expect_result']},请分析得到的回复和预期是否一致,仅回复我是或者否";
118 $strResult = $geo_service->getChatResult($str, 'gpt-4o-mini'); 126 $strResult = $geo_service->getChatResult($str, 'gpt-4o-mini');
@@ -120,6 +128,7 @@ class GeoQuestionRes extends Command @@ -120,6 +128,7 @@ class GeoQuestionRes extends Command
120 switch ($strResult['text']){ 128 switch ($strResult['text']){
121 case '是': 129 case '是':
122 $is_match = 1; 130 $is_match = 1;
  131 + $hit++;
123 break; 132 break;
124 case '否': 133 case '否':
125 $is_match = 2; 134 $is_match = 2;
@@ -130,12 +139,6 @@ class GeoQuestionRes extends Command @@ -130,12 +139,6 @@ class GeoQuestionRes extends Command
130 } 139 }
131 } 140 }
132 } 141 }
133 - if(!empty($result['annotations'])){  
134 - $url = array_column(array_column($result['annotations'], 'url_citation'), 'url');  
135 - $title = array_column(array_column($result['annotations'], 'url_citation'), 'title');  
136 - $hit_data = array_merge($url, $title, $hit_data);  
137 - }  
138 - $hit = 0;  
139 $hit_keyword = $this->getKeywords($taskInfo['keywords'],$hit_data); 142 $hit_keyword = $this->getKeywords($taskInfo['keywords'],$hit_data);
140 if (!empty($hit_keyword['keywords'])) { 143 if (!empty($hit_keyword['keywords'])) {
141 $hit++; 144 $hit++;
@@ -19,6 +19,7 @@ use App\Models\WorkOrder\TicketProject; @@ -19,6 +19,7 @@ use App\Models\WorkOrder\TicketProject;
19 use App\Models\WorkOrder\Tickets; 19 use App\Models\WorkOrder\Tickets;
20 use Illuminate\Console\Command; 20 use Illuminate\Console\Command;
21 use Illuminate\Support\Carbon; 21 use Illuminate\Support\Carbon;
  22 +use Illuminate\Support\Facades\DB;
22 use Illuminate\Support\Facades\Log; 23 use Illuminate\Support\Facades\Log;
23 24
24 class TicketCount extends Command 25 class TicketCount extends Command
@@ -75,6 +76,7 @@ class TicketCount extends Command @@ -75,6 +76,7 @@ class TicketCount extends Command
75 $date = Carbon::yesterday()->toDateString(); // 昨日时间 76 $date = Carbon::yesterday()->toDateString(); // 昨日时间
76 $ticketManageCountModel = new TicketDailyManageCount(); 77 $ticketManageCountModel = new TicketDailyManageCount();
77 foreach ($manageList as $item){ 78 foreach ($manageList as $item){
  79 + $average_time = '';
78 $this->output('按人员统计:执行的人员名称/id:'.$item['name'].'/'.$item['manage_id']); 80 $this->output('按人员统计:执行的人员名称/id:'.$item['name'].'/'.$item['manage_id']);
79 $ticketLogModel = new TicketLog(); 81 $ticketLogModel = new TicketLog();
80 $ticket_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1]); 82 $ticket_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1]);
@@ -128,6 +130,7 @@ class TicketCount extends Command @@ -128,6 +130,7 @@ class TicketCount extends Command
128 $ticketDailyDeptModel = new TicketDailyDeptCount(); 130 $ticketDailyDeptModel = new TicketDailyDeptCount();
129 $date = Carbon::yesterday()->toDateString(); // "2025-08-07" 131 $date = Carbon::yesterday()->toDateString(); // "2025-08-07"
130 foreach ($groupList as $item){ 132 foreach ($groupList as $item){
  133 + $average_time = '';
131 $this->output('组统计:执行的组/id:'.$item['name'].'/'.$item['id']); 134 $this->output('组统计:执行的组/id:'.$item['name'].'/'.$item['id']);
132 $manageIdArr = $manageHrModel->selectField(['belong_group'=>$item['id'],'status'=>1,'dept_id'=>1],'manage_id'); 135 $manageIdArr = $manageHrModel->selectField(['belong_group'=>$item['id'],'status'=>1,'dept_id'=>1],'manage_id');
133 $ticket_num = $ticketLogModel->counts(['engineer_id'=>['in',$manageIdArr],'is_engineer'=>1]); 136 $ticket_num = $ticketLogModel->counts(['engineer_id'=>['in',$manageIdArr],'is_engineer'=>1]);
@@ -140,7 +143,7 @@ class TicketCount extends Command @@ -140,7 +143,7 @@ class TicketCount extends Command
140 'dept_id'=>$item['id'], 143 'dept_id'=>$item['id'],
141 'dept_name'=>$item['name'], 144 'dept_name'=>$item['name'],
142 'ticket_num'=>$ticket_num ?? 0, 145 'ticket_num'=>$ticket_num ?? 0,
143 - 'average_time'=>$average_time ?? 0 146 + 'average_time'=>$average_time ?? ''
144 ]; 147 ];
145 $deptInfo = $ticketDailyDeptModel->read(['date'=>$date,'dept_id'=>$item['id']],['id']); 148 $deptInfo = $ticketDailyDeptModel->read(['date'=>$date,'dept_id'=>$item['id']],['id']);
146 if($deptInfo === false){ 149 if($deptInfo === false){
@@ -173,6 +176,13 @@ class TicketCount extends Command @@ -173,6 +176,13 @@ class TicketCount extends Command
173 $processed_num = $ticketModel->counts(['end_at'=>['between',[$date.' 00:00:00',$date.' 23:59:59']]]); 176 $processed_num = $ticketModel->counts(['end_at'=>['between',[$date.' 00:00:00',$date.' 23:59:59']]]);
174 $submit_a_side = $ticketModel->formatQuery(['submit_side'=>1])->sum('submit_side'); 177 $submit_a_side = $ticketModel->formatQuery(['submit_side'=>1])->sum('submit_side');
175 $submit_b_side = $ticketModel->formatQuery(['submit_side'=>2])->sum('submit_side'); 178 $submit_b_side = $ticketModel->formatQuery(['submit_side'=>2])->sum('submit_side');
  179 + $dbResult = DB::table('gl_ticket_projects as p')->leftJoin('gl_tickets as t', 'p.id', '=', 't.project_id')
  180 + ->select(
  181 + 'p.project_cate',
  182 + DB::raw('COUNT(t.id) as ticket_count')
  183 + )
  184 + ->groupBy('p.project_cate')
  185 + ->pluck('ticket_count', 'project_cate');
176 $data = [ 186 $data = [
177 'date' => $date, 187 'date' => $date,
178 'ticket_num'=>$ticket_num, 188 'ticket_num'=>$ticket_num,
@@ -181,6 +191,7 @@ class TicketCount extends Command @@ -181,6 +191,7 @@ class TicketCount extends Command
181 'processed_num'=>$processed_num, 191 'processed_num'=>$processed_num,
182 'average_time'=>$average_time ?? '', 192 'average_time'=>$average_time ?? '',
183 'source'=>json_encode(['a'=>$submit_a_side,'b'=>$submit_b_side],true), 193 'source'=>json_encode(['a'=>$submit_a_side,'b'=>$submit_b_side],true),
  194 + 'source_type'=>json_encode($dbResult,true)
184 ]; 195 ];
185 $ticketDailyModel = new TicketDailyCount(); 196 $ticketDailyModel = new TicketDailyCount();
186 $ticketDailyInfo = $ticketDailyModel->read(['date'=>$date],['id']); 197 $ticketDailyInfo = $ticketDailyModel->read(['date'=>$date],['id']);
@@ -37,7 +37,7 @@ class BaseController extends Controller @@ -37,7 +37,7 @@ class BaseController extends Controller
37 $info = Cache::get(Common::MANAGE_TOKEN . $this->token); 37 $info = Cache::get(Common::MANAGE_TOKEN . $this->token);
38 if(!empty($this->token) && !empty($info)){ 38 if(!empty($this->token) && !empty($info)){
39 $this->manage = $info; 39 $this->manage = $info;
40 - Cache::put(Common::MANAGE_TOKEN . $this->token, $info, 3600 * 6);//更新缓存时间 40 + Cache::put(Common::MANAGE_TOKEN . $this->token, $info, 3600 * 12);//更新缓存时间
41 $this->uid = $info['id']; 41 $this->uid = $info['id'];
42 } 42 }
43 } 43 }
@@ -779,13 +779,15 @@ class ProjectController extends BaseController @@ -779,13 +779,15 @@ class ProjectController extends BaseController
779 * @author zbj 779 * @author zbj
780 * @date 2023/9/11 780 * @date 2023/9/11
781 */ 781 */
782 - public function getProjectByChannel(){ 782 + public function getProjectByChannel(Request $request){
783 $id = $this->param['id'] ?? ''; 783 $id = $this->param['id'] ?? '';
784 $notice_order_id = $this->param['notice_order_id'] ?? ''; 784 $notice_order_id = $this->param['notice_order_id'] ?? '';
785 $source_id = $this->param['channel_id'] ?? 0; //原系统渠道id 785 $source_id = $this->param['channel_id'] ?? 0; //原系统渠道id
786 $size = $this->param['page_size'] ?? 20; 786 $size = $this->param['page_size'] ?? 20;
787 $type = $this->param['type'] ?? ''; 787 $type = $this->param['type'] ?? '';
788 $company = $this->param['company'] ?? ''; 788 $company = $this->param['company'] ?? '';
  789 + $order_by_field = $request->input('order_by_field', 'id');
  790 + $order_by_sort = $request->input('order_by_sort', 'desc');
789 791
790 if(!$source_id && !$id){ 792 if(!$source_id && !$id){
791 $this->response('参数异常',Code::SYSTEM_ERROR); 793 $this->response('参数异常',Code::SYSTEM_ERROR);
@@ -828,7 +830,7 @@ class ProjectController extends BaseController @@ -828,7 +830,7 @@ class ProjectController extends BaseController
828 if ($notice_order_id) { 830 if ($notice_order_id) {
829 $query->whereIn('notice_order_id', $notice_order_id); 831 $query->whereIn('notice_order_id', $notice_order_id);
830 } 832 }
831 - })->orderBy('id', 'desc')->paginate($size)->toArray(); 833 + })->orderBy($order_by_field, $order_by_sort)->paginate($size)->toArray();
832 $list = []; 834 $list = [];
833 foreach ($data['list'] as $item){ 835 foreach ($data['list'] as $item){
834 $domain = ''; 836 $domain = '';
@@ -81,7 +81,14 @@ class AsideTicketController extends BaseController @@ -81,7 +81,14 @@ class AsideTicketController extends BaseController
81 $q->where('project_cate', $projectCate); 81 $q->where('project_cate', $projectCate);
82 }); 82 });
83 }); 83 });
84 - 84 + //TODO::用户部门搜索
  85 + if(isset($this->param['dept_id']) && !empty($this->param['dept_id'])){
  86 + $manageHrModel = new ManageHr();
  87 + $manageIdArr = $manageHrModel->selectField(['dept_id'=>$this->param['dept_id'],'status'=>1],'manage_id');
  88 + $query->whereHas('logs', function ($q) use ($manageIdArr) {
  89 + $q->whereIn('engineer_id', $manageIdArr);
  90 + });
  91 + }
85 // 添加排序功能 92 // 添加排序功能
86 $query->orderBy('status', 'asc'); 93 $query->orderBy('status', 'asc');
87 // $query->orderBy('id', 'desc'); 94 // $query->orderBy('id', 'desc');
@@ -192,6 +199,7 @@ class AsideTicketController extends BaseController @@ -192,6 +199,7 @@ class AsideTicketController extends BaseController
192 $ticket->star = $request->input('star', 3); 199 $ticket->star = $request->input('star', 3);
193 $ticket->plan_end_at = $request->input('plan_end_at', null); 200 $ticket->plan_end_at = $request->input('plan_end_at', null);
194 $ticket->close_wechat = $request->input('close_wechat', false); 201 $ticket->close_wechat = $request->input('close_wechat', false);
  202 + $ticket->num = $request->input('num', 0);
195 $ticket->save(); 203 $ticket->save();
196 204
197 // 分配工单参与人 205 // 分配工单参与人
@@ -249,6 +257,8 @@ class AsideTicketController extends BaseController @@ -249,6 +257,8 @@ class AsideTicketController extends BaseController
249 $ticket->plan_end_at = $request->input('plan_end_at'); 257 $ticket->plan_end_at = $request->input('plan_end_at');
250 if ($request->input('status')) 258 if ($request->input('status'))
251 $ticket->status = $request->input('status'); 259 $ticket->status = $request->input('status');
  260 + if ($request->input('num'))
  261 + $ticket->num = $request->input('num',0);
252 262
253 if ($ticket->status == Tickets::STATUS_COMPLETED) 263 if ($ticket->status == Tickets::STATUS_COMPLETED)
254 { 264 {
@@ -559,7 +559,7 @@ class ProductController extends BaseController @@ -559,7 +559,7 @@ class ProductController extends BaseController
559 if(!empty($v['og_image'])){ 559 if(!empty($v['og_image'])){
560 $v['og_image'] = getImageUrl($v['og_image'] ?? '',$this->user['storage_type'],$this->user['project_location']); 560 $v['og_image'] = getImageUrl($v['og_image'] ?? '',$this->user['storage_type'],$this->user['project_location']);
561 }else{ 561 }else{
562 - $v['og_image'] = $v['thumb']['url'] ?? ''; 562 + $v['og_image'] = '';
563 } 563 }
564 if(!empty($v['icon'])){ 564 if(!empty($v['icon'])){
565 foreach ($v['icon'] as $icon_k => $icon_v){ 565 foreach ($v['icon'] as $icon_k => $icon_v){
@@ -41,13 +41,20 @@ class WebSettingImageController extends BaseController @@ -41,13 +41,20 @@ class WebSettingImageController extends BaseController
41 public function save(WebSettingImage $webSettingImage){ 41 public function save(WebSettingImage $webSettingImage){
42 try { 42 try {
43 foreach ($this->param['data'] as $v){ 43 foreach ($this->param['data'] as $v){
  44 +
44 if(isset($v['id']) && !empty($v['id'])){ 45 if(isset($v['id']) && !empty($v['id'])){
45 $v['image'] = str_replace_url($v['image']); 46 $v['image'] = str_replace_url($v['image']);
46 $webSettingImage->edit($v,['id'=>$v['id']]); 47 $webSettingImage->edit($v,['id'=>$v['id']]);
47 }else{ 48 }else{
  49 + $info = $webSettingImage->read(['type'=>$v['type']],'id');
  50 + if($info === false){
48 $v['project_id'] = $this->user['project_id']; 51 $v['project_id'] = $this->user['project_id'];
49 $v['image'] = str_replace_url($v['image']); 52 $v['image'] = str_replace_url($v['image']);
50 $webSettingImage->add($v); 53 $webSettingImage->add($v);
  54 + }else{
  55 + $v['image'] = str_replace_url($v['image']);
  56 + $webSettingImage->edit($v,['id'=>$info['id']]);
  57 + }
51 } 58 }
52 } 59 }
53 }catch (\Exception $e){ 60 }catch (\Exception $e){
@@ -61,9 +61,9 @@ class TicketLogic extends BaseLogic @@ -61,9 +61,9 @@ class TicketLogic extends BaseLogic
61 $dailyModel = new TicketDailyCount(); 61 $dailyModel = new TicketDailyCount();
62 $dailyList = $dailyModel->list([],'date',['*'],'desc',5);//取最近5条数据 62 $dailyList = $dailyModel->list([],'date',['*'],'desc',5);//取最近5条数据
63 $manageModel = new TicketDailyManageCount(); 63 $manageModel = new TicketDailyManageCount();
64 - $manageList = $manageModel->list(['date'=>$date],'average_time',['*'],'asc',5);//取最近5条数据 64 + $manageList = $manageModel->list(['date'=>$date,'ticket_num'=>['!=',0],'average_time'=>['!=','']],'average_time',['*'],'asc',5);//取最近5条数据
65 $deptModel = new TicketDailyDeptCount(); 65 $deptModel = new TicketDailyDeptCount();
66 - $deptList = $deptModel->list(['date'=>$date],'average_time',['*'],'asc',5); 66 + $deptList = $deptModel->list(['date'=>$date,'ticket_num'=>['!=',0]],'average_time',['*'],'asc',5);
67 $data = ['daily'=>$dailyList,'manage'=>$manageList,'dept'=>$deptList]; 67 $data = ['daily'=>$dailyList,'manage'=>$manageList,'dept'=>$deptList];
68 return $this->success($data); 68 return $this->success($data);
69 } 69 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Logic\Bside\HomeCount; 3 namespace App\Http\Logic\Bside\HomeCount;
4 4
5 5
  6 +use App\Helper\FormGlobalsoApi;
6 use App\Http\Logic\Bside\BaseLogic; 7 use App\Http\Logic\Bside\BaseLogic;
7 use App\Models\Template\BCustomTemplate; 8 use App\Models\Template\BCustomTemplate;
8 use App\Models\Visit\Visit; 9 use App\Models\Visit\Visit;
@@ -14,6 +15,7 @@ use App\Models\Project\Project; @@ -14,6 +15,7 @@ use App\Models\Project\Project;
14 use App\Models\RankData\RankData as RankDataModel; 15 use App\Models\RankData\RankData as RankDataModel;
15 use App\Models\Service\Service; 16 use App\Models\Service\Service;
16 use Carbon\Carbon; 17 use Carbon\Carbon;
  18 +use Illuminate\Support\Facades\Cache;
17 use Illuminate\Support\Facades\DB; 19 use Illuminate\Support\Facades\DB;
18 20
19 class CountLogic extends BaseLogic 21 class CountLogic extends BaseLogic
@@ -41,6 +43,17 @@ class CountLogic extends BaseLogic @@ -41,6 +43,17 @@ class CountLogic extends BaseLogic
41 $info = $this->model->read(['project_id' => $this->user['project_id']], 43 $info = $this->model->read(['project_id' => $this->user['project_id']],
42 ['pv_num','ip_num','inquiry_num','date','compliance_day','service_day','country']); 44 ['pv_num','ip_num','inquiry_num','date','compliance_day','service_day','country']);
43 } 45 }
  46 + $inquiry_num = Cache::get('inquiry_num_'.$this->user['project_id']);
  47 + if(empty($inquiry_num)){
  48 + $domain = parse_url($this->user['domain'], PHP_URL_HOST); // 直接取域名部分
  49 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$this->user['is_upgrade']);
  50 + if($inquiry_list !== false){
  51 + if($inquiry_list['status'] != 400){
  52 + $info['inquiry_num'] = $inquiry_list['data']['count'];
  53 + Cache::add('inquiry_num_'.$this->user['project_id'],$inquiry_list['data']['count'],3600);
  54 + }
  55 + }
  56 + }
44 //获取项目的剩余时长 57 //获取项目的剩余时长
45 $projectModel = new Project(); 58 $projectModel = new Project();
46 $projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']); 59 $projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']);
@@ -111,7 +111,7 @@ class RankDataLogic extends BaseLogic @@ -111,7 +111,7 @@ class RankDataLogic extends BaseLogic
111 $lang_data = Arr::setValueToKey($lang_data, 'language'); 111 $lang_data = Arr::setValueToKey($lang_data, 'language');
112 $data['langs'] = []; 112 $data['langs'] = [];
113 $languageModel = new MinorLanguages(); 113 $languageModel = new MinorLanguages();
114 - $languageList = $languageModel->list(['project_id'=>$project['id']]); 114 + $languageList = $languageModel->list(['project_id'=>$project['id'], 'is_delete' => 0]);
115 if(!empty($languageList) && is_array($languageList)){ 115 if(!empty($languageList) && is_array($languageList)){
116 foreach($languageList as $lang){ 116 foreach($languageList as $lang){
117 if($lang['lang'] =='ja'){ 117 if($lang['lang'] =='ja'){
@@ -292,12 +292,14 @@ class UserLoginLogic @@ -292,12 +292,14 @@ class UserLoginLogic
292 $info['project_location'] = $project['project_location']; 292 $info['project_location'] = $project['project_location'];
293 $info['file_cdn'] = $project['deploy_build']['file_cdn']; 293 $info['file_cdn'] = $project['deploy_build']['file_cdn'];
294 $info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0; 294 $info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0;
  295 + $info['seo_service_duration'] = $project['deploy_build']['seo_service_duration'] ?? 0;
295 $info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0; 296 $info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0;
296 $info['is_ai_blog_send'] = $project['deploy_optimize']['is_ai_blog_send'] ?? 0; 297 $info['is_ai_blog_send'] = $project['deploy_optimize']['is_ai_blog_send'] ?? 0;
297 $info['tech_leader'] = $project['deploy_optimize']['tech_leader'] ?? 0; 298 $info['tech_leader'] = $project['deploy_optimize']['tech_leader'] ?? 0;
298 $manageModel = new ManageHr(); 299 $manageModel = new ManageHr();
299 $info['tech_leader_name'] = $manageModel->getName($project['deploy_optimize']['tech_leader'] ?? 0); 300 $info['tech_leader_name'] = $manageModel->getName($project['deploy_optimize']['tech_leader'] ?? 0);
300 $info['remain_day'] = $project['remain_day'] ?? 0; 301 $info['remain_day'] = $project['remain_day'] ?? 0;
  302 + $info['seo_remain_day'] = $project['seo_remain_day'] ?? 0;
301 $info['project_created_at'] = $project['created_at']; 303 $info['project_created_at'] = $project['created_at'];
302 $info['type'] = $project['type'] ?? 1; 304 $info['type'] = $project['type'] ?? 1;
303 if($info['is_customized'] == 1){ 305 if($info['is_customized'] == 1){
@@ -27,4 +27,9 @@ class TicketDailyCount extends Base @@ -27,4 +27,9 @@ class TicketDailyCount extends Base
27 { 27 {
28 return Arr::s2a($value); 28 return Arr::s2a($value);
29 } 29 }
  30 +
  31 + public function getSourceTypeAttribute($value)
  32 + {
  33 + return Arr::s2a($value);
  34 + }
30 } 35 }
@@ -28,6 +28,7 @@ class MessagePush extends Base @@ -28,6 +28,7 @@ class MessagePush extends Base
28 const TYPE_INQUIRY = 'inquiry'; 28 const TYPE_INQUIRY = 'inquiry';
29 const TYPE_WEEK = 'week'; 29 const TYPE_WEEK = 'week';
30 const TYPE_TICKET = 'Ticket'; 30 const TYPE_TICKET = 'Ticket';
  31 + const TYPE_DOMAIN = 'domain';
31 //设置关联表名 32 //设置关联表名
32 /** 33 /**
33 * @var mixed 34 * @var mixed