作者 李美松

Merge branch 'develop' into lms

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside; @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Helper\Common; 6 use App\Helper\Common;
7 use App\Http\Controllers\Controller; 7 use App\Http\Controllers\Controller;
  8 +use App\Http\Logic\Aside\Project\ProjectLogic;
8 use App\Http\Requests\Bside\Nav\NavRequest; 9 use App\Http\Requests\Bside\Nav\NavRequest;
9 use App\Http\Requests\Scene; 10 use App\Http\Requests\Scene;
10 use App\Models\Project\DeployBuild; 11 use App\Models\Project\DeployBuild;
@@ -225,4 +226,15 @@ class BaseController extends Controller @@ -225,4 +226,15 @@ class BaseController extends Controller
225 $url = $info['test_domain'].'api/updateHtmlNotify?model='.$param; 226 $url = $info['test_domain'].'api/updateHtmlNotify?model='.$param;
226 return http_get($url); 227 return http_get($url);
227 } 228 }
  229 +
  230 + public function getProjectDomain(){
  231 + $project = (new ProjectLogic())->getInfo($this->user['project_id']);
  232 + if(!empty($project['deploy_optimize']['domain'])){
  233 + return $project['deploy_optimize']['domain'];
  234 + }
  235 + if(!empty($project['deploy_build']['test_domain'])){
  236 + return $project['deploy_build']['test_domain'];
  237 + }
  238 + return '';
  239 + }
228 } 240 }
@@ -8,6 +8,7 @@ use App\Http\Logic\Bside\Blog\BlogCategoryLogic; @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\Blog\BlogCategoryLogic;
8 use App\Http\Requests\Bside\Blog\BlogCategoryRequest; 8 use App\Http\Requests\Bside\Blog\BlogCategoryRequest;
9 use App\Models\Blog\Blog as BlogModel; 9 use App\Models\Blog\Blog as BlogModel;
10 use App\Models\Blog\BlogCategory as BlogCategoryModel; 10 use App\Models\Blog\BlogCategory as BlogCategoryModel;
  11 +use App\Models\RouteMap;
11 12
12 class BlogCategoryController extends BaseController 13 class BlogCategoryController extends BaseController
13 { 14 {
@@ -25,6 +26,8 @@ class BlogCategoryController extends BaseController @@ -25,6 +26,8 @@ class BlogCategoryController extends BaseController
25 $blogModel = new BlogModel(); 26 $blogModel = new BlogModel();
26 foreach ($lists['list'] as $k => $v){ 27 foreach ($lists['list'] as $k => $v){
27 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 28 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
  29 + $v['alias'] = RouteMap::getRoute(RouteMap::SOURCE_BLOG_CATE, $v['id'], $this->user['project_id']);
  30 + $v['url'] = $this->getProjectDomain() . RouteMap::PATH_BLOG_CATE . '/' . $v['alias'];
28 $lists['list'][$k] = $v; 31 $lists['list'][$k] = $v;
29 } 32 }
30 } 33 }
@@ -43,6 +46,8 @@ class BlogCategoryController extends BaseController @@ -43,6 +46,8 @@ class BlogCategoryController extends BaseController
43 'id.required' => 'ID不能为空' 46 'id.required' => 'ID不能为空'
44 ]); 47 ]);
45 $info = $blogCategoryLogic->info_blog_category(); 48 $info = $blogCategoryLogic->info_blog_category();
  49 + $info['alias'] = RouteMap::getRoute(RouteMap::SOURCE_BLOG_CATE, $info['id'], $this->user['project_id']);
  50 + $info['url'] = $this->getProjectDomain() . RouteMap::PATH_BLOG_CATE . '/' . $info['alias'];
