阶段性更新

This commit is contained in:
2021-10-09 13:12:45 +08:00
parent ae95c5540b
commit d89bc90cef
248 changed files with 8676 additions and 5682 deletions

View File

@@ -21,7 +21,7 @@ class IndexController extends AdminController
$grid->filter(function ($filter) { $grid->filter(function ($filter) {
$filter->column(1 / 2, function ($filter) { $filter->column(1 / 2, function ($filter) {
$filter->like('title', '文章标题'); $filter->like('title', '文章标题');
$filter->equal('categories.id', '所属分类')->select(Category::selectOptions(function ($model) { $filter->equal('category_id', '所属分类')->select(Category::selectOptions(function ($model) {
return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]); return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
}, '所有分类')); }, '所有分类'));
}); });
@@ -31,9 +31,7 @@ class IndexController extends AdminController
$grid->column('id', '#ID#'); $grid->column('id', '#ID#');
$grid->column('cover', '封面图片')->image('', 100); $grid->column('cover', '封面图片')->image('', 100);
$grid->column('所属分类')->display(function () { $grid->column('category.title', '所属分类');
return $this->categories()->pluck('title');
})->label();
$grid->column('title', '文章标题'); $grid->column('title', '文章标题');
$states = [ $states = [
'on' => ['value' => 1, 'text' => '打开', 'color' => 'primary'], 'on' => ['value' => 1, 'text' => '打开', 'color' => 'primary'],
@@ -51,8 +49,11 @@ class IndexController extends AdminController
$form = new Form(new Article); $form = new Form(new Article);
$form->text('title', '文章标题')->rules('min:2'); $form->text('title', '文章标题')->rules('min:2');
$form->belongsToMany('categories', CategorySelectAble::class, __('关联分类')); $form->text('remark', '子标题');
$form->select('category_id', '上级分类')
->options(Category::selectOptions(function ($model) {
return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
}, '一级分类'));
$form->textarea('description', '内容简介'); $form->textarea('description', '内容简介');
$form->image('cover', '封面') $form->image('cover', '封面')
->move('images/' . date('Y/m/d')) ->move('images/' . date('Y/m/d'))

View File

@@ -33,6 +33,7 @@ class IndexController extends AdminController
return $model->where('status', 1); return $model->where('status', 1);
}, '一级分类')); }, '一级分类'));
$form->text('title', '分类名称')->rules('required'); $form->text('title', '分类名称')->rules('required');
$form->text('alias', '别名');
$form->select('type', '分类类型') $form->select('type', '分类类型')
->options(Category::TYPES) ->options(Category::TYPES)
->when('show', function (WidgetsForm $form) { ->when('show', function (WidgetsForm $form) {
@@ -46,10 +47,15 @@ class IndexController extends AdminController
->required(); ->required();
$form->textarea('description', '分类简介') $form->textarea('description', '分类简介')
->rules('nullable'); ->rules('nullable');
$form->image('logo', 'Logo')
->move('logos/' . date('Y/m/d'))
->removable()
->uniqueName();
$form->image('cover', '封面') $form->image('cover', '封面')
->move('images/' . date('Y/m/d')) ->move('images/' . date('Y/m/d'))
->removable() ->removable()
->uniqueName(); ->uniqueName();
$form->text('template', '模板');
$form->number('order', '排序')->default(0); $form->number('order', '排序')->default(0);
$form->switch('top_show', '顶部导航显示')->states()->default(0); $form->switch('top_show', '顶部导航显示')->states()->default(0);
$form->switch('status', '显示')->states()->default(1); $form->switch('status', '显示')->states()->default(1);
@@ -76,8 +82,9 @@ class IndexController extends AdminController
} }
$payload .= " [ID:{$branch['id']}] - "; $payload .= " [ID:{$branch['id']}] - ";
$payload .= " <strong>{$branch['title']}</strong> "; $payload .= " <strong>{$branch['title']}</strong> ";
$payload .= " <strong>{$branch['alias']}</strong> ";
$payload .= " <small>{$branch['type']}</small> "; $payload .= " <small>{$branch['type']}</small> ";
$payload .= " <small style='color:#999'>{$branch['description']}</small>"; $payload .= " <small style='color:#999'>{$branch['template']}</small>";
return $payload; return $payload;
}); });
@@ -88,7 +95,7 @@ class IndexController extends AdminController
* Make a form builder. * Make a form builder.
* @return Form * @return Form
*/ */
protected function form() protected function form(): Form
{ {
$form = new Form(new Category); $form = new Form(new Category);
@@ -96,6 +103,7 @@ class IndexController extends AdminController
return $model->where('status', 1); return $model->where('status', 1);
}, '一级分类')); }, '一级分类'));
$form->text('title', '分类名称')->rules('required'); $form->text('title', '分类名称')->rules('required');
$form->text('alias', '别名');
$form->select('type', '分类类型') $form->select('type', '分类类型')
->options(Category::TYPES) ->options(Category::TYPES)
->when('show', function (Form $form) { ->when('show', function (Form $form) {
@@ -109,10 +117,15 @@ class IndexController extends AdminController
->required() ->required()
->rules('required'); ->rules('required');
$form->textarea('description', '分类简介')->rows(4)->rules('nullable'); $form->textarea('description', '分类简介')->rows(4)->rules('nullable');
$form->image('logo', 'Logo')
->move('logos/' . date('Y/m/d'))
->removable()
->uniqueName();
$form->image('cover', '封面') $form->image('cover', '封面')
->move('images/' . date('Y/m/d')) ->move('images/' . date('Y/m/d'))
->removable() ->removable()
->uniqueName(); ->uniqueName();
$form->text('template', '模板');
$form->number('order', '排序')->default(0)->help('正序优先'); $form->number('order', '排序')->default(0)->help('正序优先');
$form->switch('top_show', '顶部导航显示')->states()->default(0); $form->switch('top_show', '顶部导航显示')->states()->default(0);
$form->switch('status', '显示')->states()->default(1); $form->switch('status', '显示')->states()->default(1);

View File

@@ -0,0 +1,80 @@
<?php
namespace App\Admin\Controllers\Video;
use App\Models\Advert;
use App\Models\Category;
use App\Models\Video;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
class IndexController extends AdminController
{
protected $title = '视频资源';
protected function grid()
{
$grid = new Grid(new Video());
$grid->filter(function ($filter) {
$filter->column(1 / 2, function ($filter) {
$filter->like('title', '视频名称');
$filter->like('category.id', '分类名称')
->select(Category::selectOptions(function ($model) {
return $model->where('status', 1)->where('type', Category::TYPE_ADVERT);
}, '所有分类'));
});
$filter->disableIdFilter();
});
$grid->column('id');
$grid->column('title', '视频名称');
$grid->column('cover', '视频地址')->downloadable();
$grid->column('category.title', '分类名称');
$grid->column('url', '地址');
$grid->column('sort', '排序');
return $grid;
}
/**
* Make a form builder.
* @return Form
*/
protected function form()
{
$form = new Form(new Video());
$form->text('title', '视频名称')->required();
$form->select('category_id', '所属分类')
->options(Category::selectOptions(function ($model) {
return $model->where('status', 1);
}, '选择分类'))
->rules('required|min:1', [
'required' => '必须选择所属分类',
'min' => '必须选择所属分类',
]);
$form->file('cover', '视频')
->rules(function ($form) {
if ($form->model()->cover != []) {
return 'nullable|image';
} else {
return 'required';
}
})
->move('videos/' . date('Y/m/d'))
->removable()
->uniqueName();
$form->text('url', '链接地址');
$form->number('sort', '排序')
->default(1)
->required()
->help('数字越大越靠前');
return $form;
}
}

View File

@@ -0,0 +1,11 @@
<?php
use Illuminate\Routing\Router;
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace') . '\\Video',
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->resource('videos', 'IndexController');
});

View File

@@ -19,3 +19,4 @@ require __DIR__ . '/Routes/article.php';
require __DIR__ . '/Routes/category.php'; require __DIR__ . '/Routes/category.php';
require __DIR__ . '/Routes/link.php'; require __DIR__ . '/Routes/link.php';
require __DIR__ . '/Routes/advert.php'; require __DIR__ . '/Routes/advert.php';
require __DIR__ . '/Routes/video.php';

View File

@@ -1,7 +1,9 @@
<?php <?php
use App\Models\Advert;
use App\Models\Category; use App\Models\Category;
use App\Models\Article; use App\Models\Article;
use App\Models\Video;
function getOneCategory($categoryId, $return = '') function getOneCategory($categoryId, $return = '')
{ {
@@ -21,8 +23,8 @@ function getOneCategory($categoryId, $return = '')
* Notes: 获取文章分类详情 * Notes: 获取文章分类详情
* @Author: 玄尘 * @Author: 玄尘
* @Date : 2020/9/10 13:21 * @Date : 2020/9/10 13:21
* @param $categoryId * @param $categoryId
* @param string $result * @param string $result
* @return \App\Models\Article * @return \App\Models\Article
*/ */
function getOneArticleBYCate($categoryId, $result = '') function getOneArticleBYCate($categoryId, $result = '')
@@ -48,8 +50,9 @@ function getOneArticleBYCate($categoryId, $result = '')
* Notes: 获取分类下的文章 * Notes: 获取分类下的文章
* @Author: 玄尘 * @Author: 玄尘
* @Date : 2020/9/10 10:05 * @Date : 2020/9/10 10:05
* @param $categoryId * @param $categoryId
* @param $take * @param int $take
* @param string $mark
* @return \App\Models\Article * @return \App\Models\Article
*/ */
function getArticlesBYCate($categoryId, $take = 8, $mark = 'one') function getArticlesBYCate($categoryId, $take = 8, $mark = 'one')
@@ -63,7 +66,7 @@ function getArticlesBYCate($categoryId, $take = 8, $mark = 'one')
->get(); ->get();
} else { } else {
$cate = Category::find($categoryId); $cate = Category::find($categoryId);
$ids = $cate->getAllChildrenId(); $ids = $cate ? $cate->getAllChildrenId() : [];
$articles = Article::where('status', 1) $articles = Article::where('status', 1)
->ByCategory($ids) ->ByCategory($ids)
@@ -97,3 +100,54 @@ function getTopCate($categoryId)
return $parent; return $parent;
} }
/**
* Notes: 根据分类获取一张图片
* @Author: 玄尘
* @Date : 2021/10/8 13:53
* @param $categoryId
* @param string $result
* @return string
*/
function getOneAdvertByCate($categoryId, $result = '')
{
$info = Advert::where('category_id', $categoryId)
->latest('sort')
->latest()
->first();
if ($info) {
if ($result) {
return $info->{$result};
}
return $info;
} else {
return '';
}
}
function getVideoByCate($categoryId, $result = '')
{
$video = Video::where('category_id', $categoryId)
->latest()
->first();
if ($video) {
if ($result) {
return $video->{$result};
}
return $video;
} else {
return '';
}
}
function getVideosByCate($categoryId, $take = '8')
{
return Video::where('category_id', $categoryId)
->latest()
->take($take)
->get();
}

View File

@@ -9,27 +9,24 @@ class ArticleController extends Controller
{ {
/** /**
* 显示分类 * Notes: description
* @param \App\Models\Article $article * @Author: 玄尘
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View [type] [description] * @Date : 2021/10/8 14:54
* @param \App\Models\Article $article
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/ */
public function show(Article $article) public function show(Article $article)
{ {
// $parent = $category = $article->category;
// if ($category->childrens->isEmpty()) {
// $parent = $category->parent;
// }
// $advert = Advert::where('category_id',73)->first();
$categories = $article->categories;
$parent = [];
foreach ($categories as $category) { $parent = $category = $article->category;
$top = getTopCate($category->id);
$parent[] = $top->id; if ($category->childrens->isEmpty() && $category->parent) {
$parent = $category->parent;
} }
return view('article.show', compact('article', 'parent')); $article->increment('clicks');
// return view('article.show', compact('article', 'parent', 'category','advert'));
return view('article.show', compact('article', 'parent', 'category'));
} }

View File

@@ -10,7 +10,7 @@ class CategoryController extends Controller
/** /**
* 显示分类 * 显示分类
* @param Category $category [description] * @param Category $category [description]
* @return [type] [description] * @return [type] [description]
*/ */
public function index(Category $category) public function index(Category $category)
@@ -18,14 +18,25 @@ class CategoryController extends Controller
if ($category->type == Category::TYPE_SHOW && $category->article_id) { if ($category->type == Category::TYPE_SHOW && $category->article_id) {
return redirect("articles/" . $category->article_id); return redirect("articles/" . $category->article_id);
} else { } else {
$articles = $category->relations(Category::TYPE_ARTICLE)->where('status', 1)->latest()->paginate(); $template = 'show';
$parent = $category; if ($category->template) {
if ($parent->childrens->isEmpty()) { $template = $category->template;
}
$articles = $category->relations(Category::TYPE_ARTICLE)
->where('status', 1)
->latest('sort')
->latest('created_at')
->paginate(8);
$parent = $category;
if ($category->childrens->isEmpty() && $category->parent) {
$parent = $category->parent; $parent = $category->parent;
} }
return view('category.show', compact('articles', 'category', 'parent')); return view('category.' . $template, compact('articles', 'category', 'parent'));
} }
} }
} }

