123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <?php
- namespace App\Http\Controllers\User;
- use App\Http\Controllers\Controller;
- use App\Services\User\HomeService;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Core\Auth;
- use App\Models\Fpdx\RoomModel;
- use Illuminate\Support\Facades\Redis;
- /**
- * 个人主页接口
- * Class HomeController
- * @package App\Http\Controllers\User
- */
- class HomeController extends Controller
- {
- /**
- * 喜欢我的列表
- * @param Request $request
- * @return array
- * @deprecated
- */
- public function likeMeList(Request $request)
- {
- $uid = Auth::auth();
- $page = $request->get('page', 1);
- $pages = array(
- 'page' => $page,
- 'limit' => 20
- );
- $hs = new HomeService();
- $data = $hs->likeMeList($uid, $pages);
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- ]);
- }
- /**
- * 我喜欢的列表
- * @param Request $request
- * @return array
- */
- public function likeList(Request $request)
- {
- $uid = Auth::auth();
- $page = $request->get('page', 1);
- $pages = array(
- 'page' => $page,
- 'limit' => 20
- );
- $hs = new HomeService();
- $data = $hs->likeList($uid, $pages);
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => [
- 'page' => $data['pages']['page'],
- 'limit' => $data['pages']['limit'],
- 'total' => $data['pages']['total'],
- 'list' => $data['list']
- ],
- ]);
- }
- /**
- * 聊天列表数量
- * @return array
- */
- public function chatCount()
- {
- $uid = Auth::auth();
- $roomModel = new RoomModel();
- $cnt = $roomModel->getCountByType(2, $uid) ?? 0;
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => [
- 'count' => $cnt
- ]
- ]);
- }
- /**
- * 匹配历史数量
- * @return array
- */
- public function pairCount()
- {
- $uid = Auth::auth();
- $roomModel = new RoomModel();
- $cnt = $roomModel->getCountByType(1, $uid) ?? 0;
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => [
- 'count' => $cnt
- ]
- ]);
- }
- /**
- * 看过我的人数
- */
- public function lastLookMe()
- {
- $uid = Auth::auth();
- $hs = new HomeService();
- $cnt = $hs->lastLookMe($uid);
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => [
- 'cnt' => $cnt
- ]
- ]);
- }
- /**
- * 获取未解锁的「心动我的」卡片数量和最近三人的头像
- */
- public function unLookLikemeCnt()
- {
- $uid = Auth::auth();
- $hs = new HomeService();
- $data = $hs->unLookLikemeCnt($uid);
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- ]);
- }
- /**
- * 判断是否是内测用户
- */
- public function isTestUser()
- {
- $uid = Auth::auth();
- $exists = Redis::sismember("fpdx_supervip_test", $uid);
- if (1 == $exists) {
- $istest = true;
- } else {
- $istest = false;
- }
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => [
- 'istest' => $istest
- ]
- ]);
- }
- /**
- * 获取某人最近七天的热度
- */
- public function getLast7dayHot()
- {
- $uid = Auth::auth();
- $hs = new HomeService();
- $data = $hs->getLast7dayHot($uid);
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- ]);
- }
- /**
- * 获取当前人气值
- */
- public function getPopularity()
- {
- $uid = Auth::auth();
- $hs = new HomeService();
- $data = $hs->getPopularity($uid);
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- ]);
- }
- /**
- * 访客数据概览
- * @param Request $request
- * @return array
- */
- public function getVisitorOverView(Request $request)
- {
- $uid = Auth::auth();
- $hs = new HomeService();
- $data = $hs->getVisitorOverView($uid);
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- ]);
- }
- /**
- * 访客数据列表
- * @param Request $request
- * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
- * @deprecated
- */
- public function getVisitorList(Request $request)
- {
- $page = $request->get('page', 1);
- $pages = array(
- 'page' => $page,
- 'limit' => 20
- );
- $uid = Auth::auth();
- $hs = new HomeService();
- $data = $hs->getVisitorList($uid, $pages);
- return response([
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- ]);
- }
- }
|