This commit is contained in:
2025-08-15 14:00:18 +08:00
parent 7d650a5d3c
commit d8ef43508f

View File

@@ -8,7 +8,7 @@ use extend\ba\Random;
use think\cache\driver\Redis; use think\cache\driver\Redis;
use support\think\Cache; use support\think\Cache;
use think\facade\Db; use think\facade\Db;
use think\facade\Log; use support\Log;
use think\Model; use think\Model;
class Course extends Model class Course extends Model
@@ -344,11 +344,8 @@ class Course extends Model
if (!$freeWatch) { if (!$freeWatch) {
$det_db = Db::connect(DatabaseRoute::getConnection('course_user', ['user_id' => $user['user_id']])); $det_db = Db::connect(DatabaseRoute::getConnection('course_user', ['user_id' => $user['user_id']]));
$detailsId = $det_db->name('course_user')->where(['course_id' => $courseId, 'classify' => 2])->column('course_details_id'); $detailsId = $det_db->name('course_user')->where(['course_id' => $courseId, 'classify' => 2])->column('course_details_id');
$det_db->close();
// Log::write('123');
$detailsId = array_flip(array_flip($detailsId)); // 去重 $detailsId = array_flip(array_flip($detailsId)); // 去重
} }
// return returnSuccessData(123);
// 处理剧集列表 // 处理剧集列表
$current = null; $current = null;
foreach ($courseDetailsSetVos as &$s) { foreach ($courseDetailsSetVos as &$s) {
@@ -371,18 +368,16 @@ class Course extends Model
} }
// 检查是否已点赞 // 检查是否已点赞
// if ($s['sort'] > $startSort && $s['sort'] < $endSort) { if ($s['sort'] > $startSort && $s['sort'] < $endSort) {
// $isGood_db = Db::connect(DatabaseRoute::getConnection('course_collect', ['user_id' => $user['user_id']])); $isGood_db = Db::connect(DatabaseRoute::getConnection('course_collect', ['user_id' => $user['user_id']]));
// $isGood = $isGood_db->name('course_collect') $isGood = $isGood_db->name('course_collect')
// ->where('course_details_id', $s['courseDetailsId']) ->where('course_details_id', $s['courseDetailsId'])
// ->where('classify', 2) ->where('classify', 2)
// ->limit(1) ->limit(1)
// ->count(); ->count();
// $isGood_db->close(); $s['isGood'] = empty($isGood) || $isGood == 0 ? 0 : 1;
// $s['isGood'] = empty($isGood) || $isGood == 0 ? 0 : 1; }
// }
} }
// return returnSuccessData(999);
// 如果没有当前播放集,默认第一集 // 如果没有当前播放集,默认第一集
if (empty($current) && !empty($courseDetailsSetVos)) { if (empty($current) && !empty($courseDetailsSetVos)) {
$courseDetailsSetVos[0]['current'] = 1; $courseDetailsSetVos[0]['current'] = 1;