作者 李宇航

合并分支 'master-server' 到 'master'

Master server



查看合并请求 !855
@@ -17,6 +17,7 @@ use App\Models\CustomModule\CustomModuleContent; @@ -17,6 +17,7 @@ use App\Models\CustomModule\CustomModuleContent;
17 use App\Models\Product\CategoryRelated; 17 use App\Models\Product\CategoryRelated;
18 use App\Models\Product\Keyword; 18 use App\Models\Product\Keyword;
19 use App\Models\Product\Product; 19 use App\Models\Product\Product;
  20 +use App\Models\Project\ProcessRecords;
20 use App\Models\Project\Project; 21 use App\Models\Project\Project;
21 use App\Models\RouteMap\RouteMap; 22 use App\Models\RouteMap\RouteMap;
22 use App\Services\ProjectServer; 23 use App\Services\ProjectServer;
@@ -55,20 +56,26 @@ class UpdateRoute extends Command @@ -55,20 +56,26 @@ class UpdateRoute extends Command
55 * @time :2023/11/20 15:13 56 * @time :2023/11/20 15:13
56 */ 57 */
57 public function handle(){ 58 public function handle(){
58 - $projectModel = new Project();  
59 - $list = $projectModel->list(['id'=>['in',[1653]]]);  
60 - $data = [];  
61 - foreach ($list as $v){  
62 - echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;  
63 - ProjectServer::useProject($v['id']);  
64 -// $this->getProduct();  
65 -// $this->setProductKeyword();  
66 -// $this->getBlog();  
67 -// $this->setCustomRoute($v['id']);  
68 - $this->editProductAlt();  
69 -// $this->custom_to_blogs();  
70 - DB::disconnect('custom_mysql');  
71 - } 59 + $recordModel = new ProcessRecords();
  60 + $lists = $recordModel->list();
  61 + foreach ($lists as $k => $v){
  62 + $date = $v['record'][0]['date'];
  63 + $recordModel->edit(['date'=>$date],['id'=>$v['id']]);
  64 + }
  65 +// $projectModel = new Project();
  66 +// $list = $projectModel->list(['delete_status'=>['=',0]]);
  67 +// $data = [];
  68 +// foreach ($list as $v){
  69 +// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  70 +// ProjectServer::useProject($v['id']);
  71 +//// $this->getProduct();
  72 +//// $this->setProductKeyword();
  73 +//// $this->getBlog();
  74 +//// $this->setCustomRoute($v['id']);
  75 +// $this->editProductAlt();
  76 +//// $this->custom_to_blogs();
  77 +// DB::disconnect('custom_mysql');
  78 +// }
72 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 79 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
73 } 80 }
74 81
@@ -65,12 +65,14 @@ class ProjectController extends BaseController @@ -65,12 +65,14 @@ class ProjectController extends BaseController
65 if(!empty($lists) && !empty($lists['list'])){ 65 if(!empty($lists) && !empty($lists['list'])){
66 foreach ($lists['list'] as $k => $v){ 66 foreach ($lists['list'] as $k => $v){
67 $v = $this->handleParam($v); 67 $v = $this->handleParam($v);
  68 + $project_arr[] = $v['id'];
68 $lists['list'][$k] = $v; 69 $lists['list'][$k] = $v;
69 } 70 }
70 } 71 }
71 $this->response('success',Code::SUCCESS,$lists); 72 $this->response('success',Code::SUCCESS,$lists);
72 } 73 }
73 74
  75 +
