作者 赵彬吉
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GeoWritingsTask.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/10/27 14:12
  8 + */
  9 +
  10 +namespace App\Console\Commands\Geo;
  11 +
  12 +use App\Helper\Gpt;
  13 +use App\Models\Geo\GeoWritings;
  14 +use Illuminate\Console\Command;
  15 +use Illuminate\Support\Facades\Redis;
  16 +use App\Models\Geo\GeoWritingsTask as GeoWritingsTaskModel;
  17 +
  18 +class GeoWritingsTask extends Command
  19 +{
  20 + /**
  21 + * The name and signature of the console command.
  22 + *
  23 + * @var string
  24 + */
  25 + protected $signature = 'geo_writings_task';
  26 +
  27 + public $porject_id;//记录当时执行的project_id
  28 +
  29 + /**
  30 + * The console command description.
  31 + *
  32 + * @var string
  33 + */
  34 + protected $description = 'geoAi生成文章';
  35 +
  36 + public function handle(){
  37 + while (true){
  38 + $geoWritingsTaskModel = new GeoWritingsTaskModel();
  39 + $task_id = $this->getTaskId();
  40 + if(empty($task_id)){
  41 + sleep(60);
  42 + continue;
  43 + }
  44 + echo date("Y-m-d H:i:s").',执行的任务id'.$task_id.PHP_EOL;
  45 + $info = $geoWritingsTaskModel->read(['id'=>$task_id]);
  46 + if($info === false){
  47 + echo date("Y-m-d H:i:s").',任务id数据不存在:'.$task_id.PHP_EOL;
  48 + continue;
  49 + }
  50 + //生成引言
  51 + $aiCommand1 = "请根据这个文章标题:{$info['title']},并同时参考公司的介绍’{$info['description']}‘以及公司参与的事件内容’{$info['event_content']}‘,给我写一个英文Press Release前言内容,前言内容请参考并引用{$info['keyword']}行业的一些专业数据报告,只需要1个段落,大约150-200字,请一定要出现这个关键词“{$info['prefix']}{$info['keyword']}{$info['suffix']}”,所有内容一定要用英文, 只需要回复我引言内容,不需要别的内容(比如序号、你的提示、寒暄、解释、注释之类的)";
  52 + $gptHelper = new Gpt();
  53 + $introduction = $gptHelper->openai_chat_qqs($aiCommand1);
  54 + //生成内容
  55 + $aiCommand2 = "请根据这个文章标题:{$info['title']},并同时参考公司的介绍{$info['description']},以及公司参与的事件内容{$info['event_content']},给我写一篇英文Press Release内容正文(已经有前言内容了),内容请参考并引用“{$info['prefix']}{$info['keyword']}{$info['suffix']}”行业的一些专业数据报告,新闻内容需要 5-6 个大纲,每个大纲需要标题和 1-2 段内容,最后1-2个大纲主要介绍企业的核心优势、主营产品应用场景、主要客户案例,并最后附带内容{$info['footer']},最后只需要回复我新闻稿内容,整个新闻稿内容字数1000字左右,不需要别的内容(比如序号、你的提示、寒暄、解释、注释之类的)";
  56 + $main = $gptHelper->openai_chat_qqs($aiCommand2);
  57 + $images = explode(',',$info['img']);
  58 + //组装一条数据
  59 + try {
  60 + $geoWritingsModel = new GeoWritings();
  61 + $saveData = [
  62 + 'project_id'=>$info['project_id'],
  63 + 'type'=>$geoWritingsModel::TYPE_AI_CREATE,
  64 + 'title'=>$info['title'],
  65 + 'content'=>$introduction.($images[0] ?? '').PHP_EOL.$main.($images[1] ?? ''),
  66 + 'content_length'=>strlen($introduction.PHP_EOL.$main),
  67 + 'uniqid'=>md5(uniqid().$task_id.$info['project_id']),
  68 + ];
  69 + $id = $geoWritingsModel->addReturnId($saveData);
  70 + $data = [
  71 + 'introduction'=>$introduction,
  72 + 'main'=>$main,
  73 + 'status'=>2,
  74 + 'writings_id'=>$id,
  75 + ];
  76 + $geoWritingsTaskModel->edit($data,['task_id'=>$task_id]);
  77 + }catch (\Exception $e){
  78 + echo date('Y-m-d H:i:s').'保存失败:'.$task_id.$e->getMessage().PHP_EOL;
  79 + continue;
  80 + }
  81 + }
  82 + }
  83 +
  84 + /**
  85 + * @remark :获取任务id
  86 + * @name :getTaskId
  87 + * @author :lyh
  88 + * @method :post
  89 + * @time :2025/10/27 14:22
  90 + */
  91 + public function getTaskId(){
  92 + $task_id = Redis::rpop('geo_writings_task');
  93 + $geoWritingsTaskModel = new GeoWritingsTaskModel();
  94 + if (empty($task_id)) {
  95 + $ids = $geoWritingsTaskModel->formatQuery(['status'=>0])->limit(100)->pluck('id');
  96 + if(!empty($ids)){
  97 + foreach ($ids as $id) {
  98 + Redis::lpush('geo_writings_task', $id);
  99 + }
  100 + $task_id = Redis::rpop('geo_writings_task');
  101 + }
  102 + }else{
  103 + $geoWritingsTaskModel->edit(['status'=>1],['id'=>$task_id]);
  104 + }
  105 + return $task_id;
  106 + }
  107 +}
@@ -124,6 +124,7 @@ class PostInquiryForward extends Command @@ -124,6 +124,7 @@ class PostInquiryForward extends Command
124 if ($res) { 124 if ($res) {
125 $form = InquiryInfo::find($detail['form_id']); 125 $form = InquiryInfo::find($detail['form_id']);
126 $form->success = $form->success + 1; 126 $form->success = $form->success + 1;
  127 + $form->timestamps = false;
127 $form->save(); 128 $form->save();
128 Log::channel('inquiry_forward')->info('询盘成功:', [$detail['form_id'], $val->id, getmypid()]); 129 Log::channel('inquiry_forward')->info('询盘成功:', [$detail['form_id'], $val->id, getmypid()]);
129 } 130 }
@@ -1597,18 +1597,24 @@ if (!function_exists('httpGetSsl')) { @@ -1597,18 +1597,24 @@ if (!function_exists('httpGetSsl')) {
1597 * @time :2025/9/22 14:46 1597 * @time :2025/9/22 14:46
1598 */ 1598 */
1599 function truncate_text($text, $limit = 300) { 1599 function truncate_text($text, $limit = 300) {
1600 - // 长度小于限制直接返回  
1601 if (mb_strlen($text, 'UTF-8') <= $limit) { 1600 if (mb_strlen($text, 'UTF-8') <= $limit) {
1602 return $text; 1601 return $text;
1603 } 1602 }
1604 - // 先取前 $limit 个字符  
1605 $truncated = mb_substr($text, 0, $limit, 'UTF-8'); 1603 $truncated = mb_substr($text, 0, $limit, 'UTF-8');
1606 - // 如果这一段包含空格(说明有英文单词),尽量在最后一个空格处截断 1604 + // 优先找空格
1607 $lastSpace = mb_strrpos($truncated, ' ', 0, 'UTF-8'); 1605 $lastSpace = mb_strrpos($truncated, ' ', 0, 'UTF-8');
1608 - if ($lastSpace !== false) {  
1609 - // 在最后一个空格处截断,避免英文单词被截断 1606 + if ($lastSpace === false) {
  1607 + // 没有空格则找 '-'
  1608 + $lastDash = mb_strrpos($truncated, '-', 0, 'UTF-8');
  1609 + if ($lastDash !== false && $lastDash > 0) {
  1610 + $lastSpace = $lastDash;
  1611 + }
  1612 + }
  1613 + if ($lastSpace !== false && $lastSpace > 0) {
1610 $truncated = mb_substr($truncated, 0, $lastSpace, 'UTF-8'); 1614 $truncated = mb_substr($truncated, 0, $lastSpace, 'UTF-8');
1611 } 1615 }
1612 return $truncated; 1616 return $truncated;
1613 } 1617 }
  1618 +
  1619 +
1614 } 1620 }
@@ -39,7 +39,7 @@ class GeoController extends BaseController @@ -39,7 +39,7 @@ class GeoController extends BaseController
39 $projectModel = new Project(); 39 $projectModel = new Project();
40 $projectInfo = $projectModel->read(['project_id' => $project_id],['title','version']); 40 $projectInfo = $projectModel->read(['project_id' => $project_id],['title','version']);
41 $geoWritingsModel = new GeoWritings(); 41 $geoWritingsModel = new GeoWritings();
42 - $lists = $geoWritingsModel->list(['project_id' => $project_id, 'is_del' => GeoWritings::IS_DEL_FALSE],'id',['title', 'status', 'uniqid', 'confirm_at']); 42 + $lists = $geoWritingsModel->list(['project_id' => $project_id, 'status' => 2 ,'is_del' => GeoWritings::IS_DEL_FALSE],'id',['title', 'status', 'uniqid', 'confirm_at']);
43 $result = [ 43 $result = [
44 'project' => $projectInfo, 44 'project' => $projectInfo,
45 'list' => $lists 45 'list' => $lists
@@ -66,9 +66,9 @@ class GeoController extends BaseController @@ -66,9 +66,9 @@ class GeoController extends BaseController
66 * @param Request $request 66 * @param Request $request
67 * @return false|string 67 * @return false|string
68 */ 68 */
69 - public function confirmWritings(Request $request) 69 + public function confirmWritings()
70 { 70 {
71 - $request->validate([ 71 + $this->request->validate([
72 'token' => 'required', 72 'token' => 'required',
73 'title' => 'required|max:120', 73 'title' => 'required|max:120',
74 'content' => 'required|max:5000' 74 'content' => 'required|max:5000'
@@ -79,19 +79,21 @@ class GeoController extends BaseController @@ -79,19 +79,21 @@ class GeoController extends BaseController
79 'content.required' => '内容不能为空', 79 'content.required' => '内容不能为空',
80 'content.max' => '内容过长保存失败', 80 'content.max' => '内容过长保存失败',
81 ]); 81 ]);
82 - $token = trim($request->input('token'));  
83 - $data = GeoWritings::where(['uniqid' => $token])->first();  
84 - if (empty($data)){ 82 + $token = trim($this->param['token']);
  83 + $geoWritingsModel = new GeoWritings();
  84 + $info = $geoWritingsModel->read(['uniqid' => $token]);
  85 + if ($info === false){
85 return $this->error('非法请求'); 86 return $this->error('非法请求');
86 } 87 }
87 -  
88 - if ($data->status != GeoWritings::STATUS_RUNNING){ 88 + if ($info['status'] == GeoWritings::STATUS_FINISH){
89 return $this->error('当前文章已确认,不可再次确认'); 89 return $this->error('当前文章已确认,不可再次确认');
90 } 90 }
91 -  
92 -  
93 - // FIXME 验证完成,保存数据,计算内容长度,处理内容中的资源, IP 确认时间 状态  
94 - return $data; 91 + $this->param['confirm_ip'] = $this->request->ip();
  92 + $this->param['confirm_at'] = date('Y-m-d H:i:s');
  93 + $this->param['content_length'] = strlen($this->param['content']);
  94 + $this->param['status'] = GeoWritings::STATUS_FINISH;
  95 + $geoWritingsModel->edit($this->param,['uniqid' => $token]);
  96 + return true;
95 } 97 }
96 98
97 /** 99 /**
@@ -68,16 +68,4 @@ class GeoController extends BaseController @@ -68,16 +68,4 @@ class GeoController extends BaseController
68 $data = $this->logic->saveConfig($this->param); 68 $data = $this->logic->saveConfig($this->param);
69 $this->response('success', Code::SUCCESS, $data); 69 $this->response('success', Code::SUCCESS, $data);
70 } 70 }
71 -  
72 -  
73 -  
74 - /**  
75 - * OA后台管理员,保存确认数据  
76 - * 客户可以进行确认, OA后台也可以进行确认,以及修改  
77 - * @param Request $request  
78 - */  
79 - public function saveConfirmData(Request $request)  
80 - {  
81 -  
82 - }  
83 } 71 }
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 namespace App\Http\Controllers\Aside\Geo; 10 namespace App\Http\Controllers\Aside\Geo;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
  13 +use App\Helper\Gpt;