View File

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\Advert; use App\Models\Advert;
use App\Models\Category; use App\Models\Category;
use App\Models\Link;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
@@ -21,19 +22,21 @@ class Controller extends BaseController
$categorys = Category::where('status', 1) $categorys = Category::where('status', 1)
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]) ->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW])
->where('top_show', 1) ->where('top_show', 1)
->latest('order') ->oldest('order')
->select('id', 'title') ->select('id', 'title')
->get(); ->get();
//地步友情链接 //友情链接
if (url()->current() == route('index.index')) { if (url()->current() == route('index.index')) {
$adverts = Advert::where('category_id', 72)->get(); $adverts = Advert::where('category_id', 72)->get();
} else { } else {
$adverts = Advert::where('category_id', 73)->get(); $adverts = Advert::where('category_id', 73)->get();
} }
$links = Link::get();
View::share('all_categorys', $categorys); View::share('all_categorys', $categorys);
View::share('adverts', $adverts); View::share('adverts', $adverts);
View::share('links', $links);
} }
} }

View File

@@ -17,12 +17,11 @@ class IndexController extends Controller
*/ */
public function index() public function index()
{ {
//研究中心
$links = Link::get();
$lt_adverts = Advert::where('category_id', 175)->latest('sort')->get(); $top_adverts = Advert::where('category_id', 33)->latest('sort')->first();
$cent_adverts = Advert::where('category_id', 33)->latest('sort')->first();
return view('index.index', compact('links', 'lt_adverts')); return view('index.index', compact('top_adverts', 'top_adverts'));
} }
//通用获取文章 //通用获取文章

