Home.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\Fpdx\PairModel;
  4. use App\Services\User\NoticeService;
  5. use App\Services\User\PartnerService;
  6. use Illuminate\Http\Request;
  7. use Illuminate\Support\Facades\Redis;
  8. class Home extends Controller
  9. {
  10. // 游乐场模块人数
  11. public function modelCnt(Request $request)
  12. {
  13. $data = Redis::get('app:model:cnt');
  14. if (empty($data)) {
  15. $pair = PairModel::count(\DB::raw('DISTINCT(`uid`)')) * 5;
  16. $goodnight = \App\Models\Goodnight\UserModel::count() * 5;
  17. $voice = \App\Models\Gnight\UserModel::count() * 5;
  18. $data = [
  19. 'pair' => $pair,
  20. 'voice' => $voice,
  21. 'goodnight' => $goodnight
  22. ];
  23. } else {
  24. $data = json_decode($data, true);
  25. }
  26. return array(
  27. 'code' => 200,
  28. 'message' => 'success',
  29. 'data' => [
  30. 'pair' => $pair,
  31. 'voice' => $voice,
  32. 'goodnight' => $goodnight
  33. ]
  34. );
  35. }
  36. }