作者 张关杰

Merge remote-tracking branch 'origin/develop' into zgj

正在显示 38 个修改的文件 包含 1396 行增加844 行删除
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\Domain;
  4 +
  5 +use App\Exceptions\AsideGlobalException;
  6 +use App\Exceptions\BsideGlobalException;
  7 +use App\Helper\AyrShare as AyrShareHelper;
  8 +use App\Http\Logic\Aside\Domain\DomainInfoLogic;
  9 +use App\Models\AyrShare\AyrRelease as AyrReleaseModel;
  10 +use Carbon\Carbon;
  11 +use App\Models\AyrShare\AyrShare as AyrShareModel;
  12 +use Illuminate\Console\Command;
  13 +
  14 +class DomainTime extends Command
  15 +{
  16 + public $error = 0;
  17 + /**
  18 + * The name and signature of the console command.
  19 + *
  20 + * @var string
  21 + */
  22 + protected $signature = 'domain_time';
  23 +
  24 + /**
  25 + * The console command description.
  26 + *
  27 + * @var string
  28 + */
  29 + protected $description = '域名定时任务 更新域名|证书到期时间';
  30 +
  31 + /**
  32 + * @name :(定时执行)handle
  33 + * @author :lyh
  34 + * @method :post
  35 + * @time :2023/5/12 14:48
  36 + */
  37 + public function handle()
  38 + {
  39 + echo $this->update_domain_time();
  40 + }
  41 +
  42 + /**
  43 + * 更新域名|证书到期时间
  44 + * @return int|mixed|void
  45 + * @throws AsideGlobalException
  46 + * @throws BsideGlobalException
  47 + */
  48 + protected function update_domain_time()
  49 + {
  50 + $domainCon = new DomainInfoLogic();
  51 + $all = $domainCon->getAllDomain();
  52 + $all = $all->toArray();
  53 + if ( empty( $all ) ) {
  54 + $this->info( '未获取到数据' );
  55 + return;
  56 + }
  57 + foreach ( $all as $item ) {
  58 + $domain = $item['domain'];
  59 + // 域名到期时间
  60 + $domainT = $domainCon->getDomainTime( $domain );
  61 + if ( $domainT ) {
  62 + $domain_time = $item['domain_end_time'];
  63 + $domainValidFrom = $domainT['validFrom'];
  64 + $domainValidTo = $domainT['validTo'];
  65 + if ( strtotime( $domain_time ) < strtotime( $domainValidTo ) ) {
  66 + $this->info( $domain . '域名到期时间更新成功' );
  67 + $domainCon->updateDomain( $item['id'], [ 'domain_end_time' => $domainValidTo ] );
  68 + }
  69 + } else {
  70 + $this->error++;
  71 + $this->info( $domain . '域名到期时间获取失败' );
  72 + }
  73 + // 证书到期时间
  74 + $certificateT = $domainCon->getDomainCertificateTime( $domain );
  75 + if ( $certificateT ) {
  76 + $certificate_time = $item['certificate_end_time'];
  77 + $certificateValidFrom = $certificateT['validFrom'];
  78 + $certificateValidTo = $certificateT['validTo'];
  79 + if ( strtotime( $certificate_time ) < strtotime( $certificateValidTo ) ) {
  80 + $this->info( $domain . '证书到期时间更新成功' );
  81 + $domainCon->updateDomain( $item['id'], [ 'certificate_end_time' => $certificateValidTo ] );
  82 + }
  83 + } else {
  84 + $this->error++;
  85 + $this->info( $domain . '证书到期时间获取失败' );
  86 + }
  87 + }
  88 + return $this->error;
  89 + }
  90 +}
@@ -27,6 +27,7 @@ class Kernel extends ConsoleKernel @@ -27,6 +27,7 @@ class Kernel extends ConsoleKernel
27 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 27 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
28 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 28 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
29 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 29 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
  30 +// $schedule->command('domain_time')->dailyAt('01:00')->withoutOverlapping(1); // 更新域名|证书结束时间,每天凌晨1点执行一次
30 } 31 }
31 32
32 /** 33 /**
@@ -22,9 +22,25 @@ class ServerInformationController extends BaseController @@ -22,9 +22,25 @@ class ServerInformationController extends BaseController
22 */ 22 */
23 public function lists($deleted = ServerInformation::DELETED_NORMAL) 23 public function lists($deleted = ServerInformation::DELETED_NORMAL)
24 { 24 {
  25 + $request = $this->param;
  26 + $search = [];
  27 + $search_array = [
  28 + 'ip' => 'ip',
  29 + 'title' => 'title'
  30 + ];
  31 + foreach ($search_array as $key => $item) {
  32 + if (isset($request[$key]) && $request[$key]) {
  33 + $search[$item] = $request[$key];
  34 + }
  35 + }
25 $size = request()->input('size', $this->row); 36 $size = request()->input('size', $this->row);
26 - $data = ServerInformation::query()->select(['id', 'title', 'ip'])  
27 - ->where('deleted', $deleted) 37 + $query = ServerInformation::query()->select(['id', 'title', 'ip']);
  38 + if ($search) {
  39 + foreach ($search as $key => $item) {
  40 + $query = $query->Where("{$key}", 'like', "%{$item}%");
  41 + }
  42 + }
  43 + $data = $query->where('deleted', $deleted)
28 ->orderBy('id', 'desc') 44 ->orderBy('id', 'desc')
29 ->paginate($size); 45 ->paginate($size);
30 return $this->response('success', Code::SUCCESS, $data); 46 return $this->response('success', Code::SUCCESS, $data);
@@ -58,9 +74,10 @@ class ServerInformationController extends BaseController @@ -58,9 +74,10 @@ class ServerInformationController extends BaseController
58 public function edit(ServerInformationRequest $serverInformationRequest, ServerInformationLogic $serverInformationLogic) 74 public function edit(ServerInformationRequest $serverInformationRequest, ServerInformationLogic $serverInformationLogic)
59 { 75 {
60 $serverInformationRequest->validate([ 76 $serverInformationRequest->validate([
61 - 'id' => ['required'], 77 + 'id' => 'required|integer',
62 ], [ 78 ], [
63 'id.required' => 'ID不能为空', 79 'id.required' => 'ID不能为空',
  80 + 'id.integer' => 'ID必须为整数',
64 ]); 81 ]);
65 $serverInformationLogic->update(); 82 $serverInformationLogic->update();
66 $this->response('服务器修改成功!'); 83 $this->response('服务器修改成功!');
@@ -110,7 +127,7 @@ class ServerInformationController extends BaseController @@ -110,7 +127,7 @@ class ServerInformationController extends BaseController
110 public function search(Request $request) 127 public function search(Request $request)
111 { 128 {
112 $search = []; 129 $search = [];
113 - $ip = $request->input('ip'); 130 + $ip = $request->input('ip');
114 if ($ip) { 131 if ($ip) {
115 $search['ip'] = $ip; 132 $search['ip'] = $ip;
116 } 133 }
@@ -125,7 +142,7 @@ class ServerInformationController extends BaseController @@ -125,7 +142,7 @@ class ServerInformationController extends BaseController
125 foreach ($search as $key => $item) { 142 foreach ($search as $key => $item) {
126 $query = $query->Where("{$key}", 'like', "%{$item}%"); 143 $query = $query->Where("{$key}", 'like', "%{$item}%");
127 } 144 }
128 - $size = $request->input('size', $this->row); 145 + $size = $request->input('size', $this->row);
129 $query = $query->orderBy('id', 'desc')->paginate($size); 146 $query = $query->orderBy('id', 'desc')->paginate($size);
130 return $this->response('success', Code::SUCCESS, $query); 147 return $this->response('success', Code::SUCCESS, $query);
131 } 148 }
@@ -142,7 +159,7 @@ class ServerInformationController extends BaseController @@ -142,7 +159,7 @@ class ServerInformationController extends BaseController
142 public function getServerInfo(int $deleted = ServerInformation::DELETED_NORMAL) 159 public function getServerInfo(int $deleted = ServerInformation::DELETED_NORMAL)
143 { 160 {
144 $serverInformationLogic = new ServerInformationLogic(); 161 $serverInformationLogic = new ServerInformationLogic();
145 - $data = $serverInformationLogic->serverInfo($deleted); 162 + $data = $serverInformationLogic->serverInfo($deleted);
146 if (!$data) { 163 if (!$data) {
147 return $this->response('服务器信息不存在', Code::USER_ERROR); 164 return $this->response('服务器信息不存在', Code::USER_ERROR);
148 } 165 }
@@ -150,6 +167,7 @@ class ServerInformationController extends BaseController @@ -150,6 +167,7 @@ class ServerInformationController extends BaseController
150 } 167 }
151 168
152 /** 169 /**
  170 + * 获取软删除的服务器信息
153 * @return JsonResponse 171 * @return JsonResponse
154 * @throws AsideGlobalException 172 * @throws AsideGlobalException
155 * @throws BsideGlobalException 173 * @throws BsideGlobalException
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Aside\Domain;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Exceptions\AsideGlobalException;
  7 +use App\Exceptions\BsideGlobalException;
  8 +use App\Http\Controllers\Aside\BaseController;
  9 +use App\Http\Logic\Aside\Domain\DomainInfoLogic;
  10 +use App\Http\Requests\Aside\Domain\DomainInfoRequest;
  11 +use App\Models\Aside\Domain\DomainInfo;
  12 +use App\Models\Aside\Domain\DomainInfoLog;
  13 +use Illuminate\Http\JsonResponse;
  14 +use Psr\Container\ContainerExceptionInterface;
  15 +use Psr\Container\NotFoundExceptionInterface;
  16 +
  17 +/**
  18 + * Class DomainInfoController
  19 + * @package App\Http\Controllers\Aside 域名管理
  20 + */
  21 +class DomainInfoController extends BaseController
  22 +{
  23 + /**
  24 + * 域名列表
  25 + * @param int $deleted
  26 + * @return JsonResponse
  27 + */
  28 + public function lists(int $deleted = DomainInfo::DELETED_NORMAL)
  29 + {
  30 + $request = $this->param;
  31 + $search = [];
  32 + $search_array = [
  33 + 'domain' => 'domain',
  34 + 'belong' => 'belong_to',
  35 + 'domain_time' => 'domain_end_time',
  36 + 'certificate_time' => 'certificate_end_time'
  37 + ];
  38 + foreach ($search_array as $key => $item) {
  39 + if (isset($request[$key]) && $request[$key]) {
  40 + $search[$item] = $request[$key];
  41 + }
  42 + }
  43 + // 每页条数
  44 + $size = request()->input('size', $this->row);
  45 + $query = DomainInfo::query()->select(['id', 'domain', 'belong_to']);
  46 + if ($search) {
  47 + foreach ($search as $key => $item) {
  48 + $query = $query->Where("{$key}", 'like', "%{$item}%");
  49 + }
  50 + }
  51 + $data = $query->where('deleted', $deleted)
  52 + ->orderBy('id', 'desc')
  53 + ->paginate($size);
  54 + return $this->response('success', Code::SUCCESS, $data);
  55 + }
  56 +
  57 + /**
  58 + * 获取软删除的数据
  59 + * @return JsonResponse
  60 + */
  61 + public function delete_list()
  62 + {
  63 + return $this->lists(DomainInfo::DELETED_DELETE);
  64 + }
  65 +
  66 + /**
  67 + * 添加域名
  68 + * @param DomainInfoRequest $domainInfoRequest
  69 + * @param DomainInfoLogic $domainInfoLogic
  70 + * @return void
  71 + * @throws AsideGlobalException
  72 + * @throws BsideGlobalException
  73 + */
  74 + public function add(DomainInfoRequest $domainInfoRequest, DomainInfoLogic $domainInfoLogic)
  75 + {
  76 + $domainInfoRequest->validated();
  77 + $domainInfoLogic->create();
  78 + $this->response('域名添加成功!');
  79 + }
  80 +
  81 + /**
  82 + * 编辑域名
  83 + * @param DomainInfoRequest $domainInfoRequest
  84 + * @param DomainInfoLogic $domainInfoLogic
  85 + * @return void
  86 + * @throws AsideGlobalException
  87 + * @throws BsideGlobalException
  88 + */
  89 + public function edit(DomainInfoRequest $domainInfoRequest, DomainInfoLogic $domainInfoLogic)
  90 + {
  91 + $domainInfoRequest->validate([
  92 + 'id' => 'required|integer'
  93 + ], [
  94 + 'id.required' => 'id不能为空',
  95 + 'id.integer' => 'id参数错误'
  96 + ]);
  97 + $domainInfoLogic->update();
  98 + $this->response('域名修改成功!');
  99 + }
  100 +
  101 + /**
  102 + * 删除
  103 + * @param DomainInfoLogic $domainInfoLogic
  104 + * @return void
  105 + * @throws AsideGlobalException
  106 + * @throws BsideGlobalException
  107 + */
  108 + public function delete(DomainInfoLogic $domainInfoLogic)
  109 + {
  110 + $domainInfoLogic->get_batch_update();
  111 + $this->response('域名删除成功!');
  112 + }
  113 +
  114 + /**
  115 + * 恢复数据
  116 + * @param DomainInfoLogic $domainInfoLogic
  117 + * @return void
  118 + * @throws AsideGlobalException
  119 + * @throws BsideGlobalException
  120 + */
  121 + public function restore(DomainInfoLogic $domainInfoLogic)
  122 + {
  123 + $domainInfoLogic->get_batch_update(DomainInfoLog::ACTION_RECOVER, DomainInfo::DELETED_DELETE);
  124 + $this->response('域名恢复成功!');
  125 + }
  126 +
  127 + /**
  128 + * 域名信息
  129 + * @param int $deleted
  130 + * @return JsonResponse
  131 + * @throws AsideGlobalException
  132 + * @throws BsideGlobalException
  133 + * @throws ContainerExceptionInterface
  134 + * @throws NotFoundExceptionInterface
  135 + */
  136 + public function info(int $deleted = DomainInfo::DELETED_NORMAL)
  137 + {
  138 + $domainInfoLogic = new DomainInfoLogic();
  139 + $data = $domainInfoLogic->domainInfo($deleted);
  140 + if (!$data) {
  141 + return $this->response('域名信息不存在', Code::USER_ERROR);
  142 + }
  143 + return $this->success($data->toArray());
  144 + }
  145 +
  146 + /**
  147 + * 获取软删除域名信息
  148 + * @return JsonResponse
  149 + * @throws AsideGlobalException
  150 + * @throws BsideGlobalException
  151 + * @throws ContainerExceptionInterface
  152 + * @throws NotFoundExceptionInterface
  153 + */
  154 + public function getDeleteDomainInfo()
  155 + {
  156 + return $this->info(DomainInfo::DELETED_DELETE);
  157 + }
  158 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Aside\Domain;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Http\Controllers\Aside\BaseController;
  7 +use App\Models\Aside\Domain\DomainInfoLog;
  8 +use Illuminate\Http\Request;
  9 +
  10 +class DomainInfoLogController extends BaseController
  11 +{
  12 + public function lists(Request $request)
  13 + {
  14 + $size = $request->input('size', $this->row);
  15 + $data = DomainInfoLog::query()
  16 + ->orderBy('id', 'desc')
  17 + ->paginate($size);
  18 + return $this->response('success', Code::SUCCESS, $data);
  19 +
  20 + }
  21 +}
1 -<?php  
2 -  
3 -namespace App\Http\Controllers\Aside\Template;  
4 -  
5 -use App\Http\Controllers\Aside\BaseController;  
6 -  
7 -/**  
8 - * 模板header footer  
9 - * @author:dc  
10 - * @time 2023/4/26 11:10  
11 - * Class HeaderFooterController  
12 - * @package App\Http\Controllers\Aside\Template  
13 - */  
14 -class HeaderFooterController extends BaseController  
15 -{  
16 -  
17 -}  
@@ -3,9 +3,12 @@ @@ -3,9 +3,12 @@
3 namespace App\Http\Controllers\Aside; 3 namespace App\Http\Controllers\Aside;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
  6 +use App\Http\Logic\Aside\Template\TemplateChunkLogic;
6 use App\Http\Logic\Aside\Template\TemplateLogic; 7 use App\Http\Logic\Aside\Template\TemplateLogic;
  8 +use App\Http\Requests\Aside\Template\TemplateChunkRequest;
7 use App\Http\Requests\Aside\Template\TemplateRequest; 9 use App\Http\Requests\Aside\Template\TemplateRequest;
8 use App\Models\Template\ATemplate; 10 use App\Models\Template\ATemplate;
  11 +use App\Models\Template\ATemplateChunk;
9 use App\Models\Template\ATemplateHtml; 12 use App\Models\Template\ATemplateHtml;
10 use Illuminate\Validation\Rule; 13 use Illuminate\Validation\Rule;
11 14
@@ -195,4 +198,48 @@ class TemplateController extends BaseController @@ -195,4 +198,48 @@ class TemplateController extends BaseController
195 198
196 199
197 200
  201 +
  202 +
  203 + /**
  204 + * 自定义界面,块
  205 + * @author:dc
  206 + * @time 2023/5/29 10:27
  207 + */
  208 + public function chunk_lists(){
  209 + $lists = TemplateChunkLogic::instance()->getList()->toArray();
  210 + return $this->success($lists);
  211 + }
  212 +
  213 +
  214 + /**
  215 + * 自定义界面,块 保存
  216 + * @author:dc
  217 + * @time 2023/5/29 10:37
  218 + */
  219 + public function chunk_save(TemplateChunkRequest $request){
  220 + $data = TemplateChunkLogic::instance()->save($request->validated());
  221 + return $this->success(TemplateChunkLogic::instance()->getInfo($data['id']));
  222 + }
  223 +
  224 +
  225 + /**
  226 + * 自定义界面,块 删除
  227 + * @author:dc
  228 + * @time 2023/5/29 10:38
  229 + */
  230 + public function chunk_delete($chunk_id){
  231 +
  232 + TemplateChunkLogic::instance()->delete($chunk_id);
  233 +
  234 + return $this->response('删除成功');
  235 +
  236 + }
  237 +
  238 +
  239 +
  240 +
  241 +
  242 +
  243 +
  244 +
198 } 245 }
@@ -39,4 +39,31 @@ class FileController extends BaseController @@ -39,4 +39,31 @@ class FileController extends BaseController
39 $path = Upload::url2path($this->param['url'] ?? ''); 39 $path = Upload::url2path($this->param['url'] ?? '');
40 return Storage::disk('upload')->download($path); 40 return Storage::disk('upload')->download($path);
41 } 41 }
  42 +
  43 +
  44 + /**
  45 + * 文件列表
  46 + * @author:dc
  47 + * @time 2023/5/29 11:42
  48 + */
  49 + public function lists(){
  50 + $type = \request()->get('type');
  51 +
  52 + switch ($type){
  53 + case 'video':{
  54 + $ext = ['mp4','avi'];
  55 + break;
  56 + }
  57 + default:{
  58 + $ext = ['png','jpg','jpeg','gif'];
  59 + break;
  60 + }
  61 + }
  62 +
  63 + $files = Upload::lists($this->param['config'] ?? 'default',$ext);
  64 + return $this->success($files);
  65 + }
  66 +
  67 +
  68 +
42 } 69 }
@@ -37,7 +37,7 @@ class CountController extends BaseController @@ -37,7 +37,7 @@ class CountController extends BaseController
37 //TODO::询盘国家统计 37 //TODO::询盘国家统计
38 $data['country_data'] = $countLogic->inquiry_country_count(); 38 $data['country_data'] = $countLogic->inquiry_country_count();
39 //TODO::来源排名 39 //TODO::来源排名
40 - $data['country_data'] = $countLogic->referrer_count(); 40 + $data['referrer_count'] = $countLogic->referrer_count();
41 //TODO::访问国家前10 41 //TODO::访问国家前10
42 $data['access_country_count'] = $countLogic->access_country_count(); 42 $data['access_country_count'] = $countLogic->access_country_count();
43 //TODO::企业中心服务 43 //TODO::企业中心服务
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Bside; @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Bside;
4 4
5 5
6 use App\Enums\Common\Code; 6 use App\Enums\Common\Code;
  7 +use App\Http\Logic\Aside\Template\TemplateChunkLogic;
