作者 赵彬吉
... ... @@ -152,6 +152,8 @@ class ProjectController extends BaseController
$query = $this->searchUpgrade($query);
//搜索战队
$query = $this->searchChannel($query);
//其他搜索
$query = $this->searchTechMid($query);
return $query;
}
... ... @@ -252,6 +254,23 @@ class ProjectController extends BaseController
}
/**
* @remark :搜索售后技术
* @name :searchTechMid
* @author :lyh
* @method :post
* @time :2024/3/4 14:58
*/
public function searchTechMid(&$query){
if(isset($this->map['tech_mid'])){
$query = $query->where('gl_project_deploy_optimize.tech_mid',$this->map['tech_mid']);
}
if(isset($this->map['optimist_mid'])){
$query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimist_mid']);
}
return $query;
}
/**
* @remark :访问权限
* @name :getManagerRole
* @author :lyh
... ...
... ... @@ -7,6 +7,8 @@ use App\Helper\Arr;
use App\Helper\Common;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\User\UserLogic;
use App\Jobs\PurchaserJob;
use App\Models\Com\Purchaser;
use App\Models\CustomModule\CustomModule;
use App\Models\Project\DeployBuild;
use App\Models\Project\Project;
... ... @@ -15,6 +17,7 @@ use App\Models\User\ProjectMenu as ProjectMenuModel;
use App\Models\User\ProjectRole as ProjectRoleModel;
use App\Models\User\User;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Hash;
/***
* 当前为公共类
... ... @@ -333,22 +336,14 @@ class ComController extends BaseController
* @time :2024/3/4 10:10
*/
public function recommendedPurchaser(){
$this->param['keyword'] = 'led';
$url = 'https://admin.hagro.cn/api/company_list';
$data = [
'prod_desc'=>$this->param['keyword'],
'total'=>$this->param['now'] ?? 10,
];
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(http_build_query($data), true) . PHP_EOL, FILE_APPEND);
$token = 'company_list'.date('Y-m-d').http_build_query(arsort($data));
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($token, true) . PHP_EOL, FILE_APPEND);
$param = [
'prod_desc'=>$this->param['keyword'],
'token'=>$token,
'total'=>$this->param['now'] ?? 10,
];
$lists = http_post($url,$param);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($token, true) . PHP_EOL, FILE_APPEND);
$this->response('success',Code::SUCCESS,$lists);
$data = [];
$purchaserModel = new Purchaser();
$info = $purchaserModel->read(['project_id'=>$this->user['project_id']]);
if($info === false){
PurchaserJob::dispatch(['keyword'=>$this->param['keyword'] ?? 'led','row'=>$this->param['row'] ?? 10,'project_id'=>$this->user['project_id']]);
}else{
$data = json_decode($info['data']);
}
$this->response('数据生成中',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -173,12 +173,11 @@ class BaseLogic extends Logic
$data['project_id'] = $this->user['project_id'];
$str = http_build_query($data);
$url = $this->user['domain'].'api/delHtml/?'.$str;
$rs = shell_exec('curl -k "'.$url.'"');
// if($this->user['project_id'] == 177){
// @file_put_contents(storage_path('logs/lyh_error.log'), var_export($url, true) . PHP_EOL, FILE_APPEND);
// @file_put_contents(storage_path('logs/lyh_error.log'), var_export($rs, true) . PHP_EOL, FILE_APPEND);
// }
// curlGet($url);
if($this->user['project_id'] == 672){//TODO::当前项目通知不过 ,跳过自动更新
exec('curl -k "'.$url.'" > /dev/null 2>&1 &');
}else{
shell_exec('curl -k "'.$url.'"');
}
return $this->success();
}
}
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Jobs;
use App\Models\Com\Purchaser;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
... ... @@ -41,6 +42,29 @@ class PurchaserJob implements ShouldQueue
*/
public function handle()
{
$this->param['keyword'] = 'led';
$url = 'https://admin.hagro.cn/api/company_list';
$data = [
'prod_desc'=>$this->param['keyword'],
'total'=>$this->param['row'] ?? 10,
];
arsort($data);
$token = 'company_list+'.date('Y-m-d').'+'.http_build_query($data);
$param = [
'prod_desc'=>$this->param['keyword'],
'token'=>md5($token),
'total'=>$this->param['row'] ?? 10,
];
$res = http_post($url,json_encode($param));
if(!empty($res) && $res['code'] == 200){
$saveData = [
'project_id'=>$this->param['project_id'],
'keyword'=>$this->param['keyword'],
'data'=>json_encode($res['data'])
];
$purchaserModel = new Purchaser();
$purchaserModel->add($saveData);
}
return true;
}
}
... ...
<?php
/**
* @remark :
* @name :Purchaser.php
* @author :lyh
* @method :post
* @time :2024/3/4 14:39
*/
namespace App\Models\Com;
use App\Models\Base;
class Purchaser extends Base
{
protected $table = 'gl_purchaser';
}
... ...