作者 lyh

gx

... ... @@ -520,3 +520,31 @@ if (!function_exists('str_replace_url')) {
}
}
}
if(!function_exists('curlGet')){
/**
* @remark :忽略证书curl请求
* @name :curlGet
* @author :lyh
* @method :post
* @time :2023/9/12 10:10
*/
function curlGet($url){
$ch1 = curl_init();
$timeout = 0;
curl_setopt($ch1, CURLOPT_URL, $url);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_ENCODING, '');
curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch1, CURLOPT_HTTPHEADER, array());
curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
$access_txt = curl_exec($ch1);
curl_close($ch1);
return json_decode($access_txt, true);
}
}
... ...
... ... @@ -50,7 +50,7 @@ class CNoticeController extends BaseController
}
$urlStr = $this->getString($this->param['type'],$this->param['page']);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($urlStr, true) . PHP_EOL, FILE_APPEND);
$this->curlGet($urlStr);
curlGet($urlStr);
$this->response('更新成功');
}
... ... @@ -117,32 +117,6 @@ class CNoticeController extends BaseController
}
/**
* @remark :curl请求
* @name :curlGet
* @author :lyh
* @method :post
* @time :2023/9/12 10:10
*/
public function curlGet($url){
$ch1 = curl_init();
$timeout = 0;
curl_setopt($ch1, CURLOPT_URL, $url);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_ENCODING, '');
curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch1, CURLOPT_HTTPHEADER, array());
curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
$access_txt = curl_exec($ch1);
curl_close($ch1);
return json_decode($access_txt, true);
}
/**
* @remark :生成一条更新记录
* @name :addProgress
* @author :lyh
... ... @@ -203,4 +177,5 @@ class CNoticeController extends BaseController
}
$this->response('success',Code::SUCCESS,$lists);
}
}
... ...
... ... @@ -191,8 +191,6 @@ class BTemplateLogic extends BaseLogic
$this->model->edit($this->param,['id'=>$info['id']]);
}
$this->setTemplateLog($this->param);
//路由映射
RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ... @@ -240,6 +238,8 @@ class BTemplateLogic extends BaseLogic
if($source == BTemplate::SOURCE_HOME){
$type = 'index';
$route = '';
//路由映射
RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
}elseif($source == BTemplate::SOURCE_PRODUCT){
$type = RouteMap::SOURCE_PRODUCT;
$productModel = new Product();
... ...
... ... @@ -149,7 +149,7 @@ class BaseLogic extends Logic
function updateNotify($data)
{
$updateNotifyModel = new UpdateNotify();
$info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>0]);
$info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>1]);
if($info === false){
$param = [
'project_id'=>$data['project_id'],
... ... @@ -158,6 +158,9 @@ class BaseLogic extends Logic
];
$updateNotifyModel->add($param);
}
//单页面直接通知更新
$url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$data['route'];
curlGet($url);
return $this->success();
}
... ...