缘池,和许愿树的内容

This commit is contained in:
userName 2025-12-30 17:57:42 +08:00
parent e2b4d04420
commit eb5daad9de
5 changed files with 152 additions and 30 deletions

View File

@ -181,26 +181,23 @@ public class CategoryManagementActivity extends AppCompatActivity {
private void loadCategoryStatistics() { private void loadCategoryStatistics() {
// 获取直播间分类统计type=8 // 获取直播间分类统计type=8
ApiClient.getService(this).getCategoryStatistics(8) ApiClient.getService(this).getCategoryStatistics(8)
.enqueue(new Callback<ApiResponse<List<Map<String, Object>>>>() { .enqueue(new Callback<ApiResponse<Map<String, Object>>>() {
@Override @Override
public void onResponse(Call<ApiResponse<List<Map<String, Object>>>> call, public void onResponse(Call<ApiResponse<Map<String, Object>>> call,
Response<ApiResponse<List<Map<String, Object>>>> response) { Response<ApiResponse<Map<String, Object>>> response) {
ApiResponse<List<Map<String, Object>>> body = response.body(); ApiResponse<Map<String, Object>> body = response.body();
List<Map<String, Object>> statistics = Map<String, Object> statistics =
response.isSuccessful() && body != null && body.isOk() && body.getData() != null response.isSuccessful() && body != null && body.isOk() && body.getData() != null
? body.getData() ? body.getData()
: null; : null;
if (statistics != null && !statistics.isEmpty()) { if (statistics != null && !statistics.isEmpty()) {
Log.d(TAG, "获取到 " + statistics.size() + " 个分类统计"); Log.d(TAG, "获取到分类统计: " + statistics.toString());
for (Map<String, Object> stat : statistics) {
Log.d(TAG, "统计: " + stat.toString());
}
} }
} }
@Override @Override
public void onFailure(Call<ApiResponse<List<Map<String, Object>>>> call, Throwable t) { public void onFailure(Call<ApiResponse<Map<String, Object>>> call, Throwable t) {
Log.e(TAG, "获取分类统计失败: " + t.getMessage(), t); Log.e(TAG, "获取分类统计失败: " + t.getMessage(), t);
} }
}); });

View File

@ -95,7 +95,12 @@ public class GroupDetailActivity extends AppCompatActivity {
membersAdapter = new GroupMembersAdapter(item -> { membersAdapter = new GroupMembersAdapter(item -> {
if (item == null) return; if (item == null) return;
// 点击成员查看资料 // 点击成员查看资料
UserProfileReadOnlyActivity.start(this, item.getUserId()); UserProfileReadOnlyActivity.start(this,
String.valueOf(item.getUserId()),
item.getNickname(),
"",
"",
0);
}); });
membersAdapter.setOnMemberLongClickListener(item -> { membersAdapter.setOnMemberLongClickListener(item -> {
if (item == null) return; if (item == null) return;
@ -277,7 +282,12 @@ public class GroupDetailActivity extends AppCompatActivity {
.setTitle(member.getNickname()) .setTitle(member.getNickname())
.setItems(options, (dialog, which) -> { .setItems(options, (dialog, which) -> {
if (which == 0) { if (which == 0) {
UserProfileReadOnlyActivity.start(this, member.getUserId()); UserProfileReadOnlyActivity.start(this,
String.valueOf(member.getUserId()),
member.getNickname(),
"",
"",
0);
} else if (which == 1) { } else if (which == 1) {
showRemoveMemberDialog(member); showRemoveMemberDialog(member);
} }

View File

@ -29,6 +29,7 @@ import com.example.livestreaming.net.ApiClient;
import com.example.livestreaming.net.ApiResponse; import com.example.livestreaming.net.ApiResponse;
import com.example.livestreaming.net.ApiService; import com.example.livestreaming.net.ApiService;
import com.example.livestreaming.net.AuthStore; import com.example.livestreaming.net.AuthStore;
import com.example.livestreaming.net.ChatMessageResponse;
import com.example.livestreaming.net.CreateRechargeRequest; import com.example.livestreaming.net.CreateRechargeRequest;
import com.example.livestreaming.net.CreateRechargeResponse; import com.example.livestreaming.net.CreateRechargeResponse;
import com.example.livestreaming.net.GiftResponse; import com.example.livestreaming.net.GiftResponse;

View File

@ -152,37 +152,29 @@ public class SearchActivity extends AppCompatActivity {
Log.d(TAG, "执行搜索: " + keyword); Log.d(TAG, "执行搜索: " + keyword);
ApiService apiService = ApiClient.getService(this); ApiService apiService = ApiClient.getService(this);
Call<ApiResponse<PageResponse<Map<String, Object>>>> call = Call<ApiResponse<PageResponse<Room>>> call =
apiService.searchLiveRooms(keyword, null, null, 1, 20); apiService.searchLiveRooms(keyword, null, null, 1, 20);
call.enqueue(new Callback<ApiResponse<PageResponse<Map<String, Object>>>>() { call.enqueue(new Callback<ApiResponse<PageResponse<Room>>>() {
@Override @Override
public void onResponse(Call<ApiResponse<PageResponse<Map<String, Object>>>> call, public void onResponse(Call<ApiResponse<PageResponse<Room>>> call,
Response<ApiResponse<PageResponse<Map<String, Object>>>> response) { Response<ApiResponse<PageResponse<Room>>> response) {
isSearching = false; isSearching = false;
if (response.isSuccessful() && response.body() != null) { if (response.isSuccessful() && response.body() != null) {
ApiResponse<PageResponse<Map<String, Object>>> apiResponse = response.body(); ApiResponse<PageResponse<Room>> apiResponse = response.body();
if (apiResponse.getCode() == 200 && apiResponse.getData() != null) { if (apiResponse.getCode() == 200 && apiResponse.getData() != null) {
PageResponse<Map<String, Object>> pageResponse = apiResponse.getData(); PageResponse<Room> pageResponse = apiResponse.getData();
List<Map<String, Object>> rooms = pageResponse.getList(); List<Room> rooms = pageResponse.getList();
if (rooms != null && !rooms.isEmpty()) { if (rooms != null && !rooms.isEmpty()) {
List<Room> roomList = new ArrayList<>();
for (Map<String, Object> roomData : rooms) {
Room room = parseRoomFromMap(roomData);
if (room != null) {
roomList.add(room);
}
}
all.clear(); all.clear();
all.addAll(roomList); all.addAll(rooms);
adapter.submitList(new ArrayList<>(all)); adapter.submitList(new ArrayList<>(all));
updateEmptyState(all); updateEmptyState(all);
Log.d(TAG, "搜索成功,找到 " + roomList.size() + " 个直播间"); Log.d(TAG, "搜索成功,找到 " + rooms.size() + " 个直播间");
} else { } else {
all.clear(); all.clear();
adapter.submitList(new ArrayList<>()); adapter.submitList(new ArrayList<>());
@ -204,7 +196,7 @@ public class SearchActivity extends AppCompatActivity {
} }
@Override @Override
public void onFailure(Call<ApiResponse<PageResponse<Map<String, Object>>>> call, Throwable t) { public void onFailure(Call<ApiResponse<PageResponse<Room>>> call, Throwable t) {
isSearching = false; isSearching = false;
Toast.makeText(SearchActivity.this, Toast.makeText(SearchActivity.this,
"网络错误: " + t.getMessage(), "网络错误: " + t.getMessage(),

View File

@ -265,4 +265,126 @@ public interface ApiService {
Call<ApiResponse<Boolean>> transferGroup( Call<ApiResponse<Boolean>> transferGroup(
@Path("groupId") long groupId, @Path("groupId") long groupId,
@Body TransferGroupRequest body); @Body TransferGroupRequest body);
// ==================== 分类接口 ====================
@GET("api/front/category/live")
Call<ApiResponse<List<CategoryResponse>>> getLiveRoomCategories();
@GET("api/front/category/work")
Call<ApiResponse<List<CategoryResponse>>> getWorkCategories();
@GET("api/front/category/list")
Call<ApiResponse<List<CategoryResponse>>> getCategories(@Query("type") int type);
@GET("api/front/category/hot")
Call<ApiResponse<List<CategoryResponse>>> getHotCategories(
@Query("type") int type,
@Query("limit") int limit);
@GET("api/front/category/statistics")
Call<ApiResponse<Map<String, Object>>> getCategoryStatistics(@Query("type") int type);
// ==================== 关注接口 ====================
@GET("api/front/follow/followers")
Call<ApiResponse<PageResponse<Map<String, Object>>>> getFollowersList(
@Query("page") int page,
@Query("pageSize") int pageSize);
@GET("api/front/follow/following")
Call<ApiResponse<PageResponse<Map<String, Object>>>> getFollowingList(
@Query("page") int page,
@Query("pageSize") int pageSize);
@GET("api/front/follow/stats")
Call<ApiResponse<Map<String, Object>>> getFollowStats(@Query("userId") Integer userId);
@GET("api/front/follow/check/{userId}")
Call<ApiResponse<Map<String, Object>>> checkFollowStatus(@Path("userId") int userId);
@POST("api/front/follow")
Call<ApiResponse<Map<String, Object>>> followUser(@Body Map<String, Object> body);
@POST("api/front/follow/cancel")
Call<ApiResponse<Map<String, Object>>> unfollowUser(@Body Map<String, Object> body);
// ==================== 作品接口 ====================
@Multipart
@POST("api/front/upload/video")
Call<ApiResponse<FileUploadResponse>> uploadVideo(
@Part MultipartBody.Part file,
@Part("model") RequestBody model,
@Part("pid") RequestBody pid);
@POST("api/front/works/publish")
Call<ApiResponse<Long>> publishWork(@Body WorksRequest body);
@GET("api/front/works/{id}")
Call<ApiResponse<WorksResponse>> getWorkDetail(@Path("id") long id);
@DELETE("api/front/works/{id}")
Call<ApiResponse<Boolean>> deleteWork(@Path("id") long id);
@POST("api/front/works/{id}/like")
Call<ApiResponse<Boolean>> likeWork(@Path("id") long id);
@DELETE("api/front/works/{id}/like")
Call<ApiResponse<Boolean>> unlikeWork(@Path("id") long id);
@POST("api/front/works/{id}/collect")
Call<ApiResponse<Boolean>> collectWork(@Path("id") long id);
@DELETE("api/front/works/{id}/collect")
Call<ApiResponse<Boolean>> uncollectWork(@Path("id") long id);
// ==================== 搜索接口 ====================
@GET("api/front/live/public/rooms/search")
Call<ApiResponse<PageResponse<Room>>> searchLiveRooms(
@Query("keyword") String keyword,
@Query("categoryId") Integer categoryId,
@Query("status") Integer status,
@Query("page") int page,
@Query("pageSize") int pageSize);
@GET("api/front/search/hot")
Call<ApiResponse<List<HotSearchResponse>>> getHotSearch(
@Query("type") int type,
@Query("limit") int limit);
@GET("api/front/search/suggestions")
Call<ApiResponse<List<String>>> getSearchSuggestions(
@Query("keyword") String keyword,
@Query("type") int type,
@Query("limit") int limit);
// ==================== 观看历史 ====================
@POST("api/front/history/watch")
Call<ApiResponse<Map<String, Object>>> recordWatchHistory(@Body Map<String, Object> body);
// ==================== 支付接口 ====================
@POST("api/front/pay/payment")
Call<ApiResponse<OrderPayResultResponse>> payment(@Body OrderPayRequest body);
// ==================== 直播间礼物 ====================
@POST("api/front/live/rooms/{roomId}/gift")
Call<ApiResponse<SendGiftResponse>> sendRoomGift(
@Path("roomId") String roomId,
@Body SendGiftRequest body);
// ==================== 直播控制 ====================
@POST("api/front/live/rooms/{roomId}/start")
Call<ApiResponse<Map<String, Object>>> startLiveRoom(@Path("roomId") String roomId);
@POST("api/front/live/rooms/{roomId}/stop")
Call<ApiResponse<Map<String, Object>>> stopLiveRoom(@Path("roomId") String roomId);
@POST("api/front/live/rooms/{roomId}/broadcast/online")
Call<ApiResponse<Map<String, Object>>> broadcastOnlineCount(@Path("roomId") String roomId);
} }