1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Http\Controllers;
- use App\Models\Fpdx\PairModel;
- use App\Services\User\NoticeService;
- use App\Services\User\PartnerService;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Redis;
- class Home extends Controller
- {
- // 游乐场模块人数
- public function modelCnt(Request $request)
- {
- $data = Redis::get('app:model:cnt');
- if (empty($data)) {
- $pair = PairModel::count(\DB::raw('DISTINCT(`uid`)')) * 5;
- $goodnight = \App\Models\Goodnight\UserModel::count() * 5;
- $voice = \App\Models\Gnight\UserModel::count() * 5;
- $data = [
- 'pair' => $pair,
- 'voice' => $voice,
- 'goodnight' => $goodnight
- ];
- } else {
- $data = json_decode($data, true);
- }
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => [
- 'pair' => $pair,
- 'voice' => $voice,
- 'goodnight' => $goodnight
- ]
- );
- }
- }
|