作者 lyh

gx数据

@@ -11,6 +11,7 @@ namespace App\Console\Commands\Suppliers; @@ -11,6 +11,7 @@ namespace App\Console\Commands\Suppliers;
11 11
12 use App\Models\Product\Keyword; 12 use App\Models\Product\Keyword;
13 use App\Models\Project\DeployBuild; 13 use App\Models\Project\DeployBuild;
  14 +use App\Models\Project\Project;
14 use App\Models\Purchaser\Purchaser; 15 use App\Models\Purchaser\Purchaser;
15 use App\Models\Purchaser\PurchaserInfo; 16 use App\Models\Purchaser\PurchaserInfo;
16 use App\Services\ProjectServer; 17 use App\Services\ProjectServer;
@@ -33,6 +34,10 @@ class RecommendedSuppliers extends Command @@ -33,6 +34,10 @@ class RecommendedSuppliers extends Command
33 */ 34 */
34 protected $description = '推荐供应商'; 35 protected $description = '推荐供应商';
35 36
  37 + public $deployBuildModel;
  38 +
  39 + public $projectModel;
  40 +
36 /** 41 /**
37 * Create a new command instance. 42 * Create a new command instance.
38 * 43 *
@@ -40,7 +45,7 @@ class RecommendedSuppliers extends Command @@ -40,7 +45,7 @@ class RecommendedSuppliers extends Command
40 */ 45 */
41 public function __construct() 46 public function __construct()
42 { 47 {
43 - parent::__construct(); 48 + $this->deployBuildModel = new DeployBuild();
44 } 49 }
45 50
46 51
@@ -49,15 +54,42 @@ class RecommendedSuppliers extends Command @@ -49,15 +54,42 @@ class RecommendedSuppliers extends Command
49 */ 54 */
50 public function handle() 55 public function handle()
51 { 56 {
52 - $projectModel = new DeployBuild();  
53 - $project_list = $projectModel->list(['is_supplier'=>1]);//TODO::已开启推荐供应商 57 + $project_list = $this->deployBuildModel->list(['is_supplier'=>1]);//TODO::已开启推荐供应商
54 foreach ($project_list as $v){ 58 foreach ($project_list as $v){
55 echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL; 59 echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL;
56 - ProjectServer::useProject($v['project_id']);  
57 - $title = $this->getKeywords($v['project_id']);  
58 - echo date('Y-m-d H:i:s') . '开始:'.$v['project_id'] . PHP_EOL;  
59 - $this->savePurchaser($v['project_id'],$title);  
60 - DB::disconnect('custom_mysql'); 60 + $result = $this->countPurchaser($v);
  61 + if($result !== false){
  62 + ProjectServer::useProject($v['project_id']);
  63 + $title = $this->getKeywords($v['project_id']);
  64 + echo date('Y-m-d H:i:s') . '开始:'.$v['project_id'] . PHP_EOL;
  65 + $this->savePurchaser($v['project_id'],$title);
  66 + DB::disconnect('custom_mysql');
  67 + }
  68 + }
  69 + return true;
  70 + }
  71 +
  72 + /**
  73 + * @remark :当前项目拥有的
  74 + * @name :countPurchaser
  75 + * @author :lyh
  76 + * @method :post
  77 + * @time :2025/3/10 16:29
  78 + * @param :is_purchaser_count;1->开启后已达到上线关闭过 0->未关闭过
  79 + * @param :plan(1->专业版 2->标准版 3->商务版 10->旗舰版)
  80 + */
  81 + public function countPurchaser($v){
  82 + if($v['is_purchaser_count'] == 0){
  83 + $purchaserInfoModel = new PurchaserInfo();
  84 + $count = $purchaserInfoModel->counts(['project_id'=>$v['project_id']]);
  85 + //获取项目版本
  86 + $plan = [10=>300, 1=>500, 2=>800, 3=>1200];
  87 + $total_number = $plan[$v['plan']] ?? 100;
  88 + if($count > $total_number){
  89 + //更新数量上限字段,下面的不执行
  90 + $this->deployBuildModel->edit(['is_purchaser_count'=>1,'is_supplier'=>0],['project_id'=>$v['project_id']]);
  91 + return false;
  92 + }
61 } 93 }
62 return true; 94 return true;
63 } 95 }
@@ -154,12 +154,12 @@ class ProjectLogic extends BaseLogic @@ -154,12 +154,12 @@ class ProjectLogic extends BaseLogic
154 * @author :lyh 154 * @author :lyh
155 * @method :post 155 * @method :post
156 * @time :2023/8/30 11:57 156 * @time :2023/8/30 11:57
  157 + * @param :1->建站中 2->优化中 3->建站完成 6-》错误单
