Merge remote-tracking branch 'origin/master' into akun
正在显示
19 个修改的文件
包含
292 行增加
和
20 行删除
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | use App\Models\File\Image; | 3 | use App\Models\File\Image; |
| 4 | +use App\Models\RouteMap\RouteMap; | ||
| 4 | use App\Services\CosService; | 5 | use App\Services\CosService; |
| 5 | use App\Utils\EncryptUtils; | 6 | use App\Utils\EncryptUtils; |
| 6 | use App\Utils\LogUtils; | 7 | use App\Utils\LogUtils; |
| @@ -560,3 +561,24 @@ function ends_with($string, $suffix) | @@ -560,3 +561,24 @@ function ends_with($string, $suffix) | ||
| 560 | { | 561 | { |
| 561 | return substr($string, -strlen($suffix)) === $suffix; | 562 | return substr($string, -strlen($suffix)) === $suffix; |
| 562 | } | 563 | } |
| 564 | + | ||
| 565 | +/** | ||
| 566 | + * @remark :获取二级路由 | ||
| 567 | + * @name :getRouteMap | ||
| 568 | + * @author :lyh | ||
| 569 | + * @method :post | ||
| 570 | + * @time :2023/11/10 14:29 | ||
| 571 | + */ | ||
| 572 | +function getRouteMap($source,$source_id){ | ||
| 573 | + $route = ''; | ||
| 574 | + $routeMapModel = new RouteMap(); | ||
| 575 | + $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]); | ||
| 576 | + if($info !== false){ | ||
| 577 | + if(!empty($info['path'])){ | ||
| 578 | + $route = $info['path'].'/'.$info['route']; | ||
| 579 | + }else{ | ||
| 580 | + $route = $info['route']; | ||
| 581 | + } | ||
| 582 | + } | ||
| 583 | + return $route; | ||
| 584 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Aside; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Aside\CollectLogic; | ||
| 6 | + | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 提供给AICC采集 | ||
| 10 | + * Class CollectController | ||
| 11 | + * @package App\Http\Controllers\Aside | ||
| 12 | + * @author zbj | ||
| 13 | + * @date 2023/11/10 | ||
| 14 | + */ | ||
| 15 | +class CollectController extends BaseController | ||
| 16 | +{ | ||
| 17 | + /** | ||
| 18 | + * @author zbj | ||
| 19 | + * @date 2023/11/10 | ||
| 20 | + */ | ||
| 21 | + public function index(CollectLogic $collectLogic) | ||
| 22 | + { | ||
| 23 | + $data = $collectLogic->collect_data(); | ||
| 24 | + return $this->success($data); | ||
| 25 | + } | ||
| 26 | +} |
| @@ -758,6 +758,9 @@ class ProjectController extends BaseController | @@ -758,6 +758,9 @@ class ProjectController extends BaseController | ||
| 758 | * @time :2023/11/8 14:17 | 758 | * @time :2023/11/8 14:17 |
| 759 | */ | 759 | */ |
| 760 | public function copyProject(ProjectLogic $logic){ | 760 | public function copyProject(ProjectLogic $logic){ |
| 761 | + if($this->manage['mobile'] != '15680871314' || $this->manage['mobile'] != '18008059100'){ | ||
| 762 | + $this->response('当前账号不支持复制项目'); | ||
| 763 | + } | ||
| 761 | $this->request->validate([ | 764 | $this->request->validate([ |
| 762 | 'project_id'=>'required', | 765 | 'project_id'=>'required', |
| 763 | ],[ | 766 | ],[ |
| @@ -767,4 +770,21 @@ class ProjectController extends BaseController | @@ -767,4 +770,21 @@ class ProjectController extends BaseController | ||
| 767 | $this->response('success',Code::SUCCESS,$data); | 770 | $this->response('success',Code::SUCCESS,$data); |
| 768 | } | 771 | } |
| 769 | 772 | ||
| 773 | + /** | ||
| 774 | + * AICC采集数据接口token | ||
| 775 | + * @author zbj | ||
| 776 | + * @date 2023/11/10 | ||
| 777 | + */ | ||
| 778 | + public function site_token(Request $request, ProjectLogic $logic){ | ||
| 779 | + $this->request->validate([ | ||
| 780 | + 'project_id'=>'required', | ||
| 781 | + ],[ | ||
| 782 | + 'project_id.required' => 'project_id不能为空', | ||
| 783 | + ]); | ||
| 784 | + | ||
| 785 | + $token = $logic->getSiteToken($this->map); | ||
| 786 | + | ||
| 787 | + $this->response('success',Code::SUCCESS,['site_token' => $token]); | ||
| 788 | + | ||
| 789 | + } | ||
| 770 | } | 790 | } |
| @@ -24,6 +24,9 @@ class ATemplateModuleController extends BaseController | @@ -24,6 +24,9 @@ class ATemplateModuleController extends BaseController | ||
| 24 | * @time :2023/6/28 16:54 | 24 | * @time :2023/6/28 16:54 |
| 25 | */ | 25 | */ |
| 26 | public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ | 26 | public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ |
| 27 | + if(!isset($this->map['test_model'])){ | ||
| 28 | + $this->map['test_model'] = 0; | ||
| 29 | + } | ||
| 27 | $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); | 30 | $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); |
| 28 | $this->response('success',Code::SUCCESS,$lists); | 31 | $this->response('success',Code::SUCCESS,$lists); |
| 29 | } | 32 | } |
| @@ -9,6 +9,7 @@ use App\Http\Controllers\Bside\BaseController; | @@ -9,6 +9,7 @@ use App\Http\Controllers\Bside\BaseController; | ||
| 9 | use App\Http\Logic\Bside\User\UserLogic; | 9 | use App\Http\Logic\Bside\User\UserLogic; |
| 10 | use App\Models\Project\DeployBuild; | 10 | use App\Models\Project\DeployBuild; |
| 11 | use App\Models\Project\Project; | 11 | use App\Models\Project\Project; |
| 12 | +use App\Models\RouteMap\RouteMap; | ||
| 12 | use App\Models\User\ProjectMenu as ProjectMenuModel; | 13 | use App\Models\User\ProjectMenu as ProjectMenuModel; |
| 13 | use App\Models\User\ProjectRole as ProjectRoleModel; | 14 | use App\Models\User\ProjectRole as ProjectRoleModel; |
| 14 | use App\Models\User\User; | 15 | use App\Models\User\User; |
| @@ -207,4 +208,36 @@ class ComController extends BaseController | @@ -207,4 +208,36 @@ class ComController extends BaseController | ||
| 207 | $str = $common->encrypt($data); | 208 | $str = $common->encrypt($data); |
| 208 | $this->response('success',Code::SUCCESS,['str'=>$str]); | 209 | $this->response('success',Code::SUCCESS,['str'=>$str]); |
| 209 | } | 210 | } |
| 211 | + | ||
| 212 | + /** | ||
| 213 | + * @remark :获取访问链接 | ||
| 214 | + * @name :getLink | ||
| 215 | + * @author :lyh | ||
| 216 | + * @method :post | ||
| 217 | + * @time :2023/11/10 15:18 | ||
| 218 | + */ | ||
| 219 | + public function getLink(){ | ||
| 220 | + $this->request->validate([ | ||
| 221 | + 'type' => 'required', | ||
| 222 | + ], [ | ||
| 223 | + 'type.required' => '类型不能为空', | ||
| 224 | + ]); | ||
| 225 | + switch ($this->param['type']){ | ||
| 226 | + case 'news': | ||
| 227 | + $url_link = $this->user['domain'].RouteMap::SOURCE_NEWS.'/'; | ||
| 228 | + break; | ||
| 229 | + case 'news_category': | ||
| 230 | + $url_link = $this->user['domain'].RouteMap::PATH_NEWS_CATE.'/'; | ||
| 231 | + break; | ||
| 232 | + case 'blog': | ||
| 233 | + $url_link = $this->user['domain'].RouteMap::SOURCE_BLOG.'/'; | ||
| 234 | + break; | ||
| 235 | + case 'blog_category': | ||
| 236 | + $url_link = $this->user['domain'].RouteMap::PATH_BLOG_CATE.'/'; | ||
| 237 | + break; | ||
| 238 | + default: | ||
| 239 | + $url_link = $this->user['domain']; | ||
| 240 | + } | ||
| 241 | + $this->response('success',Code::SUCCESS,['url'=>$url_link]); | ||
| 242 | + } | ||
| 210 | } | 243 | } |
| @@ -27,7 +27,7 @@ class BlogCategoryController extends BaseController | @@ -27,7 +27,7 @@ class BlogCategoryController extends BaseController | ||
| 27 | $blogModel = new BlogModel(); | 27 | $blogModel = new BlogModel(); |
| 28 | foreach ($lists as $k => $v){ | 28 | foreach ($lists as $k => $v){ |
| 29 | $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); | 29 | $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); |
| 30 | - $v['url'] = $this->user['domain'] . $v['alias'].'/'; | 30 | + $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']); |
| 31 | $lists[$k] = $v; | 31 | $lists[$k] = $v; |
| 32 | } | 32 | } |
| 33 | if(!isset($this->map['name'])){ | 33 | if(!isset($this->map['name'])){ |
| @@ -81,7 +81,6 @@ class BlogCategoryController extends BaseController | @@ -81,7 +81,6 @@ class BlogCategoryController extends BaseController | ||
| 81 | 'id.required' => 'ID不能为空' | 81 | 'id.required' => 'ID不能为空' |
| 82 | ]); | 82 | ]); |
| 83 | $info = $blogCategoryLogic->info_blog_category(); | 83 | $info = $blogCategoryLogic->info_blog_category(); |
| 84 | - $info['url'] = $this->user['domain'] . $info['alias']; | ||
| 85 | $this->response('success',Code::SUCCESS,$info); | 84 | $this->response('success',Code::SUCCESS,$info); |
| 86 | } | 85 | } |
| 87 | 86 |
| @@ -10,6 +10,7 @@ use App\Models\Blog\Blog as BlogModel; | @@ -10,6 +10,7 @@ use App\Models\Blog\Blog as BlogModel; | ||
| 10 | use App\Models\Blog\BlogCategory; | 10 | use App\Models\Blog\BlogCategory; |
| 11 | use App\Models\Blog\BlogCategory as BlogCategoryModel; | 11 | use App\Models\Blog\BlogCategory as BlogCategoryModel; |
| 12 | use App\Models\Product\Category; | 12 | use App\Models\Product\Category; |
| 13 | +use App\Models\RouteMap\RouteMap; | ||
| 13 | use App\Models\User\User; | 14 | use App\Models\User\User; |
| 14 | 15 | ||
| 15 | class BlogController extends BaseController | 16 | class BlogController extends BaseController |
| @@ -35,7 +36,7 @@ class BlogController extends BaseController | @@ -35,7 +36,7 @@ class BlogController extends BaseController | ||
| 35 | $user = new User(); | 36 | $user = new User(); |
| 36 | foreach ($lists['list'] as $k => $v){ | 37 | foreach ($lists['list'] as $k => $v){ |
| 37 | $v['category_name'] = $this->categoryName($v['category_id'],$data); | 38 | $v['category_name'] = $this->categoryName($v['category_id'],$data); |
| 38 | - $v['url'] = $this->user['domain'] .$v['url'].'/'; | 39 | + $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']); |
| 39 | $v['image_link'] = getImageUrl($v['image']); | 40 | $v['image_link'] = getImageUrl($v['image']); |
| 40 | $v['operator_name'] = $user->getName($v['operator_id']); | 41 | $v['operator_name'] = $user->getName($v['operator_id']); |
| 41 | $lists['list'][$k] = $v; | 42 | $lists['list'][$k] = $v; |
| @@ -27,7 +27,7 @@ class NewsCategoryController extends BaseController | @@ -27,7 +27,7 @@ class NewsCategoryController extends BaseController | ||
| 27 | $newsModel = new NewsModel(); | 27 | $newsModel = new NewsModel(); |
| 28 | foreach ($lists as $k => $v){ | 28 | foreach ($lists as $k => $v){ |
| 29 | $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); | 29 | $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); |
| 30 | - $v['url'] = $this->user['domain'] . $v['alias'].'/'; | 30 | + $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']); |
| 31 | $lists[$k] = $v; | 31 | $lists[$k] = $v; |
| 32 | } | 32 | } |
| 33 | if(!isset($this->map['name'])){ | 33 | if(!isset($this->map['name'])){ |
| @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\News\NewsLogic; | @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\News\NewsLogic; | ||
| 8 | use App\Http\Requests\Bside\News\NewsRequest; | 8 | use App\Http\Requests\Bside\News\NewsRequest; |
| 9 | use App\Models\News\News as NewsModel; | 9 | use App\Models\News\News as NewsModel; |
| 10 | use App\Models\News\NewsCategory; | 10 | use App\Models\News\NewsCategory; |
| 11 | +use App\Models\RouteMap\RouteMap; | ||
| 11 | use App\Models\User\User; | 12 | use App\Models\User\User; |
| 12 | 13 | ||
| 13 | 14 | ||
| @@ -35,7 +36,7 @@ class NewsController extends BaseController | @@ -35,7 +36,7 @@ class NewsController extends BaseController | ||
| 35 | $user = new User(); | 36 | $user = new User(); |
| 36 | foreach ($lists['list'] as $k => $v){ | 37 | foreach ($lists['list'] as $k => $v){ |
| 37 | $v['category_name'] = $this->categoryName($v['category_id'],$data); | 38 | $v['category_name'] = $this->categoryName($v['category_id'],$data); |
| 38 | - $v['url'] = $this->user['domain'] .$v['url'].'/'; | 39 | + $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']); |
| 39 | $v['image_link'] = getImageUrl($v['image']); | 40 | $v['image_link'] = getImageUrl($v['image']); |
| 40 | $v['operator_name'] = $user->getName($v['operator_id']); | 41 | $v['operator_name'] = $user->getName($v['operator_id']); |
| 41 | $lists['list'][$k] = $v; | 42 | $lists['list'][$k] = $v; |
| @@ -44,6 +45,8 @@ class NewsController extends BaseController | @@ -44,6 +45,8 @@ class NewsController extends BaseController | ||
| 44 | $this->response('success',Code::SUCCESS,$lists); | 45 | $this->response('success',Code::SUCCESS,$lists); |
| 45 | } | 46 | } |
| 46 | 47 | ||
| 48 | + | ||
| 49 | + | ||
| 47 | /** | 50 | /** |
| 48 | * @remark :处理列表返回参数 | 51 | * @remark :处理列表返回参数 |
| 49 | * @name :handleReturnParam | 52 | * @name :handleReturnParam |
| @@ -22,6 +22,9 @@ class BTemplateModuleController extends BaseController | @@ -22,6 +22,9 @@ class BTemplateModuleController extends BaseController | ||
| 22 | * @time :2023/6/29 11:33 | 22 | * @time :2023/6/29 11:33 |
| 23 | */ | 23 | */ |
| 24 | public function lists(BTemplateModuleLogic $BTemplateModuleLogic){ | 24 | public function lists(BTemplateModuleLogic $BTemplateModuleLogic){ |
| 25 | + if(!isset($this->map['test_model'])){ | ||
| 26 | + $this->map['test_model'] = 0; | ||
| 27 | + } | ||
| 25 | $list = $BTemplateModuleLogic->ModuleList($this->map,$this->order); | 28 | $list = $BTemplateModuleLogic->ModuleList($this->map,$this->order); |
| 26 | $this->response('success',Code::SUCCESS,$list); | 29 | $this->response('success',Code::SUCCESS,$list); |
| 27 | } | 30 | } |
app/Http/Logic/Aside/CollectLogic.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside; | ||
| 4 | + | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Http\Logic\Logic; | ||
| 7 | +use App\Models\Blog\Blog; | ||
| 8 | +use App\Models\Domain\DomainInfo; | ||
| 9 | +use App\Models\News\News; | ||
| 10 | +use App\Models\Product\Keyword; | ||
| 11 | +use App\Models\Product\Product; | ||
| 12 | +use App\Models\Project\Project; | ||
| 13 | +use App\Services\ProjectServer; | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * Class CollectLogic | ||
| 18 | + * @package App\Http\Logic\Aside | ||
| 19 | + * @author zbj | ||
| 20 | + * @date 2023/11/10 | ||
| 21 | + */ | ||
| 22 | +class CollectLogic extends Logic | ||
| 23 | +{ | ||
| 24 | + protected $project; | ||
| 25 | + protected $domain; | ||
| 26 | + protected $type; | ||
| 27 | + protected $page_size = 100; | ||
| 28 | + | ||
| 29 | + public function __construct() | ||
| 30 | + { | ||
| 31 | + $this->checkAuth(); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 校验权限 | ||
| 36 | + * @throws \App\Exceptions\AsideGlobalException | ||
| 37 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 38 | + * @author zbj | ||
| 39 | + * @date 2023/11/10 | ||
| 40 | + */ | ||
| 41 | + public function checkAuth() | ||
| 42 | + { | ||
| 43 | + $request = request(); | ||
| 44 | + $site_token = $request->header('site-token'); | ||
| 45 | + $domain = $request->input('domain'); | ||
| 46 | + if (!$site_token) { | ||
| 47 | + $this->fail('参数异常'); | ||
| 48 | + } | ||
| 49 | + $this->project = Project::where('site_token', $site_token)->first(); | ||
| 50 | + if (!$this->project) { | ||
| 51 | + $this->fail('授权码无效'); | ||
| 52 | + } | ||
| 53 | + $domain_info = DomainInfo::where('project_id', $this->project->id)->where('domain', $domain)->first(); | ||
| 54 | + if (!$domain_info) { | ||
| 55 | + $this->fail('域名不匹配'); | ||
| 56 | + } | ||
| 57 | + $this->domain = 'https://' . $domain_info['domain'] . '/'; | ||
| 58 | + $this->type = $request->input('type', ''); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public function collect_data() | ||
| 62 | + { | ||
| 63 | + ProjectServer::useProject($this->project->id); | ||
| 64 | + $action = $this->type; | ||
| 65 | + return $this->$action(); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public function __call($name, $param) | ||
| 69 | + { | ||
| 70 | + return []; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + | ||
| 74 | + public function product() | ||
| 75 | + { | ||
| 76 | + $this->model = new Product(); | ||
| 77 | + $where[] = ['status' => Product::STATUS_ON]; | ||
| 78 | + $sort = ['sort' => 'desc']; | ||
| 79 | + $columns = ['title', 'content', 'gallery', 'seo_mate', 'intro', 'route', 'keyword_id']; | ||
| 80 | + $list = self::getList($where,$sort, $columns, $this->page_size); | ||
| 81 | + $data =[]; | ||
| 82 | + foreach ($list['list'] as $item){ | ||
| 83 | + //关键词标签 没有就取seo 键词 | ||
| 84 | + if($item['keyword_id']){ | ||
| 85 | + $keyword = Keyword::whereIn('id', $item['keyword_id'])->pluck('title')->toArray(); | ||
| 86 | + if($keyword){ | ||
| 87 | + $keyword = implode(',', $keyword); | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + $keyword = $keyword ?: ($item['seo_mate']['keyword'] ?? ''); | ||
| 91 | + $data[] = [ | ||
| 92 | + 'title' => $item['title'], | ||
| 93 | + 'url' => $this->domain . $item['route'], | ||
| 94 | + 'keywords' => $keyword, | ||
| 95 | + 'description' => strip_tags($item['intro']?:''), | ||
| 96 | + 'content' => strip_tags($item['content'] ?: ''), | ||
| 97 | + 'img' => array_column($item['gallery'] ?: [], 'url') | ||
| 98 | + ]; | ||
| 99 | + } | ||
| 100 | + $list['list'] = $data; | ||
| 101 | + return $list; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public function news() | ||
| 105 | + { | ||
| 106 | + $this->model = new News(); | ||
| 107 | + $where[] = ['status' => News::STATUS_ONE]; | ||
| 108 | + $sort = ['sort' => 'desc']; | ||
| 109 | + $columns = ['name', 'text', 'image', 'seo_keywords', 'remark', 'url']; | ||
| 110 | + $list = self::getList($where,$sort, $columns, $this->page_size); | ||
| 111 | + $data =[]; | ||
| 112 | + foreach ($list['list'] as $item){ | ||
| 113 | + $data[] = [ | ||
| 114 | + 'title' => $item['name'], | ||
| 115 | + 'url' => $this->domain . $item['url'], | ||
| 116 | + 'keywords' => $item['seo_keywords'], | ||
| 117 | + 'description' => strip_tags($item['remark']?:''), | ||
| 118 | + 'content' => strip_tags($item['text'] ?: ''), | ||
| 119 | + 'img' => $item['image'] ?:'' | ||
| 120 | + ]; | ||
| 121 | + } | ||
| 122 | + $list['list'] = $data; | ||
| 123 | + return $list; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + public function blog() | ||
| 127 | + { | ||
| 128 | + $this->model = new Blog(); | ||
| 129 | + $where[] = ['status' => Blog::STATUS_ONE]; | ||
| 130 | + $sort = ['sort' => 'desc']; | ||
| 131 | + $columns = ['name', 'text', 'image', 'seo_keywords', 'remark', 'url']; | ||
| 132 | + $list = self::getList($where,$sort, $columns, $this->page_size); | ||
| 133 | + $data =[]; | ||
| 134 | + foreach ($list['list'] as $item){ | ||
| 135 | + $data[] = [ | ||
| 136 | + 'title' => $item['name'], | ||
| 137 | + 'url' => $this->domain . $item['url'], | ||
| 138 | + 'keywords' => $item['seo_keywords'], | ||
| 139 | + 'description' => strip_tags($item['remark']?:''), | ||
| 140 | + 'content' => strip_tags($item['text'] ?: ''), | ||
| 141 | + 'img' => $item['image'] ?:'' | ||
| 142 | + ]; | ||
| 143 | + } | ||
| 144 | + $list['list'] = $data; | ||
| 145 | + return $list; | ||
| 146 | + } | ||
| 147 | +} |
| @@ -214,15 +214,15 @@ class DomainInfoLogic extends BaseLogic | @@ -214,15 +214,15 @@ class DomainInfoLogic extends BaseLogic | ||
| 214 | } | 214 | } |
| 215 | //保存301跳转数据+其他域名 | 215 | //保存301跳转数据+其他域名 |
| 216 | $data = [ | 216 | $data = [ |
| 217 | - 'other_domain'=>json_encode($this->param['other_domain']), | ||
| 218 | - 'extend_config'=>json_encode($this->param['extend_config']), | 217 | + 'other_domain'=>json_encode($this->param['other_domain'] ?? []), |
| 218 | + 'extend_config'=>json_encode($this->param['extend_config'] ?? []), | ||
| 219 | 'type'=>$this->param['type'], | 219 | 'type'=>$this->param['type'], |
| 220 | 'private_key' => $this->param['key'] ?? '', | 220 | 'private_key' => $this->param['key'] ?? '', |
| 221 | 'private_cert' => $this->param['cert'] ?? '', | 221 | 'private_cert' => $this->param['cert'] ?? '', |
| 222 | ]; | 222 | ]; |
| 223 | $this->model->edit($data,['id'=>$this->param['id']]); | 223 | $this->model->edit($data,['id'=>$this->param['id']]); |
| 224 | //生成证书 | 224 | //生成证书 |
| 225 | - $this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'],$this->param['other_domain']); | 225 | + $this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? []); |
| 226 | return $this->success(); | 226 | return $this->success(); |
| 227 | } | 227 | } |
| 228 | 228 |
| @@ -35,6 +35,7 @@ use App\Models\User\User as UserModel; | @@ -35,6 +35,7 @@ use App\Models\User\User as UserModel; | ||
| 35 | use Illuminate\Support\Facades\DB; | 35 | use Illuminate\Support\Facades\DB; |
| 36 | use Illuminate\Support\Facades\Log; | 36 | use Illuminate\Support\Facades\Log; |
| 37 | use Illuminate\Support\Facades\Schema; | 37 | use Illuminate\Support\Facades\Schema; |
| 38 | +use Illuminate\Support\Str; | ||
| 38 | 39 | ||
| 39 | /** | 40 | /** |
| 40 | * Class ProjectLogic | 41 | * Class ProjectLogic |
| @@ -74,6 +75,9 @@ class ProjectLogic extends BaseLogic | @@ -74,6 +75,9 @@ class ProjectLogic extends BaseLogic | ||
| 74 | if(empty($info['channel'])){ | 75 | if(empty($info['channel'])){ |
| 75 | $info['channel'] = ["user_id"=>"", "zone_id"=>"", "channel_id"=>""]; | 76 | $info['channel'] = ["user_id"=>"", "zone_id"=>"", "channel_id"=>""]; |
| 76 | } | 77 | } |
| 78 | + if(empty($info['payment']['renewal_record'])){ | ||
| 79 | + $info['payment']['renewal_record'] = [["amount"=> null, "remark"=> null, "expire_at"=> null]]; | ||
| 80 | + } | ||
| 77 | return $this->success($info); | 81 | return $this->success($info); |
| 78 | } | 82 | } |
| 79 | 83 | ||
| @@ -647,6 +651,7 @@ class ProjectLogic extends BaseLogic | @@ -647,6 +651,7 @@ class ProjectLogic extends BaseLogic | ||
| 647 | $query->select('*')->from("{$name}"); | 651 | $query->select('*')->from("{$name}"); |
| 648 | } | 652 | } |
| 649 | ); | 653 | ); |
| 654 | + | ||
| 650 | if (Schema::connection('custom_mysql')->hasColumn($table, 'project_id')) { | 655 | if (Schema::connection('custom_mysql')->hasColumn($table, 'project_id')) { |
| 651 | DB::connection('custom_mysql')->table($table)->update(['project_id' => $news_project_id]); | 656 | DB::connection('custom_mysql')->table($table)->update(['project_id' => $news_project_id]); |
| 652 | } | 657 | } |
| @@ -654,4 +659,21 @@ class ProjectLogic extends BaseLogic | @@ -654,4 +659,21 @@ class ProjectLogic extends BaseLogic | ||
| 654 | return true; | 659 | return true; |
| 655 | } | 660 | } |
| 656 | 661 | ||
| 662 | + /** | ||
| 663 | + * 对外接口token | ||
| 664 | + * @param $data | ||
| 665 | + * @return string | ||
| 666 | + * @author zbj | ||
| 667 | + * @date 2023/11/10 | ||
| 668 | + */ | ||
| 669 | + public function getSiteToken($data){ | ||
| 670 | + $project = $this->getCacheInfo($data['project_id']); | ||
| 671 | + if(empty($project['site_token']) || !empty($data['refresh'])){ | ||
| 672 | + $token = strtolower(base64_encode("6.0") . md5('project_' . $data['project_id'] . '_' . time())); | ||
| 673 | + $project->site_token = $token; | ||
| 674 | + $project->save(); | ||
| 675 | + } | ||
| 676 | + return $project->site_token; | ||
| 677 | + } | ||
| 678 | + | ||
| 657 | } | 679 | } |
| @@ -29,15 +29,11 @@ class UserLogic extends BaseLogic | @@ -29,15 +29,11 @@ class UserLogic extends BaseLogic | ||
| 29 | */ | 29 | */ |
| 30 | public function user_info() | 30 | public function user_info() |
| 31 | { | 31 | { |
| 32 | - $info = Common::get_user_cache($this->model, $this->param['id'], 'A'); | ||
| 33 | - if (empty($info)) { | ||
| 34 | $info = $this->model->read($this->param, ['id', 'project_id', 'name', 'status', 'role_id' ,'mobile', 'operator_id']); | 32 | $info = $this->model->read($this->param, ['id', 'project_id', 'name', 'status', 'role_id' ,'mobile', 'operator_id']); |
| 35 | if ($info === false) { | 33 | if ($info === false) { |
| 36 | $this->fail('当前数据不存在'); | 34 | $this->fail('当前数据不存在'); |
| 37 | } | 35 | } |
| 38 | $info['project_name'] = (new Project())->read(['id' => $info['project_id']], ['title'])['title']; | 36 | $info['project_name'] = (new Project())->read(['id' => $info['project_id']], ['title'])['title']; |
| 39 | - Common::set_user_cache($info, $this->model, $this->param['id'], 'A'); | ||
| 40 | - } | ||
| 41 | return $this->success($info); | 37 | return $this->success($info); |
| 42 | } | 38 | } |
| 43 | 39 |
| @@ -181,10 +181,6 @@ class CustomTemplateLogic extends BaseLogic | @@ -181,10 +181,6 @@ class CustomTemplateLogic extends BaseLogic | ||
| 181 | 'route'=>$info['url'], | 181 | 'route'=>$info['url'], |
| 182 | ]; | 182 | ]; |
| 183 | $this->setRouteDeleteSave($data); | 183 | $this->setRouteDeleteSave($data); |
| 184 | - //"字符串以\"-product\"结尾" | ||
| 185 | - if (!ends_with($route, "-tag")) { | ||
| 186 | - $route = $route."-tag"; | ||
| 187 | - } | ||
| 188 | } | 184 | } |
| 189 | return $route; | 185 | return $route; |
| 190 | } | 186 | } |
| @@ -59,6 +59,7 @@ class KeywordLogic extends BaseLogic | @@ -59,6 +59,7 @@ class KeywordLogic extends BaseLogic | ||
| 59 | }else{ | 59 | }else{ |
| 60 | $this->param['project_id'] = $this->user['project_id']; | 60 | $this->param['project_id'] = $this->user['project_id']; |
| 61 | $this->param['created_at'] = date('Y-m-d H:i:s'); | 61 | $this->param['created_at'] = date('Y-m-d H:i:s'); |
| 62 | + $this->param['title'] = $this->param['title'].'-tag'; | ||
| 62 | $this->param['updated_at'] = $this->param['created_at']; | 63 | $this->param['updated_at'] = $this->param['created_at']; |
| 63 | $id = $this->model->insertGetId($this->param); | 64 | $id = $this->model->insertGetId($this->param); |
| 64 | //路由映射 | 65 | //路由映射 |
| @@ -215,10 +215,6 @@ class ProductLogic extends BaseLogic | @@ -215,10 +215,6 @@ class ProductLogic extends BaseLogic | ||
| 215 | 'route'=>$route, | 215 | 'route'=>$route, |
| 216 | ]; | 216 | ]; |
| 217 | $this->setRouteDeleteSave($data); | 217 | $this->setRouteDeleteSave($data); |
| 218 | - //"字符串以\"-product\"结尾" | ||
| 219 | - if (!ends_with($route, "-product")) { | ||
| 220 | - $route = $route."-product"; | ||
| 221 | - } | ||
| 222 | } | 218 | } |
| 223 | return $route; | 219 | return $route; |
| 224 | } | 220 | } |
| @@ -170,6 +170,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -170,6 +170,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 170 | Route::any('/getRenewLog', [Aside\Project\ProjectController::class, 'getRenewLog'])->name('admin.project_getRenewLog'); | 170 | Route::any('/getRenewLog', [Aside\Project\ProjectController::class, 'getRenewLog'])->name('admin.project_getRenewLog'); |
| 171 | Route::any('/tdkList', [Aside\Project\ProjectController::class, 'tdkList'])->name('admin.project_tdkList'); | 171 | Route::any('/tdkList', [Aside\Project\ProjectController::class, 'tdkList'])->name('admin.project_tdkList'); |
| 172 | Route::any('/copyProject', [Aside\Project\ProjectController::class, 'copyProject'])->name('admin.project_copyProject'); | 172 | Route::any('/copyProject', [Aside\Project\ProjectController::class, 'copyProject'])->name('admin.project_copyProject'); |
| 173 | + Route::any('/site_token', [Aside\Project\ProjectController::class, 'site_token'])->name('admin.project_site_token'); | ||
| 173 | //获取关键词前缀和后缀 | 174 | //获取关键词前缀和后缀 |
| 174 | Route::prefix('keyword')->group(function () { | 175 | Route::prefix('keyword')->group(function () { |
| 175 | Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); | 176 | Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); |
| @@ -339,6 +340,8 @@ Route::group([], function () { | @@ -339,6 +340,8 @@ Route::group([], function () { | ||
| 339 | // 提供模板 提单后台查看 | 340 | // 提供模板 提单后台查看 |
| 340 | Route::any('get_template_list', [Aside\Template\ATemplateController::class, 'getTemplateList'])->name('admin.get_template_list'); | 341 | Route::any('get_template_list', [Aside\Template\ATemplateController::class, 'getTemplateList'])->name('admin.get_template_list'); |
| 341 | Route::any('get_template_detail', [Aside\Template\ATemplateController::class, 'getTemplateDetail'])->name('admin.get_template_detail'); | 342 | Route::any('get_template_detail', [Aside\Template\ATemplateController::class, 'getTemplateDetail'])->name('admin.get_template_detail'); |
| 343 | + | ||
| 344 | + Route::any('/collect', [Aside\CollectController::class, 'index'])->name('admin.collect'); | ||
| 342 | }); | 345 | }); |
| 343 | 346 | ||
| 344 | 347 |
| @@ -16,6 +16,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -16,6 +16,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 16 | //获取当前登录用户项目详情 | 16 | //获取当前登录用户项目详情 |
| 17 | Route::any('/get_project', [\App\Http\Controllers\Bside\BCom\ComController::class, 'get_project'])->name('get_project'); | 17 | Route::any('/get_project', [\App\Http\Controllers\Bside\BCom\ComController::class, 'get_project'])->name('get_project'); |
| 18 | Route::any('/generateToken', [\App\Http\Controllers\Bside\BCom\ComController::class, 'generateToken'])->name('generateToken'); | 18 | Route::any('/generateToken', [\App\Http\Controllers\Bside\BCom\ComController::class, 'generateToken'])->name('generateToken'); |
| 19 | + Route::any('/getLink', [\App\Http\Controllers\Bside\BCom\ComController::class, 'getLink'])->name('getLink'); | ||
| 19 | //用户相关路由 | 20 | //用户相关路由 |
| 20 | Route::prefix('user')->group(function () { | 21 | Route::prefix('user')->group(function () { |
| 21 | Route::any('/', [\App\Http\Controllers\Bside\User\UserController::class, 'lists'])->name('user_lists'); | 22 | Route::any('/', [\App\Http\Controllers\Bside\User\UserController::class, 'lists'])->name('user_lists'); |
-
请 注册 或 登录 后发表评论