123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace App\Http\Controllers\Goodnight;
- use App\Http\Controllers\Miniprogram\Auth;
- use App\Services\Goodnight\SubscribeService;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- class SubscribeController extends Controller
- {
- public function subscribe(Request $request)
- {
- $uid = Auth::auth();
- $this->validate($request, [
- 'type' => 'required|in:1, 2, 3'
- ]);
- $type = $request->post('type');
- $subService = new SubscribeService();
- $subscribed_at = $subService->subscribe($uid, $type);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => [
- 'subscribed_at' => $subscribed_at
- ]
- );
- }
- public function voices(Request $request)
- {
- $uid = Auth::auth();
- $page = $request->get('page') ?? 1;
- $subService = new SubscribeService();
- $data = $subService->voices($page, 20, $uid);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => [
- 'page' => $page,
- 'limit' => 20,
- 'total' => $data['total'],
- 'list' => $data['list']
- ]
- );
- }
- public function fishVoice()
- {
- $uid = Auth::auth();
- $ss = new SubscribeService();
- $data = $ss->fishVoice($uid);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- );
- }
- public function todayVoice()
- {
- $uid = Auth::auth();
- $ss = new SubscribeService();
- $data = $ss->todayVoice($uid);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $data
- );
- }
- }
|