12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Http\Controllers\Goodnight;
- use App\Http\Controllers\Controller;
- use App\Models\User\UserModel;
- use App\Services\Goodnight\UserService;
- class UserController extends Controller
- {
- /**
- * 获取某人用户信息
- * @param int $uid
- * @return array
- */
- public function getUser(int $uid): array
- {
- $user = UserModel::findOrfail($uid, ['uid', 'nickname', 'headimgurl', 'sex']);
- $uS = new UserService();
- $uS->getUser($user);
- unset($user->like_sex);
- unset($user->gnight_coin);
- unset($user->like_tone_1);
- unset($user->like_tone_2);
- unset($user->like_tone_3);
- unset($user->subscribed_at);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => $user
- );
- }
- }
|