13 use App\Http\Controllers\Aside\BaseController; 14 use App\Http\Controllers\Aside\BaseController;
14 use App\Http\Logic\Aside\Geo\GeoWritingsTaskLogic; 15 use App\Http\Logic\Aside\Geo\GeoWritingsTaskLogic;
15 use App\Http\Requests\Aside\Geo\GeoWritingsTaskRequest; 16 use App\Http\Requests\Aside\Geo\GeoWritingsTaskRequest;
@@ -49,8 +50,7 @@ class GeoWritingTaskController extends BaseController @@ -49,8 +50,7 @@ class GeoWritingTaskController extends BaseController
49 * @method :post 50 * @method :post
50 * @time :2025/10/25 10:41 51 * @time :2025/10/25 10:41
51 */ 52 */
52 - public function saveWritingTask(){  
53 - $request = new GeoWritingsTaskRequest(); 53 + public function saveWritingTask(GeoWritingsTaskRequest $request){
54 $request->validated(); 54 $request->validated();
55 $data = $this->logic->saveWritingTask(); 55 $data = $this->logic->saveWritingTask();
56 $this->response('success',Code::SUCCESS,$data); 56 $this->response('success',Code::SUCCESS,$data);
@@ -73,4 +73,33 @@ class GeoWritingTaskController extends BaseController @@ -73,4 +73,33 @@ class GeoWritingTaskController extends BaseController
73 $data = $this->logic->delWritingTask(); 73 $data = $this->logic->delWritingTask();
74 $this->response('success',Code::SUCCESS,$data); 74 $this->response('success',Code::SUCCESS,$data);
75 } 75 }
  76 +
  77 + /**
  78 + * @remark :Ai请求标题
  79 + * @name :sendAiTitle
  80 + * @author :lyh
  81 + * @method :post
  82 + * @time :2025/10/27 11:10
  83 + */
  84 + public function sendAiTitle(){
  85 + $this->request->validate([
  86 + 'company'=>'required',
  87 + 'number'=>'required',
  88 + 'prefix'=>'required',
  89 + 'keyword'=>'required',
  90 + 'suffix'=>'required',
  91 + 'event_title'=>'required',
  92 + ],[
  93 + 'company.required' => '公司简称不能为空',
  94 + 'number.required' => '生成数量不能为空',
  95 + 'prefix.required' => '关键词前缀为数组',
  96 + 'keyword.required' => '关键词不能为空',
  97 + 'suffix.requiredrequired' => '关键词后缀不能为空',
  98 + 'event_title.required' => '事件标题不能为空',
  99 + ]);
  100 + $aiCommand = "请根据公司简称{$this->param['company']}和这个公司产品的关键词:{$this->param['prefix']}{$this->param['keyword']}{$this->param['suffix']},以及{$this->param['event_title']},帮我写{$this->param['number']}个有吸引力的英文新闻标题;确保这个标题在Google上面唯一存在的,只需要回复我标题,不需要别的内容(比如序号、你的提示、寒暄、解释、注释之类的) 标题不能超过 100 字符数!,一行一个";
  101 + $gptHelper = new Gpt();
  102 + $data = $gptHelper->openai_chat_qqs($aiCommand);
  103 + $this->response('success',Code::SUCCESS,$data);
  104 + }
76 } 105 }
@@ -13,6 +13,7 @@ use App\Enums\Common\Code; @@ -13,6 +13,7 @@ use App\Enums\Common\Code;
13 use App\Http\Controllers\Aside\BaseController; 13 use App\Http\Controllers\Aside\BaseController;
14 use App\Http\Logic\Aside\Geo\GeoWritingsLogic; 14 use App\Http\Logic\Aside\Geo\GeoWritingsLogic;
15 use App\Http\Requests\Aside\Geo\GeoWritingsRequest; 15 use App\Http\Requests\Aside\Geo\GeoWritingsRequest;
  16 +use App\Models\Geo\GeoWritings;
16 use Illuminate\Http\Request; 17 use Illuminate\Http\Request;
17 18
18 /** 19 /**
@@ -49,8 +50,7 @@ class GeoWritingsController extends BaseController @@ -49,8 +50,7 @@ class GeoWritingsController extends BaseController
49 * @method :post 50 * @method :post
50 * @time :2025/10/25 10:41 51 * @time :2025/10/25 10:41
51 */ 52 */
52 - public function saveWriting(){  
53 - $request = new GeoWritingsRequest(); 53 + public function saveWriting(GeoWritingsRequest $request){
54 $request->validated(); 54 $request->validated();
55 $data = $this->logic->saveWriting(); 55 $data = $this->logic->saveWriting();
56 $this->response('success',Code::SUCCESS,$data); 56 $this->response('success',Code::SUCCESS,$data);
@@ -74,4 +74,20 @@ class GeoWritingsController extends BaseController @@ -74,4 +74,20 @@ class GeoWritingsController extends BaseController
74 $this->response('success',Code::SUCCESS,$data); 74 $this->response('success',Code::SUCCESS,$data);
75 } 75 }
76 76
  77 + /**
  78 + * @remark :推送待审核列表消息
  79 + * @name :sendMessage
  80 + * @author :lyh
  81 + * @method :post
  82 + * @time :2025/10/28 09:59
  83 + */
  84 + public function sendWechatMessage(){
  85 + $this->request->validate([
  86 + 'project_id'=>'required',
  87 + ],[
  88 + 'project_id.required' => '项目ID不能为空',
  89 + ]);
  90 + $data = $this->logic->sendWechatMessage();
  91 + $this->response('success',Code::SUCCESS,$data);
  92 + }
