作者 赵彬吉
@@ -152,6 +152,8 @@ class ProjectController extends BaseController @@ -152,6 +152,8 @@ class ProjectController extends BaseController
152 $query = $this->searchUpgrade($query); 152 $query = $this->searchUpgrade($query);
153 //搜索战队 153 //搜索战队
154 $query = $this->searchChannel($query); 154 $query = $this->searchChannel($query);
  155 + //其他搜索
  156 + $query = $this->searchTechMid($query);
155 return $query; 157 return $query;
156 } 158 }
157 159
@@ -252,6 +254,23 @@ class ProjectController extends BaseController @@ -252,6 +254,23 @@ class ProjectController extends BaseController
252 } 254 }
253 255
254 /** 256 /**
  257 + * @remark :搜索售后技术
  258 + * @name :searchTechMid
  259 + * @author :lyh
  260 + * @method :post
  261 + * @time :2024/3/4 14:58
  262 + */
  263 + public function searchTechMid(&$query){
  264 + if(isset($this->map['tech_mid'])){
  265 + $query = $query->where('gl_project_deploy_optimize.tech_mid',$this->map['tech_mid']);
  266 + }
  267 + if(isset($this->map['optimist_mid'])){
  268 + $query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimist_mid']);
  269 + }
  270 + return $query;
  271 + }
  272 +
  273 + /**
255 * @remark :访问权限 274 * @remark :访问权限
256 * @name :getManagerRole 275 * @name :getManagerRole
257 * @author :lyh 276 * @author :lyh
@@ -7,6 +7,8 @@ use App\Helper\Arr; @@ -7,6 +7,8 @@ use App\Helper\Arr;
7 use App\Helper\Common; 7 use App\Helper\Common;
8 use App\Http\Controllers\Bside\BaseController; 8 use App\Http\Controllers\Bside\BaseController;
9 use App\Http\Logic\Bside\User\UserLogic; 9 use App\Http\Logic\Bside\User\UserLogic;
  10 +use App\Jobs\PurchaserJob;
  11 +use App\Models\Com\Purchaser;
10 use App\Models\CustomModule\CustomModule; 12 use App\Models\CustomModule\CustomModule;
11 use App\Models\Project\DeployBuild; 13 use App\Models\Project\DeployBuild;
12 use App\Models\Project\Project; 14 use App\Models\Project\Project;
@@ -15,6 +17,7 @@ use App\Models\User\ProjectMenu as ProjectMenuModel; @@ -15,6 +17,7 @@ use App\Models\User\ProjectMenu as ProjectMenuModel;
15 use App\Models\User\ProjectRole as ProjectRoleModel; 17 use App\Models\User\ProjectRole as ProjectRoleModel;
16 use App\Models\User\User; 18 use App\Models\User\User;
17 use Illuminate\Support\Facades\Cache; 19 use Illuminate\Support\Facades\Cache;
  20 +use Illuminate\Support\Facades\Hash;
18 21
19 /*** 22 /***
20 * 当前为公共类 23 * 当前为公共类
@@ -333,22 +336,14 @@ class ComController extends BaseController @@ -333,22 +336,14 @@ class ComController extends BaseController
333 * @time :2024/3/4 10:10 336 * @time :2024/3/4 10:10
334 */ 337 */
335 public function recommendedPurchaser(){ 338 public function recommendedPurchaser(){
336 - $this->param['keyword'] = 'led';  
337 - $url = 'https://admin.hagro.cn/api/company_list';  
338 - $data = [  
339 - 'prod_desc'=>$this->param['keyword'],  
340 - 'total'=>$this->param['now'] ?? 10,  
341 - ];  
342 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export(http_build_query($data), true) . PHP_EOL, FILE_APPEND);  
343 - $token = 'company_list'.date('Y-m-d').http_build_query(arsort($data));  
344 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($token, true) . PHP_EOL, FILE_APPEND);  
345 - $param = [  
346 - 'prod_desc'=>$this->param['keyword'],  
347 - 'token'=>$token,  
348 - 'total'=>$this->param['now'] ?? 10,  
349 - ];  
350 - $lists = http_post($url,$param);  
351 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($token, true) . PHP_EOL, FILE_APPEND);  
352 - $this->response('success',Code::SUCCESS,$lists); 339 + $data = [];
  340 + $purchaserModel = new Purchaser();
  341 + $info = $purchaserModel->read(['project_id'=>$this->user['project_id']]);
  342 + if($info === false){
  343 + PurchaserJob::dispatch(['keyword'=>$this->param['keyword'] ?? 'led','row'=>$this->param['row'] ?? 10,'project_id'=>$this->user['project_id']]);
  344 + }else{
  345 + $data = json_decode($info['data']);
  346 + }
  347 + $this->response('数据生成中',Code::SUCCESS,$data);
