正在显示
7 个修改的文件
包含
13 行增加
和
13 行删除
| @@ -26,7 +26,7 @@ class BlogCategoryController extends BaseController | @@ -26,7 +26,7 @@ class BlogCategoryController extends BaseController | ||
| 26 | $blogModel = new BlogModel(); | 26 | $blogModel = new BlogModel(); |
| 27 | foreach ($lists['list'] as $k => $v){ | 27 | foreach ($lists['list'] as $k => $v){ |
| 28 | $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); | 28 | $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); |
| 29 | - $v['route'] = RouteMap::getRoute(RouteMap::SOURCE_BLOG_CATE, $v['id'], $this->user['project_id']); | 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['route']; | 30 | $v['url'] = $this->getProjectDomain() . RouteMap::PATH_BLOG_CATE . '/' . $v['route']; |
| 31 | $lists['list'][$k] = $v; | 31 | $lists['list'][$k] = $v; |
| 32 | } | 32 | } |
| @@ -46,7 +46,7 @@ class BlogCategoryController extends BaseController | @@ -46,7 +46,7 @@ class BlogCategoryController extends BaseController | ||
| 46 | 'id.required' => 'ID不能为空' | 46 | 'id.required' => 'ID不能为空' |
| 47 | ]); | 47 | ]); |
| 48 | $info = $blogCategoryLogic->info_blog_category(); | 48 | $info = $blogCategoryLogic->info_blog_category(); |
| 49 | - $info['route'] = RouteMap::getRoute(RouteMap::SOURCE_BLOG_CATE, $info['id'], $this->user['project_id']); | 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['route']; | 50 | $info['url'] = $this->getProjectDomain() . RouteMap::PATH_BLOG_CATE . '/' . $info['route']; |
| 51 | $this->response('success',Code::SUCCESS,$info); | 51 | $this->response('success',Code::SUCCESS,$info); |
| 52 | } | 52 | } |
| @@ -26,7 +26,7 @@ class NewsCategoryController extends BaseController | @@ -26,7 +26,7 @@ class NewsCategoryController extends BaseController | ||
| 26 | $newsModel = new NewsModel(); | 26 | $newsModel = new NewsModel(); |
| 27 | foreach ($lists['list'] as $k => $v){ | 27 | foreach ($lists['list'] as $k => $v){ |
| 28 | $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); | 28 | $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); |
| 29 | - $v['route'] = RouteMap::getRoute(RouteMap::SOURCE_NEWS_CATE, $v['id'], $this->user['project_id']); | 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['route']; | 30 | $v['url'] = $this->getProjectDomain() . RouteMap::PATH_NEWS_CATE . '/' . $v['route']; |
| 31 | $lists['list'][$k] = $v; | 31 | $lists['list'][$k] = $v; |
| 32 | } | 32 | } |
| @@ -46,7 +46,7 @@ class NewsCategoryController extends BaseController | @@ -46,7 +46,7 @@ class NewsCategoryController extends BaseController | ||
| 46 | 'id.required' => 'ID不能为空' | 46 | 'id.required' => 'ID不能为空' |
| 47 | ]); | 47 | ]); |
| 48 | $info = $newsCategoryLogic->info_news_category(); | 48 | $info = $newsCategoryLogic->info_news_category(); |
| 49 | - $info['route'] = RouteMap::getRoute(RouteMap::SOURCE_NEWS_CATE, $info['id'], $this->user['project_id']); | 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['route']; | 50 | $info['url'] = $this->getProjectDomain() . RouteMap::PATH_NEWS_CATE . '/' . $info['route']; |
| 51 | $this->response('success',Code::SUCCESS,$info); | 51 | $this->response('success',Code::SUCCESS,$info); |
| 52 | } | 52 | } |
| @@ -79,7 +79,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -79,7 +79,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | - RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG_CATE, $cate_id, $this->user['project_id']); | 82 | + RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $cate_id, $this->user['project_id']); |
| 83 | 83 | ||
| 84 | DB::commit(); | 84 | DB::commit(); |
| 85 | }catch (\Exception $e){ | 85 | }catch (\Exception $e){ |
| @@ -108,7 +108,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -108,7 +108,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 108 | 108 | ||
| 109 | $this->param['operator_id'] = $this->user['id']; | 109 | $this->param['operator_id'] = $this->user['id']; |
| 110 | $this->edit($this->param,['id'=>$this->param['id']]); | 110 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 111 | - RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']); | 111 | + RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']); |
| 112 | return $this->success(); | 112 | return $this->success(); |
| 113 | } | 113 | } |
| 114 | 114 |
| @@ -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){ |
| @@ -50,7 +50,7 @@ class CustomLogic extends BaseLogic | @@ -50,7 +50,7 @@ class CustomLogic extends BaseLogic | ||
| 50 | try { | 50 | try { |
| 51 | $id = parent::save($param); | 51 | $id = parent::save($param); |
| 52 | //路由映射 | 52 | //路由映射 |
| 53 | - RouteMap::setRoute($param['url'], RouteMap::SOURCE_PAGE, $id['id'], $this->user['project_id']); | 53 | + RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_PAGE, $id['id'], $this->user['project_id']); |
| 54 | 54 | ||
| 55 | DB::commit(); | 55 | DB::commit(); |
| 56 | }catch (\Exception $e){ | 56 | }catch (\Exception $e){ |
| @@ -88,7 +88,7 @@ class NewsCategoryLogic extends BaseLogic | @@ -88,7 +88,7 @@ class NewsCategoryLogic extends BaseLogic | ||
| 88 | } | 88 | } |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | - RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS_CATE, $cate_id, $this->user['project_id']); | 91 | + RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $cate_id, $this->user['project_id']); |
| 92 | DB::commit(); | 92 | DB::commit(); |
| 93 | }catch (\Exception $e){ | 93 | }catch (\Exception $e){ |
| 94 | DB::rollBack(); | 94 | DB::rollBack(); |
| @@ -115,7 +115,7 @@ class NewsCategoryLogic extends BaseLogic | @@ -115,7 +115,7 @@ class NewsCategoryLogic extends BaseLogic | ||
| 115 | } | 115 | } |
| 116 | $this->param['operator_id'] = $this->user['id']; | 116 | $this->param['operator_id'] = $this->user['id']; |
| 117 | $this->edit($this->param,['id'=>$this->param['id']]); | 117 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 118 | - RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']); | 118 | + RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']); |
| 119 | return $this->success(); | 119 | return $this->success(); |
| 120 | } | 120 | } |
| 121 | 121 |
| @@ -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){ |
-
请 注册 或 登录 后发表评论