|
|
@@ -297,15 +297,12 @@ class Pub extends BaseController
|
|
|
//名片浏览次数
|
|
|
(new UserModel)->where('uid', $uid)->inc('card_look_count', 1)->update();
|
|
|
$data["card_look_count"] = $userData["card_look_count"] + 1;
|
|
|
-
|
|
|
// 获取名片浏览量排行榜
|
|
|
- $time = $request->param('time', 'week'); // 时间段,默认为一周
|
|
|
+ $time = $request->param('time', time()); // 时间戳,默认为当前时间
|
|
|
$num = $request->param('num', 50); // 显示个数,默认为50个
|
|
|
$list = (new UserModel)->where('card_look_count', '>', 0);
|
|
|
- if ($time == 'week') {
|
|
|
- $list = $list->whereTime('create_time', '>=', strtotime('-1 week'));
|
|
|
- } else if ($time == 'month') {
|
|
|
- $list = $list->whereTime('create_time', '>=', strtotime('-1 month'));
|
|
|
+ if ($time > 0) {
|
|
|
+ $list = $list->whereTime('create_time', '>=', $time);
|
|
|
}
|
|
|
$list = $list->order('card_look_count', 'desc')->limit($num)->select();
|
|
|
$rankList = [];
|