作者 lyh

gx

@@ -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
@@ -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;