|
@@ -223,22 +223,27 @@ class VideoService extends BaseService
|
|
|
|
|
|
// 随机优先匹配推送
|
|
|
$match = false;
|
|
|
- if($total > 3 && rand(100,999) > rand(100,999)){
|
|
|
+ $list = [];
|
|
|
+ if($total > 3 ){
|
|
|
// 关联推荐数据
|
|
|
- $match = true;
|
|
|
$list = $countModel->selectRaw($field)
|
|
|
->orderByRaw($uids?DB::raw("FIND_IN_SET(user_id,'".implode(',', $uids)."')"):'lev_a.create_time desc')
|
|
|
->orderByRaw($order)
|
|
|
->paginate($pageSize > 0 ? $pageSize : 9999999);
|
|
|
- }else{
|
|
|
+ $list = $list ? $list->toArray() : [];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 数据不够补充默认匹配数据
|
|
|
+ if($total<$pageSize){
|
|
|
// 默认推荐数据
|
|
|
- $list = $model->selectRaw($field)
|
|
|
+ $list1 = $model->selectRaw($field)
|
|
|
->orderByRaw('lev_a.create_time desc')
|
|
|
->orderByRaw($order)
|
|
|
->paginate($pageSize > 0 ? $pageSize : 9999999);
|
|
|
+ $list1 = $list1 ? $list1->toArray() : [];
|
|
|
+ $list = array_merge($list, $list1);
|
|
|
}
|
|
|
-
|
|
|
- $list = $list ? $list->toArray() : [];
|
|
|
+
|
|
|
if ($list && $list['data']) {
|
|
|
foreach ($list['data'] as &$item) {
|
|
|
$item['time_text'] = isset($item['create_time']) ? dateFormat($item['create_time'], 'Y-m-d H:i') : '';
|