|
@@ -31,7 +31,13 @@ class VideoController extends Controller
|
|
|
|
|
|
|
|
|
// 获取分类信息
|
|
|
- $category = DistVideoCategory::findOrFail($slug);
|
|
|
+ $category = DistVideoCategory::where(function ($query) use ($slug) {
|
|
|
+ $query->where('id', $slug)
|
|
|
+ ->orWhere('slug', $slug);
|
|
|
+ })
|
|
|
+ ->where('dist_id', getDistId())
|
|
|
+ ->firstOrFail();
|
|
|
+
|
|
|
// 获取分类下的所有产品,并按 is_pinned 排序,然后进行分页
|
|
|
$videos = DistVideo::where('category_id', $category->id)
|
|
|
->where('dist_id', getDistId())
|
|
@@ -87,8 +93,13 @@ class VideoController extends Controller
|
|
|
public function detail($slug)
|
|
|
{
|
|
|
|
|
|
- $video = DistVideo::where('dist_id', getDistId())->where('slug', $slug)->orWhere('id', $slug)->first();
|
|
|
-
|
|
|
+ // 获取视频信息,并确保 dist_id 符合 getDistId() 的要求
|
|
|
+ $video = DistVideo::where('dist_id', getDistId())
|
|
|
+ ->where(function ($query) use ($slug) {
|
|
|
+ $query->where('slug', $slug)
|
|
|
+ ->orWhere('id', $slug);
|
|
|
+ })
|
|
|
+ ->firstOrFail();
|
|
|
|
|
|
// 构建导航数据 开始
|
|
|
$breadcrumbs = [
|