46 $this->response('success',Code::SUCCESS,$info); 51 $this->response('success',Code::SUCCESS,$info);
47 } 52 }
48 /** 53 /**
@@ -9,6 +9,7 @@ use App\Http\Logic\Bside\Blog\BlogLabelLogic; @@ -9,6 +9,7 @@ use App\Http\Logic\Bside\Blog\BlogLabelLogic;
9 use App\Http\Logic\Bside\Blog\BlogLogic; 9 use App\Http\Logic\Bside\Blog\BlogLogic;
10 use App\Http\Requests\Bside\Blog\BlogRequest; 10 use App\Http\Requests\Bside\Blog\BlogRequest;
11 use App\Models\Blog\Blog as BlogModel; 11 use App\Models\Blog\Blog as BlogModel;
  12 +use App\Models\RouteMap;
12 13
13 class BlogController extends BaseController 14 class BlogController extends BaseController
14 { 15 {
@@ -30,6 +31,8 @@ class BlogController extends BaseController @@ -30,6 +31,8 @@ class BlogController extends BaseController
30 $v = $blogCategoryLogic->get_category_name($v); 31 $v = $blogCategoryLogic->get_category_name($v);
31 //获取标签名称 32 //获取标签名称
32 $v = $blogLabelLogic->get_label_name($v); 33 $v = $blogLabelLogic->get_label_name($v);
  34 + $v['route'] = RouteMap::getRoute(RouteMap::SOURCE_BLOG, $v['id'], $this->user['project_id']);
  35 + $v['url'] = $this->getProjectDomain() . $v['route'];
33 $lists['list'][$k] = $v; 36 $lists['list'][$k] = $v;
34 } 37 }
35 } 38 }
@@ -58,6 +61,8 @@ class BlogController extends BaseController @@ -58,6 +61,8 @@ class BlogController extends BaseController
58 'id.required' => 'ID不能为空' 61 'id.required' => 'ID不能为空'
59 ]); 62 ]);
60 $info = $blogLogic->blog_info(); 63 $info = $blogLogic->blog_info();
  64 + $info['route'] = RouteMap::getRoute(RouteMap::SOURCE_BLOG, $info['id'], $this->user['project_id']);
  65 + $info['url'] = $this->getProjectDomain() . $info['route'];
61 $this->response('success',Code::SUCCESS,$info); 66 $this->response('success',Code::SUCCESS,$info);
62 } 67 }
63 /** 68 /**
@@ -8,6 +8,7 @@ use App\Http\Logic\Bside\News\NewsCategoryLogic; @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\News\NewsCategoryLogic;
8 use App\Http\Requests\Bside\News\NewsCategoryRequest; 8 use App\Http\Requests\Bside\News\NewsCategoryRequest;
9 use App\Models\News\News as NewsModel; 9 use App\Models\News\News as NewsModel;
10 use App\Models\News\NewsCategory as NewsCategoryModel; 10 use App\Models\News\NewsCategory as NewsCategoryModel;
  11 +use App\Models\RouteMap;
11 12
12 class NewsCategoryController extends BaseController 13 class NewsCategoryController extends BaseController
13 { 14 {
@@ -25,6 +26,8 @@ class NewsCategoryController extends BaseController @@ -25,6 +26,8 @@ class NewsCategoryController extends BaseController
25 $newsModel = new NewsModel(); 26 $newsModel = new NewsModel();
26 foreach ($lists['list'] as $k => $v){ 27 foreach ($lists['list'] as $k => $v){
27 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 28 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
  29 + $v['alias'] = RouteMap::getRoute(RouteMap::SOURCE_NEWS_CATE, $v['id'], $this->user['project_id']);
  30 + $v['url'] = $this->getProjectDomain() . RouteMap::PATH_NEWS_CATE . '/' . $v['alias'];
28 $lists['list'][$k] = $v; 31 $lists['list'][$k] = $v;
29 } 32 }
30 } 33 }
@@ -43,6 +46,8 @@ class NewsCategoryController extends BaseController @@ -43,6 +46,8 @@ class NewsCategoryController extends BaseController
43 'id.required' => 'ID不能为空' 46 'id.required' => 'ID不能为空'
44 ]); 47 ]);
45 $info = $newsCategoryLogic->info_news_category(); 48 $info = $newsCategoryLogic->info_news_category();
  49 + $info['alias'] = RouteMap::getRoute(RouteMap::SOURCE_NEWS_CATE, $info['id'], $this->user['project_id']);
  50 + $info['url'] = $this->getProjectDomain() . RouteMap::PATH_NEWS_CATE . '/' . $info['alias'];
46 $this->response('success',Code::SUCCESS,$info); 51 $this->response('success',Code::SUCCESS,$info);
47 } 52 }
48 /** 53 /**
@@ -8,6 +8,7 @@ use App\Http\Logic\Bside\News\NewsCategoryLogic; @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\News\NewsCategoryLogic;
8 use App\Http\Logic\Bside\News\NewsLogic; 8 use App\Http\Logic\Bside\News\NewsLogic;
9 use App\Http\Requests\Bside\News\NewsRequest; 9 use App\Http\Requests\Bside\News\NewsRequest;
10 use App\Models\News\News as NewsModel; 10 use App\Models\News\News as NewsModel;
  11 +use App\Models\RouteMap;
11 12
12 13
13 /** 14 /**
@@ -28,6 +29,8 @@ class NewsController extends BaseController @@ -28,6 +29,8 @@ class NewsController extends BaseController
28 if(!empty($lists['list'])){ 29 if(!empty($lists['list'])){
29 foreach ($lists['list'] as $k => $v){ 30 foreach ($lists['list'] as $k => $v){
30 $v = $newsCategoryLogic->get_category_name($v); 31 $v = $newsCategoryLogic->get_category_name($v);
  32 + $v['route'] = RouteMap::getRoute(RouteMap::SOURCE_NEWS, $v['id'], $this->user['project_id']);
  33 + $v['url'] = $this->getProjectDomain() . $v['route'];
31 $lists['list'][$k] = $v; 34 $lists['list'][$k] = $v;
32 } 35 }
33 } 36 }
@@ -55,6 +58,8 @@ class NewsController extends BaseController @@ -55,6 +58,8 @@ class NewsController extends BaseController
55 'id.required' => 'ID不能为空', 58 'id.required' => 'ID不能为空',
56 ]); 59 ]);
57 $info = $newsLogic->news_info(); 60 $info = $newsLogic->news_info();
  61 + $info['route'] = RouteMap::getRoute(RouteMap::SOURCE_NEWS, $info['id'], $this->user['project_id']);
  62 + $info['url'] = $this->getProjectDomain() . $info['route'];
58 $this->response('success',Code::SUCCESS,$info); 63 $this->response('success',Code::SUCCESS,$info);
59 } 64 }
60 /** 65 /**
@@ -28,8 +28,8 @@ class ProjectCountryController extends BaseController @@ -28,8 +28,8 @@ class ProjectCountryController extends BaseController
28 * @method :post 28 * @method :post
29 * @time :2023/4/28 17:53 29 * @time :2023/4/28 17:53
30 */ 30 */
31 - public function edit(ProjectCountryLogic $projectCountryLogic){  
32 - $projectCountryLogic->country_edit(); 31 + public function save(ProjectCountryLogic $projectCountryLogic){
  32 + $projectCountryLogic->country_save();
33 $this->response('success'); 33 $this->response('success');
34 } 34 }
35 } 35 }
@@ -9,6 +9,7 @@ use App\Http\Logic\Bside\User\UserLogic; @@ -9,6 +9,7 @@ use App\Http\Logic\Bside\User\UserLogic;
9 use App\Models\Blog\BlogCategory as BlogCategoryModel; 9 use App\Models\Blog\BlogCategory as BlogCategoryModel;
10 use App\Models\Blog\Blog as BlogModel; 10 use App\Models\Blog\Blog as BlogModel;
11 use App\Models\News\NewsCategory as NewsCategoryModel; 11 use App\Models\News\NewsCategory as NewsCategoryModel;
  12 +use App\Models\RouteMap;
