作者 lyh

gx数据

... ... @@ -11,6 +11,7 @@ namespace App\Console\Commands\Suppliers;
use App\Models\Product\Keyword;
use App\Models\Project\DeployBuild;
use App\Models\Project\Project;
use App\Models\Purchaser\Purchaser;
use App\Models\Purchaser\PurchaserInfo;
use App\Services\ProjectServer;
... ... @@ -33,6 +34,10 @@ class RecommendedSuppliers extends Command
*/
protected $description = '推荐供应商';
public $deployBuildModel;
public $projectModel;
/**
* Create a new command instance.
*
... ... @@ -40,7 +45,7 @@ class RecommendedSuppliers extends Command
*/
public function __construct()
{
parent::__construct();
$this->deployBuildModel = new DeployBuild();
}
... ... @@ -49,15 +54,42 @@ class RecommendedSuppliers extends Command
*/
public function handle()
{
$projectModel = new DeployBuild();
$project_list = $projectModel->list(['is_supplier'=>1]);//TODO::已开启推荐供应商
$project_list = $this->deployBuildModel->list(['is_supplier'=>1]);//TODO::已开启推荐供应商
foreach ($project_list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL;
ProjectServer::useProject($v['project_id']);
$title = $this->getKeywords($v['project_id']);
echo date('Y-m-d H:i:s') . '开始:'.$v['project_id'] . PHP_EOL;
$this->savePurchaser($v['project_id'],$title);
DB::disconnect('custom_mysql');
$result = $this->countPurchaser($v);
if($result !== false){
ProjectServer::useProject($v['project_id']);
$title = $this->getKeywords($v['project_id']);
echo date('Y-m-d H:i:s') . '开始:'.$v['project_id'] . PHP_EOL;
$this->savePurchaser($v['project_id'],$title);
DB::disconnect('custom_mysql');
}
}
return true;
}
/**
* @remark :当前项目拥有的
* @name :countPurchaser
* @author :lyh
* @method :post
* @time :2025/3/10 16:29
* @param :is_purchaser_count;1->开启后已达到上线关闭过 0->未关闭过
* @param :plan(1->专业版 2->标准版 3->商务版 10->旗舰版)
*/
public function countPurchaser($v){
if($v['is_purchaser_count'] == 0){
$purchaserInfoModel = new PurchaserInfo();
$count = $purchaserInfoModel->counts(['project_id'=>$v['project_id']]);
//获取项目版本
$plan = [10=>300, 1=>500, 2=>800, 3=>1200];
$total_number = $plan[$v['plan']] ?? 100;
if($count > $total_number){
//更新数量上限字段,下面的不执行
$this->deployBuildModel->edit(['is_purchaser_count'=>1,'is_supplier'=>0],['project_id'=>$v['project_id']]);
return false;
}
}
return true;
}
... ...
... ... @@ -154,12 +154,12 @@ class ProjectLogic extends BaseLogic
* @author :lyh
* @method :post
* @time :2023/8/30 11:57
* @param :1->建站中 2->优化中 3->建站完成 6-》错误单
*/
public function projectSave(){
DB::beginTransaction();
try {
if($this->param['type'] == Project::TYPE_SEVEN){
//错误单直接返回,单独处理
$this->setTypeSevenEdit($this->param);
}else{
//初始化项目
... ... @@ -196,6 +196,32 @@ class ProjectLogic extends BaseLogic
}
/**
* @remark :开启推荐供应商设置
* @name :isPurchaser
* @author :lyh
* @method :post
* @time :2025/3/10 15:33
*/
public function isPurchaser($project_id){
if($this->param['type'] == Project::TYPE_TWO){
if(empty($this->param['uptime'])){
$this->param['deploy_build']['is_supplier'] = 1;
}else{
//获取项目的上线时间
$projectInfo = $this->model->read(['id'=>$project_id],['uptime']);
//查看上线时间是否大于3天
$threeDaysAgo = date('Y-m-d H:i:s', strtotime('-3 days'));
if($projectInfo['uptime'] > $threeDaysAgo){
//上线时间大于当前时间的3天钱,默认不允许关闭推荐供应商
$this->param['deploy_build']['is_supplier'] = 1;
}
}
return true;
}
}
/**
* @remark :开启AI博客后
* @name :setAiBlog
* @author :lyh
... ... @@ -206,8 +232,7 @@ class ProjectLogic extends BaseLogic
if(empty($main_lang_id) || empty($is_ai_blog)){
return true;
}
$projectModel = new Project();
$projectInfo = $projectModel->read(['id'=>$project_id],['title','is_ai_blog','main_lang_id','company']);
$projectInfo = $this->model->read(['id'=>$project_id],['title','is_ai_blog','main_lang_id','company']);
//获取项目主语种
$languageModel = new WebLanguage();
$languageInfo = $languageModel->read(['id'=>$main_lang_id],['short']);
... ... @@ -277,8 +302,7 @@ class ProjectLogic extends BaseLogic
return $this->success();
}
//查看當前項目服務器是否有更改
$projectModel = new Project();
$projectInfo = $projectModel->read(['id'=>$project_id],['serve_id']);
$projectInfo = $this->model->read(['id'=>$project_id],['serve_id']);
$serversIpModel = new ServersIp();
$serversModel = new Servers();
if(!empty($projectInfo['serve_id'])){
... ...
... ... @@ -57,12 +57,14 @@ class WebSettingTextLogic extends BaseLogic
if(count($this->param['data']) > $this->param['anchor_num']){
$this->fail('超过最大设置限制');
}
//更新描文本设置
if($this->param['anchor_is_enable'] == 0){
$this->param['anchor_keyword_is_enable'] = 0;
$web_setting->edit($this->param,['project_id'=>$this->user['project_id']]);
return $this->success();
}
DB::beginTransaction();
try {
//更新描文本设置
if($this->param['anchor_is_enable'] == 0){
$this->param['anchor_keyword_is_enable'] = 0;
}
$data = [
'anchor_setting'=>$this->param['anchor_setting'] ?? [],
'anchor_is_enable'=>$this->param['anchor_is_enable'],
... ... @@ -72,7 +74,7 @@ class WebSettingTextLogic extends BaseLogic
];
$web_setting->edit($data,['project_id'=>$this->user['project_id']]);
$this->model->del(['project_id'=>$this->user['project_id']]);
if(!empty($this->param['data'])){
if(isset($this->param['data']) && !empty($this->param['data'])){
foreach ($this->param['data'] as $k => $v){
$v['created_at'] = date('Y-m-d H:i:s');
$v['updated_at'] = date('Y-m-d H:i:s');
... ... @@ -86,6 +88,6 @@ class WebSettingTextLogic extends BaseLogic
DB::rollBack();
$this->fail('更新失败');
}
$this->success();
return $this->success();
}
}
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Models\Workchat;
use App\Models\Base;
use App\Models\Inquiry\InquiryFormData;
use App\Models\Project\Project;
use App\Models\ProjectAssociation\ProjectAssociation;
use App\Services\ProjectServer;
use App\Utils\LogUtils;
... ... @@ -40,12 +41,15 @@ class MessagePush extends Base
* @param $name
* @param $submit_at
* @return bool
* @param : is_forward_inquiry:0未开启转发询盘 1:开启转发询盘
*/
public static function addInquiryMessage($id, $project_id, $country, $name, $submit_at){
// if(!ProjectServer::useProject($project_id)){
// return false;
// }
//查看项目是否开启转发询盘
$projectModel = new Project();
$projectInfo = $projectModel->read(['id'=>$project_id],['is_forward_inquiry']);
if($projectInfo['is_forward_inquiry'] == 0){
return false;
}
//项目是否有绑定群
$friend_id = ProjectAssociation::where('project_id', $project_id)
->where('status', ProjectAssociation::STATUS_NORMAL)
... ...