7 use App\Http\Logic\Bside\TemplateLogic; 8 use App\Http\Logic\Bside\TemplateLogic;
8 use App\Http\Requests\Bside\TemplateRequest; 9 use App\Http\Requests\Bside\TemplateRequest;
9 use App\Models\Template\ATemplate; 10 use App\Models\Template\ATemplate;
@@ -119,583 +120,12 @@ class TemplateController extends BaseController @@ -119,583 +120,12 @@ class TemplateController extends BaseController
119 public function get_html(){ 120 public function get_html(){
120 $source = $this->param['source']??''; 121 $source = $this->param['source']??'';
121 $source_id = $this->param['source_id']??0; 122 $source_id = $this->param['source_id']??0;
122 -  
123 - if($source=='index'){  
124 - $def = '<!DOCTYPE html>  
125 -<html lang="en">  
126 -  
127 -<head>  
128 - <meta charset="utf-8">  
129 - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">  
130 - <meta name="description" content="">  
131 - <meta name="author" content="">  
132 - <link rel="icon" href="../../favicon.ico">  
133 -  
134 - <title>Example Template for Bootstrap</title>  
135 -  
136 - <link href="../../css/editor.css" rel="stylesheet">  
137 -  
138 - <script src="../../js/jquery.min.js"></script>  
139 - <script src="../../js/popper.min.js"></script>  
140 - <script src="../../js/bootstrap.min.js"></script>  
141 -  
142 - <link href="example.css" rel="stylesheet">  
143 -  
144 - <script src="../../libs/aos/aos.js"></script>  
145 - <link href="../../libs/aos/aos.css" rel="stylesheet">  
146 -  
147 - <script src="../../libs/swiper/swiper.js"></script>  
148 - <link href="../../libs/swiper/swiper.css" rel="stylesheet">  
149 -</head>  
150 -  
151 -<body>  
152 - <header noAction id="globalso-header" class="web_head testnoaction screen-xxl sticky-top ">  
153 - <div class=" layout">  
154 - <div class=" d-flex align-items-center justify-content-between py-md-4">  
155 - <div class="logo w-25 w-sm-auto"><a href="#"><img class="img-fluid" src="img/logo.png" alt=""></a></div>  
156 - <nav class="navbar navbar-expand-md navbar-dark flex-fill justify-content-end mx-2 pe-md-5">  
157 - <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#navMenu"  
158 - aria-controls="navMenu">  
159 - <span class="navbar-toggler-icon"></span>  
160 - </button>  
161 - <ul class="nav column-gap-5 justify-content-end text-white d-none d-md-flex">  
162 - <li><a href="#">Home</a></li>  
163 - <li class="dropdown">  
164 - <a href="#" class="dropdown-toggle" data-bs-toggle="dropdown">Products</a>  
165 - <ul class="dropdown-menu fs-6 text-body shadow-sm border-0">  
166 - <li><a href="#" class="dropdown-item py-2">Product Information</a></li>  
167 - <li><a href="#" class="dropdown-item py-2">Change of Insurance</a></li>  
168 - <li><a href="#" class="dropdown-item py-2">Traveling Oxygen Program</a></li>  
169 - <li><a href="#" class="dropdown-item py-2">Contact</a></li>  
170 - </ul>  
171 - </li>  
172 - <li><a href="#">News</a></li>  
173 - <li><a href="#">Download</a></li>  
174 - <li><a href="#">FAQ</a></li>  
175 - <li><a href="#">Contact</a></li>  
176 - </ul>  
177 - </nav>  
178 - <div class="d-flex align-items-center justify-content-end">  
179 - <div class="search">  
180 - <button type="button" class="btn border-0" data-bs-toggle="dropdown">  
181 - <svg viewBox="0 0 24 24" width="18" height="18" stroke="#ffffff" stroke-width="2"  
182 - fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">  
183 - <circle cx="11" cy="11" r="8"></circle>  
184 - <line x1="21" y1="21" x2="16.65" y2="16.65"></line>  
185 - </svg>  
186 - </button>  
187 - <div class="dropdown-menu p-3 shadow-sm border-0">  
188 - <form action="">  
189 - <div class="d-flex mb-2">  
190 - <input type="text" class="form-control" name="search" placeholder="Start Typing...">  
191 - <button class="btn btn-search border-0" type="submit">  
192 - <svg viewBox="0 0 24 24" width="18" height="18" stroke="#333333"  
193 - stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"  
194 - class="css-i6dzq1">  
195 - <circle cx="11" cy="11" r="8"></circle>  
196 - <line x1="21" y1="21" x2="16.65" y2="16.65"></line>  
197 - </svg>  
198 - </button>  
199 - </div>  
200 - <p class="search-attr">Hit enter to search or ESC to close</p>  
201 - </form>  
202 - </div>  
203 - </div>  
204 - <div class="change-language ms-md-4">  
205 - <div role="button" class="dropdown-toggle text-white d-flex align-items-center"  
206 - data-bs-toggle="dropdown">  
207 - <b class="country-flag language-flag-en"></b> <span>English</span>  
208 - </div>  
209 - <div class="dropdown-menu shadow-sm border-0">  
210 - <div class="d-flex flex-wrap p-3 text-body">  
211 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="English">  
212 - <b class="country-flag language-flag-en"></b>  
213 - <span>English</span>  
214 - </a>  
215 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Françai">  
216 - <b class="country-flag language-flag-fr"></b>  
217 - <span>Françai</span>  
218 - </a>  
219 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Español">  
220 - <b class="country-flag language-flag-es"></b>  
221 - <span>Español</span>  
222 - </a>  
223 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Deutsch">  
224 - <b class="country-flag language-flag-de"></b>  
225 - <span>Deutsch</span>  
226 - </a>  
227 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Română">  
228 - <b class="country-flag language-flag-ro"></b>  
229 - <span>Română</span>  
230 - </a>  
231 - </div>  
232 - </div>  
233 - </div>  
234 - </div>  
235 - </div>  
236 - </div>  
237 - </header>  
238 -  
239 - <main class="web_main" id="globalso-main">  
240 - <section class="slider_banner screen-full position-relative testnoaction" data-aos="fade-up"  
241 - data-aos-delay="500" id="banner">  
242 - <div class="layout">  
243 - <div class="swiper-wrapper">  
244 - <div class="swiper-slide"><a href="#"> <img class=" img-fluid" src="img/banner01.jpg"  
245 - alt="slide1" /></a>  
246 - </div>  
247 - <div class="swiper-slide"><a href="#"> <img class=" img-fluid" src="img/banner02.jpg"  
248 - alt="slide2" /></a>  
249 - </div>  
250 - <div class="swiper-slide"><a href="#"> <img class=" img-fluid" src="img/banner01.jpg"  
251 - alt="slide3" /></a>  
252 - </div>  
253 - </div>  
254 - <div class="index-swiper-buttons">  
255 - <div class="swiper-button-prev la"></div>  
256 - <div class="swiper-button-next la"></div>  
257 - </div>  
258 - <div class="swiper-pagination">  
259 - </div>  
260 - </section>  
261 - <section noActionSection noAction class="product-1 screen-xxl mb-5 mt-0 block-item-4 testnoaction">  
262 - <div class="layout">  
263 - <div class="row gx-0">  
264 - <div class="index-hd text-center" data-aos="fade-up" data-aos-delay="500">  
265 - <h2 class="fs-1 fw-bold">New Products</h2>  
266 - </div>  
267 - <div class="index-bd default-product-items d-flex flex-wrap" data-aos="fade-up"  
268 - data-aos-delay="500">  
269 - <div class="default-product-item block-item" style="padding:10px">  
270 - <figure class="item-inner" style="padding:10px">  
271 - <div class="item-img" style="padding:10px">  
272 - <a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>  
273 - </div>  
274 - <figcaption class="item-info">  
275 - <h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>  
276 - </figcaption>  
277 - </figure>  
278 - </div>  
279 - <div class="default-product-item block-item">  
280 - <figure class="item-inner">  
281 - <div class="item-img">  
282 - <a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>  
283 - </div>  
284 - <figcaption class="item-info">  
285 - <h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>  
286 - </figcaption>  
287 - </figure>  
288 - </div>  
289 - <div class="default-product-item block-item">  
290 - <figure class="item-inner">  
291 - <div class="item-img">  
292 - <a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>  
293 - </div>  
294 - <figcaption class="item-info">  
295 - <h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>  
296 - </figcaption>  
297 - </figure>  
298 - </div>  
299 - <div class="default-product-item block-item">  
300 - <figure class="item-inner">  
301 - <div class="item-img">  
302 - <a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>  
303 - </div>  
304 - <figcaption class="item-info">  
305 - <h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>  
306 - </figcaption>  
307 - </figure>  
308 - </div>  
309 - <div class="default-product-item block-item">  
310 - <figure class="item-inner">  
311 - <div class="item-img">  
312 - <a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>  
313 - </div>  
314 - <figcaption class="item-info">  
315 - <h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>  
316 - </figcaption>  
317 - </figure>  
318 - </div>  
319 - </div>  
320 - </div>  
321 - </div>  
322 - </section>  
323 - <section class="screen-xxl">  
324 - <div class="layout">  
325 - <div class="row">  
326 - <div class="col-md-4 p-3" data-aos="fade-up" data-aos-delay="500">  
327 - <i>  
328 - <svg viewBox="0 0 24 24" width="48" height="48" stroke="#318fff" stroke-width="1"  
329 - fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">  
330 - <path  
331 - d="M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z">  
332 - </path>  
333 - </svg>  
334 - </i>  
335 - <div class="la-3x text-body opacity-25 lh-1 my-4">01</div>  
336 - <div class="pe-4">  
337 - <h4 class="text-uppercase fw-bold">Saddles</h4>  
338 - <div class="mt-3 uu">Our store is ready to offer you the best saddle selection of all shapes  
339 - and  
340 - types for your bike.</div>  
341 - </div>  
342 - </div>  
343 - <div class="col-md-4 p-3" data-aos="fade-up" data-aos-delay="500">  
344 - <i>  
345 - <svg viewBox="0 0 24 24" width="48" height="48" stroke="#318fff" stroke-width="1"  
346 - fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">  
347 - <line x1="4" y1="21" x2="4" y2="14"></line>  
348 - <line x1="4" y1="10" x2="4" y2="3"></line>  
349 - <line x1="12" y1="21" x2="12" y2="12"></line>  
350 - <line x1="12" y1="8" x2="12" y2="3"></line>  
351 - <line x1="20" y1="21" x2="20" y2="16"></line>  
352 - <line x1="20" y1="12" x2="20" y2="3"></line>  
353 - <line x1="1" y1="14" x2="7" y2="14"></line>  
354 - <line x1="9" y1="8" x2="15" y2="8"></line>  
355 - <line x1="17" y1="16" x2="23" y2="16"></line>  
356 - </svg>  
357 - </i>  
358 - <div class="la-3x text-body opacity-25 lh-1 my-4">02</div>  
359 - <div class="pe-4">  
360 - <h4 class="text-uppercase fw-bold">rims &amp; Wheels</h4>  
361 - <p class="mt-3">Feel free to explore an extensive range of wheels, rims &amp; tires for  
362 - your  
363 - bike at our store.</p>  
364 - </div>  
365 - </div>  
366 - <div class="col-md-4 p-3" data-aos="fade-up" data-aos-delay="500">  
367 - <i>  
368 - <svg viewBox="0 0 24 24" width="48" height="48" stroke="#318fff" stroke-width="1"  
369 - fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">  
370 - <path  
371 - d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z">  
372 - </path>  
373 - <polyline points="7.5 4.21 12 6.81 16.5 4.21"></polyline>  
374 - <polyline points="7.5 19.79 7.5 14.6 3 12"></polyline>  
375 - <polyline points="21 12 16.5 14.6 16.5 19.79"></polyline>  
376 - <polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline>  
377 - <line x1="12" y1="22.08" x2="12" y2="12"></line>  
378 - </svg>  
379 - </i>  
380 - <div class="la-3x text-body opacity-25 lh-1 my-4">04</div>  
381 - <div class="pe-4">  
382 - <h4 class="text-uppercase fw-bold">Saddles</h4>  
383 - <p class="mt-3">Need a reliable and durable frame for your bike? Our store managers  
384 - will be  
385 - ready to help you.</p>  
386 - </div>  
387 - </div>  
388 - </div>  
389 - </div>  
390 - </section>  
391 - <section class="about-1 screen-xxl">  
392 - <div class="layout">  
393 - <div class="row">  
394 - <div class="col-lg-6" data-aos="fade-up" data-aos-delay="500">  
395 - <div class="company_show bg-light rounded-3 position-relative h-100">  
396 - <div class="swiper-wrapper">  
397 - <div class="swiper-slide p-4">  
398 - <a href="#"><img class=" img-fluid" src="img/company_intr_01.png" alt=""></a>  
399 - </div>  
400 - <div class="swiper-slide p-4">  
401 - <a href="#"><img class=" img-fluid" src="img/company_intr_02.png" alt=""></a>  
402 - </div>  
403 - <div class="swiper-slide p-4">  
404 - <a href="#"><img class=" img-fluid" src="img/company_intr_03.png" alt=""></a>  
405 - </div>  
406 - </div>  
407 - <div class="swiper-pagination"></div>  
408 - </div>  
409 - </div>  
410 - <div class="col-lg-6" data-aos="fade-up" data-aos-delay="500">  
411 - <div class="company_content ps-lg-5 py-5 py-lg-3">  
412 - <h2 class="fs-1 fw-bold">Why Choose Us</h2>  
413 - <dl class="my-4 my-sm-5 text-dark">  
414 - <dt class="fs-7">◎ Over 25 years of experience</dt>  
415 - <dd class="my-3">  
416 - Since 1990, we have been partnering with various suppliers and manufacturers of bike  
417 - parts  
418 - to provide our customers with high-quality replacement parts for their bikes for  
419 - over 25 years.  
420 - </dd>  
421 - <dt class="fs-7">◎ 5+ years of warranty on all parts</dt>  
422 - <dd class="my-3">  
423 - Every part you buy at our store is provided with exclusive 5-year warranty and some  
424 - parts  
425 - from premium manufacturers have even longer warranty.  
426 - </dd>  
427 - <dt class="fs-7">◎ Over 25 years of experience</dt>  
428 - <dd class="my-3">  
429 - We guarantee the best customer service with easy product returns &amp; replacements  
430 - as well  
431 - as 24-hour support for all our clients. Besides, every client also gets free  
432 - worldwide  
433 - delivery of any part from our catalog.  
434 - </dd>  
435 - </dl>  
436 - <a href="#" class="btn btn-primary px-4 fs-7">Learn More</a>  
437 - </div>  
438 - </div>  
439 - </div>  
440 - </div>  
441 - </section>  
442 -  
443 - <section class="news-1 screen-xxl">  
444 - <div class="layout">  
445 - <div class="row gx-0 my-sm-4">  
446 - <div class="index_hd text-center" data-aos="fade-up" data-aos-delay="500">  
447 - <h2 class="fs-1 fw-bold">Our Blog</h2>  
448 - </div>  
449 - <div class="index-bd row pb-3 py-md-4 px-0 gx-0 gy-3" data-aos="fade-up" data-aos-delay="500">  
450 - <div class="col-sm-6 col-md-4 gx-3 gx-md-4 gy-3 gy-md-0">  
451 - <figure class="d-flex flex-column h-100">  
452 - <span class="item_img">  
453 - <a href=""><img class="img-fluid" src="img/news01.jpg" alt=""></a>  
454 - </span>  
455 - <figcaption class="bg-white p-3 flex-fill">  
456 - <time class="text-secondary">August 9, 2019</time>  
457 - <h3 class="fs-7 fs-sm-5 my-3 fw-bold">  
458 - <a href="#" class="text-body">Essential Commuter Accessories: Stock or DIY?</a>  
459 - </h3>  
460 - <p class="m-0 text-secondary">Lorem ipsum dolor sit amet, consetetur sadipscing  
461 - elitr, sed  
462 - diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed  
463 - diam voluptua. </p>  
464 - </figcaption>  
465 - </figure>  
466 - </div>  
467 - <div class="col-sm-6 col-md-4 gx-3 gx-md-4 gy-3 gy-md-0">  
468 - <figure class="d-flex flex-column h-100">  
469 - <span class="item_img">  
470 - <a href=""><img class=" img-fluid" src="img/news02.jpg" alt=""></a>  
471 - </span>  
472 - <figcaption class="bg-white p-3 flex-fill">  
473 - <time class="text-secondary">August 9, 2019</time>  
474 - <h3 class="fs-7 fs-sm-5 my-3 fw-bold">  
475 - <a href="#" class="text-body">5 Winter Biking Necessities that You Need to  
476 - Have</a>  
477 - </h3>  
478 - <p class="m-0 text-secondary">Lorem ipsum dolor sit amet, consetetur sadipscing  
479 - elitr, sed diam nonumy</p>  
480 - </figcaption>  
481 - </figure>  
482 - </div>  
483 - <div class="col-sm-6 col-md-4 gx-3 gx-md-4 gy-3 gy-md-0">  
484 - <figure class="d-flex flex-column h-100">  
485 - <span class="item_img">  
486 - <a href=""><img class=" img-fluid" src="img/news03.jpg" alt=""></a>  
487 - </span>  
488 - <figcaption class="bg-white p-3 flex-fill">  
489 - <time class="text-secondary">August 9, 2019</time>  
490 - <h3 class="fs-7 fs-sm-5 my-3 fw-bold">  
491 - <a href="#" class="text-body">Bike Tune-up Done Right: Tips from Cyclert  
492 - Experts</a>  
493 - </h3>  
494 - <p class="m-0 text-secondary">Lorem ipsum dolor sit amet, consetetur sadipscing  
495 - elitr, sed  
496 - diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed  
497 - diam voluptua. </p>  
498 - </figcaption>  
499 - </figure>  
500 - </div>  
501 - </div>  
502 - </div>  
503 - </div>  
504 - </section>  
505 - </main>  
506 -  
507 - <footer class="web_footer screen-xxl" id="globalso-footer">  
508 - <div class="layout">  
509 - <div class="row py-5 gx-0" data-aos="fade-up" data-aos-delay="500">  
510 - <nav class="foot_item col-sm-6 col-md-4 gx-0 gx-sm-4 pt-4">  
511 - <div class="foot_logo"><img src="img/logo.png" alt=""></div>  
512 - <div class="my-5 pe-4 text-white">Shelter has been a trusted name in insurance for more than 15  
513 - years. Today, we  
514 - proudly serve more than 16 million customers nationwide.Shelter has been a trusted name in  
515 - insurance for  
516 - more than 15 years. </div>  
517 - <ul class="sns_list d-flex gap-4 list-unstyled">  
518 - <li><a href=""><img src="img/sns01.png" alt=""></a></li>  
519 - <li><a href=""><img src="img/sns02.png" alt=""></a></li>  
520 - <li><a href=""><img src="img/sns03.png" alt=""></a></li>  
521 - <li><a href=""><img src="img/sns04.png" alt=""></a></li>  
522 - <li><a href=""><img src="img/sns05.png" alt=""></a></li>  
523 - </ul>  
524 - </nav>  
525 - <nav class="foot_item col-sm-6 col-md-4 gx-0 gx-sm-4 pt-4 px-sm-5 ps-lg-9">  
526 - <div class="mb-4">  
527 - <h2 class="fs-5 fw-bold text-white">Quick Links</h2>  
528 - </div>  
529 - <div class="foot_item_bd">  
530 - <ul class="list-unstyled">  
531 - <li class="my-3"><a href="" class="text-white">Home</a></li>  
532 - <li class="my-3"><a href="" class="text-white">Products</a></li>  
533 - <li class="my-3"><a href="" class="text-white">Services</a></li>  
534 - <li class="my-3"><a href="" class="text-white">News</a></li>  
535 - <li class="my-3"><a href="" class="text-white">About us</a></li>  
536 - <li class="my-3"><a href="" class="text-white">Contact us</a></li>  
537 - </ul>  
538 - </div>  
539 - </nav>  
540 - <nav class="foot_item col-sm-6 col-md-4 gx-0 gx-sm-4 pt-4">  
541 - <div class="mb-4">  
542 - <h2 class="fs-5 fw-bold text-white">Get in Touch</h2>  
543 - </div>  
544 - <div class="foot_item_bd">  
545 - <address>  
546 - <ul class="list-unstyled">  
547 - <li class="my-3 d-flex align-items-center">  
548 - <i class="la la-city la-inverse fs-4"></i>  
549 - <div class="flex-fill ms-2">  
550 - <span class="text-white">Chengdu,Sichuan province Shuxihuanjie #615</span>  
551 - </div>  
552 - </li>  
553 - <li class="my-3 d-flex align-items-center">  
554 - <i class="la la-phone la-inverse fs-4"></i>  
555 - <div class="flex-fill ms-2">  
556 - <a class="tel_link" href="tel:">  
557 - <span class="text-white">Phone:</span>  
558 - <span class="text-white">400-86-25660</span>  
559 - </a>  
560 - </div>  
561 - </li>  
562 - <li class="my-3 d-flex align-items-center">  
563 - <i class="la la-mail-bulk la-inverse fs-4"></i>  
564 - <div class="flex-fill ms-2">  
565 - <a href="mailto:">  
566 - <span class="text-white">Email:</span>  
567 - <span class="text-white">800025660@126.com</span>  
568 - </a>  
569 - </div>  
570 - </li>  
571 - </ul>  
572 - </address>  
573 - </div>  
574 - </nav>  
575 - </div>  
576 - </div>  
577 - </footer>  
578 -  
579 -</body>  
580 -<script>  
581 - AOS.init();  
582 - var mySwiper = new Swiper(\'.slider_banner .layout\', {  
583 - effect: \'fade\',  
584 - speed: 1000,  
585 - loop: true,  
586 - autoplay: {  
587 - delay: 3500,  
588 - disableOnInteraction: false,  
589 - },  
590 - pagination: {  
591 - el: \'.slider_banner .swiper-pagination\',  
592 - clickable: true,  
593 - },  
594 - navigation: {  
595 - nextEl: \'.slider_banner .swiper-button-next\',  
596 - prevEl: \'.slider_banner .swiper-button-prev\',  
597 - },  
598 - });  
599 -  
600 - var swiper = new Swiper(\'.company_show\', {  
601 - pagination: {  
602 - el: \'.company_show .swiper-pagination\',  
603 - },  
604 - })  
605 -</script>  
606 -  
607 -</html>';  
608 - }else{  
609 - $def = '<div class=" d-flex align-items-center justify-content-between py-md-4">  
610 - <div class="logo w-25 w-sm-auto"><a href="#"><img class="img-fluid" src="img/logo.png" alt=""></a></div>  
611 - <nav class="navbar navbar-expand-md navbar-dark flex-fill justify-content-end mx-2 pe-md-5">  
612 - <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#navMenu"  
613 - aria-controls="navMenu">  
614 - <span class="navbar-toggler-icon"></span>  
615 - </button>  
616 - <ul class="nav column-gap-5 justify-content-end text-white d-none d-md-flex">  
617 - <li><a href="#">Home</a></li>  
618 - <li class="dropdown">  
619 - <a href="#" class="dropdown-toggle" data-bs-toggle="dropdown">Products</a>  
620 - <ul class="dropdown-menu fs-6 text-body shadow-sm border-0">  
621 - <li><a href="#" class="dropdown-item py-2">Product Information</a></li>  
622 - <li><a href="#" class="dropdown-item py-2">Change of Insurance</a></li>  
623 - <li><a href="#" class="dropdown-item py-2">Traveling Oxygen Program</a></li>  
624 - <li><a href="#" class="dropdown-item py-2">Contact</a></li>  
625 - </ul>  
626 - </li>  
627 - <li><a href="#">News</a></li>  
628 - <li><a href="#">Download</a></li>  
629 - <li><a href="#">FAQ</a></li>  
630 - <li><a href="#">Contact</a></li>  
631 - </ul>  
632 - </nav>  
633 - <div class="d-flex align-items-center justify-content-end">  
634 - <div class="search">  
635 - <button type="button" class="btn border-0" data-bs-toggle="dropdown">  
636 - <svg viewBox="0 0 24 24" width="18" height="18" stroke="#ffffff" stroke-width="2"  
637 - fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">  
638 - <circle cx="11" cy="11" r="8"></circle>  
639 - <line x1="21" y1="21" x2="16.65" y2="16.65"></line>  
640 - </svg>  
641 - </button>  
642 - <div class="dropdown-menu p-3 shadow-sm border-0">  
643 - <form action="">  
644 - <div class="d-flex mb-2">  
645 - <input type="text" class="form-control" name="search" placeholder="Start Typing...">  
646 - <button class="btn btn-search border-0" type="submit">  
647 - <svg viewBox="0 0 24 24" width="18" height="18" stroke="#333333"  
648 - stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"  
649 - class="css-i6dzq1">  
650 - <circle cx="11" cy="11" r="8"></circle>  
651 - <line x1="21" y1="21" x2="16.65" y2="16.65"></line>  
652 - </svg>  
653 - </button>  
654 - </div>  
655 - <p class="search-attr">Hit enter to search or ESC to close</p>  
656 - </form>  
657 - </div>  
658 - </div>  
659 - <div class="change-language ms-md-4">  
660 - <div role="button" class="dropdown-toggle text-white d-flex align-items-center"  
661 - data-bs-toggle="dropdown">  
662 - <b class="country-flag language-flag-en"></b> <span>English</span>  
663 - </div>  
664 - <div class="dropdown-menu shadow-sm border-0">  
665 - <div class="d-flex flex-wrap p-3 text-body">  
666 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="English">  
667 - <b class="country-flag language-flag-en"></b>  
668 - <span>English</span>  
669 - </a>  
670 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Françai">  
671 - <b class="country-flag language-flag-fr"></b>  
672 - <span>Françai</span>  
673 - </a>  
674 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Español">  
675 - <b class="country-flag language-flag-es"></b>  
676 - <span>Español</span>  
677 - </a>  
678 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Deutsch">  
679 - <b class="country-flag language-flag-de"></b>  
680 - <span>Deutsch</span>  
681 - </a>  
682 - <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Română">  
683 - <b class="country-flag language-flag-ro"></b>  
684 - <span>Română</span>  
685 - </a>  
686 - </div>  
687 - </div>  
688 - </div>  
689 - </div>  
690 - </div>';  
691 - }  
692 -  
693 -  
694 $data = TemplateLogic::instance()->first($source,$source_id); 123 $data = TemplateLogic::instance()->first($source,$source_id);
695 -  
696 -  
697 -  
698 - return $this->response('',Code::SUCCESS,$data?$data['html']:$def); 124 + $res = [
  125 + 'html' => $data['html']??'',
  126 + 'name' => 'example'
  127 + ];
  128 + return $this->response('',Code::SUCCESS,$res);
