作者 lyh

gx

@@ -520,3 +520,31 @@ if (!function_exists('str_replace_url')) { @@ -520,3 +520,31 @@ if (!function_exists('str_replace_url')) {
520 } 520 }
521 } 521 }
522 } 522 }
  523 +
  524 +if(!function_exists('curlGet')){
  525 + /**
  526 + * @remark :忽略证书curl请求
  527 + * @name :curlGet
  528 + * @author :lyh
  529 + * @method :post
  530 + * @time :2023/9/12 10:10
  531 + */
  532 + function curlGet($url){
  533 + $ch1 = curl_init();
  534 + $timeout = 0;
  535 + curl_setopt($ch1, CURLOPT_URL, $url);
  536 + curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
  537 + curl_setopt($ch1, CURLOPT_ENCODING, '');
  538 + curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
  539 + curl_setopt($ch1, CURLOPT_HTTPHEADER, array());
  540 + curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
  541 + curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);
  542 + curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);
  543 + curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
  544 + curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');
  545 + curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  546 + $access_txt = curl_exec($ch1);
  547 + curl_close($ch1);
  548 + return json_decode($access_txt, true);
  549 + }
  550 +}
@@ -50,7 +50,7 @@ class CNoticeController extends BaseController @@ -50,7 +50,7 @@ class CNoticeController extends BaseController
50 } 50 }
51 $urlStr = $this->getString($this->param['type'],$this->param['page']); 51 $urlStr = $this->getString($this->param['type'],$this->param['page']);
52 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($urlStr, true) . PHP_EOL, FILE_APPEND); 52 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($urlStr, true) . PHP_EOL, FILE_APPEND);
53 - $this->curlGet($urlStr); 53 + curlGet($urlStr);
54 $this->response('更新成功'); 54 $this->response('更新成功');
55 } 55 }
56 56
@@ -117,32 +117,6 @@ class CNoticeController extends BaseController @@ -117,32 +117,6 @@ class CNoticeController extends BaseController
117 } 117 }
118 118
119 /** 119 /**
120 - * @remark :curl请求  
121 - * @name :curlGet  
122 - * @author :lyh  
123 - * @method :post  
124 - * @time :2023/9/12 10:10  
125 - */  
126 - public function curlGet($url){  
127 - $ch1 = curl_init();  
128 - $timeout = 0;  
129 - curl_setopt($ch1, CURLOPT_URL, $url);  
130 - curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);  
131 - curl_setopt($ch1, CURLOPT_ENCODING, '');  
132 - curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);  
133 - curl_setopt($ch1, CURLOPT_HTTPHEADER, array());  
134 - curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);  
135 - curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);  
136 - curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);  
137 - curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);  
138 - curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');  
139 - curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);  
140 - $access_txt = curl_exec($ch1);  
141 - curl_close($ch1);  
142 - return json_decode($access_txt, true);  
143 - }  
144 -  
145 - /**  
146 * @remark :生成一条更新记录 120 * @remark :生成一条更新记录
147 * @name :addProgress 121 * @name :addProgress
148 * @author :lyh 122 * @author :lyh
@@ -203,4 +177,5 @@ class CNoticeController extends BaseController @@ -203,4 +177,5 @@ class CNoticeController extends BaseController
203 } 177 }
204 $this->response('success',Code::SUCCESS,$lists); 178 $this->response('success',Code::SUCCESS,$lists);
205 } 179 }
  180 +
206 } 181 }
@@ -191,8 +191,6 @@ class BTemplateLogic extends BaseLogic @@ -191,8 +191,6 @@ class BTemplateLogic extends BaseLogic
191 $this->model->edit($this->param,['id'=>$info['id']]); 191 $this->model->edit($this->param,['id'=>$info['id']]);
192 } 192 }
193 $this->setTemplateLog($this->param); 193 $this->setTemplateLog($this->param);
194 - //路由映射  
195 - RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);  
196 DB::commit(); 194 DB::commit();
197 }catch (\Exception $e){ 195 }catch (\Exception $e){
198 DB::rollBack(); 196 DB::rollBack();
@@ -240,6 +238,8 @@ class BTemplateLogic extends BaseLogic @@ -240,6 +238,8 @@ class BTemplateLogic extends BaseLogic
240 if($source == BTemplate::SOURCE_HOME){ 238 if($source == BTemplate::SOURCE_HOME){
241 $type = 'index'; 239 $type = 'index';
242 $route = ''; 240 $route = '';
  241 + //路由映射
  242 + RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
243 }elseif($source == BTemplate::SOURCE_PRODUCT){ 243 }elseif($source == BTemplate::SOURCE_PRODUCT){
244 $type = RouteMap::SOURCE_PRODUCT; 244 $type = RouteMap::SOURCE_PRODUCT;
245 $productModel = new Product(); 245 $productModel = new Product();
@@ -149,7 +149,7 @@ class BaseLogic extends Logic @@ -149,7 +149,7 @@ class BaseLogic extends Logic
149 function updateNotify($data) 149 function updateNotify($data)
150 { 150 {
151 $updateNotifyModel = new UpdateNotify(); 151 $updateNotifyModel = new UpdateNotify();
152 - $info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>0]); 152 + $info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>1]);
153 if($info === false){ 153 if($info === false){
154 $param = [ 154 $param = [
155 'project_id'=>$data['project_id'], 155 'project_id'=>$data['project_id'],
@@ -158,6 +158,9 @@ class BaseLogic extends Logic @@ -158,6 +158,9 @@ class BaseLogic extends Logic
158 ]; 158 ];
159 $updateNotifyModel->add($param); 159 $updateNotifyModel->add($param);
160 } 160 }
  161 + //单页面直接通知更新
  162 + $url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$data['route'];
  163 + curlGet($url);
161 return $this->success(); 164 return $this->success();
162 } 165 }
163 166