353 } 348 }
354 } 349 }
@@ -173,12 +173,11 @@ class BaseLogic extends Logic @@ -173,12 +173,11 @@ class BaseLogic extends Logic
173 $data['project_id'] = $this->user['project_id']; 173 $data['project_id'] = $this->user['project_id'];
174 $str = http_build_query($data); 174 $str = http_build_query($data);
175 $url = $this->user['domain'].'api/delHtml/?'.$str; 175 $url = $this->user['domain'].'api/delHtml/?'.$str;
176 - $rs = shell_exec('curl -k "'.$url.'"');  
177 -// if($this->user['project_id'] == 177){  
178 -// @file_put_contents(storage_path('logs/lyh_error.log'), var_export($url, true) . PHP_EOL, FILE_APPEND);  
179 -// @file_put_contents(storage_path('logs/lyh_error.log'), var_export($rs, true) . PHP_EOL, FILE_APPEND);  
180 -// }  
181 -// curlGet($url); 176 + if($this->user['project_id'] == 672){//TODO::当前项目通知不过 ,跳过自动更新
  177 + exec('curl -k "'.$url.'" > /dev/null 2>&1 &');
  178 + }else{
  179 + shell_exec('curl -k "'.$url.'"');
  180 + }
182 return $this->success(); 181 return $this->success();
183 } 182 }
184 } 183 }
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 9
10 namespace App\Jobs; 10 namespace App\Jobs;
11 11
  12 +use App\Models\Com\Purchaser;
12 use Illuminate\Bus\Queueable; 13 use Illuminate\Bus\Queueable;
13 use Illuminate\Contracts\Queue\ShouldQueue; 14 use Illuminate\Contracts\Queue\ShouldQueue;
14 use Illuminate\Foundation\Bus\Dispatchable; 15 use Illuminate\Foundation\Bus\Dispatchable;
@@ -41,6 +42,29 @@ class PurchaserJob implements ShouldQueue @@ -41,6 +42,29 @@ class PurchaserJob implements ShouldQueue
41 */ 42 */
42 public function handle() 43 public function handle()
43 { 44 {
44 - 45 + $this->param['keyword'] = 'led';
  46 + $url = 'https://admin.hagro.cn/api/company_list';
  47 + $data = [
  48 + 'prod_desc'=>$this->param['keyword'],
  49 + 'total'=>$this->param['row'] ?? 10,
  50 + ];
  51 + arsort($data);
  52 + $token = 'company_list+'.date('Y-m-d').'+'.http_build_query($data);
  53 + $param = [
  54 + 'prod_desc'=>$this->param['keyword'],
  55 + 'token'=>md5($token),
  56 + 'total'=>$this->param['row'] ?? 10,
  57 + ];
  58 + $res = http_post($url,json_encode($param));
  59 + if(!empty($res) && $res['code'] == 200){
  60 + $saveData = [
  61 + 'project_id'=>$this->param['project_id'],
  62 + 'keyword'=>$this->param['keyword'],
  63 + 'data'=>json_encode($res['data'])
  64 + ];
  65 + $purchaserModel = new Purchaser();
  66 + $purchaserModel->add($saveData);
  67 + }
  68 + return true;
45 } 69 }
46 } 70 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :Purchaser.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/3/4 14:39
  8 + */
  9 +
  10 +namespace App\Models\Com;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class Purchaser extends Base
  15 +{
  16 + protected $table = 'gl_purchaser';
  17 +}