699 129
700 } 130 }
701 131
@@ -707,17 +137,38 @@ class TemplateController extends BaseController @@ -707,17 +137,38 @@ class TemplateController extends BaseController
707 public function save_html(TemplateRequest $request){ 137 public function save_html(TemplateRequest $request){
708 138
709 $data = $request->validated(); 139 $data = $request->validated();
710 -  
711 $data['data_source'] = $data['source']; 140 $data['data_source'] = $data['source'];
712 $data['data_source_id'] = $data['source_id']; 141 $data['data_source_id'] = $data['source_id'];
713 -  
714 unset($data['source']); 142 unset($data['source']);
715 unset($data['source_id']); 143 unset($data['source_id']);
716 -  
717 TemplateLogic::instance()->save($data); 144 TemplateLogic::instance()->save($data);
718 -  
719 return $this->response('保存成功'); 145 return $this->response('保存成功');
720 146
  147 + // 不需要数据id
  148 + if(in_array($data['data_source'],['index'])){
  149 + $data['data_source_id'] = 0;
  150 + }
  151 + unset($data['source']);
  152 + unset($data['source_id']);
  153 + $id = TemplateLogic::instance()->save($data);
  154 + if($id){
  155 + $info = TemplateLogic::instance()->getInfo($id['id']);
  156 + $info['source'] = $info['data_source'];
  157 + $info['source_id'] = $info['data_source_id'];
  158 + unset($info['data_source']);
  159 + unset($info['data_source_id']);
  160 + unset($info['template_id']);
  161 + unset($info['created_at']);
  162 + unset($info['updated_at']);
  163 + unset($info['css']);
  164 + unset($info['script']);
  165 + unset($info['data_ext']);
  166 +
  167 + return $this->success($info,Code::SUCCESS,'保存成功');
  168 + }
  169 +
  170 + return $this->response('保存失败',Code::SYSTEM_ERROR);
  171 +
721 } 172 }
722 173
723 /** 174 /**
@@ -745,36 +196,17 @@ class TemplateController extends BaseController @@ -745,36 +196,17 @@ class TemplateController extends BaseController
745 * @author:dc 196 * @author:dc
746 * @time 2023/5/10 14:55 197 * @time 2023/5/10 14:55
747 */ 198 */
748 - public function customChunk(){  
749 -//  
750 -// $html = $this->param['html']??[];  
751 -// // 那个页面 的  
752 -// $type = $this->param['type']??'';  
753 -//  
754 -// if(!is_array($html)){  
755 -// return $this->response('参数异常',Code::SYSTEM_ERROR);  
756 -// }  
757 -//  
758 -// // 项目id  
759 -// $project_id = $this->user['project_id'];  
760 -// // 当前模板  
761 -// $template_id = BSetting::_get($project_id)['template_id'];  
762 -//  
763 -// // 验证这个模板是否存在  
764 -// if(!$type || !ATemplateHtml::_typeExist($template_id,$type)){  
765 -// return $this->response('页面类型错误',Code::SYSTEM_ERROR);  
766 -// }  
767 -//  
768 -//  
769 -// $html = view("template.{$template_id}.{$type}")->render();  
770 -//  
771 -//  
772 -// return $this->response('',Code::SUCCESS,$html);  
773 -//// $data = BTemplateData::_insert();  
774 -//  
775 -// 199 + public function chunk(){
776 200
  201 + $lists = TemplateChunkLogic::instance()->getList([['status','=',1]],['sort'=>'asc'],['*'],false)->toArray();
  202 +
  203 + foreach ($lists as &$list){
  204 + unset($list['created_at']);
  205 + unset($list['updated_at']);
  206 + unset($list['status']);
  207 + }
777 208
  209 + return $this->success($lists);
778 } 210 }
779 211
780 212
@@ -95,8 +95,8 @@ class UserController extends BaseController @@ -95,8 +95,8 @@ class UserController extends BaseController
95 ],[ 95 ],[
96 'id.required' => 'ID不能为空', 96 'id.required' => 'ID不能为空',
97 ]); 97 ]);
98 - $userLogic->user_info();  
99 - $this->response('success'); 98 + $info = $userLogic->user_info();
  99 + $this->response('success',Code::SUCCESS,$info);
