request->user['user_id'] ?? 0; $user = Account::findById($userId); if (empty($user)) { return json(['code' => 6001, 'msg' => '未登录']); } $level = AccountRepository::getInstance()->getUserLevel($user["coin_total"]); $nextLevel = AccountRepository::getInstance()->getUserNextLevel($level["value"]); if (!empty($nextLevel)) { $nextLevel["disparity"] = ( $nextLevel["value"] - $user['coin_total']); } return $this->json(0, "ok", [ "level" => $level, "nextLevel" => $nextLevel, "nickname" => $user['nickname'], "headimgurl" => $user['headimgurl'], ]); } }