diff --git a/app/Http/Controllers/Api/UserChannelController.php b/app/Http/Controllers/Api/UserChannelController.php new file mode 100644 index 0000000..bb375a6 --- /dev/null +++ b/app/Http/Controllers/Api/UserChannelController.php @@ -0,0 +1,23 @@ +only('channels'); + $channels = array_filter(json_decode($formData['channels'], true)); + if (!$channels) { + return $this->error('未选择任何频道'); + } + + $UserChannel = UserChannel::where('user_id', $this->user_id)->first(); + $UserChannel->channels = $channels; + $UserChannel->save(); + return $this->success(); + } +}