12 use Illuminate\Support\Facades\DB; 13 use Illuminate\Support\Facades\DB;
13 14
14 class BlogCategoryLogic extends BaseLogic 15 class BlogCategoryLogic extends BaseLogic
@@ -77,6 +78,9 @@ class BlogCategoryLogic extends BaseLogic @@ -77,6 +78,9 @@ class BlogCategoryLogic extends BaseLogic
77 } 78 }
78 } 79 }
79 } 80 }
  81 +
  82 + RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $cate_id, $this->user['project_id']);
  83 +
80 DB::commit(); 84 DB::commit();
81 }catch (\Exception $e){ 85 }catch (\Exception $e){
82 DB::rollBack(); 86 DB::rollBack();
@@ -104,6 +108,7 @@ class BlogCategoryLogic extends BaseLogic @@ -104,6 +108,7 @@ class BlogCategoryLogic extends BaseLogic
104 108
105 $this->param['operator_id'] = $this->user['id']; 109 $this->param['operator_id'] = $this->user['id'];
106 $this->edit($this->param,['id'=>$this->param['id']]); 110 $this->edit($this->param,['id'=>$this->param['id']]);
  111 + RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']);
107 return $this->success(); 112 return $this->success();
108 } 113 }
109 114
@@ -152,6 +157,7 @@ class BlogCategoryLogic extends BaseLogic @@ -152,6 +157,7 @@ class BlogCategoryLogic extends BaseLogic
152 if($rs !== false){ 157 if($rs !== false){
153 $this->response('当前分类拥有博客'); 158 $this->response('当前分类拥有博客');
154 } 159 }
  160 + RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $v, $this->user['project_id']);
