refacotr: 视频
This commit is contained in:
@@ -5,6 +5,8 @@ namespace app\index\controller;
|
|||||||
|
|
||||||
use app\index\model\AttachmentCategoryModel;
|
use app\index\model\AttachmentCategoryModel;
|
||||||
use app\index\model\AttachmentModel;
|
use app\index\model\AttachmentModel;
|
||||||
|
use app\index\model\VideoCategoryModel;
|
||||||
|
use app\index\model\VideoModel;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,16 +65,51 @@ class Attachment extends Common
|
|||||||
*/
|
*/
|
||||||
public function video()
|
public function video()
|
||||||
{
|
{
|
||||||
|
$param = request()->param([
|
||||||
|
'page/d' => 1,
|
||||||
|
'size/d' => 12
|
||||||
|
]);
|
||||||
|
|
||||||
// 获取附件分类
|
// 获取附件分类
|
||||||
$categorys = AttachmentCategoryModel::field([
|
$attachment_categorys = AttachmentCategoryModel::field([
|
||||||
'id',
|
'id',
|
||||||
'name'
|
'name'
|
||||||
])
|
])
|
||||||
->language($this->lang_id)
|
->language($this->lang_id)
|
||||||
->parent(0)
|
->parent(0)
|
||||||
->isShow(true)
|
->isShow(true)
|
||||||
|
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||||
->select();
|
->select();
|
||||||
View::assign('categorys', $categorys);
|
View::assign('attachment_categorys', $attachment_categorys);
|
||||||
|
|
||||||
|
// 获取视频分类
|
||||||
|
$video_categorys = VideoCategoryModel::field([
|
||||||
|
'id',
|
||||||
|
'name'
|
||||||
|
])
|
||||||
|
->language($this->lang_id)
|
||||||
|
->isShow(true)
|
||||||
|
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||||
|
->select();
|
||||||
|
View::assign('video_categorys', $video_categorys);
|
||||||
|
|
||||||
|
// 获取视频
|
||||||
|
$videos = VideoModel::field([
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'desc',
|
||||||
|
'image',
|
||||||
|
'video',
|
||||||
|
'link'
|
||||||
|
])
|
||||||
|
->language($this->lang_id)
|
||||||
|
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||||
|
->paginate([
|
||||||
|
'list_rows' => $param['size'],
|
||||||
|
'page' => $param['page'],
|
||||||
|
]);
|
||||||
|
View::assign('videos', $videos);
|
||||||
|
View::assign('page', $videos->render());
|
||||||
|
|
||||||
return View::fetch('video');
|
return View::fetch('video');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,29 @@ declare (strict_types = 1);
|
|||||||
|
|
||||||
namespace app\index\model;
|
namespace app\index\model;
|
||||||
|
|
||||||
use think\Model;
|
use app\common\model\VideoCategoryBaseModel;
|
||||||
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 视频分类模型
|
||||||
* @mixin \think\Model
|
* @mixin \think\Model
|
||||||
*/
|
*/
|
||||||
class VideoCategoryModel extends Model
|
class VideoCategoryModel extends VideoCategoryBaseModel
|
||||||
{
|
{
|
||||||
//
|
// 启用软删除
|
||||||
|
use SoftDelete;
|
||||||
|
// 软删除字段
|
||||||
|
protected $deleteTime = 'deleted_at';
|
||||||
|
|
||||||
|
// 所属语言范围查询
|
||||||
|
public function scopeLanguage($query, $language)
|
||||||
|
{
|
||||||
|
$query->where('language_id', '=', $language);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否显示状态范围查询
|
||||||
|
public function scopeIsShow($query, bool $is_show)
|
||||||
|
{
|
||||||
|
$query->where('is_show', '=', (int)$is_show);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,30 @@ declare (strict_types = 1);
|
|||||||
|
|
||||||
namespace app\index\model;
|
namespace app\index\model;
|
||||||
|
|
||||||
|
use app\common\model\VideoBaseModel;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 视频模型
|
||||||
* @mixin \think\Model
|
* @mixin \think\Model
|
||||||
*/
|
*/
|
||||||
class VideoModel extends Model
|
class VideoModel extends VideoBaseModel
|
||||||
{
|
{
|
||||||
//
|
// 启用软删除
|
||||||
|
use SoftDelete;
|
||||||
|
// 软删除字段
|
||||||
|
protected $deleteTime = 'deleted_at';
|
||||||
|
|
||||||
|
// 所属语言范围查询
|
||||||
|
public function scopeLanguage($query, $language)
|
||||||
|
{
|
||||||
|
$query->where('language_id', '=', $language);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 推荐状态范围查询
|
||||||
|
public function scopeRecommend($query, bool $recommend)
|
||||||
|
{
|
||||||
|
$query->where('recommend', '=', (int)$recommend);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- tab切换 -->
|
<!-- tab切换 -->
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
{notempty name="categorys"}
|
{notempty name="attachment_categorys"}
|
||||||
{volist name="categorys" id="ca"}
|
{volist name="attachment_categorys" id="ca"}
|
||||||
<a href="{:url('attachment/index', ['id' => $ca.id])}">
|
<a href="{:url('attachment/index', ['id' => $ca.id])}">
|
||||||
<div class="tabit">
|
<div class="tabit">
|
||||||
{$ca.name}
|
{$ca.name}
|
||||||
@@ -33,57 +33,42 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- VIDEO 切换 -->
|
<!-- VIDEO 切换 -->
|
||||||
<div class="vidotabs">
|
<div class="vidotabs">
|
||||||
|
{notempty name="video_categorys"}
|
||||||
<div class="hd">
|
<div class="hd">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="vli von">Data Storage</li>
|
{volist name="video_categorys" id="vca"}
|
||||||
<li class="vli">Power Transmission</li>
|
<li class="vli {eq name='vca.id' value='Request.get.id' }von{/eq}">
|
||||||
<li class="vli">Smart Life</li>
|
<a href="{:url('attachment/video', ['id' => $vca.id])}" style="display: block;">{$vca.name}</a>
|
||||||
<li class="vli">Accessories</li>
|
</li>
|
||||||
|
{/volist}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
{/notempty}
|
||||||
<!-- 视频内容 -->
|
<!-- 视频内容 -->
|
||||||
|
{notempty name="videos"}
|
||||||
<div class="bdconten">
|
<div class="bdconten">
|
||||||
<ul >
|
<ul >
|
||||||
<dl class="video_hotul">
|
<dl class="video_hotul">
|
||||||
|
{volist name="videos" id="vo"}
|
||||||
<dd>
|
<dd>
|
||||||
<div class="hot1">
|
<div class="hot1">
|
||||||
<video preload="none" controls="controls">
|
<video poster="{$vo.image}" preload="none" controls="controls">
|
||||||
<source src="/uploads/uk/video/entertainment/RP1 .mp4" type="video/mp4">
|
<source src="{$vo.video}" type="video/mp4">
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
<div class="htit">
|
<div class="htit">
|
||||||
<div class="htit1">ORICO RP1 Headphones</div>
|
<div class="htit1">{$vo.name}</div>
|
||||||
<div class="htit2"> ORICO RP1 in-ear music headphones, skin-friendly and
|
<div class="htit2">{$vo.desc}</div>
|
||||||
comfortable for long time wearing; black, white, red and blue, four
|
|
||||||
colors for you to choose. ORICO 2169U3 full mesh 2.5 inch hard drive
|
|
||||||
enclosure, all-round heat-dissipation; compatible with SATA HDD below
|
|
||||||
9.5mm. </div>
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
<dd>
|
|
||||||
<div class="hot1">
|
|
||||||
<video preload="none" controls="controls">
|
|
||||||
<source src="/uploads/uk/video/entertainment/BS16.mp4" type="video/mp4">
|
|
||||||
</video>
|
|
||||||
</div>
|
|
||||||
<div class="htit">
|
|
||||||
<div class="htit1">ORICO BS16 Bluetooth Speaker</div>
|
|
||||||
<div class="htit2"> ORICO BS16 unique and delicate pocket Bluetooth speaker,
|
|
||||||
bring you beautiful music; smaller size, unprecedented endurance. ORICO
|
|
||||||
2169U3 full mesh 2.5 inch hard drive enclosure, all-round
|
|
||||||
heat-dissipation; compatible with SATA HDD below 9.5mm. </div>
|
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
|
{/volist}
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</dl>
|
</dl>
|
||||||
<div id="page39">
|
<div>{$page|raw}</div>
|
||||||
<!-- 分页 s -->
|
|
||||||
<!-- 分页 e -->
|
|
||||||
</div>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
{/notempty}
|
||||||
</div>
|
</div>
|
||||||
<!-- 如果切换的是 Videos-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user