123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- import 'package:common_project/common_project.dart';
- import 'package:flutter/material.dart';
- import 'package:module_home/model/home_banner_model.dart';
- import 'package:module_home/model/home_diamond_rank_model.dart';
- import 'package:module_home/model/home_dust_rank_model.dart';
- import 'package:module_home/model/home_hot_room_list_model.dart';
- import 'package:module_home/model/home_may_like_model.dart';
- import 'package:module_home/model/home_room_list_model.dart';
- import 'package:module_home/model/home_search_content_users_model.dart';
- import 'package:module_home/model/home_search_rtc_room_model.dart';
- class HomeMainApi{
- //获取首页banner
- static Future<HomeBannerModel> getBanners() async {
- var url="api-app/v1/config/getBanners";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("bannerPosition", () => 102);
- map.putIfAbsent("categoryId", () => -1);
- var json = await ApiUtil.request(url,RequestType.GET, formData: map);
- return HomeBannerModel.fromJson(json);
- }
- //获取首页房间列表
- static Future<HomeHotRoomListModel> getHotRoomList({required int pageIndex,required String categoryId}) async {
- var url="api-app/v1/rtc/getHotRoomList";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("pageIndex", () => pageIndex);
- map.putIfAbsent("categoryId", () => categoryId);
- var json = await ApiUtil.request(url,RequestType.GET, formData: map);
- return HomeHotRoomListModel.fromJson(json);
- }
- static Future<HomeRoomListModel> getRoomList({required int pageIndex,required String categoryId}) async {
- var url="api-app/v1/rtc/getRoomList";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("pageIndex", () => pageIndex);
- map.putIfAbsent("categoryId", () => categoryId);
- var json = await ApiUtil.request(url,RequestType.GET, formData: map);
- return HomeRoomListModel.fromJson(json);
- }
- //猜你喜欢
- static Future<HomeMayLikeModel> getMayLike() async {
- var url="api-app/v1/social/getMayLike";
- Map<String, dynamic> map = Map();
- var json = await ApiUtil.request(url,RequestType.GET, formData: map);
- return HomeMayLikeModel.fromJson(json);
- }
- //搜索语聊房间
- static Future<HomeSearchRtcRoomModel> searchRtcRoom(String content,int pageIndex,int pageSize) async {
- var url="api-common/v1/search/searchRtcRoom";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("content", () => content);
- map.putIfAbsent("pageIndex", () => pageIndex);
- map.putIfAbsent("pageSize", () => pageSize);
- var json = await ApiUtil.request(url,RequestType.POST, formData: map);
- return HomeSearchRtcRoomModel.fromJson(json);
- }
- //搜索用户
- static Future<HomeSearchContentUsersModel> searchContent(String content,int pageNum,int pageSize) async {
- var url="api-common/v1/search/searchContent";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("content", () => content);
- map.putIfAbsent("pageNum", () => pageNum);
- map.putIfAbsent("pageSize", () => pageSize);
- var json = await ApiUtil.request(url,RequestType.POST, formData: map);
- return HomeSearchContentUsersModel.fromJson(json);
- }
- //富豪榜
- static Future<HomeDiamondRankModel> getDiamondRankDay(String roomId) async {
- var url="api-app/v1/rtc/getDiamondRankDay";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("roomId", () => roomId);
- var json = await ApiUtil.request(url,RequestType.GET, formData: map);
- return HomeDiamondRankModel.fromJson(json);
- }
- //魅力榜
- static Future<HomeDustRankModel> getDustRankDay(String roomId) async {
- var url="api-app/v1/rtc/getDustRankDay";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("roomId", () => roomId);
- var json = await ApiUtil.request(url,RequestType.GET, formData: map);
- return HomeDustRankModel.fromJson(json);
- }
- //我的收藏房间
- static Future<MeFavRoomModel> getFavRoomList(int pageIndex) async {
- var url = "api-app/v1/rtc/getFavRoomList";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("pageIndex", () => pageIndex);
- var json = await ApiUtil.request(url, RequestType.GET,formData: map);
- return MeFavRoomModel.fromJson(json);
- }
- static Future<BaseModel> followUser(String targetId) async {
- var url="api-app/v1/social/followUser";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("targetId", () => targetId);
- var json = await ApiUtil.request(url,RequestType.POST, formData: map);
- return BaseModel.fromJson(json);
- }
- //取消关注
- static Future<BaseModel> unFollowUser(String targetId) async {
- var url="api-app/v1/social/unFollowUser";
- Map<String, dynamic> map = Map();
- map.putIfAbsent("targetId", () => targetId);
- var json = await ApiUtil.request(url,RequestType.POST, formData: map);
- return BaseModel.fromJson(json);
- }
- }
|