157 */ 158 */
158 public function projectSave(){ 159 public function projectSave(){
159 DB::beginTransaction(); 160 DB::beginTransaction();
160 try { 161 try {
161 if($this->param['type'] == Project::TYPE_SEVEN){ 162 if($this->param['type'] == Project::TYPE_SEVEN){
162 - //错误单直接返回,单独处理  
163 $this->setTypeSevenEdit($this->param); 163 $this->setTypeSevenEdit($this->param);
164 }else{ 164 }else{
165 //初始化项目 165 //初始化项目
@@ -196,6 +196,32 @@ class ProjectLogic extends BaseLogic @@ -196,6 +196,32 @@ class ProjectLogic extends BaseLogic
196 } 196 }
197 197
198 /** 198 /**
  199 + * @remark :开启推荐供应商设置
  200 + * @name :isPurchaser
  201 + * @author :lyh
  202 + * @method :post
  203 + * @time :2025/3/10 15:33
  204 + */
  205 + public function isPurchaser($project_id){
  206 + if($this->param['type'] == Project::TYPE_TWO){
  207 + if(empty($this->param['uptime'])){
  208 + $this->param['deploy_build']['is_supplier'] = 1;
  209 + }else{
  210 + //获取项目的上线时间
  211 + $projectInfo = $this->model->read(['id'=>$project_id],['uptime']);
  212 + //查看上线时间是否大于3天
  213 + $threeDaysAgo = date('Y-m-d H:i:s', strtotime('-3 days'));
  214 + if($projectInfo['uptime'] > $threeDaysAgo){
  215 + //上线时间大于当前时间的3天钱,默认不允许关闭推荐供应商
  216 + $this->param['deploy_build']['is_supplier'] = 1;
  217 + }
  218 + }
  219 + return true;
  220 + }
  221 +
  222 + }
  223 +
  224 + /**
199 * @remark :开启AI博客后 225 * @remark :开启AI博客后
200 * @name :setAiBlog 226 * @name :setAiBlog
201 * @author :lyh 227 * @author :lyh
@@ -206,8 +232,7 @@ class ProjectLogic extends BaseLogic @@ -206,8 +232,7 @@ class ProjectLogic extends BaseLogic
206 if(empty($main_lang_id) || empty($is_ai_blog)){ 232 if(empty($main_lang_id) || empty($is_ai_blog)){
207 return true; 233 return true;
208 } 234 }
209 - $projectModel = new Project();  
210 - $projectInfo = $projectModel->read(['id'=>$project_id],['title','is_ai_blog','main_lang_id','company']); 235 + $projectInfo = $this->model->read(['id'=>$project_id],['title','is_ai_blog','main_lang_id','company']);
211 //获取项目主语种 236 //获取项目主语种
212 $languageModel = new WebLanguage(); 237 $languageModel = new WebLanguage();
213 $languageInfo = $languageModel->read(['id'=>$main_lang_id],['short']); 238 $languageInfo = $languageModel->read(['id'=>$main_lang_id],['short']);
@@ -277,8 +302,7 @@ class ProjectLogic extends BaseLogic @@ -277,8 +302,7 @@ class ProjectLogic extends BaseLogic
277 return $this->success(); 302 return $this->success();
278 } 303 }
279 //查看當前項目服務器是否有更改 304 //查看當前項目服務器是否有更改
280 - $projectModel = new Project();  
281 - $projectInfo = $projectModel->read(['id'=>$project_id],['serve_id']); 305 + $projectInfo = $this->model->read(['id'=>$project_id],['serve_id']);
282 $serversIpModel = new ServersIp(); 306 $serversIpModel = new ServersIp();
283 $serversModel = new Servers(); 307 $serversModel = new Servers();
284 if(!empty($projectInfo['serve_id'])){ 308 if(!empty($projectInfo['serve_id'])){
@@ -57,12 +57,14 @@ class WebSettingTextLogic extends BaseLogic @@ -57,12 +57,14 @@ class WebSettingTextLogic extends BaseLogic
57 if(count($this->param['data']) > $this->param['anchor_num']){ 57 if(count($this->param['data']) > $this->param['anchor_num']){
58 $this->fail('超过最大设置限制'); 58 $this->fail('超过最大设置限制');
59 } 59 }
  60 + //更新描文本设置
  61 + if($this->param['anchor_is_enable'] == 0){
  62 + $this->param['anchor_keyword_is_enable'] = 0;
  63 + $web_setting->edit($this->param,['project_id'=>$this->user['project_id']]);
  64 + return $this->success();
  65 + }
60 DB::beginTransaction(); 66 DB::beginTransaction();
61 try { 67 try {
62 - //更新描文本设置  
63 - if($this->param['anchor_is_enable'] == 0){  
64 - $this->param['anchor_keyword_is_enable'] = 0;  
65 - }  
66 $data = [ 68 $data = [
67 'anchor_setting'=>$this->param['anchor_setting'] ?? [], 69 'anchor_setting'=>$this->param['anchor_setting'] ?? [],
68 'anchor_is_enable'=>$this->param['anchor_is_enable'], 70 'anchor_is_enable'=>$this->param['anchor_is_enable'],
@@ -72,7 +74,7 @@ class WebSettingTextLogic extends BaseLogic @@ -72,7 +74,7 @@ class WebSettingTextLogic extends BaseLogic
72 ]; 74 ];
73 $web_setting->edit($data,['project_id'=>$this->user['project_id']]); 75 $web_setting->edit($data,['project_id'=>$this->user['project_id']]);
74 $this->model->del(['project_id'=>$this->user['project_id']]); 76 $this->model->del(['project_id'=>$this->user['project_id']]);
75 - if(!empty($this->param['data'])){ 77 + if(isset($this->param['data']) && !empty($this->param['data'])){
76 foreach ($this->param['data'] as $k => $v){ 78 foreach ($this->param['data'] as $k => $v){
77 $v['created_at'] = date('Y-m-d H:i:s'); 79 $v['created_at'] = date('Y-m-d H:i:s');
78 $v['updated_at'] = date('Y-m-d H:i:s'); 80 $v['updated_at'] = date('Y-m-d H:i:s');
@@ -86,6 +88,6 @@ class WebSettingTextLogic extends BaseLogic @@ -86,6 +88,6 @@ class WebSettingTextLogic extends BaseLogic
86 DB::rollBack(); 88 DB::rollBack();
87 $this->fail('更新失败'); 89 $this->fail('更新失败');
88 } 90 }
89 - $this->success(); 91 + return $this->success();
90 } 92 }
91 } 93 }
@@ -4,6 +4,7 @@ namespace App\Models\Workchat; @@ -4,6 +4,7 @@ namespace App\Models\Workchat;
4 4
5 use App\Models\Base; 5 use App\Models\Base;
6 use App\Models\Inquiry\InquiryFormData; 6 use App\Models\Inquiry\InquiryFormData;
  7 +use App\Models\Project\Project;
7 use App\Models\ProjectAssociation\ProjectAssociation; 8 use App\Models\ProjectAssociation\ProjectAssociation;
8 use App\Services\ProjectServer; 9 use App\Services\ProjectServer;
9 use App\Utils\LogUtils; 10 use App\Utils\LogUtils;
@@ -40,12 +41,15 @@ class MessagePush extends Base @@ -40,12 +41,15 @@ class MessagePush extends Base
40 * @param $name 41 * @param $name
41 * @param $submit_at 42 * @param $submit_at
42 * @return bool 43 * @return bool
  44 + * @param : is_forward_inquiry:0未开启转发询盘 1:开启转发询盘
43 */ 45 */
44 public static function addInquiryMessage($id, $project_id, $country, $name, $submit_at){ 46 public static function addInquiryMessage($id, $project_id, $country, $name, $submit_at){
45 -// if(!ProjectServer::useProject($project_id)){  
46 -// return false;  
47 -// }  
48 - 47 + //查看项目是否开启转发询盘
  48 + $projectModel = new Project();
  49 + $projectInfo = $projectModel->read(['id'=>$project_id],['is_forward_inquiry']);
  50 + if($projectInfo['is_forward_inquiry'] == 0){
  51 + return false;
  52 + }
49 //项目是否有绑定群 53 //项目是否有绑定群
50 $friend_id = ProjectAssociation::where('project_id', $project_id) 54 $friend_id = ProjectAssociation::where('project_id', $project_id)
51 ->where('status', ProjectAssociation::STATUS_NORMAL) 55 ->where('status', ProjectAssociation::STATUS_NORMAL)