74 /** 76 /**
75 * 需要查询的字段 77 * 需要查询的字段
76 * @return array 78 * @return array
@@ -358,12 +360,7 @@ class ProjectController extends BaseController @@ -358,12 +360,7 @@ class ProjectController extends BaseController
358 $data = APublicModel::getNumByProjectId($item['id']); 360 $data = APublicModel::getNumByProjectId($item['id']);
359 } 361 }
360 if($item['type'] == Project::TYPE_ONE){//建站中 362 if($item['type'] == Project::TYPE_ONE){//建站中
361 - $processModel = new ProcessRecords();  
362 - $item['sign_project'] = 0;  
363 - $proInfo = $processModel->read(['project_id'=>$item['id'],'updated_at'=>['>=',time() - 3 * 12 * 3600]],['id']);  
364 - if($proInfo === false){  
365 - $item['sign_project'] = 1;  
366 - } 363 + $item['sign_project'] = $this->handleProcessRecords($item['id']);
367 } 364 }
368 $manageModel = new ManageHr(); 365 $manageModel = new ManageHr();
369 $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0); 366 $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
@@ -383,7 +380,6 @@ class ProjectController extends BaseController @@ -383,7 +380,6 @@ class ProjectController extends BaseController
383 $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : ''; 380 $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : '';
384 $item['product_num'] = $data['product'] ?? 0; 381 $item['product_num'] = $data['product'] ?? 0;
385 $item['keyword_num'] = $data['key'] ?? 0; 382 $item['keyword_num'] = $data['key'] ?? 0;
386 - $item['autologin_code'] = getAutoLoginCode($item['id']);  
387 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0); 383 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
388 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); 384 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
389 $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); 385 $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]);
@@ -392,6 +388,25 @@ class ProjectController extends BaseController @@ -392,6 +388,25 @@ class ProjectController extends BaseController
392 } 388 }
393 389
394 /** 390 /**
  391 + * @remark :处理建站中项目标记问题
  392 + * @name :handleProcessRecords
  393 + * @author :lyh
  394 + * @method :post
  395 + * @time :2024/11/6 15:22
  396 + */
  397 + public function handleProcessRecords($project_id){
  398 + $processModel = new ProcessRecords();
  399 + $proInfo = $processModel->read(['project_id'=>$project_id],['id','record']);
  400 + if($proInfo !== false){
  401 + $date = (strtotime(((array)$proInfo['record'][0])['date']) ?? 0 ) + 3 * 24 * 2600;
  402 + if($date <= time()){
  403 + return 1;
  404 + }
  405 + }
  406 + return 0;
  407 + }
  408 +
  409 + /**
395 * @remark :获取数据详情 410 * @remark :获取数据详情
396 * @name :info 411 * @name :info
397 * @author :lyh 412 * @author :lyh
@@ -65,6 +65,7 @@ class ProcessRecordsLogic extends BaseLogic @@ -65,6 +65,7 @@ class ProcessRecordsLogic extends BaseLogic
65 public function recordSave(){ 65 public function recordSave(){
66 $info = $this->model->read(['project_id'=>$this->param['project_id']]); 66 $info = $this->model->read(['project_id'=>$this->param['project_id']]);
67 $this->param['operator_id'] = $this->manager['id']; 67 $this->param['operator_id'] = $this->manager['id'];
  68 + $this->param['date'] = $this->param['record'][0]['date'] ?? null;
68 $this->param['record'] = json_encode($this->param['record']); 69 $this->param['record'] = json_encode($this->param['record']);
69 if($info === false){ 70 if($info === false){
70 $res = $this->model->add($this->param); 71 $res = $this->model->add($this->param);
@@ -4,6 +4,7 @@ namespace App\Models\Channel; @@ -4,6 +4,7 @@ namespace App\Models\Channel;
4 4
5 use App\Models\Base; 5 use App\Models\Base;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
  7 +use Illuminate\Support\Facades\Cache;
7 use phpDocumentor\Reflection\Types\Self_; 8 use phpDocumentor\Reflection\Types\Self_;
8 9
9 /** 10 /**
@@ -56,11 +57,16 @@ class Channel extends Base @@ -56,11 +57,16 @@ class Channel extends Base
56 } 57 }
57 58
58 public static function getChannelText($sales_id){ 59 public static function getChannelText($sales_id){
  60 + $channel_alias = Cache::get('channel_alias_'.$sales_id);
  61 + if(empty($channel_alias)){
59 $user = User::where('id', $sales_id)->select(['name', 'channel_id'])->first(); 62 $user = User::where('id', $sales_id)->select(['name', 'channel_id'])->first();
60 if(!$user){ 63 if(!$user){
61 return $sales_id; 64 return $sales_id;
62 } 65 }
63 $channel_alias = self::where('id', $user['channel_id'])->value('alias'); 66 $channel_alias = self::where('id', $user['channel_id'])->value('alias');
64 - return $channel_alias . '-' . $user['name']; 67 + $channel_alias = $channel_alias . '-' . $user['name'];
  68 + Cache::put('channel_alias_'.$sales_id,$channel_alias,24 * 3600);
  69 + }
  70 + return $channel_alias;
65 } 71 }
66 } 72 }
@@ -4,6 +4,7 @@ namespace App\Models\Domain; @@ -4,6 +4,7 @@ namespace App\Models\Domain;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
6 use App\Models\Base; 6 use App\Models\Base;
  7 +use Illuminate\Support\Facades\Cache;
7 8
8 /** 9 /**
9 * Class DomainInfo 10 * Class DomainInfo
@@ -61,11 +62,16 @@ class DomainInfo extends Base @@ -61,11 +62,16 @@ class DomainInfo extends Base
61 * @time :2023/9/4 17:05 62 * @time :2023/9/4 17:05
62 */ 63 */
63 public function getDomain($domain){ 64 public function getDomain($domain){
  65 + $res_domain = Cache::get('domain_'.$domain);
  66 + if(empty($res_domain)){
64 $info = $this->read(['id'=>$domain]); 67 $info = $this->read(['id'=>$domain]);
65 if($info === false){ 68 if($info === false){
66 return ''; 69 return '';
67 } 70 }
68 - return 'https://'.$info['domain'].'/'; 71 + $res_domain = 'https://'.$info['domain'].'/';
  72 + Cache::put('domain_'.$domain,$res_domain,24 * 3600);
  73 + }
  74 + return $res_domain;
69 } 75 }
70 76
71 /** 77 /**
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Models\Manage; 3 namespace App\Models\Manage;
4 use App\Models\Base; 4 use App\Models\Base;
  5 +use Illuminate\Support\Facades\Cache;
5 6
6 class ManageHr extends Base 7 class ManageHr extends Base
7 { 8 {
@@ -190,9 +191,13 @@ class ManageHr extends Base @@ -190,9 +191,13 @@ class ManageHr extends Base
190 public function getName($id){ 191 public function getName($id){
191 $name = ''; 192 $name = '';
192 if(!empty($id)){ 193 if(!empty($id)){
  194 + $name = Cache::get('manager_hr_'.$id);
  195 + if(empty($name)){
193 $info = $this->read(['id'=>$id],['id','name']); 196 $info = $this->read(['id'=>$id],['id','name']);
194 if($info !== false){ 197 if($info !== false){
195 $name = $info['name']; 198 $name = $info['name'];
  199 + Cache::put('manager_hr_'.$id,$name,24 * 3600);
  200 + }
196 } 201 }
197 } 202 }
198 return $name; 203 return $name;