作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -242,6 +242,11 @@ class OptimizeController extends BaseController @@ -242,6 +242,11 @@ class OptimizeController extends BaseController
242 'robots.required' => 'robots不能为空', 242 'robots.required' => 'robots不能为空',
243 'project_id.required' => 'project_id不能为空', 243 'project_id.required' => 'project_id不能为空',
244 ]); 244 ]);
  245 + $projectModel = new Project();
  246 + $rs = $projectModel->edit(['robots'=>$this->param['robots']],['id'=>$this->param['project_id']]);
  247 + if($rs === false){
  248 + $this->response('执行错误,请联系开发人员',Code::SYSTEM_ERROR);
  249 + }
245 //TODO::通知C端 250 //TODO::通知C端
246 $projectLogic = new ProjectLogic(); 251 $projectLogic = new ProjectLogic();
247 $project = $projectLogic->getProjectInfo($this->param['project_id']); 252 $project = $projectLogic->getProjectInfo($this->param['project_id']);
@@ -249,16 +254,11 @@ class OptimizeController extends BaseController @@ -249,16 +254,11 @@ class OptimizeController extends BaseController
249 if(empty($domain)){ 254 if(empty($domain)){
250 $domain = $project['deploy_build']['test_domain']; 255 $domain = $project['deploy_build']['test_domain'];
251 } 256 }
252 - $url = $domain.'/api/update_robots/?project_id='.$this->param['project_id'];  
253 - $res = http_get($url); 257 + $url = $domain.'api/update_robots/?project_id='.$this->param['project_id'];
  258 + $res = curlGet($url);
254 if(empty($res) || $res['status'] != 200){ 259 if(empty($res) || $res['status'] != 200){
255 $this->response('生成robots失败,请联系开发人员',Code::SYSTEM_ERROR,['url'=>$url]); 260 $this->response('生成robots失败,请联系开发人员',Code::SYSTEM_ERROR,['url'=>$url]);
256 } 261 }
257 - $projectModel = new Project();  
258 - $rs = $projectModel->edit(['robots'=>$this->param['robots']],['id'=>$this->param['project_id']]);  
259 - if($rs === false){  
260 - $this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR);  
261 - }  
262 - $this->response('success'); 262 + $this->response('success',Code::SUCCESS,['url'=>$domain.'robots.txt']);
263 } 263 }
264 } 264 }