作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -84,7 +84,7 @@ class BlogController extends BaseController @@ -84,7 +84,7 @@ class BlogController extends BaseController
84 */ 84 */
85 public function getAllSub($id,&$str = []){ 85 public function getAllSub($id,&$str = []){
86 $cateModel = new BlogCategory(); 86 $cateModel = new BlogCategory();
87 - $list = $cateModel->list(['pid'=>$id,'status'=>1],['id','pid']); 87 + $list = $cateModel->list(['pid'=>$id,'status'=>0],['id','pid']);
88 if(!empty($list)){ 88 if(!empty($list)){
89 foreach ($list as $v){ 89 foreach ($list as $v){
90 $str[] = $v['id']; 90 $str[] = $v['id'];
@@ -60,6 +60,7 @@ class NewsController extends BaseController @@ -60,6 +60,7 @@ class NewsController extends BaseController
60 $str = []; 60 $str = [];
61 $str[] = $this->map['category_id']; 61 $str[] = $this->map['category_id'];
62 $this->getAllSub($this->map['category_id'],$str); 62 $this->getAllSub($this->map['category_id'],$str);
  63 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($str, true) . PHP_EOL, FILE_APPEND);
63 $query->where(function ($subQuery) use ($str) { 64 $query->where(function ($subQuery) use ($str) {
64 foreach ($str as $v) { 65 foreach ($str as $v) {
65 $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); 66 $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]);
@@ -87,7 +88,7 @@ class NewsController extends BaseController @@ -87,7 +88,7 @@ class NewsController extends BaseController
87 */ 88 */
88 public function getAllSub($id,&$str = []){ 89 public function getAllSub($id,&$str = []){
89 $cateModel = new NewsCategory(); 90 $cateModel = new NewsCategory();
90 - $list = $cateModel->list(['pid'=>$id,'status'=>1],['id','pid']); 91 + $list = $cateModel->list(['pid'=>$id,'status'=>0],['id','pid']);
91 if(!empty($list)){ 92 if(!empty($list)){
92 foreach ($list as $v){ 93 foreach ($list as $v){
93 $str[] = $v['id']; 94 $str[] = $v['id'];
@@ -63,23 +63,22 @@ class CustomTemplateLogic extends BaseLogic @@ -63,23 +63,22 @@ class CustomTemplateLogic extends BaseLogic
63 * @time :2023/6/29 16:21 63 * @time :2023/6/29 16:21
64 */ 64 */
65 public function customTemplateSave(){ 65 public function customTemplateSave(){
66 - try {  
67 - $this->param['url'] = str_replace_url($this->param['url']);  
68 - if(isset($this->param['id']) && !empty($this->param['id'])){  
69 - $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']);  
70 - $this->editCustomRoute($this->param['url']);  
71 - $this->model->edit($this->param,['id'=>$this->param['id']]);  
72 - }else{  
73 - if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){  
74 - $this->fail('404页面已存在');  
75 - }  
76 - $this->param['project_id'] = $this->user['project_id'];  
77 - $id = $this->model->addReturnId($this->param);  
78 - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);  
79 - $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);  
80 - $this->model->edit(['url'=>$route],['id'=>$id]); 66 + $this->param['url'] = str_replace_url($this->param['url']);
  67 + if(isset($this->param['id']) && !empty($this->param['id'])){
  68 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']);
  69 + $this->editCustomRoute($this->param['url']);
  70 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  71 + }else{
  72 + if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
  73 + $this->fail('404页面已存在');
81 } 74 }
82 - }catch (\Exception $e){ 75 + $this->param['project_id'] = $this->user['project_id'];
  76 + $id = $this->model->addReturnId($this->param);
  77 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
  78 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
  79 + $rs = $this->model->edit(['url'=>$route],['id'=>$id]);
  80 + }
  81 + if($rs === false){
83 $this->fail('保存失败,请联系管理员'); 82 $this->fail('保存失败,请联系管理员');
84 } 83 }
85 return $this->success(); 84 return $this->success();
@@ -208,13 +207,13 @@ class CustomTemplateLogic extends BaseLogic @@ -208,13 +207,13 @@ class CustomTemplateLogic extends BaseLogic
208 */ 207 */
209 public function editCustomRoute($route){ 208 public function editCustomRoute($route){
210 $info = $this->model->read(['id'=>$this->param['id']]); 209 $info = $this->model->read(['id'=>$this->param['id']]);
211 - if($info['url'] == $this->model::NOT_FOUND_PAGE_URL && $route['url'] != '404'){  
212 - $this->fail('404页面链接不可修改');  
213 - }  
214 - if($info['url'] != $route){  
215 - $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);  
216 - $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$route]); 210 + if($info['url'] == $this->model::NOT_FOUND_PAGE_URL){
  211 + if($route != '404'){
  212 + $this->fail('不可删除, 只可以修改tdk');
  213 + }
217 } 214 }
  215 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
  216 + $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$route]);
218 return true; 217 return true;
219 } 218 }
220 219