100 } 100 }
101 /** 101 /**
102 * @name :删除管理员 102 * @name :删除管理员
@@ -141,7 +141,7 @@ class FileController @@ -141,7 +141,7 @@ class FileController
141 $fileModel = new File(); 141 $fileModel = new File();
142 $file_hash = $fileModel->read(['hash'=>$hash]); 142 $file_hash = $fileModel->read(['hash'=>$hash]);
143 if($file_hash !== false){ 143 if($file_hash !== false){
144 - return $hash; 144 + return $this->response('资源',Code::SUCCESS,['file'=>$hash]);
145 } 145 }
146 $url = $this->path; 146 $url = $this->path;
147 $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); 147 $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
@@ -197,7 +197,7 @@ class FileController @@ -197,7 +197,7 @@ class FileController
197 $data[] = $hash; 197 $data[] = $hash;
198 } 198 }
199 $fileModel->insert($save_data); 199 $fileModel->insert($save_data);
200 - return $this->response('资源',Code::SUCCESS,['files'=>$data]); 200 + return $this->response('资源',Code::SUCCESS,['file'=>$data]);
201 } 201 }
202 /** 202 /**
203 * @name 统一返回参数 203 * @name 统一返回参数
@@ -175,7 +175,7 @@ class ImageController @@ -175,7 +175,7 @@ class ImageController
175 $hash = hash_file('md5', $file->getPathname()); 175 $hash = hash_file('md5', $file->getPathname());
176 $image_hash = $imageModel->read(['hash'=>$hash]); 176 $image_hash = $imageModel->read(['hash'=>$hash]);
177 if($image_hash !== false){ 177 if($image_hash !== false){
178 - $data[] = $hash; 178 + $data[] = ['image'=>$hash];
179 continue; 179 continue;
180 } 180 }
181 $url = $this->path; 181 $url = $this->path;
@@ -192,10 +192,10 @@ class ImageController @@ -192,10 +192,10 @@ class ImageController
192 'hash' => $hash, 192 'hash' => $hash,
193 'type'=>$file->getClientOriginalExtension(), 193 'type'=>$file->getClientOriginalExtension(),
194 ]; 194 ];
195 - $data[] = $hash; 195 + $data[] = ['image'=>$hash];
196 } 196 }
197 $imageModel->insert($save_data); 197 $imageModel->insert($save_data);
198 - return $this->response('图片资源',Code::SUCCESS,['image'=>$data]); 198 + return $this->response('图片资源',Code::SUCCESS,$data);
199 } 199 }
200 200
201 //下载 201 //下载
@@ -247,15 +247,6 @@ class ImageController @@ -247,15 +247,6 @@ class ImageController
247 case 'image': 247 case 'image':
248 $data['image_link'] = url('/b/image/' . $v); 248 $data['image_link'] = url('/b/image/' . $v);
249 break; 249 break;
250 - case 'images':  
251 - $v = explode(',',$v);  
252 - foreach ($v as $k1=>$v1){  
253 - $data['images_link'][$k1] = url('/b/image/' . $v1);  
254 - }  
255 - break;  
256 - case 'file':  
257 - $data['file_link'] = url('/b/file_hash/' . $v);  
258 - break;  
259 } 250 }
260 } 251 }
261 } 252 }
@@ -99,6 +99,5 @@ class Kernel extends HttpKernel @@ -99,6 +99,5 @@ class Kernel extends HttpKernel
99 'aloginauth'=>AsideLoginAuthMiddleware::class, 99 'aloginauth'=>AsideLoginAuthMiddleware::class,
100 //B端登录验证中间件 100 //B端登录验证中间件
101 'bloginauth'=>BsideLoginAuthMiddleware::class, 101 'bloginauth'=>BsideLoginAuthMiddleware::class,
102 - 'accesstoken'=>AccessToken::class,  
103 ]; 102 ];
104 } 103 }
@@ -12,9 +12,7 @@ use App\Models\Devops\ServerInformationLog; @@ -12,9 +12,7 @@ use App\Models\Devops\ServerInformationLog;
12 use Illuminate\Database\Eloquent\Builder; 12 use Illuminate\Database\Eloquent\Builder;
13 use Illuminate\Database\Eloquent\Collection; 13 use Illuminate\Database\Eloquent\Collection;
14 use Illuminate\Database\Eloquent\Model; 14 use Illuminate\Database\Eloquent\Model;
15 -use Illuminate\Http\JsonResponse;  
16 use Illuminate\Support\Facades\DB; 15 use Illuminate\Support\Facades\DB;
17 -use Illuminate\Support\Facades\Log;  
18 16
19 class ServerInformationLogic extends BaseLogic 17 class ServerInformationLogic extends BaseLogic
20 { 18 {
@@ -41,31 +39,25 @@ class ServerInformationLogic extends BaseLogic @@ -41,31 +39,25 @@ class ServerInformationLogic extends BaseLogic
41 */ 39 */
42 public function create() 40 public function create()
43 { 41 {
44 - $request = $this->param; 42 + $request = $this->param ?? [];
45 $service = new ServerInformation(); 43 $service = new ServerInformation();
46 - $this->extracted($request, $service);  
47 - if ($this->checkIp($service->ip)) {  
48 - return $this->fail('服务器信息添加失败,ip已存在'); 44 + $this->extracted( $request, $service );
  45 + if ( $this->checkIp( $service->ip ) ) {
  46 + return $this->fail( '服务器信息添加失败,ip已存在' );
49 } 47 }
50 DB::beginTransaction(); 48 DB::beginTransaction();
51 49
52 - if ($service->save()) {  
53 - $original = [  
54 - 'id' => $service->id,  
55 - 'type' => $service->type,  
56 - 'ip' => $service->ip,  
57 - 'title' => $service->title,  
58 - 'belong_to' => $service->belong_to,  
59 - 'sshpass' => $service->sshpass,  
60 - 'ports' => $service->ports,  
61 - ]; 50 + if ( $service->save() ) {
  51 + $original = $service->getOriginal();
  52 + $original['type'] = $request['type'];
  53 + $original['belong_to'] = $request['belong_to'];
62 // 添加日志 54 // 添加日志
63 - $this->server_action_log(ServerInformationLog::ACTION_ADD, $original, $original, '添加服务器信息成功 - ID : ' . $service->id); 55 + $this->server_action_log( ServerInformationLog::ACTION_ADD, $original, $original, '添加服务器信息成功 - ID : ' . $service->id );
64 DB::commit(); 56 DB::commit();
65 return $this->success(); 57 return $this->success();
66 } 58 }
67 DB::rollBack(); 59 DB::rollBack();
68 - return $this->fail('服务器信息添加失败'); 60 + return $this->fail( '服务器信息添加失败' );
69 61
70 } 62 }
71 63
@@ -77,51 +69,55 @@ class ServerInformationLogic extends BaseLogic @@ -77,51 +69,55 @@ class ServerInformationLogic extends BaseLogic
77 */ 69 */
78 public function update() 70 public function update()
79 { 71 {
80 -  
81 - $service = new ServerInformation(); 72 + $service = $this->getService();
82 $fields_array = $service->FieldsArray(); 73 $fields_array = $service->FieldsArray();
83 - $request = $this->param;  
84 - $service = $this->ServerInfo();  
85 - $original = $service->toArray();  
86 - $this->extracted($request, $service);  
87 - 74 + $request = $this->param ?? [];
  75 + $original = $service->getOriginal();
  76 + $original['type'] = $service->ServiceStr( $original['type'] );
  77 + $original['belong_to'] = $service->BelongToStr( $original['belong_to'] );
  78 + $this->extracted( $request, $service, $original );
88 // 检查ip是否存在 79 // 检查ip是否存在
89 - if ($service->ip != $request['ip']) {  
90 - if ($this->checkIp($request['ip'])) {  
91 - $this->fail('服务器信息修改失败,ip已存在', Code::USER_ERROR); 80 + if ( $service->ip != $request['ip'] ) {
  81 + if ( $this->checkIp( $request['ip'] ) ) {
  82 + $this->fail( '服务器信息修改失败,ip已存在', Code::USER_ERROR );
92 } 83 }
93 } 84 }
94 DB::beginTransaction(); 85 DB::beginTransaction();
95 - if ($service->save()) {  
96 - $revised = [  
97 - 'id' => $service->id,  
98 - 'type' => $service->type,  
99 - 'ip' => $service->ip,  
100 - 'title' => $service->title,  
101 - 'belong_to' => $service->belong_to,  
102 - 'sshpass' => $service->sshpass,  
103 - 'ports' => $service->ports,  
104 - 'other' => $service->other,  
105 - 'delete' => $service->delete,  
106 - ];  
107 - $diff = array_diff_assoc($original, $revised);  
108 - unset($diff['create_at']);  
109 - unset($diff['update_at']);  
110 - unset($diff['deleted']); 86 + if ( $service->save() ) {
  87 + $revised = $service->getAttributes();
  88 + $diff = array_diff_assoc( $original, $revised );
  89 + unset( $diff['created_at'] );
  90 + unset( $diff['updated_at'] );
  91 + unset( $diff['deleted'] );
111 $remarks = ''; 92 $remarks = '';
112 - if ($diff) { 93 + if ( $diff ) {
113 $remarks .= '修改ID为 ' . $service->id . ' 的服务器信息,修改内容为:'; 94 $remarks .= '修改ID为 ' . $service->id . ' 的服务器信息,修改内容为:';
114 - foreach ($diff as $key => $value) { 95 + foreach ( $diff as $key => $value ) {
115 $remarks .= $fields_array[$key] . ' 由 ' . $value . ' 修改为 ' . $revised[$key] . '; '; 96 $remarks .= $fields_array[$key] . ' 由 ' . $value . ' 修改为 ' . $revised[$key] . '; ';
116 } 97 }
  98 + } else {
  99 + $remarks .= '修改ID为 ' . $service->id . ' 的服务器信息,无修改';
117 } 100 }
118 // 添加日志 101 // 添加日志
119 - $this->server_action_log(ServerInformationLog::ACTION_UPDATE, $original, $revised, $remarks); 102 + $this->server_action_log( ServerInformationLog::ACTION_UPDATE, $original, $revised, $remarks );
120 DB::commit(); 103 DB::commit();
121 return $this->success(); 104 return $this->success();
122 } 105 }
123 DB::rollBack(); 106 DB::rollBack();
124 - return $this->fail('服务器信息修改失败'); 107 + return $this->fail( '服务器信息修改失败' );
  108 + }
  109 +
  110 + public function getService( int $deleted = ServerInformation::DELETED_NORMAL )
  111 + {
  112 + $id = $this->param['id'] ?? 0;
  113 + if ( !$id ) {
  114 + return $this->fail( 'ID不能为空' );
  115 + }
  116 + $data = ServerInformation::query()->where( 'deleted', $deleted )->find( $id );
  117 + if ( !$data ) {
  118 + return $this->fail( '数据不存在!' );
  119 + }
  120 + return $data;
125 } 121 }
126 122
127 /** 123 /**
@@ -129,10 +125,10 @@ class ServerInformationLogic extends BaseLogic @@ -129,10 +125,10 @@ class ServerInformationLogic extends BaseLogic
129 * @param $ip 125 * @param $ip
130 * @return bool 126 * @return bool
131 */ 127 */
132 - public function checkIp($ip) 128 + public function checkIp( $ip )
133 { 129 {
134 - $usIp = ServerInformation::query()->where('ip', $ip)->first();  
135 - if ($usIp) { 130 + $usIp = ServerInformation::query()->where( 'ip', $ip )->first();
  131 + if ( $usIp ) {
136 return true; 132 return true;
137 } else { 133 } else {
138 return false; 134 return false;
@@ -146,15 +142,15 @@ class ServerInformationLogic extends BaseLogic @@ -146,15 +142,15 @@ class ServerInformationLogic extends BaseLogic
146 * @throws AsideGlobalException 142 * @throws AsideGlobalException
147 * @throws BsideGlobalException 143 * @throws BsideGlobalException
148 */ 144 */
149 - public function serverInfo(int $deleted = ServerInformation::DELETED_NORMAL) 145 + public function serverInfo( int $deleted = ServerInformation::DELETED_NORMAL )
150 { 146 {
151 - $id = \request()->input('id');  
152 - if (!$id) {  
153 - return $this->fail('参数错误'); 147 + $id = $this->param['id'] ?? 0;
  148 + if ( !$id ) {
  149 + return $this->fail( 'ID不能为空' );
154 } 150 }
155 - $data = ServerInformation::query()->where('deleted', $deleted)->find($id, ['type', 'ip', 'title', 'belong_to', 'sshpass', 'ports', 'create_at', 'update_at']);  
156 - if (!$data) {  
157 - return $this->fail('数据不存在!'); 151 + $data = ServerInformation::query()->where( 'deleted', $deleted )->find( $id, [ 'type', 'ip', 'title', 'belong_to', 'ports', 'created_at', 'updated_at' ] );
  152 + if ( !$data ) {
  153 + return $this->fail( '数据不存在!' );
158 } 154 }
159 return $data; 155 return $data;
160 } 156 }
@@ -165,32 +161,10 @@ class ServerInformationLogic extends BaseLogic @@ -165,32 +161,10 @@ class ServerInformationLogic extends BaseLogic
165 * @param array $original 原始数据 161 * @param array $original 原始数据
166 * @param array $revised 修改后数据 162 * @param array $revised 修改后数据
167 */ 163 */
168 - public function server_action_log(int $action = ServerInformationLog::ACTION_ADD, array $original = [], array $revised = [], $remarks = '') 164 + public function server_action_log( int $action = ServerInformationLog::ACTION_ADD, array $original = [], array $revised = [], $remarks = '' )
169 { 165 {
170 - // $action 1:添加 2:修改 3:删除 4:恢复  
171 - $actionArr = ServerInformationLog::actionArr();  
172 - $actionStr = $actionArr[$action];  
173 - $ip = request()->getClientIp();  
174 - $url = request()->getRequestUri();  
175 - $method = request()->getMethod();  
176 - $userId = $this->uid ?? 0;  
177 - $log = new ServerInformationLog();  
178 - $log->user_id = $userId;  
179 - $log->action = $actionStr;  
180 - $log->original = json_encode($original);  
181 - $log->revised = json_encode($revised);  
182 - $log->ip = $ip;  
183 - $log->url = $url;  
184 - $log->method = $method;  
185 - $log->remarks = $remarks;  
186 - DB::beginTransaction();  
187 - try {  
188 - $log->save();  
189 - DB::commit();  
190 - } catch (\Exception $e) {  
191 - DB::rollBack();  
192 - Log::error('服务器信息日志添加失败');  
193 - } 166 + $log = new ServerInformationLog();
  167 + $this->log( $log, $action, $original, $revised, $remarks );
194 } 168 }
195 169
196 /** 170 /**
@@ -198,14 +172,14 @@ class ServerInformationLogic extends BaseLogic @@ -198,14 +172,14 @@ class ServerInformationLogic extends BaseLogic
198 * @param $service 172 * @param $service
199 * @return void 173 * @return void
200 */ 174 */
201 - public function extracted(array $request, $service) 175 + public function extracted( array $request, $service, array $original = [] )
202 { 176 {
203 - $service->type = trim($request['type']); // 服务器类型  
204 - $service->ip = trim($request['ip']); // 服务器ip  
205 - $service->title = trim($request['title']); // 服务器标题  
206 - $service->belong_to = trim($request['belong_to']); // 服务器归属  
207 - $service->sshpass = trim($request['sshpass']); // ssh密码  
208 - $service->ports = trim($request['ports']); // ssh端口 177 + $service->type = trim( $request['type'] ) ?? $original['type']; // 服务器类型
  178 + $service->ip = trim( $request['ip'] ) ?? $original['ip']; // 服务器ip
  179 + $service->title = trim( $request['title'] ) ?? $original['title']; // 服务器标题
  180 + $service->belong_to = trim( $request['belong_to'] ) ?? $original['belong_to']; // 服务器归属
  181 + $service->sshpass = trim( $request['sshpass'] ) ?? $original['sshpass']; // ssh密码
  182 + $service->ports = trim( $request['ports'] ) ?? $original['ports']; // ssh端口
209 } 183 }
210 184
211 /** 185 /**
@@ -214,38 +188,50 @@ class ServerInformationLogic extends BaseLogic @@ -214,38 +188,50 @@ class ServerInformationLogic extends BaseLogic
214 * @throws AsideGlobalException 188 * @throws AsideGlobalException
215 * @throws BsideGlobalException 189 * @throws BsideGlobalException
216 */ 190 */
217 - public function get_batch_update($action = ServerInformationLog::ACTION_DELETE, $deleted = ServerInformation::DELETED_NORMAL) 191 + public function get_batch_update( $action = ServerInformationLog::ACTION_DELETE, $deleted = ServerInformation::DELETED_NORMAL )
218 { 192 {
219 - $id = request()->input('id');  
220 - if (!$id) {  
221 - return $this->fail('参数错误');  
222 - }  
223 - $ids = [];  
224 - if (!is_array($id)) {  
225 - $ids = explode(',', $id);  
226 - }  
227 - $ids = array_filter($ids, 'intval');  
228 - if (empty($ids)) {  
229 - return $this->fail('参数错误');  
230 - }  
231 - $data = ServerInformation::query()->whereIn('id', $ids)->where('deleted', $deleted)->get();  
232 - $restore_ids = $data->pluck('id')->toArray();  
233 - $actionArr = ServerInformationLog::actionArr();  
234 - $actionStr = $actionArr[$action];  
235 - if (empty($restore_ids)) {  
236 - $this->fail($actionStr . '服务器信息不存在!', Code::USER_ERROR); 193 + $ids = $this->getIds();
  194 + $data = ServerInformation::query()->whereIn( 'id', $ids )->where( 'deleted', $deleted )->get();
  195 + $restore_ids = $data->pluck( 'id' )->toArray();
  196 + $actionArr = ServerInformationLog::actionArr();
  197 + $actionStr = $actionArr[$action];
  198 + if ( empty( $restore_ids ) ) {
  199 + $this->fail( $actionStr . '服务器信息不存在!', Code::USER_ERROR );
237 } 200 }
238 $original = $data->toArray(); 201 $original = $data->toArray();
239 DB::beginTransaction(); 202 DB::beginTransaction();
240 try { 203 try {
241 $update = $deleted == ServerInformation::DELETED_NORMAL ? ServerInformation::DELETED_DELETE : ServerInformation::DELETED_NORMAL; 204 $update = $deleted == ServerInformation::DELETED_NORMAL ? ServerInformation::DELETED_DELETE : ServerInformation::DELETED_NORMAL;
242 - ServerInformation::query()->whereIn('id', $restore_ids)->update(['deleted' => $update]);  
243 - $this->server_action_log($action, $original, $original, $actionStr . '服务器信息 - ID : ' . implode(', ', $restore_ids)); 205 + ServerInformation::query()->whereIn( 'id', $restore_ids )->update( [ 'deleted' => $update ] );
  206 + $this->server_action_log( $action, $original, $original, $actionStr . '服务器信息 - ID : ' . implode( ', ', $restore_ids ) );
244 DB::commit(); 207 DB::commit();
245 return $this->success(); 208 return $this->success();
246 - } catch (\Exception $e) { 209 + } catch ( \Exception $e ) {
247 DB::rollBack(); 210 DB::rollBack();
248 - return $this->fail('服务器信息' . $actionStr . '失败', Code::USER_ERROR); 211 + return $this->fail( '服务器信息' . $actionStr . '失败', Code::USER_ERROR );
  212 + }
  213 + }
  214 +
  215 + /**
  216 + * 批量获取数据恢复
  217 + * @return array
  218 + * @throws AsideGlobalException
  219 + * @throws BsideGlobalException
  220 + */
  221 + public function getIds()
  222 + {
  223 + $id = $this->param['id'] ?? 0;
  224 + if ( !$id ) {
  225 + return $this->fail( '参数错误' );
  226 + }
  227 + $ids = [];
  228 + if ( !is_array( $id ) ) {
  229 + $ids = explode( ',', $id );
  230 + }
  231 + $ids = array_filter( $ids, 'intval' );
  232 + if ( empty( $ids ) ) {
  233 + return $this->fail( '参数错误' );
249 } 234 }
  235 + return $ids;
250 } 236 }
251 } 237 }
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Aside\Domain;
  4 +
  5 +
  6 +use App\Enums\Common\Code;
  7 +use App\Exceptions\AsideGlobalException;
  8 +use App\Exceptions\BsideGlobalException;
  9 +use App\Http\Logic\Aside\BaseLogic;
  10 +use App\Http\Logic\Aside\Devops\ServerInformationLogic;
  11 +use App\Models\Aside\Domain\DomainInfo;
  12 +use App\Models\Aside\Domain\DomainInfoLog;
  13 +use App\Models\Devops\ServerInformation;
  14 +use Illuminate\Database\Eloquent\Builder;
  15 +use Illuminate\Database\Eloquent\Collection;
  16 +use Illuminate\Database\Eloquent\Model;
  17 +use Illuminate\Support\Facades\DB;
  18 +
  19 +class DomainInfoLogic extends BaseLogic
  20 +{
  21 + /**
  22 + * @var array
  23 + */
  24 + private $param;
  25 +
  26 + public function __construct()
  27 + {
  28 + parent::__construct();
  29 +
  30 + $this->model = new ServerInformation();
  31 +
  32 + $this->param = $this->requestAll;
  33 +
  34 + }
  35 +
  36 + /**
  37 + * 添加数据
  38 + * @return array
  39 + * @throws AsideGlobalException
  40 + * @throws BsideGlobalException
  41 + */
  42 + public function create()
  43 + {
  44 + $request = $this->param ?? [];
  45 + if ($this->checkDomain($request['domain'])) {
  46 + return $this->fail('域名已存在!');
  47 + }
  48 + $domain = new DomainInfo();
  49 + $this->extracted($request, $domain);
  50 + DB::beginTransaction();
  51 + if ($domain->save()) {
  52 + $original = $domain->getOriginal();
  53 + $original['belong_to'] = $request['belong_to'];
  54 + $original['status'] = $request['status'];
  55 + // 添加日志
  56 + $this->domain_action_log(DomainInfoLog::ACTION_ADD, $original, $original, '添加域名信息成功 - ID : ' . $domain->id);
  57 + DB::commit();
  58 + return $this->success();
  59 + }
  60 + DB::rollBack();
  61 + return $this->fail('域名信息添加失败');
  62 +
  63 + }
  64 +
  65 + /**
  66 + * 修改数据
  67 + * @return array
  68 + * @throws AsideGlobalException
  69 + * @throws BsideGlobalException
  70 + */
  71 + public function update()
  72 + {
  73 + $domain = $this->getDomain();
  74 + $original = $domain->getOriginal();
  75 + $original['belong_to'] = $domain->BelongToStr($original['belong_to']);
  76 + $original['status'] = $domain->StatusToStr($original['status']);
  77 + $request = $this->param;
  78 + $this->extracted($request, $domain, $original);
  79 + // 检查ip是否存在
  80 + if ($domain->domain != $request['domain']) {
  81 + if ($this->checkDomain($request['domain'])) {
  82 + $this->fail('域名信息修改失败,域名已存在', Code::USER_ERROR);
  83 + }
  84 + }
  85 + DB::beginTransaction();
  86 + if ($domain->save()) {
  87 + $fields_array = $domain->FieldsArray();
  88 + $revised = $domain->getAttributes();
  89 + $diff = array_diff_assoc($original, $revised);
  90 + unset($diff['created_at']);
  91 + unset($diff['updated_at']);
  92 + unset($diff['deleted']);
  93 + $remarks = '';
  94 + if ($diff) {
  95 + $remarks .= '修改ID为 ' . $domain->id . ' 的服务器信息,修改内容为:';
  96 + foreach ($diff as $key => $value) {
  97 + $remarks .= $fields_array[$key] . ' 由 ' . $value . ' 修改为 ' . $revised[$key] . '; ';
  98 + }
  99 + } else {
  100 + $remarks .= '修改ID为 ' . $domain->id . ' 的域名信息,无修改';
  101 + }
  102 + // 添加日志
  103 + $this->domain_action_log(DomainInfoLog::ACTION_UPDATE, $original, $revised, $remarks);
  104 + DB::commit();
  105 + return $this->success();
  106 + }
  107 + DB::rollBack();
  108 + return $this->fail('域名信息修改失败');
  109 + }
  110 +
  111 + /**
  112 + * 根据ID获取数据
  113 + * @return array
  114 + * @throws AsideGlobalException
  115 + * @throws BsideGlobalException
  116 + */
  117 + public function getDomain(int $deleted = DomainInfo::DELETED_NORMAL)
  118 + {
  119 + $id = $this->param['id'] ?? 0;
  120 + if (!$id) {
  121 + return $this->fail('ID不能为空');
  122 + }
  123 + $data = DomainInfo::query()->where('deleted', $deleted)->find($id);
  124 + if (!$data) {
  125 + return $this->fail('数据不存在!');
  126 + }
  127 + return $data;
  128 + }
  129 +
  130 + /**
  131 + * 检查域名是否存在
  132 + * @param $domain
  133 + * @return bool
  134 + */
  135 + public function checkDomain($domain)
  136 + {
  137 + $usIp = DomainInfo::query()->where('domain', $domain)->first();
  138 + if ($usIp) {
  139 + return true;
  140 + } else {
  141 + return false;
  142 + }
  143 + }
  144 +
  145 + /**
  146 + * 详情
  147 + * @param int $deleted
  148 + * @return array|Builder|Collection|Model
  149 + * @throws AsideGlobalException
  150 + * @throws BsideGlobalException
  151 + */
  152 + public function domainInfo(int $deleted = DomainInfo::DELETED_NORMAL)
  153 + {
  154 + $id = $this->param['id'] ?? 0;
  155 + if (!$id) {
  156 + return $this->fail('ID不能为空');
  157 + }
  158 + $data = DomainInfo::query()->where('deleted', $deleted)->find($id, ['domain', 'belong_to', 'status', 'domain_start_time', 'domain_end_time', 'certificate_start_time', 'certificate_end_time', 'created_at', 'updated_at']);
  159 + if (!$data) {
  160 + return $this->fail('数据不存在!');
  161 + }
  162 + return $data;
  163 + }
  164 +
  165 + /**
  166 + * 服务器操作日志
  167 + * @param int $action 1:添加 2:修改 3:删除 4:搜索 5:详情 6:列表
  168 + * @param array $original 原始数据
  169 + * @param array $revised 修改后数据
  170 + */
  171 + public function domain_action_log(int $action = DomainInfoLog::ACTION_ADD, array $original = [], array $revised = [], $remarks = '')
  172 + {
  173 + $log = new DomainInfoLog();
  174 + $this->log($log, $action, $original, $revised, $remarks);
  175 + }
  176 +
  177 + /**
  178 + * @param array $request
  179 + * @param $domain
  180 + * @param array $original
  181 + * @return void
  182 + * @throws AsideGlobalException
  183 + * @throws BsideGlobalException
  184 + */
  185 + public function extracted( array $request, $domain, array $original = [])
  186 + {
  187 + $domain->domain = trim($request['domain']) ?? $original['domain'];
  188 + if (!$this->validateDomain($domain->domain)) {
  189 + $this->fail('域名格式错误');
  190 + }
  191 + $domain->belong_to = trim($request['belong_to']) ?? $original['belong_to']; // 域名归属 1 - 公司 2 - 客户
  192 + $domain->status = trim($request['status']) ?? $original['status']; // 域名状态 0 - 正常 1 - 关闭
  193 + $domain->domain_start_time = trim($request['domain_start_time']) ?? $original['domain_start_time']; // 域名开始时间
  194 + $domain->domain_end_time = trim($request['domain_end_time']) ?? $original['domain_end_time'];
  195 + $domain->certificate_start_time = trim($request['certificate_start_time']) ?? $original['certificate_start_time']; // 证书开始时间
  196 + $domain->certificate_end_time = trim($request['certificate_end_time']) ?? $original['certificate_end_time']; // 证书结束时间
  197 + }
  198 +
  199 + /**
  200 + * 批量获取数据删除
  201 + * @return array
  202 + * @throws AsideGlobalException
  203 + * @throws BsideGlobalException
  204 + */
  205 + public function get_batch_update($action = DomainInfoLog::ACTION_DELETE, $deleted = DomainInfo::DELETED_NORMAL)
  206 + {
  207 + $ids = (new ServerInformationLogic())->getIds();
  208 + $data = DomainInfo::query()->whereIn('id', $ids)->where('deleted', $deleted)->get();
  209 + $restore_ids = $data->pluck('id')->toArray();
  210 + $actionArr = DomainInfoLog::actionArr();
  211 + $actionStr = $actionArr[$action];
  212 + if (empty($restore_ids)) {
  213 + $this->fail($actionStr . '域名信息不存在!', Code::USER_ERROR);
  214 + }
  215 + $original = $data->toArray();
  216 + DB::beginTransaction();
  217 + try {
  218 + $update = $deleted == DomainInfo::DELETED_NORMAL ? DomainInfo::DELETED_DELETE : DomainInfo::DELETED_NORMAL;
  219 + DomainInfo::query()->whereIn('id', $restore_ids)->update(['deleted' => $update]);
  220 + $this->domain_action_log($action, $original, $original, $actionStr . '域名信息 - ID : ' . implode(', ', $restore_ids));
  221 + DB::commit();
  222 + return $this->success();
  223 + } catch (\Exception $e) {
  224 + DB::rollBack();
  225 + return $this->fail('域名信息' . $actionStr . '失败', Code::USER_ERROR);
  226 + }
  227 + }
  228 +
  229 + /**
  230 + * 证书到期时间
  231 + * @return array
  232 + */
  233 + public function getDomainCertificateTime($domain)
  234 + {
  235 + $domain = trim($domain);
  236 + $data = [];
  237 + $context = stream_context_create(['ssl' => ['capture_peer_cert' => true]]); // Notice: only 7.0.7+ supports this
  238 + $stream = stream_socket_client("ssl://$domain:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);
  239 + if ($stream) {
  240 + $params = stream_context_get_params($stream);
  241 + $peerCertificate = openssl_x509_parse($params['options']['ssl']['peer_certificate']);
  242 + if ($peerCertificate) {
  243 + $validFrom = date_create_from_format('U', $peerCertificate['validFrom_time_t']); // 有效期开始时间
  244 + $validTo = date_create_from_format('U', $peerCertificate['validTo_time_t']); // 有效期结束时间
  245 + $data['validFrom'] = $validFrom->format('Y-m-d H:i:s');
  246 + $data['validTo'] = $validTo->format('Y-m-d H:i:s');
  247 + }
  248 + }
  249 + return $data;
  250 + }
  251 +
  252 + /**
  253 + * 获取所有正常域名信息
  254 + * @return Builder[]|Collection
  255 + */
  256 + public function getAllDomain()
  257 + {
  258 + return DomainInfo::query()->where('status', 1)
  259 + ->where('deleted', DomainInfo::DELETED_NORMAL)
  260 + ->orderBy('updated_at', 'desc')
  261 + ->get();
  262 + }
  263 +
  264 + /**
  265 + * 域名到期时间
  266 + * @return array
  267 + */
  268 + public function getDomainTime($domain)
  269 + {
  270 + $conJson = file_get_contents("http://openai.waimaoq.com/v1/whois_api?domain={$domain}");
  271 + $conArr = json_decode($conJson, true);
  272 + $data = [];
  273 + if ($conArr['code'] == 200) {
  274 + $con = $conArr['text'];
  275 + $data['domain'] = $domain;
  276 + $data['validFrom'] = $con['creation_date'];
  277 + $data['validTo'] = $con['expiration_date'];
  278 + }
  279 + return $data;
  280 + }
  281 +
  282 + /**
  283 + * 验证给定的值是否是有效的域名。
  284 + *
  285 + * @param mixed $value
  286 + * @return bool
  287 + */
  288 + public function validateDomain($value)
  289 + {
  290 + // 从域中删除任何空间或路径。
  291 + $domain = preg_replace('/\s|\/.*$/', '', $value);
  292 + // 验证域是否至少包含一个句点。
  293 + if (strpos($domain, '.') === false) {
  294 + return false;
  295 + }
  296 + // 验证域是否以句点开始或结束。
  297 + if (strpos($domain, '.') === 0 || strrpos($domain, '.') === strlen($domain) - 1) {
  298 + return false;
  299 + }
  300 + // 验证域是否不包含无效字符。
  301 + if (!preg_match('/^[a-zA-Z0-9\-\.]+$/', $domain)) {
  302 + return false;
  303 + }
  304 + // 验证域是否具有有效的顶级域。
  305 + $tld = substr($domain, strrpos($domain, '.') + 1);
  306 + if (!in_array($tld, ['com', 'net', 'org'])) { // 如有必要,添加更多TLD。
  307 + return false;
  308 + }
  309 + return true;
  310 + }
  311 +
  312 + /**
  313 + * 根据域名更新证书到期时间
  314 + * @param $id
  315 + * @param $updata
  316 + * @return array
  317 + * @throws AsideGlobalException
  318 + * @throws BsideGlobalException
  319 + */
  320 + public function updateDomain($id, $updata)
  321 + {
  322 + $isRes = DomainInfo::query()->where('id', $id)->where('deleted', DomainInfo::DELETED_NORMAL)->update($updata);
  323 + if ($isRes) {
  324 + return $this->success();
  325 + } else {
  326 + return $this->fail('更新域名到期时间失败');
  327 + }
  328 + }
  329 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Aside\Template;
  4 +
  5 +
  6 +use App\Http\Logic\Aside\BaseLogic;
  7 +use App\Models\Template\ATemplateChunk;
  8 +
  9 +/**
  10 + * 自定义块 模板
  11 + * @author:dc
  12 + * @time 2023/5/29 10:46
  13 + * Class TemplateChunkLogic
  14 + * @package App\Http\Logic\Aside\Template
  15 + */
  16 +class TemplateChunkLogic extends BaseLogic {
  17 +
  18 + public function __construct()
  19 + {
  20 + parent::__construct();
  21 +
  22 + $this->model = new ATemplateChunk();
  23 + }
  24 +
  25 +
  26 +
  27 +
  28 + public function save($param)
  29 + {
  30 +
  31 + $param['images'] = is_array($param['images']??'') ? json_encode($param['images']): '[]';
  32 + $param['video'] = is_array($param['video']??'') ? json_encode($param['video']): '[]';
  33 +
  34 +
  35 + return parent::save($param); // TODO: Change the autogenerated stub
  36 + }
  37 +
  38 +
  39 +}
@@ -64,7 +64,7 @@ class CountLogic extends BaseLogic @@ -64,7 +64,7 @@ class CountLogic extends BaseLogic
64 $data = [ 64 $data = [
65 'total_pv'=>$pv, 65 'total_pv'=>$pv,
66 'total_ip'=>$ip, 66 'total_ip'=>$ip,
67 - 'conversion_rate' => isset($inquiry_num) ? ($inquiry_num / $ip) * 100 : 0, 67 + 'conversion_rate' => (isset($inquiry_num) && !empty($inquiry_num)) ? ($inquiry_num / $ip) * 100 : 0,
68 ]; 68 ];
69 return $this->success($data); 69 return $this->success($data);
70 } 70 }
@@ -149,7 +149,7 @@ class CountLogic extends BaseLogic @@ -149,7 +149,7 @@ class CountLogic extends BaseLogic
149 public function referrer_count(){ 149 public function referrer_count(){
150 $data = DB::table('gl_customer_visit') 150 $data = DB::table('gl_customer_visit')
151 ->select('referrer_url', DB::raw('COUNT(*) as count'))->groupBy('referrer_url') 151 ->select('referrer_url', DB::raw('COUNT(*) as count'))->groupBy('referrer_url')
152 - ->orderBy('count','desc')->limit(8)->get()->toArray(); 152 + ->orderByDesc('count')->limit(8)->get()->toArray();
153 $total = DB::table('gl_customer_visit')->count(); 153 $total = DB::table('gl_customer_visit')->count();
154 $data = object_to_array($data); 154 $data = object_to_array($data);
155 foreach ($data as $k=>$v){ 155 foreach ($data as $k=>$v){
@@ -116,6 +116,6 @@ class CategoryLogic extends BaseLogic @@ -116,6 +116,6 @@ class CategoryLogic extends BaseLogic
116 */ 116 */
117 public function getProductNum($cate_id){ 117 public function getProductNum($cate_id){
118 $cate_ids = $this->model->getChildIdsArr($cate_id); 118 $cate_ids = $this->model->getChildIdsArr($cate_id);
119 - return CategoryRelated::whereIn('cate_id', $cate_ids)->count(); 119 + return CategoryRelated::whereIn('cate_id', $cate_ids)->distinct()->count('product_id');
120 } 120 }
121 } 121 }
@@ -92,6 +92,6 @@ class KeywordLogic extends BaseLogic @@ -92,6 +92,6 @@ class KeywordLogic extends BaseLogic
92 } 92 }
93 93
94 public function getProductNum($keyword_id){ 94 public function getProductNum($keyword_id){
95 - return KeywordRelated::where('keyword_id', $keyword_id)->count(); 95 + return KeywordRelated::where('keyword_id', $keyword_id)->distinct()->count('product_id');
96 } 96 }
97 } 97 }
@@ -86,15 +86,28 @@ class ProductLogic extends BaseLogic @@ -86,15 +86,28 @@ class ProductLogic extends BaseLogic
86 86
87 DB::beginTransaction(); 87 DB::beginTransaction();
88 try { 88 try {
89 - foreach ($ids as $id){  
90 - //删除路由映射  
91 - RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); 89 + foreach ($ids as $k => $id) {
92 90
93 - //删除分类关联  
94 - CategoryRelated::where('product_id', $id)->delete(); 91 + $info = $this->getCacheInfo($id);
  92 + if(!$info){
  93 + unset($ids[$k]);
  94 + continue;
  95 + }
95 96
96 - //删除关键词关联  
97 - KeywordRelated::where('product_id', $id)->delete(); 97 + if($info->status == Product::STATUS_RECYCLE){
  98 + //删除路由映射
  99 + RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
  100 +
  101 + //删除分类关联
  102 + CategoryRelated::where('product_id', $id)->delete();
  103 +
  104 + //删除关键词关联
  105 + KeywordRelated::where('product_id', $id)->delete();
  106 + }else{
  107 + //回收站
  108 + parent::save(['id' => $id, 'status' => Product::STATUS_RECYCLE]);
  109 + unset($ids[$k]);
  110 + }
98 } 111 }
99 parent::delete($ids); 112 parent::delete($ids);
100 113
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Logic\Bside; 3 namespace App\Http\Logic\Bside;
4 4
5 use App\Models\RouteMap; 5 use App\Models\RouteMap;
  6 +use App\Models\Template\BSetting;
6 use App\Models\Template\BTemplate; 7 use App\Models\Template\BTemplate;
7 8
8 /** 9 /**
@@ -36,9 +37,11 @@ class TemplateLogic extends BaseLogic @@ -36,9 +37,11 @@ class TemplateLogic extends BaseLogic
36 $data = $this->first($param['data_source'],$param['data_source_id']); 37 $data = $this->first($param['data_source'],$param['data_source_id']);
37 if($data){ 38 if($data){
38 $param['id'] = $data['id']; 39 $param['id'] = $data['id'];
  40 + }else{
  41 + $param['template_id'] = BSetting::_get($this->user['project_id'])['template_id'];
39 } 42 }
40 43
41 - parent::save($param); 44 + return parent::save($param);
42 45
43 } 46 }
44 47
@@ -82,6 +85,7 @@ class TemplateLogic extends BaseLogic @@ -82,6 +85,7 @@ class TemplateLogic extends BaseLogic
82 'project_id'=>$this->user['project_id'], 85 'project_id'=>$this->user['project_id'],
83 'data_source' => $source, 86 'data_source' => $source,
84 'data_source_id' => $source_id, 87 'data_source_id' => $source_id,
  88 + 'template_id' => BSetting::_get($this->user['project_id'])['template_id']
85 ])->first(); 89 ])->first();
86 } 90 }
87 91
@@ -8,7 +8,11 @@ use \App\Helper\Common as CommonHelper; @@ -8,7 +8,11 @@ use \App\Helper\Common as CommonHelper;
8 use App\Exceptions\AsideGlobalException; 8 use App\Exceptions\AsideGlobalException;
9 use App\Exceptions\BsideGlobalException; 9 use App\Exceptions\BsideGlobalException;
10 use App\Helper\Arr; 10 use App\Helper\Arr;
  11 +use App\Models\Devops\ServerInformationLog;
  12 +use Illuminate\Database\Eloquent\Model;
11 use Illuminate\Support\Facades\Cache; 13 use Illuminate\Support\Facades\Cache;
  14 +use Illuminate\Support\Facades\DB;
  15 +use Illuminate\Support\Facades\Log;
12 use Illuminate\Support\Facades\Schema; 16 use Illuminate\Support\Facades\Schema;
13 17
14 /** 18 /**
@@ -54,7 +58,7 @@ class Logic @@ -54,7 +58,7 @@ class Logic
54 * @param array $sort 58 * @param array $sort
55 * @param array $columns 59 * @param array $columns
56 * @param int $limit 60 * @param int $limit
57 - * @return array 61 + * @return array|Model
58 * @author zbj 62 * @author zbj
59 * @date 2023/4/13 63 * @date 2023/4/13
60 */ 64 */
@@ -170,7 +174,7 @@ class Logic @@ -170,7 +174,7 @@ class Logic
170 public function delete($ids, $map = []){ 174 public function delete($ids, $map = []){
171 $ids = array_filter(Arr::splitFilterToArray($ids), 'intval'); 175 $ids = array_filter(Arr::splitFilterToArray($ids), 'intval');
172 if(!$ids){ 176 if(!$ids){
173 - $this->fail('ID不能为空'); 177 + return $this->success();
174 } 178 }
175 179
176 foreach ($ids as $id){ 180 foreach ($ids as $id){
@@ -393,4 +397,40 @@ class Logic @@ -393,4 +397,40 @@ class Logic
393 public static function instance(...$params){ 397 public static function instance(...$params){
394 return new static(...$params); 398 return new static(...$params);
395 } 399 }
  400 +
  401 + /**
  402 + * 添加日志
  403 + * @param $log
  404 + * @param int $action 1:添加 2:修改 3:删除 4:搜索 5:详情 6:列表
  405 + * @param array $original 原始数据
  406 + * @param array $revised 修改后数据
  407 + * @param string $remarks 备注
  408 + * @return bool
  409 + */
  410 + public function log($log, int $action = ServerInformationLog::ACTION_ADD, array $original = [], array $revised = [], string $remarks = ''): bool
  411 + {
  412 + // $action 1:添加 2:修改 3:删除 4:恢复
  413 + $actionArr = $log->actionArr();
  414 + $actionStr = $actionArr[$action];
  415 + $ip = request()->getClientIp();
  416 + $url = request()->getRequestUri();
  417 + $method = request()->getMethod();
  418 + $userId = $this->uid ?? 0;
  419 + $log->user_id = $userId;
  420 + $log->action = $actionStr;
  421 + $log->original = json_encode($original);
  422 + $log->revised = json_encode($revised);
  423 + $log->ip = $ip;
  424 + $log->url = $url;
  425 + $log->method = $method;
  426 + $log->remarks = $remarks;
  427 + DB::beginTransaction();
  428 + if($log->save()){
  429 + DB::commit();
  430 + return true;
  431 + }
  432 + DB::rollBack();
  433 + Log::error('日志添加失败');
  434 + return false;
  435 + }
396 } 436 }
1 -<?php  
2 -  
3 -namespace App\Http\Middleware;  
4 -  
5 -use Illuminate\Http\Request;  
6 -use Closure;  
7 -  
8 -class AccessToken  
9 -{  
10 - /**  
11 - * Handle an incoming request.  
12 - *  
13 - * @param \Illuminate\Http\Request $request  
14 - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next  
15 - * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse  
16 - */  
17 - public function handle(Request $request, Closure $next)  
18 - {  
19 - session_start();  
20 - // 指定允许其他域名访问  
21 - $http_origin = "*";  
22 - if(isset($_SERVER['HTTP_ORIGIN'])){  
23 - $http_origin = $_SERVER['HTTP_ORIGIN'];  
24 - }  
25 - header("Access-Control-Allow-Origin:".$http_origin);  
26 - header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作  
27 - header('Access-Control-Allow-Credentials: true');  
28 - header('Access-Control-Max-Age: 1000');  
29 - header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。  
30 - if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {  
31 - exit;  
32 - }  
33 - return $next($request);  
34 - }  
35 -  
36 -}  
@@ -15,22 +15,19 @@ class EnableCrossRequestMiddleware @@ -15,22 +15,19 @@ class EnableCrossRequestMiddleware
15 */ 15 */
16 public function handle($request, Closure $next) 16 public function handle($request, Closure $next)
17 { 17 {
18 - $response = $next($request);  
19 - $origin = $request->server('HTTP_ORIGIN') ?: '';  
20 -// $allow_origin = [  
21 -// 'http://localhost:8080',  
22 -// ];  
23 -// if (in_array($origin, $allow_origin)) {  
24 - $header = [  
25 -// 'Access-Control-Allow-Origin' => $origin,  
26 - 'Access-Control-Allow-Origin' => '*',  
27 - 'Access-Control-Allow-Headers' => '*',  
28 - 'Access-Control-Expose-Headers' => '*',  
29 - 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS',  
30 - 'Access-Control-Allow-Credentials' => 'true',  
31 - ];  
32 - $response->headers->add($header);  
33 -// }  
34 - return $response; 18 + // 指定允许其他域名访问
  19 + $http_origin = "*";
  20 + if(isset($_SERVER['HTTP_ORIGIN'])){
  21 + $http_origin = $_SERVER['HTTP_ORIGIN'];
  22 + }
  23 + header("Access-Control-Allow-Origin:".$http_origin);
  24 + header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作
  25 + header('Access-Control-Allow-Credentials: true');
  26 + header('Access-Control-Max-Age: 1000');
  27 + header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。
  28 + if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
  29 + exit;
  30 + }
  31 + return $next($request);
35 } 32 }
36 } 33 }
  1 +<?php
  2 +
  3 +namespace App\Http\Requests\Aside\Domain;
  4 +
  5 +use App\Models\Aside\Domain\DomainInfo;
  6 +use Illuminate\Foundation\Http\FormRequest;
  7 +use Illuminate\Validation\Rule;
  8 +
  9 +class DomainInfoRequest extends FormRequest
  10 +{
  11 + /**
  12 + * Determine if the user is authorized to make this request.
  13 + *
  14 + * @return bool
  15 + */
  16 + public function authorize()
  17 + {
  18 + return true;
  19 + }
  20 +
  21 + /**
  22 + * Get the validation rules that apply to the request.
  23 + *
  24 + * @return array
  25 + */
  26 + public function rules()
  27 + {
  28 + $domain = new DomainInfo();
  29 + $status_tot_keys = array_keys($domain->StatusToArray());
  30 + $belong_to_keys = array_keys($domain->BelongToArray());
  31 + return [
  32 + 'domain' => 'required|max:200',
  33 + 'belong_to' => [
  34 + 'required',
  35 + Rule::in($belong_to_keys)
  36 + ],
  37 + 'status' => [
  38 + 'required',
  39 + Rule::in($status_tot_keys)
  40 + ]
  41 + ];
  42 + }
  43 +
  44 + public function messages()
  45 + {
  46 + return [
  47 + 'domain.required' => '域名不能为空',
  48 + 'domain.max' => '域名长度不能超过200个字符',
  49 + 'belong_to.required' => '域名所属不能为空',
  50 + 'belong_to.in' => '域名所属参数错误',
  51 + 'status.required' => '域名状态不能为空',
  52 + 'status.in' => '域名状态参数错误',
  53 + ];
  54 + }
  55 +
  56 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Requests\Aside\Template;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +use Illuminate\Validation\Rule;
  7 +
  8 +/**
  9 + * 自定义模板 块
  10 + * @author:dc
  11 + * @time 2023/5/29 10:57
  12 + * Class TemplateChunkRequest
  13 + * @package App\Http\Requests\Aside\Template
  14 + */
  15 +class TemplateChunkRequest extends FormRequest
  16 +{
  17 +
  18 + /**
  19 + * Determine if the user is authorized to make this request.
  20 + *
  21 + * @return bool
  22 + */
  23 + public function authorize()
  24 + {
  25 + return true;
  26 + }
  27 +
  28 + /**
  29 + * Get the validation rules that apply to the request.
  30 + *
  31 + * @return array
  32 + */
  33 + public function rules()
  34 + {
  35 + $rule = [
  36 + 'id' => ['required','integer'],
  37 + 'name' => ['required'],
  38 + 'type' => ['required'],
  39 + 'status' => ['required',Rule::in(0,1)],
  40 + 'sort' => ['required','integer'],
  41 + 'thumb' => ['required'],
  42 + 'html' => ['required'],
  43 + 'attr' => [],
  44 + 'images' => [],
  45 + 'video' => [],
  46 + ];
  47 +
  48 + // 更新场景
  49 + if($this->is('a/template/chunk/create')){
  50 + unset($rule['id']);
  51 + }
  52 + if($this->is('b/template/chunk/create')){
  53 + unset($rule['id']);
  54 + }
  55 +
  56 + return $rule;
  57 + }
  58 +
  59 +
  60 +
  61 + public function messages()
  62 + {
  63 + return [
  64 + 'id.required' => 'id必须',
  65 + 'id.integer' => 'id必须',
  66 +
  67 + 'name.required' => '名称必须',
  68 + 'type.required' => '类型必须',
  69 + 'status.integer' => '状态错误',
  70 + 'status.in' => '状态错误',
  71 +
  72 + 'sort.required' => '排序必须',
  73 + 'sort.integer' => '排序必须',
  74 + 'thumb.required' => '缩略图必须',
  75 +
  76 + 'html.required' => 'html代码必须',
  77 +// 'attr.required' => '其他必须',
  78 +
  79 + ];
  80 + }
  81 +
  82 +}
@@ -43,7 +43,7 @@ class TemplateRequest extends FormRequest @@ -43,7 +43,7 @@ class TemplateRequest extends FormRequest
43 43
44 44
45 // 删除 45 // 删除
46 - if(!$this->is('b/template/status')){ 46 + if($this->is('b/template/status')){
47 unset($rule['css']); 47 unset($rule['css']);
48 unset($rule['script']); 48 unset($rule['script']);
49 unset($rule['html']); 49 unset($rule['html']);
  1 +<?php
  2 +
  3 +namespace App\Models\Aside\Domain;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +/**
  8 + * Class DomainInfo
  9 + * @package App\Models\Aside\Domain
  10 + * @Author YiYuan-LIn
  11 + * @Date: 2019/5/16
  12 + * 域名信息模型
  13 + */
  14 +class DomainInfo extends Base
  15 +{
  16 + protected $table = 'gl_domain_info';
  17 +
  18 + // 软删除 0:正常 1:删除
  19 + /** @var int 软删除 - 正常 */
  20 + const DELETED_NORMAL = 0;
  21 + /** @var int 软删除 - 删除 */
  22 + const DELETED_DELETE = 1;
  23 +
  24 + protected $hidden = [
  25 + 'created_at',
  26 + 'updated_at'
  27 + ];
  28 +
  29 + /**
  30 + * 字段信息
  31 + * @return array
  32 + */
  33 + public function FieldsArray()
  34 + {
  35 + return [
  36 + 'domain' => '域名',
  37 + 'belong_to' => '域名归属',
  38 + 'status' => '域名状态',
  39 + 'domain_start_time' => '域名开始时间',
  40 + 'domain_end_time' => '域名结束时间',
  41 + 'certificate_start_time' => '证书开始时间',
  42 + 'certificate_end_time' => '证书结束时间',
  43 + ];
  44 + }
  45 +
  46 + /**
  47 + * 域名归属信息
  48 + * @return array
  49 + */
  50 + public function BelongToArray()
  51 + {
  52 + return [
  53 + 1 => '公司',
  54 + 2 => '客户',
  55 + ];
  56 + }
  57 +
  58 + public function BelongToStr($num)
  59 + {
  60 + return array_flip($this->BelongToArray())[$num];
  61 + }
  62 +
  63 + public function BelongTo($num)
  64 + {
  65 + return $this->BelongToArray()[$num];
  66 + }
  67 +
  68 + /**
  69 + * 域名状态信息
  70 + * @return array
  71 + */
  72 + public function StatusToArray()
  73 + {
  74 + return [
  75 + 0 => '未使用',
  76 + 1 => '使用中',
  77 + ];
  78 + }
  79 +
  80 + public function StatusToStr($num)
  81 + {
  82 + return array_flip($this->StatusToArray())[$num];
  83 + }
  84 +
  85 + /**
  86 + * 返回域名状态
  87 + * @param $num
  88 + *
  89 + * @return string
  90 + */
  91 + public function StatusTo($num)
  92 + {
  93 + return $this->StatusToArray()[$num];
  94 + }
  95 +
  96 + /**
  97 + * 返回服务器归属
  98 + * @param $value
  99 + *
  100 + * @return string
  101 + */
  102 + public function getBelongToAttribute($value)
  103 + {
  104 + return $this->BelongTo($value);
  105 + }
  106 +
  107 + /**
  108 + * 返回服务器状态
  109 + * @param $value
  110 + *
  111 + * @return string
  112 + */
  113 + public function getStatusAttribute($value)
  114 + {
  115 + return $this->StatusTo($value);
  116 + }
  117 +}
  1 +<?php
  2 +
  3 +namespace App\Models\Aside\Domain;
  4 +
  5 +use Illuminate\Database\Eloquent\Model;
  6 +
  7 +class DomainInfoLog extends Model
  8 +{
  9 + protected $table = 'gl_domain_info_log';
  10 +
  11 + public function getOriginalAttribute($value)
  12 + {
  13 + return json_decode($value, true);
  14 + }
  15 +
  16 + public function getRevisedAttribute($value)
  17 + {
  18 + return json_decode($value, true);
  19 + }
  20 +
  21 + /** @var int 日志添加 */
  22 + const ACTION_ADD = 1;
  23 + /** @var int 日志修改 */
  24 + const ACTION_UPDATE = 2;
  25 + /** @var int 日志删除 */
  26 + const ACTION_DELETE = 3;
  27 + /** @var int 日志恢复 */
  28 + const ACTION_RECOVER = 4;
  29 +
  30 +
  31 + /**
  32 + * @return string[]
  33 + */
  34 + public static function actionArr()
  35 + {
  36 + return [
  37 + 1 => '添加',
  38 + 2 => '修改',
  39 + 3 => '删除',
  40 + 4 => '恢复',
  41 + ];
  42 + }
  43 +}
@@ -8,8 +8,6 @@ class ServerInformation extends Model @@ -8,8 +8,6 @@ class ServerInformation extends Model
8 { 8 {
9 9
10 protected $table = 'gl_server_information'; 10 protected $table = 'gl_server_information';
11 - const CREATED_AT = 'create_at';  
12 - const UPDATED_AT = 'update_at';  
13 11
14 // 软删除 0:正常 1:删除 12 // 软删除 0:正常 1:删除
15 const DELETED_NORMAL = 0; 13 const DELETED_NORMAL = 0;
@@ -44,6 +42,11 @@ class ServerInformation extends Model @@ -44,6 +42,11 @@ class ServerInformation extends Model
44 ]; 42 ];
45 } 43 }
46 44
  45 + public function ServiceStr($num)
  46 + {
  47 + return array_flip($this->ServiceArray())[$num];
  48 + }
  49 +
47 /** 50 /**
48 * 字段信息 51 * 字段信息
49 * @return array 52 * @return array
@@ -73,6 +76,11 @@ class ServerInformation extends Model @@ -73,6 +76,11 @@ class ServerInformation extends Model
73 ]; 76 ];
74 } 77 }
75 78
  79 + public function BelongToStr($num)
  80 + {
  81 + return array_flip($this->BelongToArray())[$num];
  82 + }
  83 +
76 public function BelongTo($num) 84 public function BelongTo($num)
77 { 85 {
78 return $this->BelongToArray()[$num]; 86 return $this->BelongToArray()[$num];
@@ -7,8 +7,6 @@ use Illuminate\Database\Eloquent\Model; @@ -7,8 +7,6 @@ use Illuminate\Database\Eloquent\Model;
7 class ServerInformationLog extends Model 7 class ServerInformationLog extends Model
8 { 8 {
9 protected $table = 'gl_server_information_log'; 9 protected $table = 'gl_server_information_log';
10 - const CREATED_AT = 'create_at';  
11 - const UPDATED_AT = 'update_at';  
12 10
13 public function getOriginalAttribute($value) 11 public function getOriginalAttribute($value)
14 { 12 {
  1 +<?php
  2 +
  3 +namespace App\Models\Template;
  4 +
  5 +use Illuminate\Database\Eloquent\SoftDeletes;
  6 +
  7 +/**
  8 + * 自定义块 模板块
  9 + * @author:dc
  10 + * @time 2023/5/29 10:39
  11 + * Class ATemplateChunk
  12 + * @package App\Models\Template
  13 + */
  14 +class ATemplateChunk extends \App\Models\Base{
  15 +
  16 +
  17 + protected $table = 'gl_aside_template_chunk';
  18 +
  19 +
  20 + protected $hidden = ['deleted_at'];
  21 +
  22 +
  23 + use SoftDeletes;
  24 +
  25 +
  26 + public static $typeMap = [
  27 + 'index' => '首页',
  28 + 'product' => '商品列表',
  29 + 'product_info' => '商品详情',
  30 + 'blogs' => '博客列表',
  31 + 'blogs_info' => '博客详情',
  32 + 'page' => '单页',
  33 + 'news' => '新闻列表',
  34 + 'news_info' => '新闻详情',
  35 + ];
  36 +
  37 +
  38 +
  39 + public function getImagesAttribute($val)
  40 + {
  41 + return $val ? json_decode($val,true) : [];
  42 + }
  43 +
  44 + public function getVideoAttribute($val)
  45 + {
  46 + return $val ? json_decode($val,true) : [];
  47 + }
  48 +
  49 +
  50 +}
@@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Facade; @@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Facade;
11 * @method static array filePut(string $filename, string $content, string|array $config="default") 11 * @method static array filePut(string $filename, string $content, string|array $config="default")
12 * @method static string url2path(string $url, string|array $disk="upload") 12 * @method static string url2path(string $url, string|array $disk="upload")
13 * @method static string path2url(string $path, string|array $disk="upload") 13 * @method static string path2url(string $path, string|array $disk="upload")
  14 + * @method static array lists(string $config,array $ext=[])
14 */ 15 */
15 class Upload extends Facade 16 class Upload extends Facade
16 { 17 {
@@ -272,4 +272,33 @@ class UploadService extends BaseService @@ -272,4 +272,33 @@ class UploadService extends BaseService
272 $this->config(); 272 $this->config();
273 return Storage::disk($this->config['disk'])->url($path); 273 return Storage::disk($this->config['disk'])->url($path);
274 } 274 }
  275 +
  276 + /**
  277 + * 文件列表
  278 + * @return array
  279 + * @author:dc
  280 + * @time 2023/5/29 11:49
  281 + */
  282 + public function lists($config,array $ext=[]){
  283 + $this->config($config);
  284 + $disk = Storage::disk($this->config['disk']);
  285 + $lists = $disk->allFiles();
  286 +
  287 +
  288 + if($ext){
  289 + foreach ($lists as $k=>$list){
  290 + $list = explode('.',$list);
  291 + if(!in_array(end($list),$ext)){
  292 + unset($lists[$k]);
  293 +
  294 + }else{
  295 + $lists[$k] = $disk->url($lists[$k]);
  296 + }
  297 +
  298 + }
  299 + }
  300 +
  301 +
  302 + return $lists;
  303 + }
275 } 304 }
@@ -15,7 +15,7 @@ return [ @@ -15,7 +15,7 @@ return [
15 | 15 |
16 */ 16 */
17 17
18 - 'paths' => ['api/*', 'sanctum/csrf-cookie'], 18 + 'paths' => ['a/*', 'b/*', 'sanctum/csrf-cookie'],
19 19
20 'allowed_methods' => ['*'], 20 'allowed_methods' => ['*'],
21 21
@@ -6,7 +6,8 @@ use \Illuminate\Support\Facades\Route; @@ -6,7 +6,8 @@ use \Illuminate\Support\Facades\Route;
6 use \App\Http\Controllers\Aside; 6 use \App\Http\Controllers\Aside;
7 7
8 //必须登录验证的路由组 8 //必须登录验证的路由组
9 -Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上web的中间件 9 +
  10 +Route::middleware(['web','accesstoken'])->group(function (){ //admin用渲染默认要加上web的中间件
10 Route::middleware(['aloginauth'])->group(function () { 11 Route::middleware(['aloginauth'])->group(function () {
11 Route::get('/', [Aside\IndexController::class, 'index'])->name('admin.home.white'); 12 Route::get('/', [Aside\IndexController::class, 'index'])->name('admin.home.white');
12 Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white'); 13 Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white');
@@ -124,6 +125,19 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w @@ -124,6 +125,19 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w
124 Route::post('/save_follow', [Aside\Task\TaskController::class, 'save_follow'])->name('admin.task_save_follow'); 125 Route::post('/save_follow', [Aside\Task\TaskController::class, 'save_follow'])->name('admin.task_save_follow');
125 }); 126 });
126 127
  128 + // 域名
  129 + Route::prefix('domain')->group(function () {
  130 + Route::get('/', [Aside\Domain\DomainInfoController::class, 'lists'])->name('admin.domain'); // 列表 | 搜索
  131 + Route::get('/info', [Aside\Domain\DomainInfoController::class, 'info'])->name('admin.domain_info'); // 详情
  132 + Route::get('/delete_info', [Aside\Domain\DomainInfoController::class, 'getDeleteDomainInfo'])->name('admin.domain_delete_info'); // 删除信息
  133 + Route::post('/add', [Aside\Domain\DomainInfoController::class, 'add'])->name('admin.domain_save'); // 添加
  134 + Route::post('/edit', [Aside\Domain\DomainInfoController::class, 'edit'])->name('admin.domain_edit'); // 编辑
  135 + Route::any('/delete', [Aside\Domain\DomainInfoController::class, 'delete'])->name('admin.domain_delete'); // 删除
  136 + Route::get('/delete_list', [Aside\Domain\DomainInfoController::class, 'delete_list'])->name('admin.domain_delete_list'); // 删除列表
  137 + Route::any('/restore', [Aside\Domain\DomainInfoController::class, 'restore'])->name('admin.domain_restore'); // 恢复
  138 + Route::get('/log', [Aside\Domain\DomainInfoLogController::class, 'lists'])->name('admin.domain_log_lists'); // 日志
  139 + });
  140 +
127 //运维 141 //运维
128 Route::prefix('devops')->group(function () { 142 Route::prefix('devops')->group(function () {
129 //服务器配置 143 //服务器配置
@@ -135,7 +149,7 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w @@ -135,7 +149,7 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w
135 149
136 // 服务器添加|修改|删除 150 // 服务器添加|修改|删除
137 Route::prefix('server')->group(function () { 151 Route::prefix('server')->group(function () {
138 - Route::get('/', [Aside\Devops\ServerInformationController::class, 'lists'])->name('admin.devops.bt'); // 列表 152 + Route::get('/', [Aside\Devops\ServerInformationController::class, 'lists'])->name('admin.devops.bt'); // 列表 | 搜索
139 Route::get('/info', [Aside\Devops\ServerInformationController::class, 'getServerInfo'])->name('admin.devops.bt_info'); // 获取信息 153 Route::get('/info', [Aside\Devops\ServerInformationController::class, 'getServerInfo'])->name('admin.devops.bt_info'); // 获取信息
140 Route::get('/delete_info', [Aside\Devops\ServerInformationController::class, 'getDeleteServerInfo'])->name('admin.devops.bt_delete_info'); // 删除信息 154 Route::get('/delete_info', [Aside\Devops\ServerInformationController::class, 'getDeleteServerInfo'])->name('admin.devops.bt_delete_info'); // 删除信息
141 Route::post('/add', [Aside\Devops\ServerInformationController::class, 'add'])->name('admin.devops.bt_add'); // 添加 155 Route::post('/add', [Aside\Devops\ServerInformationController::class, 'add'])->name('admin.devops.bt_add'); // 添加
@@ -143,10 +157,8 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w @@ -143,10 +157,8 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w
143 Route::get('/delete', [Aside\Devops\ServerInformationController::class, 'delete'])->name('admin.devops.bt_delete'); // 删除 157 Route::get('/delete', [Aside\Devops\ServerInformationController::class, 'delete'])->name('admin.devops.bt_delete'); // 删除
144 Route::get('/delete_list', [Aside\Devops\ServerInformationController::class, 'delete_list'])->name('admin.devops.bt_delete_list'); // 删除列表 158 Route::get('/delete_list', [Aside\Devops\ServerInformationController::class, 'delete_list'])->name('admin.devops.bt_delete_list'); // 删除列表
145 Route::get('/restore', [Aside\Devops\ServerInformationController::class, 'restore'])->name('admin.devops.bt_restore'); //恢复数据 159 Route::get('/restore', [Aside\Devops\ServerInformationController::class, 'restore'])->name('admin.devops.bt_restore'); //恢复数据
146 - Route::get('/search', [Aside\Devops\ServerInformationController::class, 'search'])->name('admin.devops.bt_search'); //搜索  
147 Route::get('/log', [Aside\Devops\ServerInformationLogController::class, 'lists'])->name('admin.devops.bt_log_lists'); //日志列表 160 Route::get('/log', [Aside\Devops\ServerInformationLogController::class, 'lists'])->name('admin.devops.bt_log_lists'); //日志列表
148 }); 161 });
149 -  
150 }); 162 });
151 163
152 // 自定义页面 模板,头部底部 164 // 自定义页面 模板,头部底部
@@ -161,10 +173,13 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w @@ -161,10 +173,13 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w
161 Route::post('/html/{template_id}/insert', [\App\Http\Controllers\Aside\TemplateController::class, 'html_insert'])->where('template_id','\d+')->name('admin.template_insert.html'); 173 Route::post('/html/{template_id}/insert', [\App\Http\Controllers\Aside\TemplateController::class, 'html_insert'])->where('template_id','\d+')->name('admin.template_insert.html');
162 Route::delete('/html/{template_id}/delete/{id}', [\App\Http\Controllers\Aside\TemplateController::class, 'html_delete'])->where('template_id','\d+')->where('id','\d+')->name('admin.template_delete.html'); 174 Route::delete('/html/{template_id}/delete/{id}', [\App\Http\Controllers\Aside\TemplateController::class, 'html_delete'])->where('template_id','\d+')->where('id','\d+')->name('admin.template_delete.html');
163 Route::get('/html/type', [\App\Http\Controllers\Aside\TemplateController::class, 'html_type'])->name('admin.template_type.html'); 175 Route::get('/html/type', [\App\Http\Controllers\Aside\TemplateController::class, 'html_type'])->name('admin.template_type.html');
164 - });  
165 -  
166 -  
167 176
  177 + // 自定义块,模板块
  178 + Route::get('/chunk/lists', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_lists'])->name('admin.template.chunk_lists');
  179 + Route::post('/chunk/create', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_save'])->name('admin.template.chunk_create');
  180 + Route::post('/chunk/update', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_save'])->name('admin.template.chunk_update');
  181 + Route::delete('/chunk/delete/{chunk_id}', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_delete'])->where('chunk_id','\d+')->name('admin.template.chunk_delete');
  182 + });
168 }); 183 });
169 184
170 185
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 use Illuminate\Support\Facades\Route; 6 use Illuminate\Support\Facades\Route;
7 7
8 //必须登录验证的路由组 8 //必须登录验证的路由组
9 -Route::middleware(['bloginauth','accesstoken'])->group(function () { 9 +Route::middleware(['bloginauth'])->group(function () {
10 //登录用户编辑个人资料 10 //登录用户编辑个人资料
11 Route::any('/edit_info', [\App\Http\Controllers\Bside\ComController::class, 'edit_info'])->name('edit_info'); 11 Route::any('/edit_info', [\App\Http\Controllers\Bside\ComController::class, 'edit_info'])->name('edit_info');
12 Route::any('/logout', [\App\Http\Controllers\Bside\ComController::class, 'logout'])->name('logout'); 12 Route::any('/logout', [\App\Http\Controllers\Bside\ComController::class, 'logout'])->name('logout');
@@ -187,6 +187,7 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () { @@ -187,6 +187,7 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () {
187 //文件操作 187 //文件操作
188 Route::prefix('file')->group(function () { 188 Route::prefix('file')->group(function () {
189 Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload'); 189 Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload');
  190 + Route::get('/lists', [\App\Http\Controllers\Bside\FileController::class, 'lists'])->name('file_lists');
190 }); 191 });
191 //图片操作 192 //图片操作
192 Route::prefix('images')->group(function () { 193 Route::prefix('images')->group(function () {
@@ -232,9 +233,22 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () { @@ -232,9 +233,22 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () {
232 // Route::get('/custom-chunk', [\App\Http\Controllers\Bside\TemplateController::class, 'customChunk'])->name('bside_template_custom_chunk'); 233 // Route::get('/custom-chunk', [\App\Http\Controllers\Bside\TemplateController::class, 'customChunk'])->name('bside_template_custom_chunk');
233 Route::get('/get_type', [\App\Http\Controllers\Bside\TemplateController::class, 'get_type'])->name('bside_template_type'); 234 Route::get('/get_type', [\App\Http\Controllers\Bside\TemplateController::class, 'get_type'])->name('bside_template_type');
234 Route::get('/get_html', [\App\Http\Controllers\Bside\TemplateController::class, 'get_html'])->name('bside_template_get_html'); 235 Route::get('/get_html', [\App\Http\Controllers\Bside\TemplateController::class, 'get_html'])->name('bside_template_get_html');
235 - Route::get('/save_html', [\App\Http\Controllers\Bside\TemplateController::class, 'save_html'])->name('bside_template_save_html'); 236 + Route::post('/save_html', [\App\Http\Controllers\Bside\TemplateController::class, 'save_html'])->name('bside_template_save_html');
236 Route::get('/status', [\App\Http\Controllers\Bside\TemplateController::class, 'status'])->name('bside_template_status'); 237 Route::get('/status', [\App\Http\Controllers\Bside\TemplateController::class, 'status'])->name('bside_template_status');
  238 +
  239 +
  240 + // 自定义模板的 块。
  241 + Route::get('/chunk', [\App\Http\Controllers\Bside\TemplateController::class, 'chunk'])->name('bside_template_chunk');
  242 +
  243 + Route::post('/chunk/create', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_save'])->name('admin.template.chunk_create');
  244 + Route::post('/chunk/update', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_save'])->name('admin.template.chunk_update');
  245 + Route::delete('/chunk/delete/{chunk_id}', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_delete'])->where('chunk_id','\d+')->name('admin.template.chunk_delete');
  246 +
  247 +
237 }); 248 });
  249 +
  250 +
  251 +
238 // 自定义页面,专题页 252 // 自定义页面,专题页
239 Route::prefix('custom')->group(function () { 253 Route::prefix('custom')->group(function () {
240 Route::get('/', [\App\Http\Controllers\Bside\CustomController::class, 'index'])->name('bside_custom'); 254 Route::get('/', [\App\Http\Controllers\Bside\CustomController::class, 'index'])->name('bside_custom');