MpUserController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace App\Http\Controllers\Api\V1\MpUser;
  3. use App\Facades\UserFacade;
  4. use App\Http\Controllers\Controller;
  5. use Illuminate\Http\Request;
  6. class MpUserController extends Controller
  7. {
  8. /**
  9. * Display a listing of the resource.
  10. *
  11. * @return \Illuminate\Http\Response
  12. */
  13. public function index()
  14. {
  15. //
  16. $code = request()->input('code');
  17. if(!$code) {
  18. return $this->error()->fail('code参数不能为空');
  19. }
  20. return UserFacade::wxMPLogin($code);
  21. }
  22. /**
  23. * Store a newly created resource in storage.
  24. *
  25. * @param \Illuminate\Http\Request $request
  26. * @return \Illuminate\Http\Response
  27. */
  28. public function store(Request $request)
  29. {
  30. //
  31. $code = request()->input('code');
  32. if(!$code) {
  33. return $this->error()->fail('code参数不能为空');
  34. }
  35. $wxUserInfo = request()->input('wx_user_info');
  36. if(!$wxUserInfo) {
  37. return $this->error()->fail('用户数据不能为空');
  38. }
  39. return UserFacade::wxMPRegister($code, $wxUserInfo);
  40. }
  41. /**
  42. * Display the specified resource.
  43. *
  44. * @param int $id
  45. * @return \Illuminate\Http\Response
  46. */
  47. public function show($id)
  48. {
  49. //
  50. }
  51. /**
  52. * Update the specified resource in storage.
  53. *
  54. * @param \Illuminate\Http\Request $request
  55. * @param int $id
  56. * @return \Illuminate\Http\Response
  57. */
  58. public function update(Request $request, $id)
  59. {
  60. //
  61. }
  62. /**
  63. * Remove the specified resource from storage.
  64. *
  65. * @param int $id
  66. * @return \Illuminate\Http\Response
  67. */
  68. public function destroy($id)
  69. {
  70. //
  71. }
  72. }