77 } 93 }
@@ -63,32 +63,34 @@ class ProjectController extends BaseController @@ -63,32 +63,34 @@ class ProjectController extends BaseController
63 * @method :post 63 * @method :post
64 * @time :2023/8/30 10:11 64 * @time :2023/8/30 10:11
65 */ 65 */
66 - public function lists(Project $project){ 66 + public function lists(Project $project)
  67 + {
67 $query = $project->leftJoin('gl_project_payment', 'gl_project.id', '=', 'gl_project_payment.project_id') 68 $query = $project->leftJoin('gl_project_payment', 'gl_project.id', '=', 'gl_project_payment.project_id')
68 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') 69 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
69 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 70 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
70 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id') 71 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id')
71 ->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id') 72 ->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id')
72 ->leftJoin('gl_project_association', 'gl_project.id', '=', 'gl_project_association.project_id') 73 ->leftJoin('gl_project_association', 'gl_project.id', '=', 'gl_project_association.project_id')
73 - ->where('gl_project.delete_status',Project::TYPE_ZERO); 74 + ->where('gl_project.delete_status', Project::TYPE_ZERO);
74 $query = $this->searchParam($query); 75 $query = $this->searchParam($query);
75 $query = $this->orderByList($query); 76 $query = $this->orderByList($query);
76 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray(); 77 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
77 - if(!empty($lists) && !empty($lists['list'])){  
78 - foreach ($lists['list'] as $k => $v){ 78 + if (!empty($lists) && !empty($lists['list'])) {
  79 + foreach ($lists['list'] as $k => $v) {
79 $v = $this->handleParam($v); 80 $v = $this->handleParam($v);
80 // 组装 工单UUID END 81 // 组装 工单UUID END
81 $lists['list'][$k] = $v; 82 $lists['list'][$k] = $v;
82 } 83 }
83 } 84 }
84 - $this->response('success',Code::SUCCESS,$lists); 85 + $this->response('success', Code::SUCCESS, $lists);
85 } 86 }
86 87
87 /** 88 /**
88 * 需要查询的字段 89 * 需要查询的字段
89 * @return array 90 * @return array
90 */ 91 */
91 - public function selectParam(){ 92 + public function selectParam()
  93 + {
92 $select = [ 94 $select = [
93 'gl_project.id AS id', 95 'gl_project.id AS id',
94 'gl_project.title AS title', 96 'gl_project.title AS title',
@@ -144,10 +146,11 @@ class ProjectController extends BaseController @@ -144,10 +146,11 @@ class ProjectController extends BaseController
144 * @method :post 146 * @method :post
145 * @time :2023/12/29 17:14 147 * @time :2023/12/29 17:14
146 */ 148 */
147 - public function orderByList($query){  
148 - if(isset($this->map['seo_plan']) && $this->map['seo_plan'] == 1){ 149 + public function orderByList($query)
  150 + {
  151 + if (isset($this->map['seo_plan']) && $this->map['seo_plan'] == 1) {
149 $query = $query->orderBy('gl_project.cooperate_date', 'desc')->orderBy('gl_project.id', 'desc'); 152 $query = $query->orderBy('gl_project.cooperate_date', 'desc')->orderBy('gl_project.id', 'desc');
150 - }else{ 153 + } else {
151 $query = $query->orderBy('gl_project.uptime', 'desc')->orderBy('gl_project.id', 'desc'); 154 $query = $query->orderBy('gl_project.uptime', 'desc')->orderBy('gl_project.id', 'desc');
152 } 155 }
153 return $query; 156 return $query;
@@ -160,7 +163,8 @@ class ProjectController extends BaseController @@ -160,7 +163,8 @@ class ProjectController extends BaseController
160 * @method :post 163 * @method :post
161 * @time :2023/8/18 10:58 164 * @time :2023/8/18 10:58
162 */ 165 */
163 - public function searchParam(&$query){ 166 + public function searchParam(&$query)
  167 + {
164 //参数type 168 //参数type
165 $query = $this->searchType($query); 169 $query = $this->searchType($query);
166 //根据查看权限获取项目搜索条件(必带) 170 //根据查看权限获取项目搜索条件(必带)
@@ -185,18 +189,19 @@ class ProjectController extends BaseController @@ -185,18 +189,19 @@ class ProjectController extends BaseController
185 * @param $query 189 * @param $query
186 * @return mixed 190 * @return mixed
187 */ 191 */
188 - public function searchType(&$query){  
189 - if(isset($this->map['type'])){  
190 - $query->where('gl_project.extend_type', '!=' ,5)->where('gl_project.extend_type', '!=' ,8);  
191 - if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])){ 192 + public function searchType(&$query)
  193 + {
  194 + if (isset($this->map['type'])) {
  195 + $query->where('gl_project.extend_type', '!=', 5)->where('gl_project.extend_type', '!=', 8);
  196 + if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])) {
192 $query->where('gl_project.type', $this->map['type']); 197 $query->where('gl_project.type', $this->map['type']);
193 - } elseif ($this->map['type'] == 8){  
194 - $query->where('gl_project_online_check.id', null)->where('gl_project.type',Project::TYPE_TWO);  
195 - }else{  
196 - $query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]); 198 + } elseif ($this->map['type'] == 8) {
  199 + $query->where('gl_project_online_check.id', null)->where('gl_project.type', Project::TYPE_TWO);
  200 + } else {
  201 + $query->whereIn('gl_project.type', [Project::TYPE_FOUR, Project::TYPE_SIX]);
197 } 202 }
198 } 203 }
199 - if(isset($this->map['uptime']) && is_array($this->map['uptime'])){ 204 + if (isset($this->map['uptime']) && is_array($this->map['uptime'])) {
200 $query->whereBetween('gl_project.uptime', $this->map['uptime']); 205 $query->whereBetween('gl_project.uptime', $this->map['uptime']);
201 } 206 }
202 return $query; 207 return $query;
@@ -209,8 +214,9 @@ class ProjectController extends BaseController @@ -209,8 +214,9 @@ class ProjectController extends BaseController
209 * @method :post 214 * @method :post
210 * @time :2023/11/6 16:27 215 * @time :2023/11/6 16:27
211 */ 216 */
212 - public function searchUpgrade(&$query){  
213 - if(isset($this->map['is_upgrade'])){ 217 + public function searchUpgrade(&$query)
  218 + {
  219 + if (isset($this->map['is_upgrade'])) {
214 $query->where('gl_project.is_upgrade', $this->map['is_upgrade']); 220 $query->where('gl_project.is_upgrade', $this->map['is_upgrade']);
215 } 221 }
216 return $query; 222 return $query;
@@ -221,31 +227,32 @@ class ProjectController extends BaseController @@ -221,31 +227,32 @@ class ProjectController extends BaseController
221 * @param $query 227 * @param $query
222 * @return mixed 228 * @return mixed
223 */ 229 */
224 - public function searchContent(&$query){  
225 - if(!empty($this->map['domain_type']) && !empty($this->map['domain_search'])){  
226 - if($this->map['domain_type'] == 'domain'){ 230 + public function searchContent(&$query)
  231 + {
  232 + if (!empty($this->map['domain_type']) && !empty($this->map['domain_search'])) {
  233 + if ($this->map['domain_type'] == 'domain') {
227 $parsedUrl = parse_url($this->map['domain_search']); 234 $parsedUrl = parse_url($this->map['domain_search']);
228 $this->map['domain_search'] = $parsedUrl['host'] ?? $this->map['domain_search']; 235 $this->map['domain_search'] = $parsedUrl['host'] ?? $this->map['domain_search'];
229 - $ids = DomainInfoModel::where('domain', 'like', '%'.$this->map['domain_search'].'%')->pluck('id')->toArray(); 236 + $ids = DomainInfoModel::where('domain', 'like', '%' . $this->map['domain_search'] . '%')->pluck('id')->toArray();
230 $query->whereIn('gl_project_deploy_optimize.domain', $ids); 237 $query->whereIn('gl_project_deploy_optimize.domain', $ids);
231 - }else{  
232 - $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['domain_search'].'%'); 238 + } else {
  239 + $query->where('gl_project_deploy_build.test_domain', 'like', '%' . $this->map['domain_search'] . '%');
233 } 240 }
234 } 241 }
235 - if(!empty($this->map['search']) && !empty($this->map['search_type'])){ 242 + if (!empty($this->map['search']) && !empty($this->map['search_type'])) {
236 $query->where(function ($subQuery) { 243 $query->where(function ($subQuery) {
237 // 搜索域名 244 // 搜索域名
238 if ($this->map['search_type'] == 'domain') { 245 if ($this->map['search_type'] == 'domain') {
239 $parsedUrl = parse_url($this->map['search']); 246 $parsedUrl = parse_url($this->map['search']);
240 $this->map['search'] = $parsedUrl['host'] ?? $this->map['search']; 247 $this->map['search'] = $parsedUrl['host'] ?? $this->map['search'];
241 - $ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray(); 248 + $ids = DomainInfo::where('domain', 'like', '%' . $this->map['search'] . '%')->pluck('id')->toArray();
242 $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids); 249 $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids);
243 - } else if($this->map['search_type'] == 'test_domain'){  
244 - $subQuery->where('gl_project_deploy_build.test_domain','like','%'.$this->map['search'].'%'); 250 + } else if ($this->map['search_type'] == 'test_domain') {
  251 + $subQuery->where('gl_project_deploy_build.test_domain', 'like', '%' . $this->map['search'] . '%');
245 } else { 252 } else {
246 // 搜索名称 253 // 搜索名称
247 - $subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%')  
248 - ->orwhere('gl_project.title','like','%'.$this->map['search'].'%'); 254 + $subQuery->orwhere('gl_project.company', 'like', '%' . $this->map['search'] . '%')
  255 + ->orwhere('gl_project.title', 'like', '%' . $this->map['search'] . '%');
249 } 256 }
250 }); 257 });
251 } 258 }
@@ -259,15 +266,16 @@ class ProjectController extends BaseController @@ -259,15 +266,16 @@ class ProjectController extends BaseController
259 * @method :post 266 * @method :post
260 * @time :2023/11/9 10:16 267 * @time :2023/11/9 10:16
261 */ 268 */
262 - public function searchChannel(&$query){  
263 - if(isset($this->map['zone_id']) && !empty($this->map['zone_id'])){  
264 - $query->where('gl_project.channel','like','%"zone_id": "'.$this->map['zone_id'].'"%'); 269 + public function searchChannel(&$query)
  270 + {
  271 + if (isset($this->map['zone_id']) && !empty($this->map['zone_id'])) {
  272 + $query->where('gl_project.channel', 'like', '%"zone_id": "' . $this->map['zone_id'] . '"%');
265 } 273 }
266 - if(isset($this->map['channel_id']) && !empty($this->map['channel_id'])){  
267 - $query->where('gl_project.channel','like','%"channel_id": "'.$this->map['channel_id'].'"%'); 274 + if (isset($this->map['channel_id']) && !empty($this->map['channel_id'])) {
  275 + $query->where('gl_project.channel', 'like', '%"channel_id": "' . $this->map['channel_id'] . '"%');
268 } 276 }
269 - if(isset($this->map['user_id']) && !empty($this->map['user_id'])){  
270 - $query->where('gl_project.channel','like','%"user_id": "'.$this->map['user_id'].'"%'); 277 + if (isset($this->map['user_id']) && !empty($this->map['user_id'])) {
  278 + $query->where('gl_project.channel', 'like', '%"user_id": "' . $this->map['user_id'] . '"%');
271 } 279 }
272 return $query; 280 return $query;
273 } 281 }
@@ -279,14 +287,15 @@ class ProjectController extends BaseController @@ -279,14 +287,15 @@ class ProjectController extends BaseController
279 * @method :post 287 * @method :post
280 * @time :2023/9/7 18:40 288 * @time :2023/9/7 18:40
281 */ 289 */
282 - public function searchDept(&$query){  
283 - if(!empty($this->map['dept_id'])){  
284 - if($this->map['dept_id'] == 7 || $this->map['dept_id'] == 9){//7,9代表合并组H+F组  
285 - $query->whereIn('gl_project_deploy_build.dept_id', [7,9]);  
286 - }else{ 290 + public function searchDept(&$query)
  291 + {
  292 + if (!empty($this->map['dept_id'])) {
  293 + if ($this->map['dept_id'] == 7 || $this->map['dept_id'] == 9) {//7,9代表合并组H+F组
  294 + $query->whereIn('gl_project_deploy_build.dept_id', [7, 9]);
  295 + } else {
287 $query->where(function ($subQuery) { 296 $query->where(function ($subQuery) {
288 - $subQuery->orwhere('gl_project_deploy_build.dept_id',$this->map['dept_id'])  
289 - ->orwhere('gl_project_deploy_optimize.dept_id',$this->map['dept_id']); 297 + $subQuery->orwhere('gl_project_deploy_build.dept_id', $this->map['dept_id'])
  298 + ->orwhere('gl_project_deploy_optimize.dept_id', $this->map['dept_id']);
290 }); 299 });
291 } 300 }
292 } 301 }
@@ -300,20 +309,21 @@ class ProjectController extends BaseController @@ -300,20 +309,21 @@ class ProjectController extends BaseController
300 * @method :post 309 * @method :post
301 * @time :2024/3/4 14:58 310 * @time :2024/3/4 14:58
302 */ 311 */
303 - public function searchTechMid(&$query){  
304 - if(isset($this->map['tech_mid'])){  
305 - $query = $query->where('gl_project_deploy_optimize.tech_mid',$this->map['tech_mid']); 312 + public function searchTechMid(&$query)
  313 + {
  314 + if (isset($this->map['tech_mid'])) {
  315 + $query = $query->where('gl_project_deploy_optimize.tech_mid', $this->map['tech_mid']);
306 } 316 }
307 - if(isset($this->map['optimize_optimist_mid'])){  
308 - $query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimize_optimist_mid']); 317 + if (isset($this->map['optimize_optimist_mid'])) {
  318 + $query = $query->where('gl_project_deploy_optimize.optimist_mid', $this->map['optimize_optimist_mid']);
309 } 319 }
310 - if(isset($this->map['plan'])){  
311 - $query = $query->where('gl_project_deploy_build.plan',$this->map['plan']); 320 + if (isset($this->map['plan'])) {
  321 + $query = $query->where('gl_project_deploy_build.plan', $this->map['plan']);
312 } 322 }
313 - if(isset($this->map['friend_id'])){  
314 - if($this->map['friend_id'] == 1){ 323 + if (isset($this->map['friend_id'])) {
  324 + if ($this->map['friend_id'] == 1) {
315 $query = $query->where('gl_project_association.friend_id', '!=', 0); 325 $query = $query->where('gl_project_association.friend_id', '!=', 0);
316 - }else{ 326 + } else {
317 $query = $query->where(function ($subQuery) { 327 $query = $query->where(function ($subQuery) {
318 $subQuery->where('gl_project_association.friend_id', 0) 328 $subQuery->where('gl_project_association.friend_id', 0)
319 ->orWhereNull('gl_project_association.friend_id'); 329 ->orWhereNull('gl_project_association.friend_id');
@@ -327,25 +337,25 @@ class ProjectController extends BaseController @@ -327,25 +337,25 @@ class ProjectController extends BaseController
327 ->orWhere('gl_project_deploy_build.seo_plan', '!=', 9); 337 ->orWhere('gl_project_deploy_build.seo_plan', '!=', 9);
328 }); 338 });
329 } 339 }
330 - if(isset($this->map['site_status'])){  
331 - $query = $query->where('gl_project.site_status',$this->map['site_status']); 340 + if (isset($this->map['site_status'])) {
  341 + $query = $query->where('gl_project.site_status', $this->map['site_status']);
332 } 342 }
333 - if(isset($this->map['domain'])){  
334 - if($this->map['domain'] == 0){  
335 - $query = $query->where('gl_project_deploy_optimize.domain',null);  
336 - }else{  
337 - $query = $query->where('gl_project_deploy_optimize.domain','!=',null); 343 + if (isset($this->map['domain'])) {
  344 + if ($this->map['domain'] == 0) {
  345 + $query = $query->where('gl_project_deploy_optimize.domain', null);
  346 + } else {
  347 + $query = $query->where('gl_project_deploy_optimize.domain', '!=', null);
338 } 348 }
339 } 349 }
340 - if(isset($this->map['project_type'])){  
341 - $query = $query->where('gl_project.project_type',$this->map['project_type']); 350 + if (isset($this->map['project_type'])) {
  351 + $query = $query->where('gl_project.project_type', $this->map['project_type']);
342 } 352 }
343 - if(isset($this->param['geo'])){  
344 - if($this->param['geo'] == 1){  
345 - $query = $query->where('gl_project.geo_status',1);  
346 - }else{ 353 + if (isset($this->param['geo'])) {
  354 + if ($this->param['geo'] == 1) {
  355 + $query = $query->where('gl_project.geo_status', 1);
  356 + } else {
347 $ids = GeoLink::pluck('project_id')->unique()->values()->all(); 357 $ids = GeoLink::pluck('project_id')->unique()->values()->all();
348 - $query = $query->whereIn('gl_project.id',$ids); 358 + $query = $query->whereIn('gl_project.id', $ids);
349 } 359 }
350 360
351 } 361 }
@@ -359,14 +369,15 @@ class ProjectController extends BaseController @@ -359,14 +369,15 @@ class ProjectController extends BaseController
359 * @method :post 369 * @method :post
360 * @time :2023/9/7 17:28 370 * @time :2023/9/7 17:28
361 */ 371 */
362 - public function getManagerRole(&$query){  
363 - if(($this->manage['role'] != 1)){//1代表查看所有 372 + public function getManagerRole(&$query)
  373 + {
  374 + if (($this->manage['role'] != 1)) {//1代表查看所有
364 //获取用户所在组 375 //获取用户所在组
365 $managerHr = new ManageHr(); 376 $managerHr = new ManageHr();
366 - $info = $managerHr->read(['manage_id'=>$this->manage['id']]); 377 + $info = $managerHr->read(['manage_id' => $this->manage['id']]);
367 //获取当前用户自己的项目 378 //获取当前用户自己的项目
368 $query->where(function ($subQuery) use ($info) { 379 $query->where(function ($subQuery) use ($info) {
369 - $subQuery->whereIn('gl_project.id', [1]) // 项目1 + 项目3默认显示 380 + $subQuery->whereIn('gl_project.id', [1])// 项目1 + 项目3默认显示
370 ->orWhere('gl_project_deploy_build.leader_mid', $info['id']) 381 ->orWhere('gl_project_deploy_build.leader_mid', $info['id'])
371 ->orWhere('gl_project_deploy_build.manager_mid', $info['id']) 382 ->orWhere('gl_project_deploy_build.manager_mid', $info['id'])
372 ->orWhere('gl_project_deploy_build.designer_mid', $info['id']) 383 ->orWhere('gl_project_deploy_build.designer_mid', $info['id'])
@@ -428,55 +439,56 @@ class ProjectController extends BaseController @@ -428,55 +439,56 @@ class ProjectController extends BaseController
428 * @method :post 439 * @method :post
429 * @time :2023/8/18 14:44 440 * @time :2023/8/18 14:44
430 */ 441 */
431 - public function handleParam(&$item){  
432 - if(($item['type'] != Project::TYPE_ZERO)){ 442 + public function handleParam(&$item)
  443 + {
  444 + if (($item['type'] != Project::TYPE_ZERO)) {
433 $data = APublicModel::getNumByProjectId($item['id']); 445 $data = APublicModel::getNumByProjectId($item['id']);
434 } 446 }
435 - if($item['type'] == Project::TYPE_ONE){//建站中 447 + if ($item['type'] == Project::TYPE_ONE) {//建站中
436 $processModel = new ProcessRecords(); 448 $processModel = new ProcessRecords();
437 $item['sign_project'] = 1; 449 $item['sign_project'] = 1;
438 - $count = $processModel->counts(['project_id'=>$item['id']]);  
439 - if($count < 1){ 450 + $count = $processModel->counts(['project_id' => $item['id']]);
  451 + if ($count < 1) {
440 $item['sign_project'] = 0; 452 $item['sign_project'] = 0;
441 - }else{  
442 - $proInfo = $processModel->read(['project_id'=>$item['id'],'date'=>['>=',date('Y-m-d', strtotime('-3 days'))]],['id']);  
443 - if($proInfo !== false){ 453 + } else {
  454 + $proInfo = $processModel->read(['project_id' => $item['id'], 'date' => ['>=', date('Y-m-d', strtotime('-3 days'))]], ['id']);
  455 + if ($proInfo !== false) {
444 $item['sign_project'] = 0; 456 $item['sign_project'] = 0;
445 } 457 }
446 } 458 }
447 } 459 }
448 - if(!empty($item['extend_type'])){ 460 + if (!empty($item['extend_type'])) {
449 $item['type'] = $item['extend_type']; 461 $item['type'] = $item['extend_type'];
450 } 462 }
451 $manageModel = new ManageHr(); 463 $manageModel = new ManageHr();
452 //geo项目 464 //geo项目
453 - if(($item['plan'] == 0) && ($item['seo_plan'] != 0)){ 465 + if (($item['plan'] == 0) && ($item['seo_plan'] != 0)) {
454 //geo项目负责人 466 //geo项目负责人
455 $geoConfModel = new GeoConf(); 467 $geoConfModel = new GeoConf();
456 - $manage_id = $geoConfModel->getValue(['project_id'=>$item['id']],'manager_id'); 468 + $manage_id = $geoConfModel->getValue(['project_id' => $item['id']], 'manager_id');
457 $item['geo_manage_name'] = $manageModel->getName($manage_id); 469 $item['geo_manage_name'] = $manageModel->getName($manage_id);
458 $geoArticleModel = new GeoArticle(); 470 $geoArticleModel = new GeoArticle();
459 - $item['geo_article_num'] = $geoArticleModel->counts(['project_id'=>$item['id']]);//文章数量 471 + $item['geo_article_num'] = $geoArticleModel->counts(['project_id' => $item['id']]);//文章数量
460 $geoLinkModel = new GeoLink(); 472 $geoLinkModel = new GeoLink();
461 - $item['geo_link_num'] = $geoLinkModel->counts(['project_id'=>$item['id']]);//权威新闻数量 473 + $item['geo_link_num'] = $geoLinkModel->counts(['project_id' => $item['id']]);//权威新闻数量
462 $questionResModel = new GeoQuestionResult(); 474 $questionResModel = new GeoQuestionResult();
463 - $item['geo_qualify_num'] = $questionResModel->counts(['project_id'=>$item['id'],'hit'=>['!=',0],'platform'=>['in',['openai', 'gemini','google_ai_overview']]]);//排名 475 + $item['geo_qualify_num'] = $questionResModel->counts(['project_id' => $item['id'], 'hit' => ['!=', 0], 'platform' => ['in', ['openai', 'gemini', 'google_ai_overview']]]);//排名
464 } 476 }
465 - $item['build_leader'] = $manageModel->getName($item['leader_mid']);  
466 - $item['build_manager'] = $manageModel->getName($item['manager_mid']);  
467 - $item['build_designer'] = $manageModel->getName($item['designer_mid']);  
468 - $item['build_tech'] = $manageModel->getName($item['tech_mid']);  
469 - $item['optimize_manager'] = $manageModel->getName($item['optimize_manager_mid']);  
470 - $item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']);  
471 - $item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']);  
472 - $item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']);  
473 - $item['quality_mid_name'] = $manageModel->getName($item['quality_mid']); 477 + $item['build_leader'] = $manageModel->getName($item['leader_mid']);
  478 + $item['build_manager'] = $manageModel->getName($item['manager_mid']);
  479 + $item['build_designer'] = $manageModel->getName($item['designer_mid']);
  480 + $item['build_tech'] = $manageModel->getName($item['tech_mid']);
  481 + $item['optimize_manager'] = $manageModel->getName($item['optimize_manager_mid']);
  482 + $item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']);
  483 + $item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']);
  484 + $item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']);
  485 + $item['quality_mid_name'] = $manageModel->getName($item['quality_mid']);
474 $planMap = Project::planMap(); 486 $planMap = Project::planMap();
475 $seoPlanMap = Project::seoMap(); 487 $seoPlanMap = Project::seoMap();
476 $item['plan'] = $planMap[$item['plan']] ?? ''; 488 $item['plan'] = $planMap[$item['plan']] ?? '';
477 $item['seo_plan'] = $seoPlanMap[$item['seo_plan']] ?? ''; 489 $item['seo_plan'] = $seoPlanMap[$item['seo_plan']] ?? '';
478 $domainModel = new DomainInfoModel(); 490 $domainModel = new DomainInfoModel();
479 - $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : ''; 491 + $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : '';
480 $item['uuid'] = TicketProject::where('table_id', $item['id'])->where('project_cate', 2)->value('uuid') ?? null; 492 $item['uuid'] = TicketProject::where('table_id', $item['id'])->where('project_cate', 2)->value('uuid') ?? null;
481 $item['friend_id'] = ProjectAssociation::where('project_id', $item['id'])->where('status', ProjectAssociation::STATUS_NORMAL)->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)->value('friend_id') ?? null; 493 $item['friend_id'] = ProjectAssociation::where('project_id', $item['id'])->where('status', ProjectAssociation::STATUS_NORMAL)->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)->value('friend_id') ?? null;
482 $item['autologin_code'] = getAutoLoginCode($item['id']); 494 $item['autologin_code'] = getAutoLoginCode($item['id']);
@@ -498,14 +510,15 @@ class ProjectController extends BaseController @@ -498,14 +510,15 @@ class ProjectController extends BaseController
498 * @method :post 510 * @method :post
499 * @time :2023/8/17 16:42 511 * @time :2023/8/17 16:42
500 */ 512 */
501 - public function info(ProjectLogic $logic){ 513 + public function info(ProjectLogic $logic)
  514 + {
502 $this->request->validate([ 515 $this->request->validate([
503 - 'id'=>'required'  
504 - ],[ 516 + 'id' => 'required'
  517 + ], [
505 'id.required' => 'ID不能为空' 518 'id.required' => 'ID不能为空'
506 ]); 519 ]);
507 $data = $logic->getProjectInfo($this->param['id']); 520 $data = $logic->getProjectInfo($this->param['id']);
508 - $this->response('success',Code::SUCCESS,$data); 521 + $this->response('success', Code::SUCCESS, $data);
509 } 522 }
510 523
511 /** 524 /**
@@ -515,14 +528,15 @@ class ProjectController extends BaseController @@ -515,14 +528,15 @@ class ProjectController extends BaseController
515 * @method :post 528 * @method :post
516 * @time :2024/6/18 11:53 529 * @time :2024/6/18 11:53
517 */ 530 */
518 - public function deleteMinorLanguages(ProjectLogic $logic){ 531 + public function deleteMinorLanguages(ProjectLogic $logic)
  532 + {
519 $this->request->validate([ 533 $this->request->validate([
520 - 'id'=>'required'  
521 - ],[ 534 + 'id' => 'required'
  535 + ], [
522 'id.required' => 'ID不能为空' 536 'id.required' => 'ID不能为空'
523 ]); 537 ]);
524 $data = $logic->deleteMinorLanguages(); 538 $data = $logic->deleteMinorLanguages();
525 - $this->response('success',Code::SUCCESS,$data); 539 + $this->response('success', Code::SUCCESS, $data);
526 } 540 }
527 541
528 /** 542 /**
@@ -535,9 +549,9 @@ class ProjectController extends BaseController @@ -535,9 +549,9 @@ class ProjectController extends BaseController
535 public function save(ProjectLogic $logic) 549 public function save(ProjectLogic $logic)
536 { 550 {
537 $this->request->validate([ 551 $this->request->validate([
538 - 'type'=>'required',  
539 - 'serve_id'=>'required',  
540 - ],[ 552 + 'type' => 'required',
  553 + 'serve_id' => 'required',
  554 + ], [
541 'type.required' => '类型不能为空', 555 'type.required' => '类型不能为空',
542 'serve_id.required' => '请选择服务器' 556 'serve_id.required' => '请选择服务器'
543 ]); 557 ]);
@@ -550,23 +564,24 @@ class ProjectController extends BaseController @@ -550,23 +564,24 @@ class ProjectController extends BaseController
550 * @author zbj 564 * @author zbj
551 * @date 2023/5/17 565 * @date 2023/5/17
552 */ 566 */
553 - public function inquiry_set(Request $request, ProjectLogic $logic){ 567 + public function inquiry_set(Request $request, ProjectLogic $logic)
  568 + {
554 $request->validate([ 569 $request->validate([
555 - 'project_id'=>'required'  
556 - ],[ 570 + 'project_id' => 'required'
  571 + ], [
557 'project_id.required' => '项目ID不能为空' 572 'project_id.required' => '项目ID不能为空'
558 ]); 573 ]);
559 - if($request->isMethod('get')){ 574 + if ($request->isMethod('get')) {
560 $data = InquirySet::where('project_id', $request->project_id)->first(); 575 $data = InquirySet::where('project_id', $request->project_id)->first();
561 - if(!$data){ 576 + if (!$data) {
562 $data = ['emails' => '', 'phones' => '']; 577 $data = ['emails' => '', 'phones' => ''];
563 - }else{ 578 + } else {
564 $data = $data->toArray(); 579 $data = $data->toArray();
565 } 580 }
566 - $this->response('success',Code::SUCCESS,$data); 581 + $this->response('success', Code::SUCCESS, $data);
567 } 582 }
568 $data = $logic->saveInquirySet($this->param); 583 $data = $logic->saveInquirySet($this->param);
569 - $this->response('success',Code::SUCCESS,$data); 584 + $this->response('success', Code::SUCCESS, $data);
570 } 585 }
571 586
572 587
@@ -577,9 +592,10 @@ class ProjectController extends BaseController @@ -577,9 +592,10 @@ class ProjectController extends BaseController
577 * @method :post 592 * @method :post
578 * @time :2023/12/7 10:41 593 * @time :2023/12/7 10:41
579 */ 594 */
580 - public function data_source(ProjectLogic $logic){ 595 + public function data_source(ProjectLogic $logic)
  596 + {
581 $data = $logic->dataSource(); 597 $data = $logic->dataSource();
582 - $this->response('success',Code::SUCCESS,$data); 598 + $this->response('success', Code::SUCCESS, $data);
583 } 599 }
584 600
585 /** 601 /**
@@ -587,9 +603,10 @@ class ProjectController extends BaseController @@ -587,9 +603,10 @@ class ProjectController extends BaseController
587 * @author zbj 603 * @author zbj
588 * @date 2023/6/27 604 * @date 2023/6/27
589 */ 605 */
590 - public function city_source(){ 606 + public function city_source()
  607 + {
591 $data = City::source($this->param['id'] ?? 0); 608 $data = City::source($this->param['id'] ?? 0);
592 - $this->response('success',Code::SUCCESS,$data); 609 + $this->response('success', Code::SUCCESS, $data);
593 } 610 }
594 611
595 /** 612 /**
@@ -597,9 +614,10 @@ class ProjectController extends BaseController @@ -597,9 +614,10 @@ class ProjectController extends BaseController
597 * @author zbj 614 * @author zbj
598 * @date 2023/6/27 615 * @date 2023/6/27
599 */ 616 */
600 - public function channel_source(ProjectLogic $logic){ 617 + public function channel_source(ProjectLogic $logic)
  618 + {
601 $data = $logic->channelSource($this->param); 619 $data = $logic->channelSource($this->param);
602 - $this->response('success',Code::SUCCESS,$data); 620 + $this->response('success', Code::SUCCESS, $data);
603 } 621 }
604 622
605 /** 623 /**
@@ -607,14 +625,15 @@ class ProjectController extends BaseController @@ -607,14 +625,15 @@ class ProjectController extends BaseController
607 * @author zbj 625 * @author zbj
608 * @date 2023/6/25 626 * @date 2023/6/25
609 */ 627 */
610 - public function get_process_records(Request $request, ProcessRecordsLogic $logic){ 628 + public function get_process_records(Request $request, ProcessRecordsLogic $logic)
  629 + {
611 $request->validate([ 630 $request->validate([
612 - 'project_id'=>'required'  
613 - ],[ 631 + 'project_id' => 'required'
  632 + ], [
614 'project_id.required' => '项目ID不能为空' 633 'project_id.required' => '项目ID不能为空'
615 ]); 634 ]);
616 $data = $logic->getInfo($this->param['project_id']); 635 $data = $logic->getInfo($this->param['project_id']);
617 - $this->response('success',Code::SUCCESS,$data); 636 + $this->response('success', Code::SUCCESS, $data);
618 } 637 }
619 638
620 639
@@ -623,7 +642,8 @@ class ProjectController extends BaseController @@ -623,7 +642,8 @@ class ProjectController extends BaseController
623 * @author zbj 642 * @author zbj
624 * @date 2023/6/25 643 * @date 2023/6/25
625 */ 644 */
626 - public function save_process_records(ProcessRecordsRequest $request, ProcessRecordsLogic $logic){ 645 + public function save_process_records(ProcessRecordsRequest $request, ProcessRecordsLogic $logic)
  646 + {
627 $request->validated(); 647 $request->validated();
628 $logic->recordSave(); 648 $logic->recordSave();
629 $this->response('success'); 649 $this->response('success');
@@ -634,15 +654,16 @@ class ProjectController extends BaseController @@ -634,15 +654,16 @@ class ProjectController extends BaseController
634 * @author zbj 654 * @author zbj
635 * @date 2023/6/27 655 * @date 2023/6/27
636 */ 656 */
637 - public function get_contract_bill(Request $request){ 657 + public function get_contract_bill(Request $request)
  658 + {
638 $request->validate([ 659 $request->validate([
639 - 'id'=>'required'  
640 - ],[ 660 + 'id' => 'required'
  661 + ], [
641 'id.required' => 'ID不能为空' 662 'id.required' => 'ID不能为空'
642 ]); 663 ]);
643 $payment = Payment::where('project_id', $this->param['id'])->select(['contract', 'bill'])->first(); 664 $payment = Payment::where('project_id', $this->param['id'])->select(['contract', 'bill'])->first();
644 $data = $payment->makeVisible(['contract', 'bill']); 665 $data = $payment->makeVisible(['contract', 'bill']);
645 - $this->response('success',Code::SUCCESS,$data ? $data->toArray() : []); 666 + $this->response('success', Code::SUCCESS, $data ? $data->toArray() : []);
646 } 667 }
647 668
648 /** 669 /**
@@ -652,10 +673,11 @@ class ProjectController extends BaseController @@ -652,10 +673,11 @@ class ProjectController extends BaseController
652 * @method :post 673 * @method :post
653 * @time :2023/12/2 9:59 674 * @time :2023/12/2 9:59
654 */ 675 */
655 - public function submit_check(OnlineCheckLogic $logic){ 676 + public function submit_check(OnlineCheckLogic $logic)
  677 + {
656 $this->request->validate([ 678 $this->request->validate([
657 - 'id'=>'required'  
658 - ],[ 679 + 'id' => 'required'
  680 + ], [
659 'id.required' => 'ID不能为空' 681 'id.required' => 'ID不能为空'
660 ]); 682 ]);
661 $logic->saveOnlineCheck(); 683 $logic->saveOnlineCheck();
@@ -669,12 +691,13 @@ class ProjectController extends BaseController @@ -669,12 +691,13 @@ class ProjectController extends BaseController
669 * @method :post 691 * @method :post
670 * @time :2023/8/30 19:01 692 * @time :2023/8/30 19:01
671 */ 693 */
672 - public function online_check(OnlineCheckLogic $logic){ 694 + public function online_check(OnlineCheckLogic $logic)
  695 + {
673 $this->request->validate([ 696 $this->request->validate([
674 - 'id'=>'required',  
675 - 'type'=>'required|in:optimist,qa',  
676 - 'status'=>'required|in:0,1'  
677 - ],[ 697 + 'id' => 'required',
  698 + 'type' => 'required|in:optimist,qa',
  699 + 'status' => 'required|in:0,1'
  700 + ], [
678 'id.required' => 'ID不能为空', 701 'id.required' => 'ID不能为空',
679 'type.required' => '请选择审核类型', 702 'type.required' => '请选择审核类型',
680 'type.in' => '审核类型值无效', 703 'type.in' => '审核类型值无效',
@@ -692,15 +715,16 @@ class ProjectController extends BaseController @@ -692,15 +715,16 @@ class ProjectController extends BaseController
692 * @method :post 715 * @method :post
693 * @time :2023/8/4 16:27 716 * @time :2023/8/4 16:27
694 */ 717 */
695 - public function getBelongingGroup(){ 718 + public function getBelongingGroup()
  719 + {
696 $this->request->validate([ 720 $this->request->validate([
697 - 'type'=>'required',  
698 - ],[ 721 + 'type' => 'required',
  722 + ], [
699 'type.required' => '请选择审核类型' 723 'type.required' => '请选择审核类型'
700 ]); 724 ]);
701 $belongGroupModel = new BelongingGroup(); 725 $belongGroupModel = new BelongingGroup();
702 - $lists = $belongGroupModel->list($this->map,'name',['id','name','type'],'asc');  
703 - $this->response('success',Code::SUCCESS,$lists); 726 + $lists = $belongGroupModel->list($this->map, 'name', ['id', 'name', 'type'], 'asc');
  727 + $this->response('success', Code::SUCCESS, $lists);
704 } 728 }
705 729
706 /** 730 /**
@@ -710,21 +734,22 @@ class ProjectController extends BaseController @@ -710,21 +734,22 @@ class ProjectController extends BaseController
710 * @method :post 734 * @method :post
711 * @time :2023/8/8 10:29 735 * @time :2023/8/8 10:29
712 */ 736 */
713 - public function getManagerList(){ 737 + public function getManagerList()
  738 + {
714 $hrManagerModel = new ManageHr(); 739 $hrManagerModel = new ManageHr();
715 - if(!isset($this->map['status'])){ 740 + if (!isset($this->map['status'])) {
716 $this->map['status'] = $hrManagerModel::STATUS_ONE; 741 $this->map['status'] = $hrManagerModel::STATUS_ONE;
717 - }else{  
718 - if(!is_array($this->map['status'])){ 742 + } else {
  743 + if (!is_array($this->map['status'])) {
719 $this->map['status'] = [$this->map['status']]; 744 $this->map['status'] = [$this->map['status']];
720 } 745 }
721 - $this->map['status'] = ['in',$this->map['status']]; 746 + $this->map['status'] = ['in', $this->map['status']];
722 } 747 }
723 - if(isset($this->map['entry_position']) && !empty($this->map['entry_position'])){  
724 - $this->map['entry_position'] = ['in',$this->map['entry_position']]; 748 + if (isset($this->map['entry_position']) && !empty($this->map['entry_position'])) {
  749 + $this->map['entry_position'] = ['in', $this->map['entry_position']];
725 } 750 }
726 - $lists = $hrManagerModel->list($this->map,['sort','id'],['id','manage_id','name','entry_position','is_leader']);  
727 - $this->response('success',Code::SUCCESS,$lists); 751 + $lists = $hrManagerModel->list($this->map, ['sort', 'id'], ['id', 'manage_id', 'name', 'entry_position', 'is_leader']);
  752 + $this->response('success', Code::SUCCESS, $lists);
728 } 753 }
729 754
730 /** 755 /**
@@ -734,10 +759,11 @@ class ProjectController extends BaseController @@ -734,10 +759,11 @@ class ProjectController extends BaseController
734 * @method :post 759 * @method :post
735 * @time :2023/8/14 10:23 todo::后面删除 760 * @time :2023/8/14 10:23 todo::后面删除
736 */ 761 */
737 - public function getServiceConfig(){ 762 + public function getServiceConfig()
  763 + {
738 $serviceConfigModel = new ServerConfig(); 764 $serviceConfigModel = new ServerConfig();
739 - $list = $serviceConfigModel->list($this->param,'id',['id','type','title','count','init_domain','service_type']);  
740 - $this->response('success',Code::SUCCESS,$list); 765 + $list = $serviceConfigModel->list($this->param, 'id', ['id', 'type', 'title', 'count', 'init_domain', 'service_type']);
  766 + $this->response('success', Code::SUCCESS, $list);
741 } 767 }
742 768
743 /** 769 /**
@@ -747,15 +773,16 @@ class ProjectController extends BaseController @@ -747,15 +773,16 @@ class ProjectController extends BaseController
747 * @method :post 773 * @method :post
748 * @time :2023/8/14 10:29 774 * @time :2023/8/14 10:29
749 */ 775 */
750 - public function getDomain(){ 776 + public function getDomain()
  777 + {
751 $this->request->validate([ 778 $this->request->validate([
752 - 'project_id'=>'required',  
753 - ],[ 779 + 'project_id' => 'required',
  780 + ], [
754 'project_id.required' => 'project_id不能为空', 781 'project_id.required' => 'project_id不能为空',
755 ]); 782 ]);
756 $domainModel = new DomainInfo(); 783 $domainModel = new DomainInfo();
757 - $list = $domainModel->list(['status'=>0,'project_id'=>['or',$this->param['project_id']]]);  
758 - $this->response('success',Code::SUCCESS,$list); 784 + $list = $domainModel->list(['status' => 0, 'project_id' => ['or', $this->param['project_id']]]);
  785 + $this->response('success', Code::SUCCESS, $list);
759 } 786 }
760 787
761 /** 788 /**
@@ -763,18 +790,19 @@ class ProjectController extends BaseController @@ -763,18 +790,19 @@ class ProjectController extends BaseController
763 * @author zbj 790 * @author zbj
764 * @date 2023/9/4 791 * @date 2023/9/4
765 */ 792 */
766 - public function getProjectInService(){ 793 + public function getProjectInService()
  794 + {
767 $company = $this->param['company']; 795 $company = $this->param['company'];
768 - if(!$company){  
769 - $this->response('企业名称必传',Code::SYSTEM_ERROR); 796 + if (!$company) {
  797 + $this->response('企业名称必传', Code::SYSTEM_ERROR);
770 } 798 }
771 $project = Project::where('company', $company)->first(); 799 $project = Project::where('company', $company)->first();
772 - if($project && ($project['remain_day'] > 0 || in_array($project['type'], [0, 1,6]))){ 800 + if ($project && ($project['remain_day'] > 0 || in_array($project['type'], [0, 1, 6]))) {
773 $in_service = 1; 801 $in_service = 1;
774 - }else{ 802 + } else {
775 $in_service = 0; 803 $in_service = 0;
776 } 804 }
777 - $this->response('success',Code::SUCCESS, ['in_service' => $in_service]); 805 + $this->response('success', Code::SUCCESS, ['in_service' => $in_service]);
778 } 806 }
779 807
780 /** 808 /**
@@ -784,10 +812,11 @@ class ProjectController extends BaseController @@ -784,10 +812,11 @@ class ProjectController extends BaseController
784 * @method :post 812 * @method :post
785 * @time :2023/9/8 15:21 813 * @time :2023/9/8 15:21
786 */ 814 */
787 - public function del(ProjectLogic $logic){ 815 + public function del(ProjectLogic $logic)
  816 + {
788 $this->request->validate([ 817 $this->request->validate([
789 - 'id'=>'required',  
790 - ],[ 818 + 'id' => 'required',
  819 + ], [
791 'id.required' => 'id不能为空', 820 'id.required' => 'id不能为空',
792 ]); 821 ]);
793 $logic->projectDel(); 822 $logic->projectDel();
@@ -799,64 +828,74 @@ class ProjectController extends BaseController @@ -799,64 +828,74 @@ class ProjectController extends BaseController
799 * @author zbj 828 * @author zbj
800 * @date 2023/9/11 829 * @date 2023/9/11
801 */ 830 */
802 - public function getProjectByChannel(Request $request){ 831 + public function getProjectByChannel(Request $request)
  832 + {
803 $id = $this->param['id'] ?? ''; 833 $id = $this->param['id'] ?? '';
804 $notice_order_id = $this->param['notice_order_id'] ?? ''; 834 $notice_order_id = $this->param['notice_order_id'] ?? '';
805 $source_id = $this->param['channel_id'] ?? 0; //原系统渠道id 835 $source_id = $this->param['channel_id'] ?? 0; //原系统渠道id
806 $size = $this->param['page_size'] ?? 20; 836 $size = $this->param['page_size'] ?? 20;
807 $type = $this->param['type'] ?? ''; 837 $type = $this->param['type'] ?? '';
808 $company = $this->param['company'] ?? ''; 838 $company = $this->param['company'] ?? '';
809 - $order_by_field = $request->input('order_by_field', 'id');  
810 - $order_by_sort = $request->input('order_by_sort', 'desc'); 839 + $order_by_field = $request->input('order_by_field', 'id');
  840 + $order_by_sort = $request->input('order_by_sort', 'desc');
811 $start_time = $this->param['start_time'] ?? ''; 841 $start_time = $this->param['start_time'] ?? '';
812 $end_time = $this->param['end_time'] ?? ''; 842 $end_time = $this->param['end_time'] ?? '';
813 - if(!$source_id && !$id){  
814 - $this->response('参数异常',Code::SYSTEM_ERROR); 843 + $plan = $this->param['plan'] ?? '';
  844 + if (!$source_id && !$id) {
  845 + $this->response('参数异常', Code::SYSTEM_ERROR);
815 } 846 }
816 $channel_id = 0; 847 $channel_id = 0;
817 - if($source_id){ 848 + if ($source_id) {
818 $channel = Channel::where('source_id', $source_id)->first(); 849 $channel = Channel::where('source_id', $source_id)->first();
819 - if(!$channel){  
820 - $this->response('渠道不存在',Code::SYSTEM_ERROR); 850 + if (!$channel) {
  851 + $this->response('渠道不存在', Code::SYSTEM_ERROR);
821 } 852 }
822 $channel_id = $channel->id; 853 $channel_id = $channel->id;
823 } 854 }
824 855
825 - if ($id){  
826 - if(!is_array($id)){ 856 + if ($id) {
  857 + if (!is_array($id)) {
827 $id = explode(',', $id); 858 $id = explode(',', $id);
828 } 859 }
829 } 860 }
830 - if ($notice_order_id){  
831 - if(!is_array($notice_order_id)){ 861 + if ($notice_order_id) {
  862 + if (!is_array($notice_order_id)) {
832 $notice_order_id = explode(',', $notice_order_id); 863 $notice_order_id = explode(',', $notice_order_id);
833 } 864 }
834 } 865 }
835 866
836 $data = Project::with(['deploy_build', 'deploy_optimize', 'online_check']) 867 $data = Project::with(['deploy_build', 'deploy_optimize', 'online_check'])
  868 + ->whereHas('deploy_build', function ($query) use ($plan) {
  869 + if ($plan && in_array($plan, Project::planMap())) {
  870 + $query->where('plan', array_search($plan, Project::planMap()));
  871 + }
  872 + if ($plan && in_array($plan, Project::seoMap())) {
  873 + $query->where('seo_plan', array_search($plan, Project::seoMap()));
  874 + }
  875 + })
837 ->where('delete_status', 0) 876 ->where('delete_status', 0)
838 - ->where(function ($query) use ($channel_id, $type, $company, $id, $notice_order_id, $start_time, $end_time){  
839 - if ($channel_id) {  
840 - $query->where('channel->channel_id', $channel_id);  
841 - }  
842 - if ($type) {  
843 - $query->where('type', $type);  
844 - }  
845 - if ($company) {  
846 - $query->where('company', 'like', '%' . $company . '%');  
847 - }  
848 - if ($id) {  
849 - $query->whereIn('id', $id);  
850 - }  
851 - if ($notice_order_id) {  
852 - $query->whereIn('notice_order_id', $notice_order_id);  
853 - }  
854 - if ($start_time && $end_time ) {  
855 - $query->whereBetween('uptime', [$start_time, $end_time]);  
856 - }  
857 - })->orderBy($order_by_field, $order_by_sort)->paginate($size)->toArray(); 877 + ->where(function ($query) use ($channel_id, $type, $company, $id, $notice_order_id, $start_time, $end_time) {
  878 + if ($channel_id) {
  879 + $query->where('channel->channel_id', $channel_id);
  880 + }
  881 + if ($type) {
  882 + $query->where('type', $type);
  883 + }
  884 + if ($company) {
  885 + $query->where('company', 'like', '%' . $company . '%');
  886 + }
  887 + if ($id) {
  888 + $query->whereIn('id', $id);
  889 + }
  890 + if ($notice_order_id) {
  891 + $query->whereIn('notice_order_id', $notice_order_id);
  892 + }
  893 + if ($start_time && $end_time) {
  894 + $query->whereBetween('uptime', [$start_time, $end_time]);
  895 + }
  896 + })->orderBy($order_by_field, $order_by_sort)->paginate($size)->toArray();
858 $list = []; 897 $list = [];
859 - foreach ($data['list'] as $item){ 898 + foreach ($data['list'] as $item) {
860 $domain = ''; 899 $domain = '';
861 if ($item['deploy_optimize']['domain']) { 900 if ($item['deploy_optimize']['domain']) {
862 $domain_pro = DomainInfo::where('id', $item['deploy_optimize']['domain'])->first(); 901 $domain_pro = DomainInfo::where('id', $item['deploy_optimize']['domain'])->first();
@@ -868,29 +907,31 @@ class ProjectController extends BaseController @@ -868,29 +907,31 @@ class ProjectController extends BaseController
868 $item['channel']['user'] = User::where('id', $item['channel']['user_id'])->value('name'); 907 $item['channel']['user'] = User::where('id', $item['channel']['user_id'])->value('name');
869 $manageHr = new ManageHr(); 908 $manageHr = new ManageHr();
870 $param = [ 909 $param = [
871 - "id" => $item['id'],  
872 - "title" => $item['title'],  
873 - "company" => $item['company'],  
874 - "type" => $item['extend_type'] ?: $item['type'],  
875 - "type_text" => Project::typeMap()[$item['type']] ?? '',  
876 - "channel" => $item['channel'],  
877 - "created_at" => $item['created_at'],  
878 - "updated_at" => $item['updated_at'],  
879 - "post_id" => $item['post_id'],  
880 - "from_order_id" => $item['from_order_id'],  
881 - "remain_day" => $item['remain_day'],  
882 - "last_inquiry_time" => $item['last_inquiry_time'],  
883 - "plan" => $item['deploy_build']['plan'] ?: 0,  
884 - "plan_text" => Project::planMap()[$item['deploy_build']['plan']] ?? '',  
885 - "start_date" => $item['deploy_optimize']['start_date'] ?? '',  
886 - "domain" => $domain ? 'https://' . $domain : $domain,  
887 - "test_domain" => $item['deploy_build']['test_domain'] ?? '', 910 + "id" => $item['id'],
  911 + "title" => $item['title'],
  912 + "company" => $item['company'],
  913 + "type" => $item['extend_type'] ?: $item['type'],
  914 + "type_text" => Project::typeMap()[$item['type']] ?? '',
  915 + "channel" => $item['channel'],
  916 + "created_at" => $item['created_at'],
  917 + "updated_at" => $item['updated_at'],
  918 + "post_id" => $item['post_id'],
  919 + "from_order_id" => $item['from_order_id'],
  920 + "remain_day" => $item['remain_day'],
  921 + "last_inquiry_time" => $item['last_inquiry_time'],
  922 + "plan" => $item['deploy_build']['plan'] ?: 0,
  923 + "plan_text" => Project::planMap()[$item['deploy_build']['plan']] ?? '',
  924 + "geo_plan" => $item['deploy_build']['seo_plan'] ?: 0,
  925 + "geo_plan_text" => Project::seoMap()[$item['deploy_build']['seo_plan']] ?? '',
  926 + "start_date" => $item['deploy_optimize']['start_date'] ?? '',
  927 + "domain" => $domain ? 'https://' . $domain : $domain,
  928 + "test_domain" => $item['deploy_build']['test_domain'] ?? '',
888 // "online_time" => $item['online_check']['qa_check_time'] ?? '', 929 // "online_time" => $item['online_check']['qa_check_time'] ?? '',
889 - "online_time" => $item['uptime'] ?? '',  
890 - "cooperate_date" => $item['cooperate_date'],  
891 - "project_manager_name" => $manageHr->getName($item['deploy_build']['manager_mid']), //项目经理  
892 - "after_sales_manager_name" => $manageHr->getName($item['deploy_optimize']['manager_mid']), //售后服务经理  
893 - "leader_name" => $manageHr->getName($item['deploy_build']['leader_mid']), //组长 930 + "online_time" => $item['uptime'] ?? '',
  931 + "cooperate_date" => $item['cooperate_date'],
  932 + "project_manager_name" => $manageHr->getName($item['deploy_build']['manager_mid']), //项目经理
  933 + "after_sales_manager_name" => $manageHr->getName($item['deploy_optimize']['manager_mid']), //售后服务经理
  934 + "leader_name" => $manageHr->getName($item['deploy_build']['leader_mid']), //组长
894 'version' => $item['version'] 935 'version' => $item['version']
895 ]; 936 ];
896 if ($item['type'] == Project::TYPE_TWO) { 937 if ($item['type'] == Project::TYPE_TWO) {
@@ -906,7 +947,8 @@ class ProjectController extends BaseController @@ -906,7 +947,8 @@ class ProjectController extends BaseController
906 $list[] = $param; 947 $list[] = $param;
907 } 948 }
908 $data['list'] = $list; 949 $data['list'] = $list;
909 - $this->response('success',Code::SUCCESS, $data); 950 + $data['plan'] = array_merge(Project::planMap(), Project::seoMap());
  951 + $this->response('success', Code::SUCCESS, $data);
910 } 952 }
911 953
912 /** 954 /**
@@ -916,9 +958,10 @@ class ProjectController extends BaseController @@ -916,9 +958,10 @@ class ProjectController extends BaseController
916 * @method :post 958 * @method :post
917 * @time :2023/9/28 9:09 959 * @time :2023/9/28 9:09
918 */ 960 */
919 - public function getRenewLog(RenewLog $renewLog){  
920 - $lists = $renewLog->lists($this->map,$this->page,$this->row,$this->order);  
921 - $this->response('success',Code::SUCCESS,$lists); 961 + public function getRenewLog(RenewLog $renewLog)
  962 + {
  963 + $lists = $renewLog->lists($this->map, $this->page, $this->row, $this->order);
  964 + $this->response('success', Code::SUCCESS, $lists);
922 } 965 }
923 966
924 /** 967 /**
@@ -928,20 +971,21 @@ class ProjectController extends BaseController @@ -928,20 +971,21 @@ class ProjectController extends BaseController
928 * @method :post 971 * @method :post
929 * @time :2023/11/8 11:17 972 * @time :2023/11/8 11:17
930 */ 973 */
931 - public function tdkList(){ 974 + public function tdkList()
  975 + {
932 $this->request->validate([ 976 $this->request->validate([
933 - 'project_id'=>'required',  
934 - ],[ 977 + 'project_id' => 'required',
  978 + ], [
935 'project_id.required' => '项目ID不能为空', 979 'project_id.required' => '项目ID不能为空',
936 ]); 980 ]);
937 $tdkModel = new ProjectUpdateTdk(); 981 $tdkModel = new ProjectUpdateTdk();
938 - $list = $tdkModel->list(['project_id'=>$this->map['project_id']],'id',['*'],'desc',5);  
939 - if(!empty($list)){  
940 - foreach ($list as $k => $v){ 982 + $list = $tdkModel->list(['project_id' => $this->map['project_id']], 'id', ['*'], 'desc', 5);
  983 + if (!empty($list)) {
  984 + foreach ($list as $k => $v) {
941 $list[$k] = $this->handleTdk($v); 985 $list[$k] = $this->handleTdk($v);
942 } 986 }
943 } 987 }
944 - $this->response('success',Code::SUCCESS,$list); 988 + $this->response('success', Code::SUCCESS, $list);
945 } 989 }
946 990
947 /** 991 /**
@@ -951,28 +995,29 @@ class ProjectController extends BaseController @@ -951,28 +995,29 @@ class ProjectController extends BaseController
951 * @method :post 995 * @method :post
952 * @time :2023/12/29 11:16 996 * @time :2023/12/29 11:16
953 */ 997 */
954 - public function handleTdk($item){ 998 + public function handleTdk($item)
  999 + {
955 $data = [ 1000 $data = [
956 - 'gl_product'=>'产品',  
957 - 'gl_product_category'=>'产品分类',  
958 - 'gl_product_keyword'=>'产品关键字',  
959 - 'gl_news'=>'新闻',  
960 - 'gl_news_category'=>'新闻分类',  
961 - 'gl_blog'=>'博客',  
962 - 'gl_blog_category'=>'博客分类',  
963 - 'gl_web_custom_template'=>'自定义页面', 1001 + 'gl_product' => '产品',
  1002 + 'gl_product_category' => '产品分类',
  1003 + 'gl_product_keyword' => '产品关键字',
  1004 + 'gl_news' => '新闻',
  1005 + 'gl_news_category' => '新闻分类',
  1006 + 'gl_blog' => '博客',
  1007 + 'gl_blog_category' => '博客分类',
  1008 + 'gl_web_custom_template' => '自定义页面',
964 ]; 1009 ];
965 - foreach ($data as $k => $v){  
966 - if(isset($item[$k])){ 1010 + foreach ($data as $k => $v) {
  1011 + if (isset($item[$k])) {
967 $data = Arr::s2a($item[$k]); 1012 $data = Arr::s2a($item[$k]);
968 //{"des": 3500, "title": 0, "keyword": 3501, "total_page": 8458, "keyword_title": 3500, "keyword_content": 3500} 1013 //{"des": 3500, "title": 0, "keyword": 3501, "total_page": 8458, "keyword_title": 3500, "keyword_content": 3500}
969 - $item[$k] = $v.'总条数:'.$data['total_page'].  
970 - ', title更新数:'.$data['title'].  
971 - ',keyword更新数:'.$data['keyword'].  
972 - ',des更新数:'.$data['des'];  
973 - if($k == 'gl_product_keyword'){  
974 - $item[$k] .= ',keyword_title更新数:'.($data['keyword_title']??0);  
975 - $item[$k] .= ',keyword_content更新数:'.($data['keyword_content']??0); 1014 + $item[$k] = $v . '总条数:' . $data['total_page'] .
  1015 + ', title更新数:' . $data['title'] .
  1016 + ',keyword更新数:' . $data['keyword'] .
  1017 + ',des更新数:' . $data['des'];
  1018 + if ($k == 'gl_product_keyword') {
  1019 + $item[$k] .= ',keyword_title更新数:' . ($data['keyword_title'] ?? 0);
  1020 + $item[$k] .= ',keyword_content更新数:' . ($data['keyword_content'] ?? 0);
976 } 1021 }
977 } 1022 }
978 1023
@@ -987,14 +1032,15 @@ class ProjectController extends BaseController @@ -987,14 +1032,15 @@ class ProjectController extends BaseController
987 * @method :post 1032 * @method :post
988 * @time :2023/11/8 14:17 1033 * @time :2023/11/8 14:17
989 */ 1034 */
990 - public function copyProject(ProjectLogic $logic){ 1035 + public function copyProject(ProjectLogic $logic)
  1036 + {
991 $this->request->validate([ 1037 $this->request->validate([
992 - 'project_id'=>'required',  
993 - ],[ 1038 + 'project_id' => 'required',
  1039 + ], [
994 'project_id.required' => 'project_id不能为空', 1040 'project_id.required' => 'project_id不能为空',
995 ]); 1041 ]);
996 $data = $logic->copyProject(); 1042 $data = $logic->copyProject();
997 - $this->response('success',Code::SUCCESS,$data); 1043 + $this->response('success', Code::SUCCESS, $data);
998 } 1044 }
999 1045
1000 /** 1046 /**
@@ -1002,14 +1048,15 @@ class ProjectController extends BaseController @@ -1002,14 +1048,15 @@ class ProjectController extends BaseController
1002 * @author zbj 1048 * @author zbj
1003 * @date 2023/11/10 1049 * @date 2023/11/10
1004 */ 1050 */
1005 - public function site_token(ProjectLogic $logic){ 1051 + public function site_token(ProjectLogic $logic)
  1052 + {
1006 $this->request->validate([ 1053 $this->request->validate([
1007 - 'project_id'=>'required',  
1008 - ],[ 1054 + 'project_id' => 'required',
  1055 + ], [
1009 'project_id.required' => 'project_id不能为空', 1056 'project_id.required' => 'project_id不能为空',
1010 ]); 1057 ]);
1011 $token = $logic->getSiteToken($this->map); 1058 $token = $logic->getSiteToken($this->map);
1012 - $this->response('success',Code::SUCCESS,['site_token' => $token]); 1059 + $this->response('success', Code::SUCCESS, ['site_token' => $token]);
1013 } 1060 }
1014 1061
1015 /** 1062 /**
@@ -1019,12 +1066,13 @@ class ProjectController extends BaseController @@ -1019,12 +1066,13 @@ class ProjectController extends BaseController
1019 * @method :post 1066 * @method :post
1020 * @time :2023/11/17 15:23 1067 * @time :2023/11/17 15:23
1021 */ 1068 */
1022 - public function saveOtherProject(ProjectLogic $logic){ 1069 + public function saveOtherProject(ProjectLogic $logic)
  1070 + {
1023 $this->request->validate([ 1071 $this->request->validate([
1024 - 'id'=>'required',  
1025 - 'aicc'=>'required',  
1026 - 'hagro'=>'required',  
1027 - ],[ 1072 + 'id' => 'required',
  1073 + 'aicc' => 'required',
  1074 + 'hagro' => 'required',
  1075 + ], [
1028 'id.required' => 'id不能为空', 1076 'id.required' => 'id不能为空',
1029 'aicc.required' => 'aicc是否开启不能为空', 1077 'aicc.required' => 'aicc是否开启不能为空',
1030 'hagro.required' => 'hagro是否开启不能为空', 1078 'hagro.required' => 'hagro是否开启不能为空',
@@ -1040,14 +1088,15 @@ class ProjectController extends BaseController @@ -1040,14 +1088,15 @@ class ProjectController extends BaseController
1040 * @method :post 1088 * @method :post
1041 * @time :2023/11/17 15:23 1089 * @time :2023/11/17 15:23
1042 */ 1090 */
1043 - public function getOtherProject(ProjectLogic $logic){ 1091 + public function getOtherProject(ProjectLogic $logic)
  1092 + {
1044 $this->request->validate([ 1093 $this->request->validate([
1045 - 'id'=>'required',  
1046 - ],[ 1094 + 'id' => 'required',
  1095 + ], [
1047 'id.required' => 'id不能为空', 1096 'id.required' => 'id不能为空',
1048 ]); 1097 ]);
1049 $info = $logic->getOtherProject(); 1098 $info = $logic->getOtherProject();
1050 - $this->response('success',Code::SUCCESS,$info); 1099 + $this->response('success', Code::SUCCESS, $info);
1051 } 1100 }
1052 1101
1053 /** 1102 /**
@@ -1057,20 +1106,21 @@ class ProjectController extends BaseController @@ -1057,20 +1106,21 @@ class ProjectController extends BaseController
1057 * @method :post 1106 * @method :post
1058 * @time :2023/11/17 16:08 1107 * @time :2023/11/17 16:08
1059 */ 1108 */
1060 - public function getChannel(){ 1109 + public function getChannel()
  1110 + {
1061 $zoneModel = new Zone(); 1111 $zoneModel = new Zone();
1062 $zone_list = $zoneModel->list(); 1112 $zone_list = $zoneModel->list();
1063 $channelModel = new Channel(); 1113 $channelModel = new Channel();
1064 $channelUserModel = new User(); 1114 $channelUserModel = new User();
1065 - foreach ($zone_list as $k => $v){  
1066 - $channel_list = $channelModel->list(['zone_id'=>$v['id']]);  
1067 - foreach ($channel_list as $k1 => $v1){  
1068 - $user_list = $channelUserModel->list(['channel_id'=>$v1['id']]); 1115 + foreach ($zone_list as $k => $v) {
  1116 + $channel_list = $channelModel->list(['zone_id' => $v['id']]);
  1117 + foreach ($channel_list as $k1 => $v1) {
  1118 + $user_list = $channelUserModel->list(['channel_id' => $v1['id']]);
1069 $channel_list[$k1]['sub'] = $user_list; 1119 $channel_list[$k1]['sub'] = $user_list;
1070 } 1120 }
1071 $zone_list[$k]['sub'] = $channel_list; 1121 $zone_list[$k]['sub'] = $channel_list;
1072 } 1122 }
1073 - $this->response('success',Code::SUCCESS,$zone_list); 1123 + $this->response('success', Code::SUCCESS, $zone_list);
1074 } 1124 }
1075 1125
1076 /** 1126 /**
@@ -1080,10 +1130,11 @@ class ProjectController extends BaseController @@ -1080,10 +1130,11 @@ class ProjectController extends BaseController
1080 * @method :post 1130 * @method :post
1081 * @time :2023/11/30 10:59 1131 * @time :2023/11/30 10:59
1082 */ 1132 */
1083 - public function languageLists(){ 1133 + public function languageLists()
  1134 + {
1084 $webLanguageModel = new WebLanguage(); 1135 $webLanguageModel = new WebLanguage();
1085 $lists = $webLanguageModel->list(); 1136 $lists = $webLanguageModel->list();
1086 - $this->response('success',Code::SUCCESS,$lists); 1137 + $this->response('success', Code::SUCCESS, $lists);
1087 } 1138 }
1088 1139
1089 /** 1140 /**
@@ -1091,8 +1142,9 @@ class ProjectController extends BaseController @@ -1091,8 +1142,9 @@ class ProjectController extends BaseController
1091 * @author zbj 1142 * @author zbj
1092 * @date 2024/1/19 1143 * @date 2024/1/19
1093 */ 1144 */
1094 - public function countryLists(){  
1095 - $this->response('success',Code::SUCCESS, Country::getCountryList()); 1145 + public function countryLists()
  1146 + {
  1147 + $this->response('success', Code::SUCCESS, Country::getCountryList());
1096 } 1148 }
1097 1149
1098 /** 1150 /**
@@ -1100,10 +1152,11 @@ class ProjectController extends BaseController @@ -1100,10 +1152,11 @@ class ProjectController extends BaseController
1100 * @author zbj 1152 * @author zbj
1101 * @date 2024/1/19 1153 * @date 2024/1/19
1102 */ 1154 */
1103 - public function saveInquiryFilterConfig(ProjectLogic $logic){ 1155 + public function saveInquiryFilterConfig(ProjectLogic $logic)
  1156 + {
1104 $this->request->validate([ 1157 $this->request->validate([
1105 - 'project_id'=>'required',  
1106 - ],[ 1158 + 'project_id' => 'required',
  1159 + ], [
1107 'project_id.required' => '项目id不能为空', 1160 'project_id.required' => '项目id不能为空',
1108 ]); 1161 ]);
1109 $logic->saveInquiryFilterConfig($this->param); 1162 $logic->saveInquiryFilterConfig($this->param);
@@ -1115,10 +1168,11 @@ class ProjectController extends BaseController @@ -1115,10 +1168,11 @@ class ProjectController extends BaseController
1115 * @author zbj 1168 * @author zbj
1116 * @date 2024/3/29 1169 * @date 2024/3/29
1117 */ 1170 */
1118 - public function saveWebTrafficConfig(ProjectLogic $logic){ 1171 + public function saveWebTrafficConfig(ProjectLogic $logic)
  1172 + {
1119 $this->request->validate([ 1173 $this->request->validate([
1120 - 'project_id'=>'required',  
1121 - ],[ 1174 + 'project_id' => 'required',
  1175 + ], [
1122 'project_id.required' => '项目id不能为空', 1176 'project_id.required' => '项目id不能为空',
1123 ]); 1177 ]);
1124 $logic->saveWebTrafficConfig($this->param); 1178 $logic->saveWebTrafficConfig($this->param);
@@ -1132,28 +1186,29 @@ class ProjectController extends BaseController @@ -1132,28 +1186,29 @@ class ProjectController extends BaseController
1132 * @method :post 1186 * @method :post
1133 * @time :2024/4/7 10:41 1187 * @time :2024/4/7 10:41
1134 */ 1188 */
1135 - public function updateProjectManager(ProjectLogic $logic){ 1189 + public function updateProjectManager(ProjectLogic $logic)
  1190 + {
1136 $this->request->validate([ 1191 $this->request->validate([
1137 - 'old_id'=>'required',  
1138 - 'new_id'=>'required'  
1139 - ],[ 1192 + 'old_id' => 'required',
  1193 + 'new_id' => 'required'
  1194 + ], [
1140 'old_id.required' => '参数不能为空', 1195 'old_id.required' => '参数不能为空',
1141 'new_id.required' => '参数不能为空', 1196 'new_id.required' => '参数不能为空',
1142 ]); 1197 ]);
1143 //查看当前用户是否存在 1198 //查看当前用户是否存在
1144 $hrModel = new ManageHr(); 1199 $hrModel = new ManageHr();
1145 - $oldHrInfo = $hrModel->read(['id'=>$this->param['old_id']]);  
1146 - if($oldHrInfo === false){  
1147 - $this->response('当前用户不存在',Code::SYSTEM_ERROR); 1200 + $oldHrInfo = $hrModel->read(['id' => $this->param['old_id']]);
  1201 + if ($oldHrInfo === false) {
  1202 + $this->response('当前用户不存在', Code::SYSTEM_ERROR);
1148 } 1203 }
1149 - $newHrInfo = $hrModel->read(['id'=>$this->param['new_id'],'status'=>1]);  
1150 - if($newHrInfo === false){  
1151 - $this->response('变更的用户不存在',Code::SYSTEM_ERROR); 1204 + $newHrInfo = $hrModel->read(['id' => $this->param['new_id'], 'status' => 1]);
  1205 + if ($newHrInfo === false) {
  1206 + $this->response('变更的用户不存在', Code::SYSTEM_ERROR);
1152 } 1207 }
1153 - if($oldHrInfo['entry_position'] != $newHrInfo['entry_position']){  
1154 - $this->response('不同岗位不允许变更',Code::SYSTEM_ERROR); 1208 + if ($oldHrInfo['entry_position'] != $newHrInfo['entry_position']) {
  1209 + $this->response('不同岗位不允许变更', Code::SYSTEM_ERROR);
1155 } 1210 }
1156 - $logic->getManagerFiled($newHrInfo['entry_position'],$this->param['old_id'],$this->param['new_id'],$this->param['project_id'] ?? []); 1211 + $logic->getManagerFiled($newHrInfo['entry_position'], $this->param['old_id'], $this->param['new_id'], $this->param['project_id'] ?? []);
1157 $this->response('success'); 1212 $this->response('success');
1158 } 1213 }
1159 1214
@@ -1164,16 +1219,17 @@ class ProjectController extends BaseController @@ -1164,16 +1219,17 @@ class ProjectController extends BaseController
1164 * @method :post 1219 * @method :post
1165 * @time :2024/6/19 10:07 1220 * @time :2024/6/19 10:07
1166 */ 1221 */
1167 - public function setIsParticiple(){ 1222 + public function setIsParticiple()
  1223 + {
1168 $this->request->validate([ 1224 $this->request->validate([
1169 - 'project_id'=>'required',  
1170 - 'is_participle'=>'required'  
1171 - ],[ 1225 + 'project_id' => 'required',
  1226 + 'is_participle' => 'required'
  1227 + ], [
1172 'project_id.required' => '项目id不能为空', 1228 'project_id.required' => '项目id不能为空',
1173 'is_participle.required' => '项目id不能为空', 1229 'is_participle.required' => '项目id不能为空',
1174 ]); 1230 ]);
1175 $deployBuildModel = new DeployBuild(); 1231 $deployBuildModel = new DeployBuild();
1176 - $deployBuildModel->edit(['is_participle'=>$this->param['is_participle']],['project_id'=>$this->param['project_id']]); 1232 + $deployBuildModel->edit(['is_participle' => $this->param['is_participle']], ['project_id' => $this->param['project_id']]);
1177 $this->response('success'); 1233 $this->response('success');
1178 } 1234 }
1179 1235
@@ -1185,54 +1241,55 @@ class ProjectController extends BaseController @@ -1185,54 +1241,55 @@ class ProjectController extends BaseController
1185 * @method :post 1241 * @method :post
1186 * @time :2024/7/29 17:12 1242 * @time :2024/7/29 17:12
1187 */ 1243 */
1188 - public function saveSiteStatus(){ 1244 + public function saveSiteStatus()
  1245 + {
1189 $this->request->validate([ 1246 $this->request->validate([
1190 - 'id'=>'required',  
1191 - 'site_status'=>'required'  
1192 - ],[ 1247 + 'id' => 'required',
  1248 + 'site_status' => 'required'
  1249 + ], [
1193 'id.required' => '项目id不能为空', 1250 'id.required' => '项目id不能为空',
1194 'site_status.required' => '状态不能为空', 1251 'site_status.required' => '状态不能为空',
1195 ]); 1252 ]);
1196 //获取项目数据 1253 //获取项目数据
1197 $projectModel = new Project(); 1254 $projectModel = new Project();
1198 - $projectInfo = $projectModel->read(['id'=>$this->param['id']],['project_type','serve_id','site_status','site_token']);  
1199 - if(!$projectInfo){ 1255 + $projectInfo = $projectModel->read(['id' => $this->param['id']], ['project_type', 'serve_id', 'site_status', 'site_token']);
  1256 + if (!$projectInfo) {
1200 $this->fail('获取项目数据失败'); 1257 $this->fail('获取项目数据失败');
1201 } 1258 }
1202 - if($projectInfo['site_status'] == $this->param['site_status']){ 1259 + if ($projectInfo['site_status'] == $this->param['site_status']) {
1203 $this->response('success'); 1260 $this->response('success');
1204 } 1261 }
1205 //获取服务器数据 1262 //获取服务器数据
1206 $serverIpModel = new ServersIp(); 1263 $serverIpModel = new ServersIp();
1207 $serversIpInfo = $serverIpModel->read(['id' => $projectInfo['serve_id']], ['servers_id']); 1264 $serversIpInfo = $serverIpModel->read(['id' => $projectInfo['serve_id']], ['servers_id']);
1208 - if(!$serversIpInfo){ 1265 + if (!$serversIpInfo) {
1209 $this->fail('获取项目所属服务器失败'); 1266 $this->fail('获取项目所属服务器失败');
1210 } 1267 }
1211 - if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){ 1268 + if ($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID) {
1212 //自建站项目 1269 //自建站项目
1213 - if($this->param['site_status'] == 1){ 1270 + if ($this->param['site_status'] == 1) {
1214 //关闭站点 1271 //关闭站点
1215 - $site_token = $projectInfo['site_token'] ? $projectInfo['site_token'].'_expired' : '';  
1216 - }else{ 1272 + $site_token = $projectInfo['site_token'] ? $projectInfo['site_token'] . '_expired' : '';
  1273 + } else {
1217 //开启站点 1274 //开启站点
1218 - $site_token = str_replace('_expired','',$projectInfo['site_token']); 1275 + $site_token = str_replace('_expired', '', $projectInfo['site_token']);
1219 } 1276 }
1220 - $projectModel->edit(['site_status'=>$this->param['site_status'],'site_token'=>$site_token],['id'=>$this->param['id']]);  
1221 - }else{ 1277 + $projectModel->edit(['site_status' => $this->param['site_status'], 'site_token' => $site_token], ['id' => $this->param['id']]);
  1278 + } else {
1222 //普通项目 1279 //普通项目
1223 //获取域名数据 1280 //获取域名数据
1224 $domainModel = new DomainInfoModel(); 1281 $domainModel = new DomainInfoModel();
1225 - $domainInfo = $domainModel->read(['project_id'=>$this->param['id']],['id','domain','amp_status']);  
1226 - if(!$domainInfo){ 1282 + $domainInfo = $domainModel->read(['project_id' => $this->param['id']], ['id', 'domain', 'amp_status']);
  1283 + if (!$domainInfo) {
1227 $this->fail('获取域名数据失败'); 1284 $this->fail('获取域名数据失败');
1228 } 1285 }
1229 - if($this->param['site_status'] == 1){ 1286 + if ($this->param['site_status'] == 1) {
1230 //关闭站点:通知C端 1287 //关闭站点:通知C端
1231 - $re = curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website');  
1232 - if(isset($re['status']) && $re['status'] !== 200){ 1288 + $re = curl_get('https://' . $domainInfo['domain'] . '/api/stop_or_start_website');
  1289 + if (isset($re['status']) && $re['status'] !== 200) {
1233 $this->fail($re['message']); 1290 $this->fail($re['message']);
1234 } 1291 }
1235 - }else{ 1292 + } else {
1236 //开启站点:创建建站任务 1293 //开启站点:创建建站任务
1237 if ($projectInfo['project_type'] == Project::PROJECT_TYPE_SEO) { 1294 if ($projectInfo['project_type'] == Project::PROJECT_TYPE_SEO) {
1238 $type = DomainCreateTask::TYPE_BLOG; 1295 $type = DomainCreateTask::TYPE_BLOG;
@@ -1253,7 +1310,7 @@ class ProjectController extends BaseController @@ -1253,7 +1310,7 @@ class ProjectController extends BaseController
1253 ]); 1310 ]);
1254 } 1311 }
1255 1312
1256 - if($domainInfo['amp_status']){ 1313 + if ($domainInfo['amp_status']) {
1257 $task_info_amp = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_AMP, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']); 1314 $task_info_amp = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_AMP, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
1258 if (!$task_info_amp) { 1315 if (!$task_info_amp) {
1259 $domainCreateTaskModel->add([ 1316 $domainCreateTaskModel->add([
@@ -1266,7 +1323,7 @@ class ProjectController extends BaseController @@ -1266,7 +1323,7 @@ class ProjectController extends BaseController
1266 } 1323 }
1267 } 1324 }
1268 } 1325 }
1269 - $projectModel->edit(['site_status'=>$this->param['site_status']],['id'=>$this->param['id']]); 1326 + $projectModel->edit(['site_status' => $this->param['site_status']], ['id' => $this->param['id']]);
1270 } 1327 }
1271 $this->response('success'); 1328 $this->response('success');
1272 } 1329 }
@@ -1290,15 +1347,16 @@ class ProjectController extends BaseController @@ -1290,15 +1347,16 @@ class ProjectController extends BaseController
1290 * @method :post 1347 * @method :post
1291 * @time :2025/6/10 10:51 1348 * @time :2025/6/10 10:51
1292 */ 1349 */
1293 - public function generateCountCharts(){ 1350 + public function generateCountCharts()
  1351 + {
1294 $this->request->validate([ 1352 $this->request->validate([
1295 - 'project_id'=>'required',  
1296 - ],[ 1353 + 'project_id' => 'required',
  1354 + ], [
1297 'project_id.required' => '项目id不能为空', 1355 'project_id.required' => '项目id不能为空',
1298 ]); 1356 ]);
1299 $noticeModel = new NoticeLog(); 1357 $noticeModel = new NoticeLog();
1300 - $info = $noticeModel->read(['type'=>NoticeLog::TYPE_GENERATE_COUNT_CHARTS,'status'=>0,'data'=>['like','%"'.$this->param['project_id'].'"%']]);  
1301 - if($info !== false){ 1358 + $info = $noticeModel->read(['type' => NoticeLog::TYPE_GENERATE_COUNT_CHARTS, 'status' => 0, 'data' => ['like', '%"' . $this->param['project_id'] . '"%']]);
  1359 + if ($info !== false) {
1302 $this->fail('当前数据在生成中'); 1360 $this->fail('当前数据在生成中');
1303 } 1361 }
1304 NoticeLog::createLog(NoticeLog::TYPE_GENERATE_COUNT_CHARTS, ['project_id' => $this->param['project_id']]); 1362 NoticeLog::createLog(NoticeLog::TYPE_GENERATE_COUNT_CHARTS, ['project_id' => $this->param['project_id']]);
@@ -1312,16 +1370,17 @@ class ProjectController extends BaseController @@ -1312,16 +1370,17 @@ class ProjectController extends BaseController
1312 * @method :post 1370 * @method :post
1313 * @time :2025/7/2 11:04 1371 * @time :2025/7/2 11:04
1314 */ 1372 */
1315 - public function updateTdk(){ 1373 + public function updateTdk()
  1374 + {
1316 $this->request->validate([ 1375 $this->request->validate([
1317 - 'project_id'=>'required',  
1318 - 'url'=>'required'  
1319 - ],[ 1376 + 'project_id' => 'required',
  1377 + 'url' => 'required'
  1378 + ], [
1320 'project_id.required' => '项目id不能为空', 1379 'project_id.required' => '项目id不能为空',
1321 'url.required' => '文件路径不为空', 1380 'url.required' => '文件路径不为空',
1322 ]); 1381 ]);
1323 - NoticeLog::createLog(NoticeLog::TYPE_UPDATE_PROJECT_TDK, ['project_id' => $this->param['project_id'],'url'=>$this->param['url']]);  
1324 - $this->response('success',Code::SUCCESS,['url'=>$this->param['url']]); 1382 + NoticeLog::createLog(NoticeLog::TYPE_UPDATE_PROJECT_TDK, ['project_id' => $this->param['project_id'], 'url' => $this->param['url']]);
  1383 + $this->response('success', Code::SUCCESS, ['url' => $this->param['url']]);
1325 } 1384 }
1326 1385
1327 /** 1386 /**
@@ -1331,11 +1390,12 @@ class ProjectController extends BaseController @@ -1331,11 +1390,12 @@ class ProjectController extends BaseController
1331 * @method :post 1390 * @method :post
1332 * @time :2025/8/5 9:50 1391 * @time :2025/8/5 9:50
1333 */ 1392 */
1334 - public function videoSetting(){ 1393 + public function videoSetting()
  1394 + {
1335 $videoModel = new AiVideoTask(); 1395 $videoModel = new AiVideoTask();
1336 $data['videoSetting'] = $videoModel->videoSetting(); 1396 $data['videoSetting'] = $videoModel->videoSetting();
1337 - $data['videoFrequency'] =$videoModel->videoFrequency();  
1338 - $this->response('success',Code::SUCCESS,$data); 1397 + $data['videoFrequency'] = $videoModel->videoFrequency();
  1398 + $this->response('success', Code::SUCCESS, $data);
1339 } 1399 }
1340 1400
1341 /** 1401 /**
@@ -9,10 +9,8 @@ @@ -9,10 +9,8 @@
9 9
10 namespace App\Http\Logic\Aside\Geo; 10 namespace App\Http\Logic\Aside\Geo;
11 11
12 -use App\Enums\Common\Code;  
13 use App\Http\Logic\Aside\BaseLogic; 12 use App\Http\Logic\Aside\BaseLogic;
14 use App\Models\Geo\GeoConf; 13 use App\Models\Geo\GeoConf;
15 -use App\Models\Geo\GeoQuestion;  
16 use App\Models\Manage\ManageHr; 14 use App\Models\Manage\ManageHr;
17 use App\Models\Project\KeywordPrefix; 15 use App\Models\Project\KeywordPrefix;
18 use App\Models\Project\Project; 16 use App\Models\Project\Project;
@@ -49,9 +49,7 @@ class GeoWritingsLogic extends BaseLogic @@ -49,9 +49,7 @@ class GeoWritingsLogic extends BaseLogic
49 */ 49 */
50 public function saveWriting(){ 50 public function saveWriting(){
51 try { 51 try {
52 - $this->param['content_length'] = strlen($this->param['content']);  
53 - $this->param['confirm_ip'] = $this->request->ip();  
54 - $this->param['confirm_at'] = date('Y-m-d H:i:s'); 52 + $this->param['status'] = GeoWritings::STATUS_INIT;
55 if(isset($this->param['id']) &&!empty($this->param['id'])){ 53 if(isset($this->param['id']) &&!empty($this->param['id'])){
56 $id = $this->param['id']; 54 $id = $this->param['id'];
57 $this->model->edit($this->param,['id'=>$id]); 55 $this->model->edit($this->param,['id'=>$id]);
@@ -80,4 +78,18 @@ class GeoWritingsLogic extends BaseLogic @@ -80,4 +78,18 @@ class GeoWritingsLogic extends BaseLogic
80 } 78 }
81 return $this->success(); 79 return $this->success();
82 } 80 }
  81 +
  82 + /**
  83 + * @remark :推送微信
  84 + * @name :sendWechatMessage
  85 + * @author :lyh
  86 + * @method :post
  87 + * @time :2025/10/28 10:15
  88 + */
  89 + public function sendWechatMessage()
  90 + {
  91 + $this->model->edit(['status'=>2],['status'=>1,'project_id'=>$this->param['project_id']]);
  92 + GeoWritings::sendConfirmMessage($this->param['project_id']);
  93 + return $this->success();
  94 + }
83 } 95 }
@@ -225,9 +225,7 @@ class NewsLogic extends BaseLogic @@ -225,9 +225,7 @@ class NewsLogic extends BaseLogic
225 if(isset($param['related_product_id'])){ 225 if(isset($param['related_product_id'])){
226 $param['related_product_id'] = implode(',',$param['related_product_id']); 226 $param['related_product_id'] = implode(',',$param['related_product_id']);
227 } 227 }
228 - if(!isset($param['seo_title']) || empty($param['seo_title'])){  
229 - $param['seo_title'] = truncate_text($param['name'],70);  
230 - } 228 + $param['seo_title'] = truncate_text($param['seo_title'] ?? $param['name'],70);
231 return $this->success($param); 229 return $this->success($param);
232 } 230 }
233 231
@@ -26,7 +26,7 @@ class NewsRequest extends FormRequest @@ -26,7 +26,7 @@ class NewsRequest extends FormRequest
26 return [ 26 return [
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
28 'url'=>'required', 28 'url'=>'required',
29 - 'seo_title' => 'max:70', 29 +// 'seo_title' => 'max:70',
30 'seo_keywords' => 'max:300', 30 'seo_keywords' => 'max:300',
31 'seo_description' => 'max:200', 31 'seo_description' => 'max:200',
32 ]; 32 ];
@@ -38,7 +38,7 @@ class NewsRequest extends FormRequest @@ -38,7 +38,7 @@ class NewsRequest extends FormRequest
38 'name.required'=>'请填写名称', 38 'name.required'=>'请填写名称',
39 'name.max'=>'名称超过最长长度200', 39 'name.max'=>'名称超过最长长度200',
40 'url.required'=>'链接不能为空', 40 'url.required'=>'链接不能为空',
41 - 'seo_title.max' => 'SEO标题不能超过70个字符', 41 +// 'seo_title.max' => 'SEO标题不能超过70个字符',
42 'seo_keywords.max' => 'SEO关键词不能超过300个字符', 42 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
43 'seo_description.max' => 'SEO描述不能超过200个字符', 43 'seo_description.max' => 'SEO描述不能超过200个字符',
44 ]; 44 ];
@@ -84,7 +84,7 @@ class RouteMap extends Base @@ -84,7 +84,7 @@ class RouteMap extends Base
84 } 84 }
85 $length = strlen($sign); 85 $length = strlen($sign);
86 if($length > $route_len){ 86 if($length > $route_len){
87 - $sign = trim(mb_substr($sign, 0, $route_len, 'UTF-8'),'-'); 87 + $sign = truncate_text($sign,$route_len);
88 } 88 }
89 $i=1;//路由重复时拼接 89 $i=1;//路由重复时拼接
90 $route = $sign.$suffix; 90 $route = $sign.$suffix;
@@ -113,5 +113,7 @@ Route::prefix('geo')->group(function () { @@ -113,5 +113,7 @@ Route::prefix('geo')->group(function () {
113 Route::any('/getWritingsList', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsList'])->name('geo.getWritingsList');//确认文章数据 113 Route::any('/getWritingsList', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsList'])->name('geo.getWritingsList');//确认文章数据
114 Route::any('/getWritingsDetail', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsDetail'])->name('geo.getWritingsDetail');//文章数据详情 114 Route::any('/getWritingsDetail', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsDetail'])->name('geo.getWritingsDetail');//文章数据详情
115 Route::any('/saveConfirm', [\App\Http\Controllers\Api\GeoController::class, 'saveConfirm'])->name('geo.saveConfirm');//保存用户确认信息 115 Route::any('/saveConfirm', [\App\Http\Controllers\Api\GeoController::class, 'saveConfirm'])->name('geo.saveConfirm');//保存用户确认信息
  116 + Route::any('/getWritingsList', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsList'])->name('geo.getWritingsList');//文章确认列表
  117 + Route::any('/confirmWritings', [\App\Http\Controllers\Api\GeoController::class, 'confirmWritings'])->name('geo.confirmWritings');//确认文章信息
116 }); 118 });
117 119
@@ -600,12 +600,14 @@ Route::middleware(['aloginauth'])->group(function () { @@ -600,12 +600,14 @@ Route::middleware(['aloginauth'])->group(function () {
600 Route::any('/', [Aside\Geo\GeoWritingTaskController::class, 'lists'])->name('admin.geo_writing_task_lists'); 600 Route::any('/', [Aside\Geo\GeoWritingTaskController::class, 'lists'])->name('admin.geo_writing_task_lists');
601 Route::any('/saveWritingTask', [Aside\Geo\GeoWritingTaskController::class, 'saveWritingTask'])->name('admin.geo_writing_task_saveWritingTask'); 601 Route::any('/saveWritingTask', [Aside\Geo\GeoWritingTaskController::class, 'saveWritingTask'])->name('admin.geo_writing_task_saveWritingTask');
602 Route::any('/delWritingTask', [Aside\Geo\GeoWritingTaskController::class, 'delWritingTask'])->name('admin.geo_writing_task_delWritingTask'); 602 Route::any('/delWritingTask', [Aside\Geo\GeoWritingTaskController::class, 'delWritingTask'])->name('admin.geo_writing_task_delWritingTask');
  603 + Route::any('/sendAiTitle', [Aside\Geo\GeoWritingTaskController::class, 'sendAiTitle'])->name('admin.geo_writing_task_sendAiTitle');
603 }); 604 });
604 //geo文章管理 605 //geo文章管理
605 Route::prefix('writing')->group(function () { 606 Route::prefix('writing')->group(function () {
606 Route::any('/', [Aside\Geo\GeoWritingsController::class, 'lists'])->name('admin.geo_writing_task'); 607 Route::any('/', [Aside\Geo\GeoWritingsController::class, 'lists'])->name('admin.geo_writing_task');
607 Route::any('/saveWriting', [Aside\Geo\GeoWritingsController::class, 'saveWriting'])->name('admin.geo_writing_saveWriting'); 608 Route::any('/saveWriting', [Aside\Geo\GeoWritingsController::class, 'saveWriting'])->name('admin.geo_writing_saveWriting');
608 Route::any('/delWriting', [Aside\Geo\GeoWritingsController::class, 'delWriting'])->name('admin.geo_writing_delWriting'); 609 Route::any('/delWriting', [Aside\Geo\GeoWritingsController::class, 'delWriting'])->name('admin.geo_writing_delWriting');
  610 + Route::any('/sendWechatMessage', [Aside\Geo\GeoWritingsController::class, 'sendWechatMessage'])->name('admin.geo_writing_sendWechatMessage');
609 }); 611 });
610 }); 612 });
611 // 任务相关 613 // 任务相关