作者 lyh

gx

... ... @@ -65,12 +65,14 @@ class ProjectController extends BaseController
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v = $this->handleParam($v);
$project_arr[] = $v['id'];
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
/**
* 需要查询的字段
* @return array
... ... @@ -358,12 +360,7 @@ class ProjectController extends BaseController
$data = APublicModel::getNumByProjectId($item['id']);
}
if($item['type'] == Project::TYPE_ONE){//建站中
$processModel = new ProcessRecords();
$item['sign_project'] = 0;
$proInfo = $processModel->read(['project_id'=>$item['id'],'updated_at'=>['>=',time() - 3 * 12 * 3600]],['id']);
if($proInfo === false){
$item['sign_project'] = 1;
}
$item['sign_project'] = $this->handleProcessRecords($item['id']);
}
$manageModel = new ManageHr();
$item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
... ... @@ -383,7 +380,6 @@ class ProjectController extends BaseController
$item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : '';
$item['product_num'] = $data['product'] ?? 0;
$item['keyword_num'] = $data['key'] ?? 0;
$item['autologin_code'] = getAutoLoginCode($item['id']);
$item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
$item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
$item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]);
... ... @@ -392,6 +388,25 @@ class ProjectController extends BaseController
}
/**
* @remark :处理建站中项目标记问题
* @name :handleProcessRecords
* @author :lyh
* @method :post
* @time :2024/11/6 15:22
*/
public function handleProcessRecords($project_id){
$processModel = new ProcessRecords();
$proInfo = $processModel->read(['project_id'=>$project_id],['id','record']);
if($proInfo !== false){
$date = (strtotime(((array)$proInfo['record'][0])['date']) ?? 0 ) + 3 * 24 * 2600;
if($date <= time()){
return 1;
}
}
return 0;
}
/**
* @remark :获取数据详情
* @name :info
* @author :lyh
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Models\Channel;
use App\Models\Base;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use phpDocumentor\Reflection\Types\Self_;
/**
... ... @@ -56,11 +57,16 @@ class Channel extends Base
}
public static function getChannelText($sales_id){
$user = User::where('id', $sales_id)->select(['name', 'channel_id'])->first();
if(!$user){
return $sales_id;
$channel_alias = Cache::get('channel_alias_'.$sales_id);
if(empty($channel_alias)){
$user = User::where('id', $sales_id)->select(['name', 'channel_id'])->first();
if(!$user){
return $sales_id;
}
$channel_alias = self::where('id', $user['channel_id'])->value('alias');
$channel_alias = $channel_alias . '-' . $user['name'];
Cache::put('channel_alias_'.$sales_id,$channel_alias,24 * 3600);
}
$channel_alias = self::where('id', $user['channel_id'])->value('alias');
return $channel_alias . '-' . $user['name'];
return $channel_alias;
}
}
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Models\Domain;
use App\Helper\Arr;
use App\Models\Base;
use Illuminate\Support\Facades\Cache;
/**
* Class DomainInfo
... ... @@ -61,11 +62,16 @@ class DomainInfo extends Base
* @time :2023/9/4 17:05
*/
public function getDomain($domain){
$info = $this->read(['id'=>$domain]);
if($info === false){
return '';
$res_domain = Cache::get('domain_'.$domain);
if(empty($res_domain)){
$info = $this->read(['id'=>$domain]);
if($info === false){
return '';
}
$res_domain = 'https://'.$info['domain'].'/';
Cache::put('domain_'.$domain,$res_domain,24 * 3600);
}
return 'https://'.$info['domain'].'/';
return $res_domain;
}
/**
... ...
... ... @@ -2,6 +2,7 @@
namespace App\Models\Manage;
use App\Models\Base;
use Illuminate\Support\Facades\Cache;
class ManageHr extends Base
{
... ... @@ -190,9 +191,13 @@ class ManageHr extends Base
public function getName($id){
$name = '';
if(!empty($id)){
$info = $this->read(['id'=>$id],['id','name']);
if($info !== false){
$name = $info['name'];
$name = Cache::get('manager_hr_'.$id);
if(empty($name)){
$info = $this->read(['id'=>$id],['id','name']);
if($info !== false){
$name = $info['name'];
Cache::put('manager_hr_'.$id,$name,24 * 3600);
}
}
}
return $name;
... ...