155 } 161 }
156 $this->param['id'] = ['in',$this->param['id']]; 162 $this->param['id'] = ['in',$this->param['id']];
157 $this->del($this->param,$ids); 163 $this->del($this->param,$ids);
@@ -75,7 +75,7 @@ class BlogLogic extends BaseLogic @@ -75,7 +75,7 @@ class BlogLogic extends BaseLogic
75 $this->param['image'] = $data; 75 $this->param['image'] = $data;
76 } 76 }
77 $rs = $this->model->insertGetId($this->param); 77 $rs = $this->model->insertGetId($this->param);
78 - RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $rs, $this->user['project_id']); 78 + RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_BLOG, $rs, $this->user['project_id']);
79 DB::commit(); 79 DB::commit();
80 }catch (\Exception $e){ 80 }catch (\Exception $e){
81 DB::rollBack(); 81 DB::rollBack();
@@ -108,7 +108,7 @@ class BlogLogic extends BaseLogic @@ -108,7 +108,7 @@ class BlogLogic extends BaseLogic
108 if(isset($this->param['image']) && is_file($this->param['image'])){ 108 if(isset($this->param['image']) && is_file($this->param['image'])){
109 $this->param['image'] = $this->upload(); 109 $this->param['image'] = $this->upload();
110 } 110 }
111 - RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']); 111 + RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);
112 $this->edit($this->param,['id'=>$this->param['id']]); 112 $this->edit($this->param,['id'=>$this->param['id']]);
113 DB::commit(); 113 DB::commit();
114 }catch (\Exception $e){ 114 }catch (\Exception $e){
@@ -185,6 +185,11 @@ class BlogLogic extends BaseLogic @@ -185,6 +185,11 @@ class BlogLogic extends BaseLogic
185 try { 185 try {
186 $this->param['id'] = ['in',$this->param['id']]; 186 $this->param['id'] = ['in',$this->param['id']];
187 $this->del($this->param,$ids); 187 $this->del($this->param,$ids);
  188 +
  189 + foreach ($ids as $id){
  190 + RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
  191 + }
  192 +
188 DB::commit(); 193 DB::commit();
189 }catch (Exception $e){ 194 }catch (Exception $e){
190 DB::rollBack(); 195 DB::rollBack();
@@ -6,6 +6,7 @@ use App\Helper\Arr; @@ -6,6 +6,7 @@ use App\Helper\Arr;
6 use App\Models\BCustom; 6 use App\Models\BCustom;
7 use App\Models\Inquiry; 7 use App\Models\Inquiry;
8 use App\Models\RouteMap; 8 use App\Models\RouteMap;
  9 +use Illuminate\Support\Facades\DB;
9 10
10 /** 11 /**
11 * 自定义页面 12 * 自定义页面
@@ -23,6 +24,15 @@ class CustomLogic extends BaseLogic @@ -23,6 +24,15 @@ class CustomLogic extends BaseLogic
23 $this->model = new BCustom(); 24 $this->model = new BCustom();
24 } 25 }
25 26
  27 + public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20)
  28 + {
  29 + $data = parent::getList($map, $sort, $columns, $limit);
  30 + foreach ($data['list'] as &$v){
  31 + $v['route'] = RouteMap::getRoute(RouteMap::SOURCE_PAGE, $v['id'], $this->project['id']);
  32 + $v['url'] = $this->getProjectDomain() . $v['route'];
  33 + }
  34 + return $this->success($data);
  35 + }
26 36
27 /** 37 /**
28 * @param $param 38 * @param $param
@@ -36,7 +46,18 @@ class CustomLogic extends BaseLogic @@ -36,7 +46,18 @@ class CustomLogic extends BaseLogic
36 { 46 {
37 $param['html'] = ''; 47 $param['html'] = '';
38 48
  49 + DB::beginTransaction();
  50 + try {
39 $id = parent::save($param); 51 $id = parent::save($param);
  52 + //路由映射
  53 + RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_PAGE, $id['id'], $this->user['project_id']);
  54 +
  55 + DB::commit();
  56 + }catch (\Exception $e){
  57 + DB::rollBack();
  58 + $this->fail('保存失败');
  59 + }
  60 +
40 61
41 $data = $this->getInfo($id['id']); 62 $data = $this->getInfo($id['id']);
42 63
@@ -55,12 +76,20 @@ class CustomLogic extends BaseLogic @@ -55,12 +76,20 @@ class CustomLogic extends BaseLogic
55 */ 76 */
56 public function delete($ids, $map = []) 77 public function delete($ids, $map = [])
57 { 78 {
  79 + DB::beginTransaction();
  80 + try {
  81 + foreach ($ids as $id) {
  82 + //删除路由映射
  83 + RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
  84 + }
  85 + parent::delete($ids);
58 86
59 - parent::delete($ids, $map); // TODO: Change the autogenerated stub  
60 -  
61 - // 删除路由  
62 - RouteMap::delRoute(RouteMap::SOURCE_CUSTOM,$ids,$this->user['project_id']);  
63 - 87 + DB::commit();
  88 + }catch (\Exception $e){
  89 + DB::rollBack();
  90 + $this->fail('删除失败');
  91 + }
  92 + return $this->success();
64 } 93 }
65 94
66 95
@@ -7,6 +7,7 @@ use App\Helper\Common; @@ -7,6 +7,7 @@ use App\Helper\Common;
7 use App\Http\Logic\Bside\BaseLogic; 7 use App\Http\Logic\Bside\BaseLogic;
8 use App\Models\News\News as NewsModel; 8 use App\Models\News\News as NewsModel;
9 use App\Models\News\NewsCategory as NewsCategoryModel; 9 use App\Models\News\NewsCategory as NewsCategoryModel;
  10 +use App\Models\RouteMap;
10 use Illuminate\Support\Facades\DB; 11 use Illuminate\Support\Facades\DB;
11 12
12 class NewsCategoryLogic extends BaseLogic 13 class NewsCategoryLogic extends BaseLogic
@@ -87,6 +88,7 @@ class NewsCategoryLogic extends BaseLogic @@ -87,6 +88,7 @@ class NewsCategoryLogic extends BaseLogic
87 } 88 }
88 } 89 }
89 } 90 }
  91 + RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $cate_id, $this->user['project_id']);
