作者 张关杰

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

正在显示 38 个修改的文件 包含 1384 行增加832 行删除
<?php
namespace App\Console\Commands\Domain;
use App\Exceptions\AsideGlobalException;
use App\Exceptions\BsideGlobalException;
use App\Helper\AyrShare as AyrShareHelper;
use App\Http\Logic\Aside\Domain\DomainInfoLogic;
use App\Models\AyrShare\AyrRelease as AyrReleaseModel;
use Carbon\Carbon;
use App\Models\AyrShare\AyrShare as AyrShareModel;
use Illuminate\Console\Command;
class DomainTime extends Command
{
public $error = 0;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'domain_time';
/**
* The console command description.
*
* @var string
*/
protected $description = '域名定时任务 更新域名|证书到期时间';
/**
* @name :(定时执行)handle
* @author :lyh
* @method :post
* @time :2023/5/12 14:48
*/
public function handle()
{
echo $this->update_domain_time();
}
/**
* 更新域名|证书到期时间
* @return int|mixed|void
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
protected function update_domain_time()
{
$domainCon = new DomainInfoLogic();
$all = $domainCon->getAllDomain();
$all = $all->toArray();
if ( empty( $all ) ) {
$this->info( '未获取到数据' );
return;
}
foreach ( $all as $item ) {
$domain = $item['domain'];
// 域名到期时间
$domainT = $domainCon->getDomainTime( $domain );
if ( $domainT ) {
$domain_time = $item['domain_end_time'];
$domainValidFrom = $domainT['validFrom'];
$domainValidTo = $domainT['validTo'];
if ( strtotime( $domain_time ) < strtotime( $domainValidTo ) ) {
$this->info( $domain . '域名到期时间更新成功' );
$domainCon->updateDomain( $item['id'], [ 'domain_end_time' => $domainValidTo ] );
}
} else {
$this->error++;
$this->info( $domain . '域名到期时间获取失败' );
}
// 证书到期时间
$certificateT = $domainCon->getDomainCertificateTime( $domain );
if ( $certificateT ) {
$certificate_time = $item['certificate_end_time'];
$certificateValidFrom = $certificateT['validFrom'];
$certificateValidTo = $certificateT['validTo'];
if ( strtotime( $certificate_time ) < strtotime( $certificateValidTo ) ) {
$this->info( $domain . '证书到期时间更新成功' );
$domainCon->updateDomain( $item['id'], [ 'certificate_end_time' => $certificateValidTo ] );
}
} else {
$this->error++;
$this->info( $domain . '证书到期时间获取失败' );
}
}
return $this->error;
}
}
... ...
... ... @@ -27,6 +27,7 @@ class Kernel extends ConsoleKernel
$schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
$schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
$schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
// $schedule->command('domain_time')->dailyAt('01:00')->withoutOverlapping(1); // 更新域名|证书结束时间,每天凌晨1点执行一次
}
/**
... ...
... ... @@ -22,9 +22,25 @@ class ServerInformationController extends BaseController
*/
public function lists($deleted = ServerInformation::DELETED_NORMAL)
{
$request = $this->param;
$search = [];
$search_array = [
'ip' => 'ip',
'title' => 'title'
];
foreach ($search_array as $key => $item) {
if (isset($request[$key]) && $request[$key]) {
$search[$item] = $request[$key];
}
}
$size = request()->input('size', $this->row);
$data = ServerInformation::query()->select(['id', 'title', 'ip'])
->where('deleted', $deleted)
$query = ServerInformation::query()->select(['id', 'title', 'ip']);
if ($search) {
foreach ($search as $key => $item) {
$query = $query->Where("{$key}", 'like', "%{$item}%");
}
}
$data = $query->where('deleted', $deleted)
->orderBy('id', 'desc')
->paginate($size);
return $this->response('success', Code::SUCCESS, $data);
... ... @@ -58,9 +74,10 @@ class ServerInformationController extends BaseController
public function edit(ServerInformationRequest $serverInformationRequest, ServerInformationLogic $serverInformationLogic)
{
$serverInformationRequest->validate([
'id' => ['required'],
'id' => 'required|integer',
], [
'id.required' => 'ID不能为空',
'id.integer' => 'ID必须为整数',
]);
$serverInformationLogic->update();
$this->response('服务器修改成功!');
... ... @@ -150,6 +167,7 @@ class ServerInformationController extends BaseController
}
/**
* 获取软删除的服务器信息
* @return JsonResponse
* @throws AsideGlobalException
* @throws BsideGlobalException
... ...
<?php
namespace App\Http\Controllers\Aside\Domain;
use App\Enums\Common\Code;
use App\Exceptions\AsideGlobalException;
use App\Exceptions\BsideGlobalException;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Domain\DomainInfoLogic;
use App\Http\Requests\Aside\Domain\DomainInfoRequest;
use App\Models\Aside\Domain\DomainInfo;
use App\Models\Aside\Domain\DomainInfoLog;
use Illuminate\Http\JsonResponse;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* Class DomainInfoController
* @package App\Http\Controllers\Aside 域名管理
*/
class DomainInfoController extends BaseController
{
/**
* 域名列表
* @param int $deleted
* @return JsonResponse
*/
public function lists(int $deleted = DomainInfo::DELETED_NORMAL)
{
$request = $this->param;
$search = [];
$search_array = [
'domain' => 'domain',
'belong' => 'belong_to',
'domain_time' => 'domain_end_time',
'certificate_time' => 'certificate_end_time'
];
foreach ($search_array as $key => $item) {
if (isset($request[$key]) && $request[$key]) {
$search[$item] = $request[$key];
}
}
// 每页条数
$size = request()->input('size', $this->row);
$query = DomainInfo::query()->select(['id', 'domain', 'belong_to']);
if ($search) {
foreach ($search as $key => $item) {
$query = $query->Where("{$key}", 'like', "%{$item}%");
}
}
$data = $query->where('deleted', $deleted)
->orderBy('id', 'desc')
->paginate($size);
return $this->response('success', Code::SUCCESS, $data);
}
/**
* 获取软删除的数据
* @return JsonResponse
*/
public function delete_list()
{
return $this->lists(DomainInfo::DELETED_DELETE);
}
/**
* 添加域名
* @param DomainInfoRequest $domainInfoRequest
* @param DomainInfoLogic $domainInfoLogic
* @return void
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function add(DomainInfoRequest $domainInfoRequest, DomainInfoLogic $domainInfoLogic)
{
$domainInfoRequest->validated();
$domainInfoLogic->create();
$this->response('域名添加成功!');
}
/**
* 编辑域名
* @param DomainInfoRequest $domainInfoRequest
* @param DomainInfoLogic $domainInfoLogic
* @return void
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function edit(DomainInfoRequest $domainInfoRequest, DomainInfoLogic $domainInfoLogic)
{
$domainInfoRequest->validate([
'id' => 'required|integer'
], [
'id.required' => 'id不能为空',
'id.integer' => 'id参数错误'
]);
$domainInfoLogic->update();
$this->response('域名修改成功!');
}
/**
* 删除
* @param DomainInfoLogic $domainInfoLogic
* @return void
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function delete(DomainInfoLogic $domainInfoLogic)
{
$domainInfoLogic->get_batch_update();
$this->response('域名删除成功!');
}
/**
* 恢复数据
* @param DomainInfoLogic $domainInfoLogic
* @return void
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function restore(DomainInfoLogic $domainInfoLogic)
{
$domainInfoLogic->get_batch_update(DomainInfoLog::ACTION_RECOVER, DomainInfo::DELETED_DELETE);
$this->response('域名恢复成功!');
}
/**
* 域名信息
* @param int $deleted
* @return JsonResponse
* @throws AsideGlobalException
* @throws BsideGlobalException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function info(int $deleted = DomainInfo::DELETED_NORMAL)
{
$domainInfoLogic = new DomainInfoLogic();
$data = $domainInfoLogic->domainInfo($deleted);
if (!$data) {
return $this->response('域名信息不存在', Code::USER_ERROR);
}
return $this->success($data->toArray());
}
/**
* 获取软删除域名信息
* @return JsonResponse
* @throws AsideGlobalException
* @throws BsideGlobalException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function getDeleteDomainInfo()
{
return $this->info(DomainInfo::DELETED_DELETE);
}
}
... ...
<?php
namespace App\Http\Controllers\Aside\Domain;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Aside\Domain\DomainInfoLog;
use Illuminate\Http\Request;
class DomainInfoLogController extends BaseController
{
public function lists(Request $request)
{
$size = $request->input('size', $this->row);
$data = DomainInfoLog::query()
->orderBy('id', 'desc')
->paginate($size);
return $this->response('success', Code::SUCCESS, $data);
}
}
... ...
<?php
namespace App\Http\Controllers\Aside\Template;
use App\Http\Controllers\Aside\BaseController;
/**
* 模板header footer
* @author:dc
* @time 2023/4/26 11:10
* Class HeaderFooterController
* @package App\Http\Controllers\Aside\Template
*/
class HeaderFooterController extends BaseController
{
}
... ... @@ -3,9 +3,12 @@
namespace App\Http\Controllers\Aside;
use App\Enums\Common\Code;
use App\Http\Logic\Aside\Template\TemplateChunkLogic;
use App\Http\Logic\Aside\Template\TemplateLogic;
use App\Http\Requests\Aside\Template\TemplateChunkRequest;
use App\Http\Requests\Aside\Template\TemplateRequest;
use App\Models\Template\ATemplate;
use App\Models\Template\ATemplateChunk;
use App\Models\Template\ATemplateHtml;
use Illuminate\Validation\Rule;
... ... @@ -195,4 +198,48 @@ class TemplateController extends BaseController
/**
* 自定义界面,块
* @author:dc
* @time 2023/5/29 10:27
*/
public function chunk_lists(){
$lists = TemplateChunkLogic::instance()->getList()->toArray();
return $this->success($lists);
}
/**
* 自定义界面,块 保存
* @author:dc
* @time 2023/5/29 10:37
*/
public function chunk_save(TemplateChunkRequest $request){
$data = TemplateChunkLogic::instance()->save($request->validated());
return $this->success(TemplateChunkLogic::instance()->getInfo($data['id']));
}
/**
* 自定义界面,块 删除
* @author:dc
* @time 2023/5/29 10:38
*/
public function chunk_delete($chunk_id){
TemplateChunkLogic::instance()->delete($chunk_id);
return $this->response('删除成功');
}
}
... ...
... ... @@ -39,4 +39,31 @@ class FileController extends BaseController
$path = Upload::url2path($this->param['url'] ?? '');
return Storage::disk('upload')->download($path);
}
/**
* 文件列表
* @author:dc
* @time 2023/5/29 11:42
*/
public function lists(){
$type = \request()->get('type');
switch ($type){
case 'video':{
$ext = ['mp4','avi'];
break;
}
default:{
$ext = ['png','jpg','jpeg','gif'];
break;
}
}
$files = Upload::lists($this->param['config'] ?? 'default',$ext);
return $this->success($files);
}
}
... ...
... ... @@ -37,7 +37,7 @@ class CountController extends BaseController
//TODO::询盘国家统计
$data['country_data'] = $countLogic->inquiry_country_count();
//TODO::来源排名
$data['country_data'] = $countLogic->referrer_count();
$data['referrer_count'] = $countLogic->referrer_count();
//TODO::访问国家前10
$data['access_country_count'] = $countLogic->access_country_count();
//TODO::企业中心服务
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Bside;
use App\Enums\Common\Code;
use App\Http\Logic\Aside\Template\TemplateChunkLogic;
use App\Http\Logic\Bside\TemplateLogic;
use App\Http\Requests\Bside\TemplateRequest;
use App\Models\Template\ATemplate;
... ... @@ -119,583 +120,12 @@ class TemplateController extends BaseController
public function get_html(){
$source = $this->param['source']??'';
$source_id = $this->param['source_id']??0;
if($source=='index'){
$def = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Example Template for Bootstrap</title>
<link href="../../css/editor.css" rel="stylesheet">
<script src="../../js/jquery.min.js"></script>
<script src="../../js/popper.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<link href="example.css" rel="stylesheet">
<script src="../../libs/aos/aos.js"></script>
<link href="../../libs/aos/aos.css" rel="stylesheet">
<script src="../../libs/swiper/swiper.js"></script>
<link href="../../libs/swiper/swiper.css" rel="stylesheet">
</head>
<body>
<header noAction id="globalso-header" class="web_head testnoaction screen-xxl sticky-top ">
<div class=" layout">
<div class=" d-flex align-items-center justify-content-between py-md-4">
<div class="logo w-25 w-sm-auto"><a href="#"><img class="img-fluid" src="img/logo.png" alt=""></a></div>
<nav class="navbar navbar-expand-md navbar-dark flex-fill justify-content-end mx-2 pe-md-5">
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#navMenu"
aria-controls="navMenu">
<span class="navbar-toggler-icon"></span>
</button>
<ul class="nav column-gap-5 justify-content-end text-white d-none d-md-flex">
<li><a href="#">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-bs-toggle="dropdown">Products</a>
<ul class="dropdown-menu fs-6 text-body shadow-sm border-0">
<li><a href="#" class="dropdown-item py-2">Product Information</a></li>
<li><a href="#" class="dropdown-item py-2">Change of Insurance</a></li>
<li><a href="#" class="dropdown-item py-2">Traveling Oxygen Program</a></li>
<li><a href="#" class="dropdown-item py-2">Contact</a></li>
</ul>
</li>
<li><a href="#">News</a></li>
<li><a href="#">Download</a></li>
<li><a href="#">FAQ</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<div class="d-flex align-items-center justify-content-end">
<div class="search">
<button type="button" class="btn border-0" data-bs-toggle="dropdown">
<svg viewBox="0 0 24 24" width="18" height="18" stroke="#ffffff" stroke-width="2"
fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
</button>
<div class="dropdown-menu p-3 shadow-sm border-0">
<form action="">
<div class="d-flex mb-2">
<input type="text" class="form-control" name="search" placeholder="Start Typing...">
<button class="btn btn-search border-0" type="submit">
<svg viewBox="0 0 24 24" width="18" height="18" stroke="#333333"
stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"
class="css-i6dzq1">
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
</button>
</div>
<p class="search-attr">Hit enter to search or ESC to close</p>
</form>
</div>
</div>
<div class="change-language ms-md-4">
<div role="button" class="dropdown-toggle text-white d-flex align-items-center"
data-bs-toggle="dropdown">
<b class="country-flag language-flag-en"></b> <span>English</span>
</div>
<div class="dropdown-menu shadow-sm border-0">
<div class="d-flex flex-wrap p-3 text-body">
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="English">
<b class="country-flag language-flag-en"></b>
<span>English</span>
</a>
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Françai">
<b class="country-flag language-flag-fr"></b>
<span>Françai</span>
</a>
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Español">
<b class="country-flag language-flag-es"></b>
<span>Español</span>
</a>
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Deutsch">
<b class="country-flag language-flag-de"></b>
<span>Deutsch</span>
</a>
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Română">
<b class="country-flag language-flag-ro"></b>
<span>Română</span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
<main class="web_main" id="globalso-main">
<section class="slider_banner screen-full position-relative testnoaction" data-aos="fade-up"
data-aos-delay="500" id="banner">
<div class="layout">
<div class="swiper-wrapper">
<div class="swiper-slide"><a href="#"> <img class=" img-fluid" src="img/banner01.jpg"
alt="slide1" /></a>
</div>
<div class="swiper-slide"><a href="#"> <img class=" img-fluid" src="img/banner02.jpg"
alt="slide2" /></a>
</div>
<div class="swiper-slide"><a href="#"> <img class=" img-fluid" src="img/banner01.jpg"
alt="slide3" /></a>
</div>
</div>
<div class="index-swiper-buttons">
<div class="swiper-button-prev la"></div>
<div class="swiper-button-next la"></div>
</div>
<div class="swiper-pagination">
</div>
</section>
<section noActionSection noAction class="product-1 screen-xxl mb-5 mt-0 block-item-4 testnoaction">
<div class="layout">
<div class="row gx-0">
<div class="index-hd text-center" data-aos="fade-up" data-aos-delay="500">
<h2 class="fs-1 fw-bold">New Products</h2>
</div>
<div class="index-bd default-product-items d-flex flex-wrap" data-aos="fade-up"
data-aos-delay="500">
<div class="default-product-item block-item" style="padding:10px">
<figure class="item-inner" style="padding:10px">
<div class="item-img" style="padding:10px">
<a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>
</div>
<figcaption class="item-info">
<h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>
</figcaption>
</figure>
</div>
<div class="default-product-item block-item">
<figure class="item-inner">
<div class="item-img">
<a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>
</div>
<figcaption class="item-info">
<h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>
</figcaption>
</figure>
</div>
<div class="default-product-item block-item">
<figure class="item-inner">
<div class="item-img">
<a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>
</div>
<figcaption class="item-info">
<h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>
</figcaption>
</figure>
</div>
<div class="default-product-item block-item">
<figure class="item-inner">
<div class="item-img">
<a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>
</div>
<figcaption class="item-info">
<h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>
</figcaption>
</figure>
</div>
<div class="default-product-item block-item">
<figure class="item-inner">
<div class="item-img">
<a href="#"><img class="img-fluid" src="img/index_pd01.png" alt=""></a>
</div>
<figcaption class="item-info">
<h3 class="item-title"><a href="#">Aluminum Bottle Cage</a></h3>
</figcaption>
</figure>
</div>
</div>
</div>
</div>
</section>
<section class="screen-xxl">
<div class="layout">
<div class="row">
<div class="col-md-4 p-3" data-aos="fade-up" data-aos-delay="500">
<i>
<svg viewBox="0 0 24 24" width="48" height="48" stroke="#318fff" stroke-width="1"
fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">
<path
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">
</path>
</svg>
</i>
<div class="la-3x text-body opacity-25 lh-1 my-4">01</div>
<div class="pe-4">
<h4 class="text-uppercase fw-bold">Saddles</h4>
<div class="mt-3 uu">Our store is ready to offer you the best saddle selection of all shapes
and
types for your bike.</div>
</div>
</div>
<div class="col-md-4 p-3" data-aos="fade-up" data-aos-delay="500">
<i>
<svg viewBox="0 0 24 24" width="48" height="48" stroke="#318fff" stroke-width="1"
fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">
<line x1="4" y1="21" x2="4" y2="14"></line>
<line x1="4" y1="10" x2="4" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="12"></line>
<line x1="12" y1="8" x2="12" y2="3"></line>
<line x1="20" y1="21" x2="20" y2="16"></line>
<line x1="20" y1="12" x2="20" y2="3"></line>
<line x1="1" y1="14" x2="7" y2="14"></line>
<line x1="9" y1="8" x2="15" y2="8"></line>
<line x1="17" y1="16" x2="23" y2="16"></line>
</svg>
</i>
<div class="la-3x text-body opacity-25 lh-1 my-4">02</div>
<div class="pe-4">
<h4 class="text-uppercase fw-bold">rims &amp; Wheels</h4>
<p class="mt-3">Feel free to explore an extensive range of wheels, rims &amp; tires for
your
bike at our store.</p>
</div>
</div>
<div class="col-md-4 p-3" data-aos="fade-up" data-aos-delay="500">
<i>
<svg viewBox="0 0 24 24" width="48" height="48" stroke="#318fff" stroke-width="1"
fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">
<path
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">
</path>
<polyline points="7.5 4.21 12 6.81 16.5 4.21"></polyline>
<polyline points="7.5 19.79 7.5 14.6 3 12"></polyline>
<polyline points="21 12 16.5 14.6 16.5 19.79"></polyline>
<polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline>
<line x1="12" y1="22.08" x2="12" y2="12"></line>
</svg>
</i>
<div class="la-3x text-body opacity-25 lh-1 my-4">04</div>
<div class="pe-4">
<h4 class="text-uppercase fw-bold">Saddles</h4>
<p class="mt-3">Need a reliable and durable frame for your bike? Our store managers
will be
ready to help you.</p>
</div>
</div>
</div>
</div>
</section>
<section class="about-1 screen-xxl">
<div class="layout">
<div class="row">
<div class="col-lg-6" data-aos="fade-up" data-aos-delay="500">
<div class="company_show bg-light rounded-3 position-relative h-100">
<div class="swiper-wrapper">
<div class="swiper-slide p-4">
<a href="#"><img class=" img-fluid" src="img/company_intr_01.png" alt=""></a>
</div>
<div class="swiper-slide p-4">
<a href="#"><img class=" img-fluid" src="img/company_intr_02.png" alt=""></a>
</div>
<div class="swiper-slide p-4">
<a href="#"><img class=" img-fluid" src="img/company_intr_03.png" alt=""></a>
</div>
</div>
<div class="swiper-pagination"></div>
</div>
</div>
<div class="col-lg-6" data-aos="fade-up" data-aos-delay="500">
<div class="company_content ps-lg-5 py-5 py-lg-3">
<h2 class="fs-1 fw-bold">Why Choose Us</h2>
<dl class="my-4 my-sm-5 text-dark">
<dt class="fs-7">◎ Over 25 years of experience</dt>
<dd class="my-3">
Since 1990, we have been partnering with various suppliers and manufacturers of bike
parts
to provide our customers with high-quality replacement parts for their bikes for
over 25 years.
</dd>
<dt class="fs-7">◎ 5+ years of warranty on all parts</dt>
<dd class="my-3">
Every part you buy at our store is provided with exclusive 5-year warranty and some
parts
from premium manufacturers have even longer warranty.
</dd>
<dt class="fs-7">◎ Over 25 years of experience</dt>
<dd class="my-3">
We guarantee the best customer service with easy product returns &amp; replacements
as well
as 24-hour support for all our clients. Besides, every client also gets free
worldwide
delivery of any part from our catalog.
</dd>
</dl>
<a href="#" class="btn btn-primary px-4 fs-7">Learn More</a>
</div>
</div>
</div>
</div>
</section>
<section class="news-1 screen-xxl">
<div class="layout">
<div class="row gx-0 my-sm-4">
<div class="index_hd text-center" data-aos="fade-up" data-aos-delay="500">
<h2 class="fs-1 fw-bold">Our Blog</h2>
</div>
<div class="index-bd row pb-3 py-md-4 px-0 gx-0 gy-3" data-aos="fade-up" data-aos-delay="500">
<div class="col-sm-6 col-md-4 gx-3 gx-md-4 gy-3 gy-md-0">
<figure class="d-flex flex-column h-100">
<span class="item_img">
<a href=""><img class="img-fluid" src="img/news01.jpg" alt=""></a>
</span>
<figcaption class="bg-white p-3 flex-fill">
<time class="text-secondary">August 9, 2019</time>
<h3 class="fs-7 fs-sm-5 my-3 fw-bold">
<a href="#" class="text-body">Essential Commuter Accessories: Stock or DIY?</a>
</h3>
<p class="m-0 text-secondary">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed
diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. </p>
</figcaption>
</figure>
</div>
<div class="col-sm-6 col-md-4 gx-3 gx-md-4 gy-3 gy-md-0">
<figure class="d-flex flex-column h-100">
<span class="item_img">
<a href=""><img class=" img-fluid" src="img/news02.jpg" alt=""></a>
</span>
<figcaption class="bg-white p-3 flex-fill">
<time class="text-secondary">August 9, 2019</time>
<h3 class="fs-7 fs-sm-5 my-3 fw-bold">
<a href="#" class="text-body">5 Winter Biking Necessities that You Need to
Have</a>
</h3>
<p class="m-0 text-secondary">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy</p>
</figcaption>
</figure>
</div>
<div class="col-sm-6 col-md-4 gx-3 gx-md-4 gy-3 gy-md-0">
<figure class="d-flex flex-column h-100">
<span class="item_img">
<a href=""><img class=" img-fluid" src="img/news03.jpg" alt=""></a>
</span>
<figcaption class="bg-white p-3 flex-fill">
<time class="text-secondary">August 9, 2019</time>
<h3 class="fs-7 fs-sm-5 my-3 fw-bold">
<a href="#" class="text-body">Bike Tune-up Done Right: Tips from Cyclert
Experts</a>
</h3>
<p class="m-0 text-secondary">Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed
diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. </p>
</figcaption>
</figure>
</div>
</div>
</div>
</div>
</section>
</main>
<footer class="web_footer screen-xxl" id="globalso-footer">
<div class="layout">
<div class="row py-5 gx-0" data-aos="fade-up" data-aos-delay="500">
<nav class="foot_item col-sm-6 col-md-4 gx-0 gx-sm-4 pt-4">
<div class="foot_logo"><img src="img/logo.png" alt=""></div>
<div class="my-5 pe-4 text-white">Shelter has been a trusted name in insurance for more than 15
years. Today, we
proudly serve more than 16 million customers nationwide.Shelter has been a trusted name in
insurance for
more than 15 years. </div>
<ul class="sns_list d-flex gap-4 list-unstyled">
<li><a href=""><img src="img/sns01.png" alt=""></a></li>
<li><a href=""><img src="img/sns02.png" alt=""></a></li>
<li><a href=""><img src="img/sns03.png" alt=""></a></li>
<li><a href=""><img src="img/sns04.png" alt=""></a></li>
<li><a href=""><img src="img/sns05.png" alt=""></a></li>
</ul>
</nav>
<nav class="foot_item col-sm-6 col-md-4 gx-0 gx-sm-4 pt-4 px-sm-5 ps-lg-9">
<div class="mb-4">
<h2 class="fs-5 fw-bold text-white">Quick Links</h2>
</div>
<div class="foot_item_bd">
<ul class="list-unstyled">
<li class="my-3"><a href="" class="text-white">Home</a></li>
<li class="my-3"><a href="" class="text-white">Products</a></li>
<li class="my-3"><a href="" class="text-white">Services</a></li>
<li class="my-3"><a href="" class="text-white">News</a></li>
<li class="my-3"><a href="" class="text-white">About us</a></li>
<li class="my-3"><a href="" class="text-white">Contact us</a></li>
</ul>
</div>
</nav>
<nav class="foot_item col-sm-6 col-md-4 gx-0 gx-sm-4 pt-4">
<div class="mb-4">
<h2 class="fs-5 fw-bold text-white">Get in Touch</h2>
</div>
<div class="foot_item_bd">
<address>
<ul class="list-unstyled">
<li class="my-3 d-flex align-items-center">
<i class="la la-city la-inverse fs-4"></i>
<div class="flex-fill ms-2">
<span class="text-white">Chengdu,Sichuan province Shuxihuanjie #615</span>
</div>
</li>
<li class="my-3 d-flex align-items-center">
<i class="la la-phone la-inverse fs-4"></i>
<div class="flex-fill ms-2">
<a class="tel_link" href="tel:">
<span class="text-white">Phone:</span>
<span class="text-white">400-86-25660</span>
</a>
</div>
</li>
<li class="my-3 d-flex align-items-center">
<i class="la la-mail-bulk la-inverse fs-4"></i>
<div class="flex-fill ms-2">
<a href="mailto:">
<span class="text-white">Email:</span>
<span class="text-white">800025660@126.com</span>
</a>
</div>
</li>
</ul>
</address>
</div>
</nav>
</div>
</div>
</footer>
</body>
<script>
AOS.init();
var mySwiper = new Swiper(\'.slider_banner .layout\', {
effect: \'fade\',
speed: 1000,
loop: true,
autoplay: {
delay: 3500,
disableOnInteraction: false,
},
pagination: {
el: \'.slider_banner .swiper-pagination\',
clickable: true,
},
navigation: {
nextEl: \'.slider_banner .swiper-button-next\',
prevEl: \'.slider_banner .swiper-button-prev\',
},
});
var swiper = new Swiper(\'.company_show\', {
pagination: {
el: \'.company_show .swiper-pagination\',
},
})
</script>
</html>';
}else{
$def = '<div class=" d-flex align-items-center justify-content-between py-md-4">
<div class="logo w-25 w-sm-auto"><a href="#"><img class="img-fluid" src="img/logo.png" alt=""></a></div>
<nav class="navbar navbar-expand-md navbar-dark flex-fill justify-content-end mx-2 pe-md-5">
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#navMenu"
aria-controls="navMenu">
<span class="navbar-toggler-icon"></span>
</button>
<ul class="nav column-gap-5 justify-content-end text-white d-none d-md-flex">
<li><a href="#">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-bs-toggle="dropdown">Products</a>
<ul class="dropdown-menu fs-6 text-body shadow-sm border-0">
<li><a href="#" class="dropdown-item py-2">Product Information</a></li>
<li><a href="#" class="dropdown-item py-2">Change of Insurance</a></li>
<li><a href="#" class="dropdown-item py-2">Traveling Oxygen Program</a></li>
<li><a href="#" class="dropdown-item py-2">Contact</a></li>
</ul>
</li>
<li><a href="#">News</a></li>
<li><a href="#">Download</a></li>
<li><a href="#">FAQ</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<div class="d-flex align-items-center justify-content-end">
<div class="search">
<button type="button" class="btn border-0" data-bs-toggle="dropdown">
<svg viewBox="0 0 24 24" width="18" height="18" stroke="#ffffff" stroke-width="2"
fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
</button>
<div class="dropdown-menu p-3 shadow-sm border-0">
<form action="">
<div class="d-flex mb-2">
<input type="text" class="form-control" name="search" placeholder="Start Typing...">
<button class="btn btn-search border-0" type="submit">
<svg viewBox="0 0 24 24" width="18" height="18" stroke="#333333"
stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"
class="css-i6dzq1">
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
</button>
</div>
<p class="search-attr">Hit enter to search or ESC to close</p>
</form>
</div>
</div>
<div class="change-language ms-md-4">
<div role="button" class="dropdown-toggle text-white d-flex align-items-center"
data-bs-toggle="dropdown">
<b class="country-flag language-flag-en"></b> <span>English</span>
</div>
<div class="dropdown-menu shadow-sm border-0">
<div class="d-flex flex-wrap p-3 text-body">
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="English">
<b class="country-flag language-flag-en"></b>
<span>English</span>
</a>
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Françai">
<b class="country-flag language-flag-fr"></b>
<span>Françai</span>
</a>
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Español">
<b class="country-flag language-flag-es"></b>
<span>Español</span>
</a>
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Deutsch">
<b class="country-flag language-flag-de"></b>
<span>Deutsch</span>
</a>
<a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Română">
<b class="country-flag language-flag-ro"></b>
<span>Română</span>
</a>
</div>
</div>
</div>
</div>
</div>';
}
$data = TemplateLogic::instance()->first($source,$source_id);
return $this->response('',Code::SUCCESS,$data?$data['html']:$def);
$res = [
'html' => $data['html']??'',
'name' => 'example'
];
return $this->response('',Code::SUCCESS,$res);
}
... ... @@ -707,17 +137,38 @@ class TemplateController extends BaseController
public function save_html(TemplateRequest $request){
$data = $request->validated();
$data['data_source'] = $data['source'];
$data['data_source_id'] = $data['source_id'];
unset($data['source']);
unset($data['source_id']);
TemplateLogic::instance()->save($data);
return $this->response('保存成功');
// 不需要数据id
if(in_array($data['data_source'],['index'])){
$data['data_source_id'] = 0;
}
unset($data['source']);
unset($data['source_id']);
$id = TemplateLogic::instance()->save($data);
if($id){
$info = TemplateLogic::instance()->getInfo($id['id']);
$info['source'] = $info['data_source'];
$info['source_id'] = $info['data_source_id'];
unset($info['data_source']);
unset($info['data_source_id']);
unset($info['template_id']);
unset($info['created_at']);
unset($info['updated_at']);
unset($info['css']);
unset($info['script']);
unset($info['data_ext']);
return $this->success($info,Code::SUCCESS,'保存成功');
}
return $this->response('保存失败',Code::SYSTEM_ERROR);
}
/**
... ... @@ -745,36 +196,17 @@ class TemplateController extends BaseController
* @author:dc
* @time 2023/5/10 14:55
*/
public function customChunk(){
//
// $html = $this->param['html']??[];
// // 那个页面 的
// $type = $this->param['type']??'';
//
// if(!is_array($html)){
// return $this->response('参数异常',Code::SYSTEM_ERROR);
// }
//
// // 项目id
// $project_id = $this->user['project_id'];
// // 当前模板
// $template_id = BSetting::_get($project_id)['template_id'];
//
// // 验证这个模板是否存在
// if(!$type || !ATemplateHtml::_typeExist($template_id,$type)){
// return $this->response('页面类型错误',Code::SYSTEM_ERROR);
// }
//
//
// $html = view("template.{$template_id}.{$type}")->render();
//
//
// return $this->response('',Code::SUCCESS,$html);
//// $data = BTemplateData::_insert();
//
//
public function chunk(){
$lists = TemplateChunkLogic::instance()->getList([['status','=',1]],['sort'=>'asc'],['*'],false)->toArray();
foreach ($lists as &$list){
unset($list['created_at']);
unset($list['updated_at']);
unset($list['status']);
}
return $this->success($lists);
}
... ...
... ... @@ -95,8 +95,8 @@ class UserController extends BaseController
],[
'id.required' => 'ID不能为空',
]);
$userLogic->user_info();
$this->response('success');
$info = $userLogic->user_info();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @name :删除管理员
... ...
... ... @@ -141,7 +141,7 @@ class FileController
$fileModel = new File();
$file_hash = $fileModel->read(['hash'=>$hash]);
if($file_hash !== false){
return $hash;
return $this->response('资源',Code::SUCCESS,['file'=>$hash]);
}
$url = $this->path;
$fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
... ... @@ -197,7 +197,7 @@ class FileController
$data[] = $hash;
}
$fileModel->insert($save_data);
return $this->response('资源',Code::SUCCESS,['files'=>$data]);
return $this->response('资源',Code::SUCCESS,['file'=>$data]);
}
/**
* @name 统一返回参数
... ...
... ... @@ -175,7 +175,7 @@ class ImageController
$hash = hash_file('md5', $file->getPathname());
$image_hash = $imageModel->read(['hash'=>$hash]);
if($image_hash !== false){
$data[] = $hash;
$data[] = ['image'=>$hash];
continue;
}
$url = $this->path;
... ... @@ -192,10 +192,10 @@ class ImageController
'hash' => $hash,
'type'=>$file->getClientOriginalExtension(),
];
$data[] = $hash;
$data[] = ['image'=>$hash];
}
$imageModel->insert($save_data);
return $this->response('图片资源',Code::SUCCESS,['image'=>$data]);
return $this->response('图片资源',Code::SUCCESS,$data);
}
//下载
... ... @@ -247,15 +247,6 @@ class ImageController
case 'image':
$data['image_link'] = url('/b/image/' . $v);
break;
case 'images':
$v = explode(',',$v);
foreach ($v as $k1=>$v1){
$data['images_link'][$k1] = url('/b/image/' . $v1);
}
break;
case 'file':
$data['file_link'] = url('/b/file_hash/' . $v);
break;
}
}
}
... ...
... ... @@ -99,6 +99,5 @@ class Kernel extends HttpKernel
'aloginauth'=>AsideLoginAuthMiddleware::class,
//B端登录验证中间件
'bloginauth'=>BsideLoginAuthMiddleware::class,
'accesstoken'=>AccessToken::class,
];
}
... ...
... ... @@ -12,9 +12,7 @@ use App\Models\Devops\ServerInformationLog;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class ServerInformationLogic extends BaseLogic
{
... ... @@ -41,31 +39,25 @@ class ServerInformationLogic extends BaseLogic
*/
public function create()
{
$request = $this->param;
$request = $this->param ?? [];
$service = new ServerInformation();
$this->extracted($request, $service);
if ($this->checkIp($service->ip)) {
return $this->fail('服务器信息添加失败,ip已存在');
$this->extracted( $request, $service );
if ( $this->checkIp( $service->ip ) ) {
return $this->fail( '服务器信息添加失败,ip已存在' );
}
DB::beginTransaction();
if ($service->save()) {
$original = [
'id' => $service->id,
'type' => $service->type,
'ip' => $service->ip,
'title' => $service->title,
'belong_to' => $service->belong_to,
'sshpass' => $service->sshpass,
'ports' => $service->ports,
];
if ( $service->save() ) {
$original = $service->getOriginal();
$original['type'] = $request['type'];
$original['belong_to'] = $request['belong_to'];
// 添加日志
$this->server_action_log(ServerInformationLog::ACTION_ADD, $original, $original, '添加服务器信息成功 - ID : ' . $service->id);
$this->server_action_log( ServerInformationLog::ACTION_ADD, $original, $original, '添加服务器信息成功 - ID : ' . $service->id );
DB::commit();
return $this->success();
}
DB::rollBack();
return $this->fail('服务器信息添加失败');
return $this->fail( '服务器信息添加失败' );
}
... ... @@ -77,51 +69,55 @@ class ServerInformationLogic extends BaseLogic
*/
public function update()
{
$service = new ServerInformation();
$service = $this->getService();
$fields_array = $service->FieldsArray();
$request = $this->param;
$service = $this->ServerInfo();
$original = $service->toArray();
$this->extracted($request, $service);
$request = $this->param ?? [];
$original = $service->getOriginal();
$original['type'] = $service->ServiceStr( $original['type'] );
$original['belong_to'] = $service->BelongToStr( $original['belong_to'] );
$this->extracted( $request, $service, $original );
// 检查ip是否存在
if ($service->ip != $request['ip']) {
if ($this->checkIp($request['ip'])) {
$this->fail('服务器信息修改失败,ip已存在', Code::USER_ERROR);
if ( $service->ip != $request['ip'] ) {
if ( $this->checkIp( $request['ip'] ) ) {
$this->fail( '服务器信息修改失败,ip已存在', Code::USER_ERROR );
}
}
DB::beginTransaction();
if ($service->save()) {
$revised = [
'id' => $service->id,
'type' => $service->type,
'ip' => $service->ip,
'title' => $service->title,
'belong_to' => $service->belong_to,
'sshpass' => $service->sshpass,
'ports' => $service->ports,
'other' => $service->other,
'delete' => $service->delete,
];
$diff = array_diff_assoc($original, $revised);
unset($diff['create_at']);
unset($diff['update_at']);
unset($diff['deleted']);
if ( $service->save() ) {
$revised = $service->getAttributes();
$diff = array_diff_assoc( $original, $revised );
unset( $diff['created_at'] );
unset( $diff['updated_at'] );
unset( $diff['deleted'] );
$remarks = '';
if ($diff) {
if ( $diff ) {
$remarks .= '修改ID为 ' . $service->id . ' 的服务器信息,修改内容为:';
foreach ($diff as $key => $value) {
foreach ( $diff as $key => $value ) {
$remarks .= $fields_array[$key] . ' 由 ' . $value . ' 修改为 ' . $revised[$key] . '; ';
}
} else {
$remarks .= '修改ID为 ' . $service->id . ' 的服务器信息,无修改';
}
// 添加日志
$this->server_action_log(ServerInformationLog::ACTION_UPDATE, $original, $revised, $remarks);
$this->server_action_log( ServerInformationLog::ACTION_UPDATE, $original, $revised, $remarks );
DB::commit();
return $this->success();
}
DB::rollBack();
return $this->fail('服务器信息修改失败');
return $this->fail( '服务器信息修改失败' );
}
public function getService( int $deleted = ServerInformation::DELETED_NORMAL )
{
$id = $this->param['id'] ?? 0;
if ( !$id ) {
return $this->fail( 'ID不能为空' );
}
$data = ServerInformation::query()->where( 'deleted', $deleted )->find( $id );
if ( !$data ) {
return $this->fail( '数据不存在!' );
}
return $data;
}
/**
... ... @@ -129,10 +125,10 @@ class ServerInformationLogic extends BaseLogic
* @param $ip
* @return bool
*/
public function checkIp($ip)
public function checkIp( $ip )
{
$usIp = ServerInformation::query()->where('ip', $ip)->first();
if ($usIp) {
$usIp = ServerInformation::query()->where( 'ip', $ip )->first();
if ( $usIp ) {
return true;
} else {
return false;
... ... @@ -146,15 +142,15 @@ class ServerInformationLogic extends BaseLogic
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function serverInfo(int $deleted = ServerInformation::DELETED_NORMAL)
public function serverInfo( int $deleted = ServerInformation::DELETED_NORMAL )
{
$id = \request()->input('id');
if (!$id) {
return $this->fail('参数错误');
$id = $this->param['id'] ?? 0;
if ( !$id ) {
return $this->fail( 'ID不能为空' );
}
$data = ServerInformation::query()->where('deleted', $deleted)->find($id, ['type', 'ip', 'title', 'belong_to', 'sshpass', 'ports', 'create_at', 'update_at']);
if (!$data) {
return $this->fail('数据不存在!');
$data = ServerInformation::query()->where( 'deleted', $deleted )->find( $id, [ 'type', 'ip', 'title', 'belong_to', 'ports', 'created_at', 'updated_at' ] );
if ( !$data ) {
return $this->fail( '数据不存在!' );
}
return $data;
}
... ... @@ -165,32 +161,10 @@ class ServerInformationLogic extends BaseLogic
* @param array $original 原始数据
* @param array $revised 修改后数据
*/
public function server_action_log(int $action = ServerInformationLog::ACTION_ADD, array $original = [], array $revised = [], $remarks = '')
public function server_action_log( int $action = ServerInformationLog::ACTION_ADD, array $original = [], array $revised = [], $remarks = '' )
{
// $action 1:添加 2:修改 3:删除 4:恢复
$actionArr = ServerInformationLog::actionArr();
$actionStr = $actionArr[$action];
$ip = request()->getClientIp();
$url = request()->getRequestUri();
$method = request()->getMethod();
$userId = $this->uid ?? 0;
$log = new ServerInformationLog();
$log->user_id = $userId;
$log->action = $actionStr;
$log->original = json_encode($original);
$log->revised = json_encode($revised);
$log->ip = $ip;
$log->url = $url;
$log->method = $method;
$log->remarks = $remarks;
DB::beginTransaction();
try {
$log->save();
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
Log::error('服务器信息日志添加失败');
}
$this->log( $log, $action, $original, $revised, $remarks );
}
/**
... ... @@ -198,14 +172,14 @@ class ServerInformationLogic extends BaseLogic
* @param $service
* @return void
*/
public function extracted(array $request, $service)
public function extracted( array $request, $service, array $original = [] )
{
$service->type = trim($request['type']); // 服务器类型
$service->ip = trim($request['ip']); // 服务器ip
$service->title = trim($request['title']); // 服务器标题
$service->belong_to = trim($request['belong_to']); // 服务器归属
$service->sshpass = trim($request['sshpass']); // ssh密码
$service->ports = trim($request['ports']); // ssh端口
$service->type = trim( $request['type'] ) ?? $original['type']; // 服务器类型
$service->ip = trim( $request['ip'] ) ?? $original['ip']; // 服务器ip
$service->title = trim( $request['title'] ) ?? $original['title']; // 服务器标题
$service->belong_to = trim( $request['belong_to'] ) ?? $original['belong_to']; // 服务器归属
$service->sshpass = trim( $request['sshpass'] ) ?? $original['sshpass']; // ssh密码
$service->ports = trim( $request['ports'] ) ?? $original['ports']; // ssh端口
}
/**
... ... @@ -214,38 +188,50 @@ class ServerInformationLogic extends BaseLogic
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function get_batch_update($action = ServerInformationLog::ACTION_DELETE, $deleted = ServerInformation::DELETED_NORMAL)
public function get_batch_update( $action = ServerInformationLog::ACTION_DELETE, $deleted = ServerInformation::DELETED_NORMAL )
{
$id = request()->input('id');
if (!$id) {
return $this->fail('参数错误');
}
$ids = [];
if (!is_array($id)) {
$ids = explode(',', $id);
}
$ids = array_filter($ids, 'intval');
if (empty($ids)) {
return $this->fail('参数错误');
}
$data = ServerInformation::query()->whereIn('id', $ids)->where('deleted', $deleted)->get();
$restore_ids = $data->pluck('id')->toArray();
$ids = $this->getIds();
$data = ServerInformation::query()->whereIn( 'id', $ids )->where( 'deleted', $deleted )->get();
$restore_ids = $data->pluck( 'id' )->toArray();
$actionArr = ServerInformationLog::actionArr();
$actionStr = $actionArr[$action];
if (empty($restore_ids)) {
$this->fail($actionStr . '服务器信息不存在!', Code::USER_ERROR);
if ( empty( $restore_ids ) ) {
$this->fail( $actionStr . '服务器信息不存在!', Code::USER_ERROR );
}
$original = $data->toArray();
DB::beginTransaction();
try {
$update = $deleted == ServerInformation::DELETED_NORMAL ? ServerInformation::DELETED_DELETE : ServerInformation::DELETED_NORMAL;
ServerInformation::query()->whereIn('id', $restore_ids)->update(['deleted' => $update]);
$this->server_action_log($action, $original, $original, $actionStr . '服务器信息 - ID : ' . implode(', ', $restore_ids));
ServerInformation::query()->whereIn( 'id', $restore_ids )->update( [ 'deleted' => $update ] );
$this->server_action_log( $action, $original, $original, $actionStr . '服务器信息 - ID : ' . implode( ', ', $restore_ids ) );
DB::commit();
return $this->success();
} catch (\Exception $e) {
} catch ( \Exception $e ) {
DB::rollBack();
return $this->fail('服务器信息' . $actionStr . '失败', Code::USER_ERROR);
return $this->fail( '服务器信息' . $actionStr . '失败', Code::USER_ERROR );
}
}
/**
* 批量获取数据恢复
* @return array
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function getIds()
{
$id = $this->param['id'] ?? 0;
if ( !$id ) {
return $this->fail( '参数错误' );
}
$ids = [];
if ( !is_array( $id ) ) {
$ids = explode( ',', $id );
}
$ids = array_filter( $ids, 'intval' );
if ( empty( $ids ) ) {
return $this->fail( '参数错误' );
}
return $ids;
}
}
... ...
<?php
namespace App\Http\Logic\Aside\Domain;
use App\Enums\Common\Code;
use App\Exceptions\AsideGlobalException;
use App\Exceptions\BsideGlobalException;
use App\Http\Logic\Aside\BaseLogic;
use App\Http\Logic\Aside\Devops\ServerInformationLogic;
use App\Models\Aside\Domain\DomainInfo;
use App\Models\Aside\Domain\DomainInfoLog;
use App\Models\Devops\ServerInformation;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class DomainInfoLogic extends BaseLogic
{
/**
* @var array
*/
private $param;
public function __construct()
{
parent::__construct();
$this->model = new ServerInformation();
$this->param = $this->requestAll;
}
/**
* 添加数据
* @return array
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function create()
{
$request = $this->param ?? [];
if ($this->checkDomain($request['domain'])) {
return $this->fail('域名已存在!');
}
$domain = new DomainInfo();
$this->extracted($request, $domain);
DB::beginTransaction();
if ($domain->save()) {
$original = $domain->getOriginal();
$original['belong_to'] = $request['belong_to'];
$original['status'] = $request['status'];
// 添加日志
$this->domain_action_log(DomainInfoLog::ACTION_ADD, $original, $original, '添加域名信息成功 - ID : ' . $domain->id);
DB::commit();
return $this->success();
}
DB::rollBack();
return $this->fail('域名信息添加失败');
}
/**
* 修改数据
* @return array
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function update()
{
$domain = $this->getDomain();
$original = $domain->getOriginal();
$original['belong_to'] = $domain->BelongToStr($original['belong_to']);
$original['status'] = $domain->StatusToStr($original['status']);
$request = $this->param;
$this->extracted($request, $domain, $original);
// 检查ip是否存在
if ($domain->domain != $request['domain']) {
if ($this->checkDomain($request['domain'])) {
$this->fail('域名信息修改失败,域名已存在', Code::USER_ERROR);
}
}
DB::beginTransaction();
if ($domain->save()) {
$fields_array = $domain->FieldsArray();
$revised = $domain->getAttributes();
$diff = array_diff_assoc($original, $revised);
unset($diff['created_at']);
unset($diff['updated_at']);
unset($diff['deleted']);
$remarks = '';
if ($diff) {
$remarks .= '修改ID为 ' . $domain->id . ' 的服务器信息,修改内容为:';
foreach ($diff as $key => $value) {
$remarks .= $fields_array[$key] . ' 由 ' . $value . ' 修改为 ' . $revised[$key] . '; ';
}
} else {
$remarks .= '修改ID为 ' . $domain->id . ' 的域名信息,无修改';
}
// 添加日志
$this->domain_action_log(DomainInfoLog::ACTION_UPDATE, $original, $revised, $remarks);
DB::commit();
return $this->success();
}
DB::rollBack();
return $this->fail('域名信息修改失败');
}
/**
* 根据ID获取数据
* @return array
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function getDomain(int $deleted = DomainInfo::DELETED_NORMAL)
{
$id = $this->param['id'] ?? 0;
if (!$id) {
return $this->fail('ID不能为空');
}
$data = DomainInfo::query()->where('deleted', $deleted)->find($id);
if (!$data) {
return $this->fail('数据不存在!');
}
return $data;
}
/**
* 检查域名是否存在
* @param $domain
* @return bool
*/
public function checkDomain($domain)
{
$usIp = DomainInfo::query()->where('domain', $domain)->first();
if ($usIp) {
return true;
} else {
return false;
}
}
/**
* 详情
* @param int $deleted
* @return array|Builder|Collection|Model
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function domainInfo(int $deleted = DomainInfo::DELETED_NORMAL)
{
$id = $this->param['id'] ?? 0;
if (!$id) {
return $this->fail('ID不能为空');
}
$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']);
if (!$data) {
return $this->fail('数据不存在!');
}
return $data;
}
/**
* 服务器操作日志
* @param int $action 1:添加 2:修改 3:删除 4:搜索 5:详情 6:列表
* @param array $original 原始数据
* @param array $revised 修改后数据
*/
public function domain_action_log(int $action = DomainInfoLog::ACTION_ADD, array $original = [], array $revised = [], $remarks = '')
{
$log = new DomainInfoLog();
$this->log($log, $action, $original, $revised, $remarks);
}
/**
* @param array $request
* @param $domain
* @param array $original
* @return void
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function extracted( array $request, $domain, array $original = [])
{
$domain->domain = trim($request['domain']) ?? $original['domain'];
if (!$this->validateDomain($domain->domain)) {
$this->fail('域名格式错误');
}
$domain->belong_to = trim($request['belong_to']) ?? $original['belong_to']; // 域名归属 1 - 公司 2 - 客户
$domain->status = trim($request['status']) ?? $original['status']; // 域名状态 0 - 正常 1 - 关闭
$domain->domain_start_time = trim($request['domain_start_time']) ?? $original['domain_start_time']; // 域名开始时间
$domain->domain_end_time = trim($request['domain_end_time']) ?? $original['domain_end_time'];
$domain->certificate_start_time = trim($request['certificate_start_time']) ?? $original['certificate_start_time']; // 证书开始时间
$domain->certificate_end_time = trim($request['certificate_end_time']) ?? $original['certificate_end_time']; // 证书结束时间
}
/**
* 批量获取数据删除
* @return array
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function get_batch_update($action = DomainInfoLog::ACTION_DELETE, $deleted = DomainInfo::DELETED_NORMAL)
{
$ids = (new ServerInformationLogic())->getIds();
$data = DomainInfo::query()->whereIn('id', $ids)->where('deleted', $deleted)->get();
$restore_ids = $data->pluck('id')->toArray();
$actionArr = DomainInfoLog::actionArr();
$actionStr = $actionArr[$action];
if (empty($restore_ids)) {
$this->fail($actionStr . '域名信息不存在!', Code::USER_ERROR);
}
$original = $data->toArray();
DB::beginTransaction();
try {
$update = $deleted == DomainInfo::DELETED_NORMAL ? DomainInfo::DELETED_DELETE : DomainInfo::DELETED_NORMAL;
DomainInfo::query()->whereIn('id', $restore_ids)->update(['deleted' => $update]);
$this->domain_action_log($action, $original, $original, $actionStr . '域名信息 - ID : ' . implode(', ', $restore_ids));
DB::commit();
return $this->success();
} catch (\Exception $e) {
DB::rollBack();
return $this->fail('域名信息' . $actionStr . '失败', Code::USER_ERROR);
}
}
/**
* 证书到期时间
* @return array
*/
public function getDomainCertificateTime($domain)
{
$domain = trim($domain);
$data = [];
$context = stream_context_create(['ssl' => ['capture_peer_cert' => true]]); // Notice: only 7.0.7+ supports this
$stream = stream_socket_client("ssl://$domain:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);
if ($stream) {
$params = stream_context_get_params($stream);
$peerCertificate = openssl_x509_parse($params['options']['ssl']['peer_certificate']);
if ($peerCertificate) {
$validFrom = date_create_from_format('U', $peerCertificate['validFrom_time_t']); // 有效期开始时间
$validTo = date_create_from_format('U', $peerCertificate['validTo_time_t']); // 有效期结束时间
$data['validFrom'] = $validFrom->format('Y-m-d H:i:s');
$data['validTo'] = $validTo->format('Y-m-d H:i:s');
}
}
return $data;
}
/**
* 获取所有正常域名信息
* @return Builder[]|Collection
*/
public function getAllDomain()
{
return DomainInfo::query()->where('status', 1)
->where('deleted', DomainInfo::DELETED_NORMAL)
->orderBy('updated_at', 'desc')
->get();
}
/**
* 域名到期时间
* @return array
*/
public function getDomainTime($domain)
{
$conJson = file_get_contents("http://openai.waimaoq.com/v1/whois_api?domain={$domain}");
$conArr = json_decode($conJson, true);
$data = [];
if ($conArr['code'] == 200) {
$con = $conArr['text'];
$data['domain'] = $domain;
$data['validFrom'] = $con['creation_date'];
$data['validTo'] = $con['expiration_date'];
}
return $data;
}
/**
* 验证给定的值是否是有效的域名。
*
* @param mixed $value
* @return bool
*/
public function validateDomain($value)
{
// 从域中删除任何空间或路径。
$domain = preg_replace('/\s|\/.*$/', '', $value);
// 验证域是否至少包含一个句点。
if (strpos($domain, '.') === false) {
return false;
}
// 验证域是否以句点开始或结束。
if (strpos($domain, '.') === 0 || strrpos($domain, '.') === strlen($domain) - 1) {
return false;
}
// 验证域是否不包含无效字符。
if (!preg_match('/^[a-zA-Z0-9\-\.]+$/', $domain)) {
return false;
}
// 验证域是否具有有效的顶级域。
$tld = substr($domain, strrpos($domain, '.') + 1);
if (!in_array($tld, ['com', 'net', 'org'])) { // 如有必要,添加更多TLD。
return false;
}
return true;
}
/**
* 根据域名更新证书到期时间
* @param $id
* @param $updata
* @return array
* @throws AsideGlobalException
* @throws BsideGlobalException
*/
public function updateDomain($id, $updata)
{
$isRes = DomainInfo::query()->where('id', $id)->where('deleted', DomainInfo::DELETED_NORMAL)->update($updata);
if ($isRes) {
return $this->success();
} else {
return $this->fail('更新域名到期时间失败');
}
}
}
... ...
<?php
namespace App\Http\Logic\Aside\Template;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Template\ATemplateChunk;
/**
* 自定义块 模板
* @author:dc
* @time 2023/5/29 10:46
* Class TemplateChunkLogic
* @package App\Http\Logic\Aside\Template
*/
class TemplateChunkLogic extends BaseLogic {
public function __construct()
{
parent::__construct();
$this->model = new ATemplateChunk();
}
public function save($param)
{
$param['images'] = is_array($param['images']??'') ? json_encode($param['images']): '[]';
$param['video'] = is_array($param['video']??'') ? json_encode($param['video']): '[]';
return parent::save($param); // TODO: Change the autogenerated stub
}
}
... ...
... ... @@ -64,7 +64,7 @@ class CountLogic extends BaseLogic
$data = [
'total_pv'=>$pv,
'total_ip'=>$ip,
'conversion_rate' => isset($inquiry_num) ? ($inquiry_num / $ip) * 100 : 0,
'conversion_rate' => (isset($inquiry_num) && !empty($inquiry_num)) ? ($inquiry_num / $ip) * 100 : 0,
];
return $this->success($data);
}
... ... @@ -149,7 +149,7 @@ class CountLogic extends BaseLogic
public function referrer_count(){
$data = DB::table('gl_customer_visit')
->select('referrer_url', DB::raw('COUNT(*) as count'))->groupBy('referrer_url')
->orderBy('count','desc')->limit(8)->get()->toArray();
->orderByDesc('count')->limit(8)->get()->toArray();
$total = DB::table('gl_customer_visit')->count();
$data = object_to_array($data);
foreach ($data as $k=>$v){
... ...
... ... @@ -116,6 +116,6 @@ class CategoryLogic extends BaseLogic
*/
public function getProductNum($cate_id){
$cate_ids = $this->model->getChildIdsArr($cate_id);
return CategoryRelated::whereIn('cate_id', $cate_ids)->count();
return CategoryRelated::whereIn('cate_id', $cate_ids)->distinct()->count('product_id');
}
}
... ...
... ... @@ -92,6 +92,6 @@ class KeywordLogic extends BaseLogic
}
public function getProductNum($keyword_id){
return KeywordRelated::where('keyword_id', $keyword_id)->count();
return KeywordRelated::where('keyword_id', $keyword_id)->distinct()->count('product_id');
}
}
... ...
... ... @@ -86,7 +86,15 @@ class ProductLogic extends BaseLogic
DB::beginTransaction();
try {
foreach ($ids as $id){
foreach ($ids as $k => $id) {
$info = $this->getCacheInfo($id);
if(!$info){
unset($ids[$k]);
continue;
}
if($info->status == Product::STATUS_RECYCLE){
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
... ... @@ -95,6 +103,11 @@ class ProductLogic extends BaseLogic
//删除关键词关联
KeywordRelated::where('product_id', $id)->delete();
}else{
//回收站
parent::save(['id' => $id, 'status' => Product::STATUS_RECYCLE]);
unset($ids[$k]);
}
}
parent::delete($ids);
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Http\Logic\Bside;
use App\Models\RouteMap;
use App\Models\Template\BSetting;
use App\Models\Template\BTemplate;
/**
... ... @@ -36,9 +37,11 @@ class TemplateLogic extends BaseLogic
$data = $this->first($param['data_source'],$param['data_source_id']);
if($data){
$param['id'] = $data['id'];
}else{
$param['template_id'] = BSetting::_get($this->user['project_id'])['template_id'];
}
parent::save($param);
return parent::save($param);
}
... ... @@ -82,6 +85,7 @@ class TemplateLogic extends BaseLogic
'project_id'=>$this->user['project_id'],
'data_source' => $source,
'data_source_id' => $source_id,
'template_id' => BSetting::_get($this->user['project_id'])['template_id']
])->first();
}
... ...
... ... @@ -8,7 +8,11 @@ use \App\Helper\Common as CommonHelper;
use App\Exceptions\AsideGlobalException;
use App\Exceptions\BsideGlobalException;
use App\Helper\Arr;
use App\Models\Devops\ServerInformationLog;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
/**
... ... @@ -54,7 +58,7 @@ class Logic
* @param array $sort
* @param array $columns
* @param int $limit
* @return array
* @return array|Model
* @author zbj
* @date 2023/4/13
*/
... ... @@ -170,7 +174,7 @@ class Logic
public function delete($ids, $map = []){
$ids = array_filter(Arr::splitFilterToArray($ids), 'intval');
if(!$ids){
$this->fail('ID不能为空');
return $this->success();
}
foreach ($ids as $id){
... ... @@ -393,4 +397,40 @@ class Logic
public static function instance(...$params){
return new static(...$params);
}
/**
* 添加日志
* @param $log
* @param int $action 1:添加 2:修改 3:删除 4:搜索 5:详情 6:列表
* @param array $original 原始数据
* @param array $revised 修改后数据
* @param string $remarks 备注
* @return bool
*/
public function log($log, int $action = ServerInformationLog::ACTION_ADD, array $original = [], array $revised = [], string $remarks = ''): bool
{
// $action 1:添加 2:修改 3:删除 4:恢复
$actionArr = $log->actionArr();
$actionStr = $actionArr[$action];
$ip = request()->getClientIp();
$url = request()->getRequestUri();
$method = request()->getMethod();
$userId = $this->uid ?? 0;
$log->user_id = $userId;
$log->action = $actionStr;
$log->original = json_encode($original);
$log->revised = json_encode($revised);
$log->ip = $ip;
$log->url = $url;
$log->method = $method;
$log->remarks = $remarks;
DB::beginTransaction();
if($log->save()){
DB::commit();
return true;
}
DB::rollBack();
Log::error('日志添加失败');
return false;
}
}
... ...
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Closure;
class AccessToken
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
session_start();
// 指定允许其他域名访问
$http_origin = "*";
if(isset($_SERVER['HTTP_ORIGIN'])){
$http_origin = $_SERVER['HTTP_ORIGIN'];
}
header("Access-Control-Allow-Origin:".$http_origin);
header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。
if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
exit;
}
return $next($request);
}
}
... ... @@ -15,22 +15,19 @@ class EnableCrossRequestMiddleware
*/
public function handle($request, Closure $next)
{
$response = $next($request);
$origin = $request->server('HTTP_ORIGIN') ?: '';
// $allow_origin = [
// 'http://localhost:8080',
// ];
// if (in_array($origin, $allow_origin)) {
$header = [
// 'Access-Control-Allow-Origin' => $origin,
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Headers' => '*',
'Access-Control-Expose-Headers' => '*',
'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS',
'Access-Control-Allow-Credentials' => 'true',
];
$response->headers->add($header);
// }
return $response;
// 指定允许其他域名访问
$http_origin = "*";
if(isset($_SERVER['HTTP_ORIGIN'])){
$http_origin = $_SERVER['HTTP_ORIGIN'];
}
header("Access-Control-Allow-Origin:".$http_origin);
header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。
if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
exit;
}
return $next($request);
}
}
... ...
<?php
namespace App\Http\Requests\Aside\Domain;
use App\Models\Aside\Domain\DomainInfo;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class DomainInfoRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$domain = new DomainInfo();
$status_tot_keys = array_keys($domain->StatusToArray());
$belong_to_keys = array_keys($domain->BelongToArray());
return [
'domain' => 'required|max:200',
'belong_to' => [
'required',
Rule::in($belong_to_keys)
],
'status' => [
'required',
Rule::in($status_tot_keys)
]
];
}
public function messages()
{
return [
'domain.required' => '域名不能为空',
'domain.max' => '域名长度不能超过200个字符',
'belong_to.required' => '域名所属不能为空',
'belong_to.in' => '域名所属参数错误',
'status.required' => '域名状态不能为空',
'status.in' => '域名状态参数错误',
];
}
}
... ...
<?php
namespace App\Http\Requests\Aside\Template;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
/**
* 自定义模板 块
* @author:dc
* @time 2023/5/29 10:57
* Class TemplateChunkRequest
* @package App\Http\Requests\Aside\Template
*/
class TemplateChunkRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rule = [
'id' => ['required','integer'],
'name' => ['required'],
'type' => ['required'],
'status' => ['required',Rule::in(0,1)],
'sort' => ['required','integer'],
'thumb' => ['required'],
'html' => ['required'],
'attr' => [],
'images' => [],
'video' => [],
];
// 更新场景
if($this->is('a/template/chunk/create')){
unset($rule['id']);
}
if($this->is('b/template/chunk/create')){
unset($rule['id']);
}
return $rule;
}
public function messages()
{
return [
'id.required' => 'id必须',
'id.integer' => 'id必须',
'name.required' => '名称必须',
'type.required' => '类型必须',
'status.integer' => '状态错误',
'status.in' => '状态错误',
'sort.required' => '排序必须',
'sort.integer' => '排序必须',
'thumb.required' => '缩略图必须',
'html.required' => 'html代码必须',
// 'attr.required' => '其他必须',
];
}
}
... ...
... ... @@ -43,7 +43,7 @@ class TemplateRequest extends FormRequest
// 删除
if(!$this->is('b/template/status')){
if($this->is('b/template/status')){
unset($rule['css']);
unset($rule['script']);
unset($rule['html']);
... ...
<?php
namespace App\Models\Aside\Domain;
use App\Models\Base;
/**
* Class DomainInfo
* @package App\Models\Aside\Domain
* @Author YiYuan-LIn
* @Date: 2019/5/16
* 域名信息模型
*/
class DomainInfo extends Base
{
protected $table = 'gl_domain_info';
// 软删除 0:正常 1:删除
/** @var int 软删除 - 正常 */
const DELETED_NORMAL = 0;
/** @var int 软删除 - 删除 */
const DELETED_DELETE = 1;
protected $hidden = [
'created_at',
'updated_at'
];
/**
* 字段信息
* @return array
*/
public function FieldsArray()
{
return [
'domain' => '域名',
'belong_to' => '域名归属',
'status' => '域名状态',
'domain_start_time' => '域名开始时间',
'domain_end_time' => '域名结束时间',
'certificate_start_time' => '证书开始时间',
'certificate_end_time' => '证书结束时间',
];
}
/**
* 域名归属信息
* @return array
*/
public function BelongToArray()
{
return [
1 => '公司',
2 => '客户',
];
}
public function BelongToStr($num)
{
return array_flip($this->BelongToArray())[$num];
}
public function BelongTo($num)
{
return $this->BelongToArray()[$num];
}
/**
* 域名状态信息
* @return array
*/
public function StatusToArray()
{
return [
0 => '未使用',
1 => '使用中',
];
}
public function StatusToStr($num)
{
return array_flip($this->StatusToArray())[$num];
}
/**
* 返回域名状态
* @param $num
*
* @return string
*/
public function StatusTo($num)
{
return $this->StatusToArray()[$num];
}
/**
* 返回服务器归属
* @param $value
*
* @return string
*/
public function getBelongToAttribute($value)
{
return $this->BelongTo($value);
}
/**
* 返回服务器状态
* @param $value
*
* @return string
*/
public function getStatusAttribute($value)
{
return $this->StatusTo($value);
}
}
... ...
<?php
namespace App\Models\Aside\Domain;
use Illuminate\Database\Eloquent\Model;
class DomainInfoLog extends Model
{
protected $table = 'gl_domain_info_log';
public function getOriginalAttribute($value)
{
return json_decode($value, true);
}
public function getRevisedAttribute($value)
{
return json_decode($value, true);
}
/** @var int 日志添加 */
const ACTION_ADD = 1;
/** @var int 日志修改 */
const ACTION_UPDATE = 2;
/** @var int 日志删除 */
const ACTION_DELETE = 3;
/** @var int 日志恢复 */
const ACTION_RECOVER = 4;
/**
* @return string[]
*/
public static function actionArr()
{
return [
1 => '添加',
2 => '修改',
3 => '删除',
4 => '恢复',
];
}
}
... ...
... ... @@ -8,8 +8,6 @@ class ServerInformation extends Model
{
protected $table = 'gl_server_information';
const CREATED_AT = 'create_at';
const UPDATED_AT = 'update_at';
// 软删除 0:正常 1:删除
const DELETED_NORMAL = 0;
... ... @@ -44,6 +42,11 @@ class ServerInformation extends Model
];
}
public function ServiceStr($num)
{
return array_flip($this->ServiceArray())[$num];
}
/**
* 字段信息
* @return array
... ... @@ -73,6 +76,11 @@ class ServerInformation extends Model
];
}
public function BelongToStr($num)
{
return array_flip($this->BelongToArray())[$num];
}
public function BelongTo($num)
{
return $this->BelongToArray()[$num];
... ...
... ... @@ -7,8 +7,6 @@ use Illuminate\Database\Eloquent\Model;
class ServerInformationLog extends Model
{
protected $table = 'gl_server_information_log';
const CREATED_AT = 'create_at';
const UPDATED_AT = 'update_at';
public function getOriginalAttribute($value)
{
... ...
<?php
namespace App\Models\Template;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* 自定义块 模板块
* @author:dc
* @time 2023/5/29 10:39
* Class ATemplateChunk
* @package App\Models\Template
*/
class ATemplateChunk extends \App\Models\Base{
protected $table = 'gl_aside_template_chunk';
protected $hidden = ['deleted_at'];
use SoftDeletes;
public static $typeMap = [
'index' => '首页',
'product' => '商品列表',
'product_info' => '商品详情',
'blogs' => '博客列表',
'blogs_info' => '博客详情',
'page' => '单页',
'news' => '新闻列表',
'news_info' => '新闻详情',
];
public function getImagesAttribute($val)
{
return $val ? json_decode($val,true) : [];
}
public function getVideoAttribute($val)
{
return $val ? json_decode($val,true) : [];
}
}
... ...
... ... @@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Facade;
* @method static array filePut(string $filename, string $content, string|array $config="default")
* @method static string url2path(string $url, string|array $disk="upload")
* @method static string path2url(string $path, string|array $disk="upload")
* @method static array lists(string $config,array $ext=[])
*/
class Upload extends Facade
{
... ...
... ... @@ -272,4 +272,33 @@ class UploadService extends BaseService
$this->config();
return Storage::disk($this->config['disk'])->url($path);
}
/**
* 文件列表
* @return array
* @author:dc
* @time 2023/5/29 11:49
*/
public function lists($config,array $ext=[]){
$this->config($config);
$disk = Storage::disk($this->config['disk']);
$lists = $disk->allFiles();
if($ext){
foreach ($lists as $k=>$list){
$list = explode('.',$list);
if(!in_array(end($list),$ext)){
unset($lists[$k]);
}else{
$lists[$k] = $disk->url($lists[$k]);
}
}
}
return $lists;
}
}
... ...
... ... @@ -15,7 +15,7 @@ return [
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'paths' => ['a/*', 'b/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
... ...
... ... @@ -6,7 +6,8 @@ use \Illuminate\Support\Facades\Route;
use \App\Http\Controllers\Aside;
//必须登录验证的路由组
Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上web的中间件
Route::middleware(['web','accesstoken'])->group(function (){ //admin用渲染默认要加上web的中间件
Route::middleware(['aloginauth'])->group(function () {
Route::get('/', [Aside\IndexController::class, 'index'])->name('admin.home.white');
Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white');
... ... @@ -124,6 +125,19 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w
Route::post('/save_follow', [Aside\Task\TaskController::class, 'save_follow'])->name('admin.task_save_follow');
});
// 域名
Route::prefix('domain')->group(function () {
Route::get('/', [Aside\Domain\DomainInfoController::class, 'lists'])->name('admin.domain'); // 列表 | 搜索
Route::get('/info', [Aside\Domain\DomainInfoController::class, 'info'])->name('admin.domain_info'); // 详情
Route::get('/delete_info', [Aside\Domain\DomainInfoController::class, 'getDeleteDomainInfo'])->name('admin.domain_delete_info'); // 删除信息
Route::post('/add', [Aside\Domain\DomainInfoController::class, 'add'])->name('admin.domain_save'); // 添加
Route::post('/edit', [Aside\Domain\DomainInfoController::class, 'edit'])->name('admin.domain_edit'); // 编辑
Route::any('/delete', [Aside\Domain\DomainInfoController::class, 'delete'])->name('admin.domain_delete'); // 删除
Route::get('/delete_list', [Aside\Domain\DomainInfoController::class, 'delete_list'])->name('admin.domain_delete_list'); // 删除列表
Route::any('/restore', [Aside\Domain\DomainInfoController::class, 'restore'])->name('admin.domain_restore'); // 恢复
Route::get('/log', [Aside\Domain\DomainInfoLogController::class, 'lists'])->name('admin.domain_log_lists'); // 日志
});
//运维
Route::prefix('devops')->group(function () {
//服务器配置
... ... @@ -135,7 +149,7 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w
// 服务器添加|修改|删除
Route::prefix('server')->group(function () {
Route::get('/', [Aside\Devops\ServerInformationController::class, 'lists'])->name('admin.devops.bt'); // 列表
Route::get('/', [Aside\Devops\ServerInformationController::class, 'lists'])->name('admin.devops.bt'); // 列表 | 搜索
Route::get('/info', [Aside\Devops\ServerInformationController::class, 'getServerInfo'])->name('admin.devops.bt_info'); // 获取信息
Route::get('/delete_info', [Aside\Devops\ServerInformationController::class, 'getDeleteServerInfo'])->name('admin.devops.bt_delete_info'); // 删除信息
Route::post('/add', [Aside\Devops\ServerInformationController::class, 'add'])->name('admin.devops.bt_add'); // 添加
... ... @@ -143,10 +157,8 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w
Route::get('/delete', [Aside\Devops\ServerInformationController::class, 'delete'])->name('admin.devops.bt_delete'); // 删除
Route::get('/delete_list', [Aside\Devops\ServerInformationController::class, 'delete_list'])->name('admin.devops.bt_delete_list'); // 删除列表
Route::get('/restore', [Aside\Devops\ServerInformationController::class, 'restore'])->name('admin.devops.bt_restore'); //恢复数据
Route::get('/search', [Aside\Devops\ServerInformationController::class, 'search'])->name('admin.devops.bt_search'); //搜索
Route::get('/log', [Aside\Devops\ServerInformationLogController::class, 'lists'])->name('admin.devops.bt_log_lists'); //日志列表
});
});
// 自定义页面 模板,头部底部
... ... @@ -161,10 +173,13 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w
Route::post('/html/{template_id}/insert', [\App\Http\Controllers\Aside\TemplateController::class, 'html_insert'])->where('template_id','\d+')->name('admin.template_insert.html');
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');
Route::get('/html/type', [\App\Http\Controllers\Aside\TemplateController::class, 'html_type'])->name('admin.template_type.html');
});
// 自定义块,模板块
Route::get('/chunk/lists', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_lists'])->name('admin.template.chunk_lists');
Route::post('/chunk/create', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_save'])->name('admin.template.chunk_create');
Route::post('/chunk/update', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_save'])->name('admin.template.chunk_update');
Route::delete('/chunk/delete/{chunk_id}', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_delete'])->where('chunk_id','\d+')->name('admin.template.chunk_delete');
});
});
... ...
... ... @@ -6,7 +6,7 @@
use Illuminate\Support\Facades\Route;
//必须登录验证的路由组
Route::middleware(['bloginauth','accesstoken'])->group(function () {
Route::middleware(['bloginauth'])->group(function () {
//登录用户编辑个人资料
Route::any('/edit_info', [\App\Http\Controllers\Bside\ComController::class, 'edit_info'])->name('edit_info');
Route::any('/logout', [\App\Http\Controllers\Bside\ComController::class, 'logout'])->name('logout');
... ... @@ -187,6 +187,7 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () {
//文件操作
Route::prefix('file')->group(function () {
Route::post('/upload', [\App\Http\Controllers\Bside\FileController::class, 'upload'])->name('file_upload');
Route::get('/lists', [\App\Http\Controllers\Bside\FileController::class, 'lists'])->name('file_lists');
});
//图片操作
Route::prefix('images')->group(function () {
... ... @@ -232,9 +233,22 @@ Route::middleware(['bloginauth','accesstoken'])->group(function () {
// Route::get('/custom-chunk', [\App\Http\Controllers\Bside\TemplateController::class, 'customChunk'])->name('bside_template_custom_chunk');
Route::get('/get_type', [\App\Http\Controllers\Bside\TemplateController::class, 'get_type'])->name('bside_template_type');
Route::get('/get_html', [\App\Http\Controllers\Bside\TemplateController::class, 'get_html'])->name('bside_template_get_html');
Route::get('/save_html', [\App\Http\Controllers\Bside\TemplateController::class, 'save_html'])->name('bside_template_save_html');
Route::post('/save_html', [\App\Http\Controllers\Bside\TemplateController::class, 'save_html'])->name('bside_template_save_html');
Route::get('/status', [\App\Http\Controllers\Bside\TemplateController::class, 'status'])->name('bside_template_status');
// 自定义模板的 块。
Route::get('/chunk', [\App\Http\Controllers\Bside\TemplateController::class, 'chunk'])->name('bside_template_chunk');
Route::post('/chunk/create', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_save'])->name('admin.template.chunk_create');
Route::post('/chunk/update', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_save'])->name('admin.template.chunk_update');
Route::delete('/chunk/delete/{chunk_id}', [\App\Http\Controllers\Aside\TemplateController::class, 'chunk_delete'])->where('chunk_id','\d+')->name('admin.template.chunk_delete');
});
// 自定义页面,专题页
Route::prefix('custom')->group(function () {
Route::get('/', [\App\Http\Controllers\Bside\CustomController::class, 'index'])->name('bside_custom');
... ...