View File

@@ -3,13 +3,11 @@
namespace App\Models; namespace App\Models;
use App\Models\Traits\BelongsToCategory; use App\Models\Traits\BelongsToCategory;
use App\Models\Traits\HasOneCover; use App\Models\Traits\HasCovers;
use App\Models\Traits\OrderByIdDesc;
use App\Scopes\SortScope;
class Advert extends Model class Advert extends Model
{ {
use HasOneCover, use HasCovers,
BelongsToCategory; BelongsToCategory;
} }

View File

@@ -3,19 +3,26 @@
namespace App\Models; namespace App\Models;
use App\Models\Traits\BelongsToCategory; use App\Models\Traits\BelongsToCategory;
use App\Models\Traits\HasOneCover; use App\Models\Traits\HasCovers;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Article extends Model class Article extends Model
{ {
use HasOneCover, BelongsToCategory; use HasCovers, BelongsToCategory;
public function getLinkAttribute() public function getLinkAttribute(): string
{ {
return route('article.show', $this); return route('article.show', $this);
} }
/***
* Notes: 获取详情内图片
* @Author: 玄尘
* @Date : 2021/10/8 11:58
* @return mixed|string
*/
public function get_content_cover() public function get_content_cover()
{ {
preg_match("/<img.*?src=\"([^\"]+)\"[^>].*?>/isU", str_ireplace("\\", "", $this->content), $matches); preg_match("/<img.*?src=\"([^\"]+)\"[^>].*?>/isU", str_ireplace("\\", "", $this->content), $matches);
@@ -35,12 +42,11 @@ class Article extends Model
*/ */
public function get_one_cover() public function get_one_cover()
{ {
if ($this->cover_path) { if ($this->cover_url) {
$path = $this->cover_path; $path = $this->cover_url;
} else { } else {
$path = $this->get_content_cover(); $path = $this->get_content_cover();
if ($path) { if ($path) {
$this->cover = str_replace("/storage", "", $path); $this->cover = str_replace("/storage", "", $path);
$this->save(); $this->save();
$path = config('app.url') . $path; $path = config('app.url') . $path;
@@ -65,6 +71,11 @@ class Article extends Model
->using(ArticleCategory::class); ->using(ArticleCategory::class);
} }
public function category(): BelongsTo
{
return $this->belongsTo(Category::class);
}
/** /**
* Notes: description * Notes: description
* @Author: 玄尘 * @Author: 玄尘
@@ -79,9 +90,11 @@ class Article extends Model
$ids = [$ids]; $ids = [$ids];
} }
return $query->whereHas('categories', function ($q) use ($ids) { return $query->whereIn('category_id', $ids);
$q->whereIN('id', $ids); //
}); // return $query->whereHas('categories', function ($q) use ($ids) {
// $q->whereIN('id', $ids);
// });
} }
} }

View File

@@ -2,32 +2,46 @@
namespace App\Models; namespace App\Models;
use App\Models\Traits\HasCovers;
use Encore\Admin\Traits\AdminBuilder; use Encore\Admin\Traits\AdminBuilder;
use Encore\Admin\Traits\ModelTree; use Encore\Admin\Traits\ModelTree;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Support\Str;
class Category extends Model class Category extends Model
{ {
use AdminBuilder, ModelTree; use AdminBuilder, ModelTree, HasCovers;
public const TYPE_SHOW = 'show'; public const TYPE_SHOW = 'show';
public const TYPE_ARTICLE = 'article'; public const TYPE_ARTICLE = 'article';
public const TYPE_ADVERT = 'advert'; public const TYPE_ADVERT = 'advert';
public const TYPE_VIDEO = 'video';
public const TYPES = [ public const TYPES = [
self::TYPE_ARTICLE => '文章列表', self::TYPE_ARTICLE => '文章列表',
self::TYPE_SHOW => '文章详情', self::TYPE_SHOW => '文章详情',
self::TYPE_ADVERT => '图片', self::TYPE_ADVERT => '图片列表',
self::TYPE_VIDEO => '视频列表',
]; ];
public function getLinkAttribute() public $cover_field = 'cover';
public function getLogoUrlAttribute(): string
{
return $this->parseImageUrl($this->logo);
}
public function getLinkAttribute(): string
{ {
return route('category.show', $this); return route('category.show', $this);
} }
/** /**
* 关联的数据 * 关联的数据
* @return [type] [description] * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany|\Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\HasOne|null [type] [description]
*/ */
public function relations() public function relations()
{ {
@@ -41,22 +55,25 @@ class Category extends Model
case self::TYPE_ADVERT: case self::TYPE_ADVERT:
return $this->hasMany(Advert::class); return $this->hasMany(Advert::class);
break; break;
case self::TYPE_VIDEO:
return $this->hasMany(Video::class);
break;
default: default:
return null; return null;
} }
} }
public function childrens() public function childrens(): HasMany
{ {
return $this->hasMany(self::class, 'parent_id'); return $this->hasMany(self::class, 'parent_id');
} }
public function parent() public function parent(): HasOne
{ {
return $this->hasOne(self::class, 'id', 'parent_id'); return $this->hasOne(self::class, 'id', 'parent_id');
} }
public function article() public function article(): BelongsTo
{ {
return $this->belongsTo(Article::class); return $this->belongsTo(Article::class);
} }
@@ -67,17 +84,38 @@ class Category extends Model
* @Date : 2020/4/6 3:12 下午 * @Date : 2020/4/6 3:12 下午
* @return array * @return array
*/ */
public function getAllChildrenId() public function getAllChildrenId(): array
{ {
$ids = array_keys($this->buildSelectOptions([], $this->id)); $ids = array_keys($this->buildSelectOptions([], $this->id));
array_unshift($ids, $this->id); if ($ids) {
array_unshift($ids, $this->id);
return $ids; return $ids;
}
return [];
} }
public function articles(): BelongsToMany // public function articles(): BelongsToMany
// {
// return $this->belongsToMany(Article::class);
// }
public function articles(): HasMany
{ {
return $this->belongsToMany(Article::class); return $this->hasMany(Article::class);
}
/**
* Notes: 格式化description
* @Author: 玄尘
* @Date : 2021/10/8 15:24
*/
public function getDescriptionHtmlAttribute(): string
{
return str_replace("\n", "</br>", $this->description);
return Str::replaceArray('\n', ['</br>'], $this->description);
} }
} }

View File

@@ -1,22 +1,16 @@
<?php <?php
namespace App\Models; namespace App\Models;
use DateTimeInterface; use DateTimeInterface;
use Encore\Admin\Traits\DefaultDatetimeFormat;
use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Database\Eloquent\Model as Eloquent;
class Model extends Eloquent class Model extends Eloquent
{ {
use DefaultDatetimeFormat;
protected $guarded = []; protected $guarded = [];
/**
* 为数组 / JSON 序列化准备日期。
*
* @param \DateTimeInterface $date
* @return string
*/
protected function serializeDate(DateTimeInterface $date)
{
return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
}
} }

View File

@@ -0,0 +1,83 @@
<?php
namespace App\Models\Traits;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
trait HasCovers
{
/**
* Notes : 获取封面图片字段(单图)
* @Date : 2021/3/16 4:34 下午
* @Author : < Jason.C >
* @return string
*/
public function getCoverField(): string
{
return $this->cover_field ?? 'cover';
}
/**
* Notes : 获取图片字段(多图)
* @Date : 2021/3/16 4:35 下午
* @Author : < Jason.C >
* @return string
*/
public function getPicturesField(): string
{
return $this->pictures_field ?? 'pictures';
}
/**
* Notes : 解析单图地址
* @Date : 2021/3/16 4:54 下午
* @Author : < Jason.C >
* @return string
*/
public function getCoverUrlAttribute(): string
{
$cover = $this->getAttribute($this->getCoverField());
return $this->parseImageUrl($cover);
}
/**
* Notes : 解析多图地址
* @Date : 2021/3/16 4:54 下午
* @Author : < Jason.C >
* @return array
*/
public function getPicturesUrlAttribute(): array
{
$pictures = $this->getAttribute($this->getPicturesField());
if (empty($pictures)) {
return [];
}
return collect($pictures)->map(function ($picture) {
return $this->parseImageUrl($picture);
})->toArray();
}
/**
* Notes : 解析图片文件的实际展示地址
* @Date : 2021/3/16 4:53 下午
* @Author : < Jason.C >
* @param string|null $image
* @return string
*/
protected function parseImageUrl(?string $image): string
{
if (empty($image)) {
return '';
} elseif (Str::startsWith($image, 'http')) {
return $image;
} else {
return Storage::url($image);
}
}
}

View File

@@ -1,24 +0,0 @@
<?php
namespace App\Models\Traits;
use Illuminate\Support\Facades\Storage;
trait HasOneCover
{
/**
* 拼接图片全地址
* @author 玄尘 2020-03-05
* @return string
*/
public function getCoverPathAttribute(): ?string
{
if ($this->cover) {
return Storage::url($this->cover);
} else {
return '';
}
}
}

13
app/Models/Video.php Normal file
View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use App\Models\Traits\BelongsToCategory;
use App\Models\Traits\HasCovers;
class Video extends Model
{
use HasCovers,
BelongsToCategory;
}

View File

@@ -9,9 +9,9 @@ use Illuminate\Support\ServiceProvider;
//add fixed sql //add fixed sql
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
/** /**
* Register any application services. * Register any application services.
*
* @return void * @return void
*/ */
public function register() public function register()
@@ -21,14 +21,14 @@ class AppServiceProvider extends ServiceProvider
/** /**
* Bootstrap any application services. * Bootstrap any application services.
*
* @return void * @return void
*/ */
public function boot() public function boot()
{ {
$table = config('admin.extensions.config.table', 'admin_config'); // $table = config('admin.extensions.config.table', 'admin_config');
if (Schema::hasTable($table)) { // if (Schema::hasTable($table)) {
Config::load(); // Config::load();
} // }
} }
} }

1977
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateVideosTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('videos', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('category_id')->index();
$table->string('title');
$table->string('cover');
$table->string('url')->nullable();
$table->integer('sort');
$table->timestamps();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('videos');
}
}

View File

@@ -1,567 +0,0 @@
@charset "utf-8";
/******基础样式开始******/
body {
font-family: Microsoft Yahei, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333;
background: #fff;
text-align: justify;
text-justify: inter-ideograph;
background-image: url(about:blank);
background-attachment: fixed;
height: 100%;
}
table,
td {
font-family: Microsoft Yahei, Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 24px;
color: #2e2e2e;
}
html,
body,
div,
span,
p,
h1,
h2,
h3,
h4,
h5,
h6,
em,
img,
strong,
blockquote,
sub,
sup,
tt,
i,
b,
dd,
dl,
dt,
form,
label,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
ul,
li,
p,
a,
ol {
margin: 0;
padding: 0;
}
s,
i,
em {
font-style: normal;
text-decoration: none;
}
ul,
ol,
li {
list-style-type: none;
list-style: none;
}
button,
input,
select,
textarea {
vertical-align: middle;
font-family: Microsoft Yahei;
margin: 0;
padding: 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: 100%;
}
address,
cite,
dfn,
em,
var {
font-style: normal;
}
code,
kbd,
pre,
samp {
font-family: courier new, courier, monospace;
}
sup {
vertical-align: text-top;
}
sub {
vertical-align: text-bottom;
}
legend {
color: #000;
}
fieldset,
img {
border: 0;
}
button,
input,
select,
textarea {
font-size: 100%;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
a {
color: #6e6e6e;
text-decoration: none;
}
.white,
.white a {
color: #fff;
text-decoration: none;
}
.white,
a:hover {
color: green;
}
.clearfix {
clear: both;
height: 1px;
margin-top: -1px;
overflow: hidden;
}
.fw {
font-family: Microsoft Yahei, Arial, Helvetica, sans-serif;
}
.fl {
float: left;
}
.fr {
float: right;
}
.fb {
font-weight: bold;
}
.disb {
display: block;
}
.disn {
display: none;
}
@font-face {
font-family: 'impact';
src: url(impact.ttf);
src: url('impact.eot');
/* IE9 Compat Modes */
src: url('impact.eot?#iefix') format('embedded-opentype'),
/* IE6-IE8 */
url('impact.woff') format('woff'),
/* Modern Browsers */
url('impact.ttf') format('truetype'),
/* Safari, Android, iOS */
url('impact.svg#impact') format('svg');
/* Legacy iOS */
}
.area-dialog-ct {
width: 760px;
padding: 10px;
background: #fff;
}
.area-dialog-bar {
height: 40px;
background: #003a52;
}
.area-dialog-bar span,
.area-dialog-bar a {
line-height: 40px;
color: #fff;
font-size: 14px;
padding: 0 15px;
}
.area-dialog-bar a#_a_c_close {
float: right;
}
.area-dialog-ct .area-dialog-content {
margin0;
}
.area-dialog-ct .area-dialog-content::after {
clear: both;
display: block;
content: "";
}
.area-dialog-content li {
float: left;
padding: 10px;
position: relative;
}
.area-dialog-content .area-m-o {
width: 150px;
margin: 0;
padding: 0 10px;
background: #fff;
}
.area-dialog-content li .a-i-disable {
background: #d8d8d8;
}
.area-dialog-content .area-m-o .a-check-num {
color: #d00;
}
.area-dialog-content input {
margin: -3px 5px 0 0;
}
.area-dialog-content .area-m-o lable {
line-height: 35px;
font-size: 12px;
color: #333;
}
.area-dialog-content li .a-city-ct {
display: none;
}
.area-dialog-content li.area-item-mover {
background: #f7e76a;
}
.area-dialog-content li.area-item-mover .a-city-ct {
display: block;
}
.area-dialog-bottom {
margin-top: 10px;
text-align: center;
}
.area-dialog-bottom a {
padding: 5px 15px;
color: #fff;
background: #007ba9;
font-size: 14px;
border-radius: 3px;
}
.area-dialog-bottom a:hover {
background: #003a52;
transition: 0.3s ease;
}
.area-dialog-content .a-city-ct {
position: absolute;
left: 0;
top: 45px;
background: #f7e76a;
padding: 10px;
z-index: 100;
width: 480px;
}
.area-dialog-content .a-city-ct:after {
content: "";
display: block;
clear: both;
}
.area-dialog-content .a-city-ct p {
float: left;
width: 100px;
padding: 5px 10px;
}
.color-1 {
background-color: #249edc;
}
.color-2 {
background-color: #17a668;
}
.color-3 {
background-color: #741d88;
}
.color-4 {
background-color: #da9627;
}
.color-5 {
background-color: #ff9933;
}
.color-6 {
background-color: #6666ff;
}
.color-7 {
background-color: #ff99ff;
}
.color-8 {
background-color: #66cc66;
}
.color-9 {
background-color: #666;
}
.color-10 {
background-color: #ff7800;
}
.color-11 {
background-color: #ccc;
}
.color-12 {
background-color: #ff3333;
}
.color-white {
background-color: #fff;
}
.bgcolor-gray {
background: #f5f5f5;
}
.ipt-txt {
outline: none;
border: 1px solid #ccc;
}
.ipt-txt:focus,
.ipt-sec:focus {
border: 1px solid #0078b5;
box-shadow: #ccc 2px 4px 2px;
}
.small-ipt {
line-height: 16px;
width: 150px;
height: 16px;
padding: 4px;
}
.ipt-sec {
padding: 5px;
}
.ipt-radio,
.ipt-check {
vertical-align: middle;
margin: 0 5px 4px 0;
}
.btnBox {
width: 100%;
text-align: center;
}
.Submit {
width: 200px;
height: 42px;
line-height: 42px;
font-size: 16px;
color: #fff;
border: 0;
outline: none;
margin: 0 auto;
cursor: pointer;
transition: background-color 0.3s ease;
-moz-transition: background-color 0.3s ease;
-webkit-transition: background-color 0.3s ease;
}
.Submit:hover {
background-color: #F60;
}
/* 弹性盒子布局 */
.flexrow {
display: -webkit-box;
/* Chrome 4+, Safari 3.1, iOS Safari 3.2+ */
display: -moz-box;
/* Firefox 17- */
display: -webkit-flex;
/* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */
display: -moz-flex;
/* Firefox 18+ */
display: -ms-flexbox;
/* IE 10 */
display: flex;
/* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */
flex-direction: row;
justify-content: center;
align-items: center;
box-sizing: border-box;
}
.flexcolumn {
display: -webkit-box;
/* Chrome 4+, Safari 3.1, iOS Safari 3.2+ */
display: -moz-box;
/* Firefox 17- */
display: -webkit-flex;
/* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */
display: -moz-flex;
/* Firefox 18+ */
display: -ms-flexbox;
/* IE 10 */
display: flex;
/* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */
flex-direction: column;
justify-content: center;
align-items: center;
box-sizing: border-box;
}
.jc_start {
justify-content: flex-start;
}
.jc_end {
justify-content: flex-end;
}
.jc_sb {
justify-content: space-between;
}
.jc_sr {
justify-content: space-around;
}
/* align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit; */
.ai_start {
align-items: flex-start;
}
.ai_end {
align-items: flex-end;
}
.flex1 {
flex: 1;
}
.flex2 {
flex: 2;
}
.flex3 {
flex: 3;
}
.flex4 {
flex: 4;
}
.flex5 {
flex: 5;
}
/* wrap 超出一行隐藏... 超出两行隐藏...*/
.overflow1 {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.overflow2 {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.overflow3 {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.overflow4 {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
}
.overflow7 {
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 7;
-webkit-box-orient: vertical;
}
.flexwrap{
flex-wrap: wrap;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1672
public/assets/index/css/font-awesome.css vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +0,0 @@
@charset "utf-8";
html, body { font-family:"微软雅黑"}
/*
* jQuery图片轮播(焦点图)插件
* ADD.JENA.201206291027
* EDIT.JENA.201206300904
* Author: jena
* Demo: http://ishere.cn/demo/jquery.slidebox/
*/
div.slideBox{ position:relative; width:670px; height:300px; overflow:hidden;}
div.slideBox ul.items{ position:absolute; float:left; background:none; list-style:none; padding:0px; margin:0px;}
div.slideBox ul.items li{ float:left; background:none; list-style:none; padding:0px; margin:0px;}
div.slideBox ul.items li a{ float:left; line-height:normal !important; padding:0px !important; border:none/*For IE.ADD.JENA.201206300844*/;}
div.slideBox ul.items li a img{ margin:0px !important; padding:0px !important; display:block; border:none/*For IE.ADD.JENA.201206300844*/;}
div.slideBox div.tips{ position:absolute; bottom:0px; width:100%; height:32px; background-color:#000; overflow:hidden;}
div.slideBox div.tips div.title{ position:absolute; left:0px; top:0px; height:100%;}
div.slideBox div.tips div.title a{ color:#FFF; font-size:12px; line-height:32px; margin-left:10px; text-decoration:none;}
div.slideBox div.tips div.title a:hover{ text-decoration:underline !important;}
div.slideBox div.tips div.nums{ position:absolute; right:0px; top:0px; height:100%;}
div.slideBox div.tips div.nums a{ display:inline-block; >float:left/*For IE.ADD.JENA.201206300844*/; width:10px; height:10px; background-color:#FFF; text-indent:-99999px; margin:12px 5px 0px 0px;}
div.slideBox div.tips div.nums a.active{ background-color:#093;}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 956 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Some files were not shown because too many files have changed in this diff Show More