123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472 |
- import 'dart:io';
- import 'package:dio/dio.dart' hide Headers;
- import 'package:retrofit/retrofit.dart';
- import 'package:sport/bean/UpdateInfo.dart';
- import 'package:sport/bean/comment.dart';
- import 'package:sport/bean/comment_post.dart';
- import 'package:sport/bean/feedback_category.dart';
- import 'package:sport/bean/forum.dart';
- import 'package:sport/bean/game.dart';
- import 'package:sport/bean/game_add_entity.dart';
- import 'package:sport/bean/game_record.dart';
- import 'package:sport/bean/game_record_sum.dart';
- import 'package:sport/bean/game_record_history.dart';
- import 'package:sport/bean/hardware.dart';
- import 'package:sport/bean/image.dart';
- import 'package:sport/bean/jog/detail.dart';
- import 'package:sport/bean/jog/record.dart';
- import 'package:sport/bean/jog/sum.dart';
- import 'package:sport/bean/notice.dart';
- import 'package:sport/bean/post.dart';
- import 'package:sport/bean/rank_game_info.dart';
- import 'package:sport/bean/rank_info.dart';
- import 'package:sport/bean/share_info.dart';
- import 'package:sport/bean/shop.dart';
- import 'package:sport/bean/sport_detail.dart';
- import 'package:sport/bean/sport_index.dart';
- import 'package:sport/bean/exer_index.dart';
- import 'package:sport/bean/sport_step.dart';
- import 'package:sport/bean/sport_target.dart';
- import 'package:sport/bean/sport_target_index.dart';
- import 'package:sport/bean/sport_target_record.dart';
- import 'package:sport/bean/sport_target_today.dart';
- import 'package:sport/bean/user_friend.dart';
- import 'package:sport/bean/user_info.dart';
- import 'package:sport/services/api/resp.dart';
- import 'package:sport/bean/message.dart';
- import 'package:sport/bean/friend_list.dart';
- import 'package:sport/bean/friend_relation.dart';
- part 'rest_client.g.dart';
- @RestApi()
- abstract class RestClient {
- factory RestClient(Dio dio, {String baseUrl}) = _RestClient;
- @GET("/app/checkUpdate")
- Future<RespData<UpdateInfo>> checkUpdate(@Query("version") String version);
- @GET("/app/hardwareLastVer")
- Future<RespData<Hardware>> checkHardwareUpdate(@Query("hardware_ver") String ver, @Query("app_ver") String appVer);
- @POST("/app/onConnBt")
- Future<RespData<String>> onConnBt(@Query("shoes_mac") String shoes_mac, @Query("firmware_ver") String firmware_ver, @Query("hardware_ver") String hardware_ver, @Query("app_ver") String app_ver, @Query("os_name") String os_name, @Query("os_ver") String os_ver, @Query("lang") String lang, @Query("phone_brand") String phone_brand, @Query("phone_model") String phone_model);
- @POST("/app/logHardwareErr")
- Future<RespData<String>> logHardwareErr(@Query("shoes_mac") String shoes_mac, @Query("firmware_ver") String firmware_ver, @Query("hardware_ver") String hardware_ver, @Query("app_ver") String app_ver, @Query("err_code") String err_code, @Query("err_msg") String err_msg, @Query("err_detail") String err_detail);
- @GET("/user/info")
- Future<RespData<UserInfo>> getUserInfo(@Query("id") String uid, {@DioOptions() Options? options});
- @GET("/user/info")
- Future<RespData<UserInfo>> getUserInfoSelf();
- @GET("/user/countNameCard")
- Future<RespData<int>> getCountNameCard();
- // ********************** 运动首页相关 *****************************
- @GET("/sport/index")
- Future<RespData<SportIndex>> getSportIndex();
- @GET("/exer/index")
- Future<RespData<ExerIndex>> getExerIndex();
- @GET("/sport/detail")
- Future<RespData<SportDetail>> getSportDetail();
- @POST("/gameRecord/addGame")
- Future<RespData<GameAddEntity>> postAddGame(
- @Query("game_id") String gameId,
- @Query("score") double score,
- @Query("level") int level,
- @Query("record") int record,
- @Query("mode") int mode,
- @Query("duration") int duration,
- @Query("consume") int consume,
- @Query("screen") int screen,
- @Query("jump") int jumpCount,
- @Query("crouch") int crouchCount,
- @Query("step") int stepCount,
- @Query("distance") int distance,
- @Query("opponent_id") int opponent_id,
- @Query("is_cancel") int is_cancel,
- @Query("play_group") String play_group,
- @Query("movements") String movements,
- @Query("time") String time,
- );
- @GET("/sportTarget/all")
- Future<RespList<SportTarget>> getSportTargetAll();
- @GET("/sportTarget/setold")
- Future<RespData<SportTargetToday>> setSportTarget(@Query("id") int id);
- @GET("/sportTarget/set")
- Future<RespData<SportTargetToday>> setSportTargetToday(@Query("type") String type, {@Query("consume") int? consume, @Query("duration_minute") int? durationMinute});
- @GET("/sportTarget/setCustom")
- Future<RespData<SportTargetToday>> setSportTargetCustom(@Query("duration") int duration, @Query("consume") int consume);
- @GET("/sportTarget/del")
- Future<Resp> delSportTarget();
- @GET("/sportTarget/my")
- Future<RespData<SportTargetToday>> getSportTargetMy();
- @GET("/sportTarget/index")
- Future<RespData<SportTargetIndex>> getSportTargetIndex();
- @GET("/sportTarget/records")
- Future<RespList<SportTargetRecord>> getSportTargetRecord(@Query("year") int year, @Query("month") int month);
- @FormUrlEncoded()
- @POST("/sportTarget/reward")
- Future<RespData<String>> sportTargetReward(@Query("id") int id);
- @GET("/exerRecord/listOneDay")
- Future<RespData<SportDetailSimple>> getSportRecordListOneDay(@Query("date") String date, {@Query("except_daily") int? exceptDaily});
- @GET("/exerRecord/listByDay")
- Future<RespData<SportDetailSimple>> getSportRecordListByDay(@Query("begin") String begin, @Query("end") String end, {@Query("except_daily") int? exceptDaily});
- @GET("/exerRecord/listByMonth")
- Future<RespData<SportDetailSimple>> getSportRecordListByMonth(@Query("year") int year, {@Query("except_daily") int? exceptDaily});
- @GET("/exerRecord/listByYear")
- Future<RespData<SportDetailSimple>> getSportRecordListByYear({@Query("except_daily") int? exceptDaily});
- @GET("/exerRecord/history")
- Future<RespList<SportHistory>> getSportRecordHistory(@Query("year") int year);
- @GET("/gameRecord/list")
- Future<RespPage<RecordsTodaySum>> getSportRecordList(@Query("game_id") int gameId, {@Query("page") int? page});
- @FormUrlEncoded()
- @POST("/stepRecord/addDaily")
- Future<RespData<SportStep>> addDaily({@Query("step") int? step, @Query("distance") int? distance, @Query("time") String? time, @Field("data") String? data});
- @GET("/stepRecord/listOneDay")
- Future<RespData<SportStep>> getStepRecordListOneDay(@Query("date") String date);
- @GET("/stepRecord/listByDay")
- Future<RespData<SportStep>> getStepRecordListByDay(@Query("begin") String begin, @Query("end") String end);
- @GET("/stepRecord/listByMonth")
- Future<RespData<SportStep>> getStepRecordListByMonth(@Query("year") int year);
- @GET("/stepRecord/listByYear")
- Future<RespData<SportStep>> getStepRecordListByYear();
- @GET("/gameRecord/sum")
- Future<RespData<GameRecordHistory>> getGameRecordSum();
- @GET("/gameRecord/game")
- Future<RespData<GameRecord>> getGameRecord(@Query("id") int gameId);
- @GET("/rank/game")
- Future<RespData<RankInfo>> getRankInfo(@Query("game_id") String gameId, {@Query("province_id") int? provinceId, @Query("city_id") int? cityId, @Query("district_id") int? districtId, @Query("scope") String? scope});
- // ********************** 社区相关 *****************************
- @GET("/forum/index")
- Future<RespList<Forum>> getForumIndex();
- @GET("/forum/index2")
- Future<RespList<Forum>> getForumIndex2();
- @GET("/forum/list")
- Future<RespPage<Post>> getPostList({
- @Query("forumId") String? forumId,
- @Query("p") int? page,
- @Query("isGood") int? isGood,
- @Query("kw") String? kw,
- @Query("isOfficial") String? isOfficial,
- });
- @GET("/forum/listByOfficial")
- Future<RespPage<Post>> getPostListByOfficial({@Query("forumId") String? forumId, @Query("p") int? page, @Query("limit") int? limit, @Query("sortBy") String? sortBy, @Query("isOfficial") String? isOfficial});
- @GET("/forum/listByHot")
- Future<RespPage<Post>> getPostListByHot({@Query("forumId") String? forumId, @Query("p") int? page, @Query("isOfficial") String? isOfficial, @DioOptions() Options? options});
- @GET("/forum/listByUser")
- Future<RespPage<Post>> getPostListByUser(@Query("uid") String uid, {@Query("forumId") String? forumId, @Query("p") int? page, @Query("sortBy") String? sortBy, @Query("removeTop") int? removeTop, @Query("isOfficial") String? isOfficial});
- @GET("/forum/listByFollow")
- Future<RespPage<Post>> getPostListByFollow(@Query("uid") String uid, {@Query("forumId") String? forumId, @Query("p") int? page, @Query("limit") int? limit, @Query("testuid") int? testuid, @Query("sortBy") String? sortBy, @Query("isOfficial") String? isOfficial, @DioOptions() Options? options});
- @GET("/forum/subjectDetail")
- Future<RespData<Post>> getPostDetail(@Query("subjectId") String subjectId);
- @GET("/forum/comments")
- Future<RespPage<Comment>> getPostComments(@Query("subjectId") String subjectId, {@Query("p") int? page, @Query("sortBy") String? sortBy});
- @GET("/forum/subComments")
- Future<RespPage<Comment>> getPostCommentSubs(@Query("parentCommentId") String parentCommentId, {@Query("p") int? page, @Query("sortBy") String? sortBy});
- @GET("/forum/commentsFromId")
- Future<RespList<Comment>> getPostCommentsFromId(@Query("commentId") String commentId, {@Query("limit") int? limit, @Query("sortBy") String? sortBy});
- @GET("/forum/hotSearchWords")
- Future<RespList<String>> getSearchWords();
- @POST("/forum/like")
- Future<RespData<String>> postForumLike(@Query("objectId") String objectId, @Query("fieldName") String fieldName);
- @POST("/forum/unlike")
- Future<RespData<String>> postForumUnLike(@Query("objectId") String objectId, @Query("fieldName") String fieldName);
- @POST("/forum/delSubject")
- Future<RespData<String>> postDelSubject(@Query("subjectId") String subjectId);
- @POST("/forum/delComment")
- Future<RespData<String>> postDelComment(@Query("commentId") String commentId);
- @POST("/forum/report")
- Future<RespData<String>> postForumReport({@Query("subjectId") String? subjectId, @Query("commentId") String? commentId, @Query("content") String? content, @Query("userId") int? userId});
- @POST("/forum/blockUser")
- Future<RespList<int>> postForumBlockUser(@Query("uid") String uid);
- @POST("/forum/unblockUser")
- Future<RespList<int>> postForumUnBlockUser(@Query("uid") String uid);
- @GET("/forum/myBlockUsers")
- Future<RespList<UserInfo>> getMyBlockUsers();
- @POST("/forum/blockObject")
- Future<RespData<String>> postForumBlockObject(@Query("objectId") String objectId, @Query("for") String forName);
- @POST("/forum/postComment")
- Future<RespData<CommentPost>> postForumComment(@Query("subjectId") String subjectId, @Query("content") String content, {@Query("parentCommentId") String? parentCommentId, @Query("toCommentId") String? toCommentId});
- @POST("/forum/post")
- Future<RespData<Map<String, dynamic>>> postForum(@Query("forumId") String forumId, @Query("content") String content, {@Query("images") String? images, @Query("quoteSubjectId") String? quoteSubjectId, @Query("quoteCommentId") String? quoteCommentId, @Query("quoteData") String? quoteData, CancelToken? cancelToken});
- @POST("/forum/setUserTopSubjects")
- Future<RespData<String>> setUserTopSubjects(@Query("subjectIdList") String subjectIdList);
- @POST("/forum/unsetUserTopSubjects")
- Future<RespData<String>> unsetUserTopSubjects(@Query("subjectIdList") String subjectIdList);
- @GET("/forum/userTopSubjects")
- Future<RespList<Post>> getPostUserTopSubjects(@Query("uid") String uid, {@Query("forumId") String? forumId, @Query("p") int? page, @Query("sortBy") String? sortBy});
- @POST("/forum/follow")
- Future<RespData<String>> userFollow({@Query("uid") int? uid, @Query("groupId") String? groupId, @Query("groupName") String? groupName});
- @POST("/forum/unfollow")
- Future<RespData<String>> userUnFollow({@Query("uid") int? uid});
- @POST("/forum/ignoreFollow")
- Future<RespData<bool>> userIgnoreFollow({@Query("uid") int? uid});
- @POST("/forum/UserRelation")
- Future<RespData<FriendRelation>> userRelation({@Query("uid") int? uid});
- @GET("/forum/followList")
- Future<RespData<FriendList>> userFollowList({@Query("groupId") String? groupId, @Query("kw") String? kw, @Query("p") int? page, @Query("limit") int limit = 50});
- @GET("/forum/fansList")
- Future<RespData<FriendList>> userFansList({@Query("groupId") String? groupId, @Query("kw") String? kw, @Query("p") int? page, @Query("limit") int limit = 50});
- @GET("/forum/friends")
- Future<RespList<UserFriend>> userFriends({
- @Query("groupId") String? groupId,
- @Query("kw") String? kw,
- @Query("p") int? page,
- @Query("limit") int limit = 50,
- @Query("test") String? test,
- });
- @GET("/forum/friends")
- Future<RespData<FriendList>> userFriendsTest({
- @Query("groupId") String? groupId,
- @Query("kw") String? kw,
- @Query("p") int? page,
- @Query("limit") int limit = 50,
- @Query("test") String? test,
- });
- @GET("/user/search")
- Future<RespPage<UserInfo>> userSearch({@Query("kw") String? kw, @Query("p") int? page, @Query("limit") int limit = 20});
- @POST("/user/newFriendCode")
- Future<RespData> getNewFriendCode({
- @Query("forever") int? forever,
- @Query("forceUpate") int? forceUpdate,
- });
- @POST("/user/newFriend")
- Future<RespData<NewFriend>> getNewFriend(@Query("code") String code);
- @POST("/share/forwardSubject")
- Future<RespData<MessageInstance>> shareForwardSubject(
- @Query("subject_id") int subjectId,
- @Query("user_id") int userId,
- );
- @POST("/message/receive")
- Future<RespData<Message>> getMessageForPoll({@Query("cur_id") int? curId});
- @POST("/user/FetchFriendsRequest")
- Future<RespList<UserFriend>> getFriendRequest();
- @POST("/user/RejectFriend")
- Future<RespData<bool>> postRejectFriend(@Query("uid") int uid);
- @POST("/user/AcceptFriend")
- Future<RespData> postAcceptFriend(@Query("uid") int uid);
- @POST("/user/isFriend")
- Future<RespData<bool>> postIsFriend(@Query("uid") int uid);
- // ********************** 聊天相关 *****************************
- @POST("/chat/index")
- Future<RespList<ChatMessageInstance>> getChatIndex();
- @POST("/chat/user")
- Future<RespData<ChatMessage>> getChatUser(@Query("user_id") int userId, {@Query("begin_id") int? beginId});
- @POST("/chat/send")
- Future<RespData<MessageInstance>> postChatSend(
- @Query("user_id") String userId,
- @Query("type") String type,
- @Query("data") String data,
- );
- @POST("/chat/upload")
- @Headers(<String, dynamic>{
- "content-type": "multipart/form-data",
- })
- Future<RespData> postChatUpload(
- @Part(name: "file") File file,
- );
- @FormUrlEncoded()
- @POST("/chat/info")
- Future<RespList<ChatOnlineInfo>> getChatUserInfo(
- @Field("user_ids") String userIds,
- );
- // ********************** 分享相关 *****************************
- @POST("/share/createSport")
- Future<RespData<ShareInfo>> getshareCreateSport(@Query("period") String period, @Query("weight") double weight);
- @POST("/share/forwardSport")
- Future<RespData<MessageInstance>> getshareForwardSport(@Query("h") String hash, @Query("user_id") int userId);
- // ********************** 公告相关 *****************************
- @GET("/inform/list")
- Future<RespPage<Notice>> getInformList({@Query("p") int? page});
- @POST("/inform/read")
- Future<RespData> postInformRead(@Query("informId") int informId);
- @GET("/notice/list")
- Future<RespPage<Notice>> getNoticeList({@Query("type") String? type, @Query("markread") String? markread = "currpage", @Query("p") int? page, @Query("read") String? read, @Query("isMsg") String? isMsg = "1"});
- @GET("/notice/count")
- Future<RespData<int>> getNoticeCount(@Query("type") String type, @Query("read") String read, {@Query("isMsg") String isMsg = "1"});
- @POST("/notice/read")
- Future<RespData<Notice>> postNoticeRead(@Query("noticeId") int noticeId);
- // ********************** 反馈相关 *****************************
- @GET("/feedback/types")
- Future<RespList<FeedbackCategory>> getFeedbackTypes();
- @GET("/feedback/myChats")
- Future<RespList<FeedbackCategory>> getFeedbackChat({@Query("groupId") int? groupId, @Query("typeId") int? typeId});
- @POST("/feedback/post")
- Future<RespData<String>> postFeedback(@Query("typeId") String typeId, @Query("content") String content, {@Query("images") String? images, @Query("extra") String? extra});
- @POST("/media/Up4Feedback")
- @Headers(<String, dynamic>{
- "content-type": "multipart/form-data",
- })
- Future<RespData<String>> mediaUp4Feedback(@Part(name: "media") File file);
- @POST("/media/Up4Subject")
- @Headers(<String, dynamic>{
- "content-type": "multipart/form-data",
- })
- Future<RespData<Image>> mediaUp4Subject(@Part(name: "media") File file, {@Query("srcType") String? srcType, @Query("subjectId") String? subjectId, CancelToken? cancelToken});
- // ********************** 游戏相关 *********************************
- @GET("/game/all")
- Future<RespList<GameInfoData>> getGameAll();
- @GET("/game/all")
- Future getGameById(@Query("id") int id);
- @GET("/rank/all")
- Future<RespList<RankInfoData>> getRankInfoAll();
- @GET("/rank/game")
- Future<RespData<RankGameInfoData>> getRankGameInfo(@Query("game_id") String id, {@Query("scope") String? scope});
- @GET("/rank/sport")
- Future<RespData<RankGameInfoData>> getRankSportInfo(@Query("rank_id") String id, {@Query("scope") String? scope});
- // ********************** 商城相关 *********************************
- @GET("/shop/item")
- Future<RespData<ShopIndex>> getShopIndex();
- @GET("/score/record")
- Future<RespData<ScoreList>> getScoreIndex();
- @POST("/shop/buy")
- Future<RespData<Map<String, dynamic>>> buyItem(
- @Query("item_id") String id,
- );
- // ********************** 跑步相关 *********************************
- @POST("/jog/addRecord")
- @Headers(<String, dynamic>{
- "content-type": "multipart/form-data",
- })
- Future<RespData<Map<String, dynamic>>> jogAddRecord(
- @Part(name:"begin") int begin,
- @Part(name:"end") int end,
- @Part(name:"distance") int distance,
- @Part(name:"step") int step,
- @Part(name:"consume") int consume,
- @Part(name:"track") String track,
- @Part(name:"step_info") String stepInfo,
- @Part(name:"altitude_info") String altitudeInfo,
- @Part(name:"km_duration_info") String kmDurationInfo,
- @Part(name:"track_thumb") String thumb,
- @Part(name: "media") File media,
- );
- @POST("/jog/delRecord")
- Future<RespData<String>> jogDelRecord(@Query("id") int id);
- @POST("/jog/copyRecord")
- Future<RespData<String>> jogCopyRecord(@Query("id") int id);
- @GET("/jog/show")
- Future<RespData<JogDetail>> jogShowRecord(@Query("id") int id);
- @GET("/jog/listOneYear")
- Future<RespData<JogSum>> jogListOneYear(@Query("year") int year);
- @GET("/jog/listByDay")
- Future<RespData<JogRecord>> jogListByDay(@Query("begin") String begin, @Query("end") String end);
- @GET("/jog/listByMonth")
- Future<RespData<JogRecord>> jogListByMonth(@Query("year") int year);
- @GET("/jog/listByYear")
- Future<RespData<JogRecord>> jogListByYear();
- @FormUrlEncoded()
- @POST("/jog/setting")
- Future<RespData<Map<String, dynamic>>> jogSetting({@Field("setting") String? setting});
- }
|