90 DB::commit(); 92 DB::commit();
91 }catch (\Exception $e){ 93 }catch (\Exception $e){
92 DB::rollBack(); 94 DB::rollBack();
@@ -113,6 +115,7 @@ class NewsCategoryLogic extends BaseLogic @@ -113,6 +115,7 @@ class NewsCategoryLogic extends BaseLogic
113 } 115 }
114 $this->param['operator_id'] = $this->user['id']; 116 $this->param['operator_id'] = $this->user['id'];
115 $this->edit($this->param,['id'=>$this->param['id']]); 117 $this->edit($this->param,['id'=>$this->param['id']]);
  118 + RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']);
116 return $this->success(); 119 return $this->success();
117 } 120 }
118 121
@@ -149,6 +152,7 @@ class NewsCategoryLogic extends BaseLogic @@ -149,6 +152,7 @@ class NewsCategoryLogic extends BaseLogic
149 if($rs !== false){ 152 if($rs !== false){
150 $this->fail('当前分类拥有商品'); 153 $this->fail('当前分类拥有商品');
151 } 154 }
  155 + RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $v, $this->user['project_id']);
152 } 156 }
153 $this->param['id'] = ['in',$this->param['id']]; 157 $this->param['id'] = ['in',$this->param['id']];
154 $this->del($this->param,$ids); 158 $this->del($this->param,$ids);
@@ -67,7 +67,7 @@ class NewsLogic extends BaseLogic @@ -67,7 +67,7 @@ class NewsLogic extends BaseLogic
67 $this->param['image'] = $data; 67 $this->param['image'] = $data;
68 } 68 }
69 $rs = $this->model->insertGetId($this->param); 69 $rs = $this->model->insertGetId($this->param);
70 - RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $rs, $this->user['project_id']); 70 + RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_NEWS, $rs, $this->user['project_id']);
71 DB::commit(); 71 DB::commit();
72 }catch (\Exception $e){ 72 }catch (\Exception $e){
73 DB::rollBack(); 73 DB::rollBack();
@@ -100,7 +100,7 @@ class NewsLogic extends BaseLogic @@ -100,7 +100,7 @@ class NewsLogic extends BaseLogic
100 $this->param['image'] = $this->upload(); 100 $this->param['image'] = $this->upload();
101 } 101 }
102 //设置路由 102 //设置路由
103 - RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']); 103 + RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']);
104 $this->edit($this->param,['id'=>$this->param['id']]); 104 $this->edit($this->param,['id'=>$this->param['id']]);
105 DB::commit(); 105 DB::commit();
106 }catch (\exception $e){ 106 }catch (\exception $e){
@@ -174,6 +174,10 @@ class NewsLogic extends BaseLogic @@ -174,6 +174,10 @@ class NewsLogic extends BaseLogic
174 try { 174 try {
175 $this->param['id'] = ['in',$this->param['id']]; 175 $this->param['id'] = ['in',$this->param['id']];
176 $this->del($this->param,$ids); 176 $this->del($this->param,$ids);
  177 + foreach ($ids as $id){
  178 + RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
  179 + }
  180 +
177 DB::commit(); 181 DB::commit();
178 }catch (Exception $e){ 182 }catch (Exception $e){
179 DB::rollBack(); 183 DB::rollBack();
@@ -34,8 +34,14 @@ class ProjectCountryLogic extends BaseLogic @@ -34,8 +34,14 @@ class ProjectCountryLogic extends BaseLogic
34 * @method :post 34 * @method :post
35 * @time :2023/4/28 17:42 35 * @time :2023/4/28 17:42
36 */ 36 */
37 - public function country_edit(){ 37 + public function country_save(){
  38 + $info = $this->model->read(['project_id'=>$this->user['project_id']]);
  39 + if($info === false){
  40 + $this->param['project_id'] = $this->user['project_id'];
  41 + $rs = $this->model->add($this->param);
  42 + }else{
38 $rs = $this->model->edit($this->param,['project_id'=>$this->user['project_id']]); 43 $rs = $this->model->edit($this->param,['project_id'=>$this->user['project_id']]);
  44 + }
39 if($rs === false){ 45 if($rs === false){
40 $this->fail('当前数据不存在'); 46 $this->fail('当前数据不存在');
41 } 47 }
@@ -36,7 +36,7 @@ class CustomRequest extends FormRequest @@ -36,7 +36,7 @@ class CustomRequest extends FormRequest
36 'keywords' => [],//'required','max:200' 36 'keywords' => [],//'required','max:200'
37 'description' => [],//'required','max:250' 37 'description' => [],//'required','max:250'
38 // 'html' => ['required'], 38 // 'html' => ['required'],
39 - 'url' => ['required','max:200','url'], 39 + 'url' => ['required','max:200'],
40 'status' => ['required','in:0,1'], 40 'status' => ['required','in:0,1'],
41 ]; 41 ];
42 42
@@ -5,6 +5,8 @@ namespace App\Models; @@ -5,6 +5,8 @@ namespace App\Models;
5 use App\Helper\Translate; 5 use App\Helper\Translate;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 use Illuminate\Support\Facades\Log; 7 use Illuminate\Support\Facades\Log;
  8 +use Illuminate\Support\Str;
  9 +use function MongoDB\select_server;
8 10
9 /** 11 /**
10 * 路由映射表 12 * 路由映射表
@@ -23,12 +25,15 @@ class RouteMap extends Model @@ -23,12 +25,15 @@ class RouteMap extends Model
23 const SOURCE_PRODUCT_CATE = 'product_category'; 25 const SOURCE_PRODUCT_CATE = 'product_category';
24 const SOURCE_PRODUCT_KEYWORD = 'product_keyword'; 26 const SOURCE_PRODUCT_KEYWORD = 'product_keyword';
25 const SOURCE_PAGE = 'page'; //单页面 27 const SOURCE_PAGE = 'page'; //单页面
26 -  
27 - //路由类型  
28 const SOURCE_BLOG = 'blog'; 28 const SOURCE_BLOG = 'blog';
  29 + const SOURCE_BLOG_CATE = 'blog_category';
29 const SOURCE_NEWS = 'news'; 30 const SOURCE_NEWS = 'news';
30 - // 自定义界面  
31 - const SOURCE_CUSTOM = 'custom'; 31 + const SOURCE_NEWS_CATE = 'news_category';
  32 +
  33 + //路由二级目录
  34 + const PATH_NEWS_CATE = 'news_catalog';
  35 + const PATH_BLOG_CATE = 'blog_catalog';
  36 +
32 /** 37 /**
33 * 生成路由标识 38 * 生成路由标识
34 * @param $title 39 * @param $title
@@ -70,9 +75,20 @@ class RouteMap extends Model @@ -70,9 +75,20 @@ class RouteMap extends Model
70 if(in_array($route, $fixed)){ 75 if(in_array($route, $fixed)){
71 return true; 76 return true;
72 } 77 }
73 - $route = self::where('project_id', $project_id)->where('route', $route)->first(); 78 + $where = [
  79 + 'project_id' => $project_id,
  80 + 'route' => $route,
  81 + 'source' => $source
  82 + ];
  83 + if($source == self::SOURCE_BLOG_CATE){
  84 + $where['path'] = self::PATH_BLOG_CATE;
  85 + }
  86 + if($source == self::SOURCE_NEWS_CATE){
  87 + $where['path'] = self::PATH_NEWS_CATE;
  88 + }
  89 + $route = self::where($where)->first();
74 if($route){ 90 if($route){
75 - if($route->source == $source && $route->source_id == $source_id){ 91 + if($route->source_id == $source_id){
76 return false; 92 return false;
77 } 93 }
78 return true; 94 return true;
@@ -102,6 +118,12 @@ class RouteMap extends Model @@ -102,6 +118,12 @@ class RouteMap extends Model
102 $route_map->source = $source; 118 $route_map->source = $source;
103 $route_map->source_id = $source_id; 119 $route_map->source_id = $source_id;
104 $route_map->project_id = $project_id; 120 $route_map->project_id = $project_id;
  121 + if($source == self::SOURCE_BLOG_CATE){
  122 + $route_map->path = self::PATH_BLOG_CATE;
  123 + }
  124 + if($source == self::SOURCE_NEWS_CATE){
  125 + $route_map->path = self::PATH_NEWS_CATE;
  126 + }
105 } 127 }
106 $route_map->route = $route; 128 $route_map->route = $route;
107 $route_map->save(); 129 $route_map->save();
@@ -115,7 +115,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -115,7 +115,7 @@ Route::middleware(['bloginauth'])->group(function () {
115 Route::prefix('country')->group(function () { 115 Route::prefix('country')->group(function () {
116 Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingCountryController::class, 'lists'])->name('web_setting_country_lists'); 116 Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingCountryController::class, 'lists'])->name('web_setting_country_lists');
117 Route::any('/info', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'info'])->name('web_setting_country_info'); 117 Route::any('/info', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'info'])->name('web_setting_country_info');
118 - Route::any('/edit', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'edit'])->name('web_setting_country_edit'); 118 + Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'save'])->name('web_setting_country_save');
119 }); 119 });
120 //客服设置 120 //客服设置
121 Route::prefix('service')->group(function () { 121 Route::prefix('service')->group(function () {