login_api.dart 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import 'dart:io';
  2. import 'package:dio/dio.dart' hide Headers;
  3. import 'package:retrofit/retrofit.dart';
  4. import 'package:sport/bean/achievement_detail_info.dart';
  5. import 'package:sport/bean/achievement_info.dart';
  6. import 'package:sport/bean/bind_info.dart';
  7. import 'package:sport/bean/feed_back.dart';
  8. import 'package:sport/bean/game.dart';
  9. import 'package:sport/bean/login.dart';
  10. import 'package:sport/bean/rank_info.dart';
  11. import 'package:sport/services/api/resp.dart';
  12. part 'login_api.g.dart';
  13. //@RestApi(baseUrl: "https://local.moodrain.cn")
  14. @RestApi()
  15. abstract class LoginApi {
  16. factory LoginApi(Dio dio, {String baseUrl}) = _LoginApi;
  17. @POST("/user/loginByPhone")
  18. Future<LoginInfo> getLoginInfo(@Query("phone") String phone, {@Query("password") String password, @Query("captcha") String captcha});
  19. @POST("/user/sendCaptcha")
  20. Future getCaptcha(@Query("phone") String phone);
  21. @POST("/user/loginByQQ")
  22. Future loginQQ(@Query("openid") String openid, @Query("name") String name,
  23. {@Query("unionid") String unionid, @Query("avatar") String avatar, @Query("gender") int gender});
  24. @POST("/user/loginByWx")
  25. Future loginByWx(@Query("code") String code);
  26. @POST("/user/registerByPhone")
  27. Future registerByPhone(@Query("phone") String phone, @Query("password") String password, @Query("captcha") String captcha);
  28. @POST("/user/updateInfo")
  29. Future updateInfo(
  30. @Query("name") String name,
  31. @Query("gender") int gender, {
  32. @Query("age") int age,
  33. @Query("province_id") int province_id,
  34. @Query("city_id") int city_id,
  35. @Query("district_id") int district_id,
  36. });
  37. @POST("/user/verifyCaptcha")
  38. Future verifyCaptcha(
  39. @Query("phone") String phone,
  40. @Query("captcha") String captcha,
  41. );
  42. @POST("/user/resetPasswordByCaptcha")
  43. Future resetPasswordByCaptcha(
  44. @Query("phone") String phone,
  45. @Query("captcha") String captcha,
  46. @Query("password") String password,
  47. );
  48. @GET("/achievement/info")
  49. Future<AchievementInfo> getAchievementInfo();
  50. @GET('/achievement/show')
  51. Future<AchieveDetailInfo> getAchieveDetailInfo(@Query("id") int id, {@Query("user_id") String userId});
  52. @GET('/user/bindInfo')
  53. Future<BindInfo> getBindInfo();
  54. @GET('/user/bindPhone')
  55. Future bindPhone(@Query("phone") String phone, @Query("captcha") String captcha);
  56. @GET('/user/bindWx')
  57. Future bindWx(@Query("code") String code);
  58. @GET("/user/bindQQ")
  59. Future bindQQ(@Query("openid") String openid, {@Query("unionid") String unionid});
  60. @POST("/user/resetPasswordByOld")
  61. Future resetPasswordByOld(@Query("old_password") String old_password, @Query("new_password") String new_password);
  62. @GET("/feedback/types")
  63. Future<FeedTypeInfo> getFeedBackTypes();
  64. @POST("/feedback/myChats")
  65. Future<FeedBackInfo> getFeedBackChats({
  66. @Query("typeId") int typeId,
  67. @Query("groupId") int groupId,
  68. @Query("limit") int limit,
  69. });
  70. @POST("/feedback/post")
  71. Future postFeedBack(@Query("typeId") int typeId, @Query("content") String content, {@Query("images") String images});
  72. @POST("/user/setAvatar")
  73. @Headers(<String, dynamic>{
  74. "content-type": "multipart/form-data",
  75. })
  76. Future<RespData<String>> setAvatar(@Part(name: "file") File file);
  77. }