HomeController.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Http\Controllers\Api\V1;
  3. use App\Models\BaseSettingsModel;
  4. use App\Models\DreamInfoModel;
  5. use App\Models\UserInfoModel;
  6. use Illuminate\Http\Request;
  7. use App\Services\Base\ErrorCode;
  8. class HomeController extends Controller
  9. {
  10. /**
  11. * @api {get} /api/home/index 首页(home)
  12. * @apiSuccessExample {json} Success-Response:
  13. * HTTP/1.1 200 OK
  14. * {
  15. * "state": true,
  16. * "code": 0,
  17. * "message": "",
  18. * "data": {
  19. * "verify_code": "1234"//该值调试时使用,sms调通后取消
  20. * }
  21. * }
  22. * @apiErrorExample {json} Error-Response:
  23. * HTTP/1.1 400 Bad Request
  24. * {
  25. * "state": false,
  26. * "code": 1000,
  27. * "message": "传入参数不正确",
  28. * "data": null or []
  29. * }
  30. * 可能出现的错误代码:
  31. * 1000 CLIENT_WRONG_PARAMS 传入参数不正确
  32. */
  33. public function index(Request $request)
  34. {
  35. // $tel = $request->session()->get('tel');
  36. $a = 1234235434534;
  37. return $a;
  38. $user = UserInfoModel::where('tel',$tel)->frist();
  39. //获取轮播图
  40. $banner = BaseSettingsModel::where([['category' => 'banner'],['status' => '1']])
  41. ->orderBy('sort')->limit('3')->get()->toArray();
  42. // 关注的用户
  43. $other_user = $user->UserCareUser;
  44. return $other_user;
  45. dd($other_user);
  46. // 获取其他用户信息 及梦想
  47. $user_info = UserInfoModel::orderBy('id')->get()->toArray();
  48. $dream = DreamInfoModel::orderBy('created_at')->get()->toArray();
  49. return $this->error(ErrorCode::SERVICE_CODE_FAILED);
  50. }
  51. }