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 ); } }