From 5b0c786f1fcadf4c38466fa8ab2d9fceed0d7018 Mon Sep 17 00:00:00 2001 From: xiao12feng8 <16507319+xiao12feng8@user.noreply.gitee.com> Date: Tue, 30 Dec 2025 09:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dapp=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0-待完成接入接口.md | 167 ++++++++++++++++++ android-app/app/release-key.jks | Bin 0 -> 2226 bytes .../livestreaming/FansListActivity.java | 6 +- .../livestreaming/FollowingListActivity.java | 6 +- .../livestreaming/ProfileActivity.java | 2 +- .../livestreaming/PublishWorkActivity.java | 12 +- .../livestreaming/RoomDetailActivity.java | 15 +- .../example/livestreaming/SearchActivity.java | 12 +- .../UserProfileReadOnlyActivity.java | 23 +-- .../livestreaming/WorkDetailActivity.java | 16 +- .../example/livestreaming/net/ApiService.java | 9 +- 11 files changed, 209 insertions(+), 59 deletions(-) create mode 100644 0-待完成接入接口.md create mode 100644 android-app/app/release-key.jks diff --git a/0-待完成接入接口.md b/0-待完成接入接口.md new file mode 100644 index 00000000..b14c635c --- /dev/null +++ b/0-待完成接入接口.md @@ -0,0 +1,167 @@ +# 待完成接入接口清单 + +> 更新时间: 2024-12-30 + +## 📊 总体情况 + +| 类别 | 后端接口数 | Android已接入 | 待接入 | +|------|-----------|--------------|--------| +| 总计 | 131 | ~85 | ~46 | + +--- + +## ✅ 已接入模块 (无需处理) + +| 模块 | 接口数 | 状态 | +|------|--------|------| +| 用户认证 | 4 | ✅ 全部接入 | +| 用户信息 | 2 | ✅ 全部接入 | +| 直播间 | 6 | ✅ 全部接入 | +| 直播弹幕 | 2 | ✅ 全部接入 | +| 礼物打赏 | 5 | ✅ 全部接入 | +| 私聊会话 | 8 | ✅ 全部接入 | +| 好友管理 | 9 | ✅ 全部接入 | +| 文件上传 | 2 | ✅ 全部接入 | +| 在线状态 | 5 | ✅ 全部接入 | +| 离线消息 | 3 | ✅ 全部接入 | +| 消息表情回应 | 4 | ✅ 全部接入 | +| 关注功能 | 7 | ✅ 全部接入 | +| 作品管理 | 13 | ✅ 全部接入 | +| 搜索功能 | 9 | ✅ 全部接入 | +| 支付集成 | 4 | ✅ 全部接入 | +| 通话功能 | 10 | ✅ 全部接入 | + +--- + +## ❌ 待接入模块 + +### 1. 群组管理 (10个接口) - 🔴 高优先级 + +后端已完成,Android端未定义接口。 + +| 接口 | 路径 | 说明 | +|------|------|------| +| 创建群组 | `POST /api/front/groups/create` | 创建新群组 | +| 群组列表 | `GET /api/front/groups/list` | 获取我的群组 | +| 群组详情 | `GET /api/front/groups/{groupId}` | 获取群组信息 | +| 更新群组 | `PUT /api/front/groups/{groupId}` | 修改群组信息 | +| 解散群组 | `DELETE /api/front/groups/{groupId}` | 解散群组 | +| 添加成员 | `POST /api/front/groups/{groupId}/members` | 邀请成员 | +| 移除成员 | `DELETE /api/front/groups/{groupId}/members/{userId}` | 踢出成员 | +| 成员列表 | `GET /api/front/groups/{groupId}/members` | 获取成员 | +| 退出群组 | `POST /api/front/groups/{groupId}/leave` | 主动退群 | +| 转让群主 | `POST /api/front/groups/{groupId}/transfer` | 转让群主 | + +--- + +### 2. 群组消息 (4个接口) - 🔴 高优先级 + +| 接口 | 路径 | 说明 | +|------|------|------| +| 发送群消息 | `POST /api/front/groups/{groupId}/messages` | 发送消息 | +| 群消息历史 | `GET /api/front/groups/{groupId}/messages` | 获取历史 | +| 撤回消息 | `DELETE /api/front/groups/{groupId}/messages/{messageId}` | 撤回消息 | +| 转发消息 | `POST /api/front/groups/{groupId}/messages/{messageId}/forward` | 转发消息 | + +--- + +### 3. 消息搜索 (3个接口) - 🟡 中优先级 + +| 接口 | 路径 | 说明 | +|------|------|------| +| 搜索会话 | `GET /api/front/messages/search/conversations` | 搜索会话 | +| 搜索消息 | `GET /api/front/messages/search/messages` | 搜索消息内容 | +| 全局搜索 | `GET /api/front/messages/search/global` | 全局搜索 | + +--- + +### 4. 评论功能 (8个接口) - 🟡 中优先级 + +| 接口 | 路径 | 说明 | +|------|------|------| +| 发布评论 | `POST /api/front/works/comment/publish` | 发布评论 | +| 评论列表 | `GET /api/front/works/comment/list/{worksId}` | 获取评论 | +| 点赞评论 | `POST /api/front/works/comment/like/{commentId}` | 点赞 | +| 取消点赞 | `POST /api/front/works/comment/unlike/{commentId}` | 取消点赞 | +| 删除评论 | `POST /api/front/works/comment/delete/{commentId}` | 删除评论 | +| 回复列表 | `GET /api/front/works/comment/reply/list/{commentId}` | 获取回复 | +| 评论详情 | `GET /api/front/works/comment/detail/{commentId}` | 评论详情 | +| 检查点赞 | `GET /api/front/works/comment/check-liked/{commentId}` | 检查状态 | + +--- + +### 5. 通知推送 (9个接口) - 🟡 中优先级 + +| 接口 | 路径 | 说明 | +|------|------|------| +| 通知列表 | `GET /api/front/notification/list` | 获取通知 | +| 未读数量 | `GET /api/front/notification/unread-count` | 未读数 | +| 标记已读 | `POST /api/front/notification/mark-read/{id}` | 单条已读 | +| 全部已读 | `POST /api/front/notification/mark-all-read` | 全部已读 | +| 注册FCM | `POST /api/front/notification/fcm/register` | 注册推送 | +| 移除FCM | `POST /api/front/notification/fcm/remove` | 移除推送 | +| 删除通知 | `DELETE /api/front/notification/{id}` | 删除单条 | +| 清空通知 | `DELETE /api/front/notification/clear-all` | 清空全部 | +| 按类型统计 | `GET /api/front/notification/unread-count-by-type` | 分类统计 | + +--- + +### 6. 分类管理 (7个接口) - 🟢 低优先级 + +| 接口 | 路径 | 说明 | +|------|------|------| +| 直播间分类 | `GET /api/front/category/live-room` | 直播分类 | +| 作品分类 | `GET /api/front/category/work` | 作品分类 | +| 分类列表 | `GET /api/front/category/list` | 全部分类 | +| 分类详情 | `GET /api/front/category/{id}` | 分类详情 | +| 分类统计 | `GET /api/front/category/statistics` | 统计数据 | +| 热门分类 | `GET /api/front/category/hot` | 热门分类 | +| 子分类 | `GET /api/front/category/{parentId}/children` | 子分类 | + +--- + +### 7. 文件上传补充 (3个接口) - 🟢 低优先级 + +| 接口 | 路径 | 说明 | +|------|------|------| +| 通用图片上传 | `POST /api/upload/image` | 通用图片 | +| 通用文件上传 | `POST /api/upload/file` | 通用文件 | +| 语音上传 | `POST /api/upload/chat/voice` | 语音消息 | + +--- + +### 8. 直播间补充 (4个接口) - 🟢 低优先级 + +| 接口 | 路径 | 说明 | +|------|------|------| +| 开始直播 | `POST /api/front/live/room/{id}/start` | 开播 | +| 结束直播 | `POST /api/front/live/room/{id}/stop` | 停播 | +| 观众列表 | `GET /api/rooms/{roomId}/viewers` | 观众列表 | +| 手动广播人数 | `POST /api/live/online/broadcast/{roomId}` | 广播人数 | + +--- + +## 📋 接入优先级建议 + +### 第一优先级 (核心社交) +1. **群组管理** - 10个接口 +2. **群组消息** - 4个接口 + +### 第二优先级 (内容互动) +3. **评论功能** - 8个接口 +4. **通知推送** - 9个接口 + +### 第三优先级 (辅助功能) +5. **消息搜索** - 3个接口 +6. **分类管理** - 7个接口 +7. **文件上传补充** - 3个接口 +8. **直播间补充** - 4个接口 + +--- + +## 📝 备注 + +- 后端接口已全部完成 (131个) +- Android端已接入约85个接口 +- 待接入约46个接口 +- 核心功能已基本完成,待接入的主要是群组和辅助功能 diff --git a/android-app/app/release-key.jks b/android-app/app/release-key.jks new file mode 100644 index 0000000000000000000000000000000000000000..74c4fc78752b4ceb8d17994090972cea09370d62 GIT binary patch literal 2226 zcmchY={wX58^>p7m|+;pAY+e+expGpwAhCT5r>d{O&TLhwj?r9mWq*`6460rdF)HJ z7-zCY36&*dj;4+!%{)`joAVbu*L~eDzTa2(c71LRlfwjoKoDMnf2Tlj0LAADIo!uH zglEwJuX79#2o3_0V0(ZNLO=rnhJn=~B498a1WSUg6xfI^RgmoF2Iw}i?+>0e&N5P(&G?=bxvGTcP5IgcE&hf`h%`R!ZWNSja)8RQEsoHsiWC>DSZJ>WBDm>)X4p_}V`*wi0qwT({ou1VeXyQ~2dDs$`WC?-c?4h<@ zsog&}D}qSH2A_Z6G1V+vr0cX0L@fSm2uG|zYBv4cwj`}=D9UlW6LQI}eN24#eX~C2 z$x5cs@G++TvI&v8zMAaGU2(l!v4`p9bdSZXG>kr~Z)td)DAy<3ul#ktw#I02Hd+NQ zc29S*_25r|5;w#NPQHbeD(QA4q=3|nOY3{_7eZZE_3x^?Vz4IpFQ({xt=%lk@KLTX zScR@Q(rdpx*9CKJR#YOjlr^Z^iGDsq&7<1PBmz1v7gWC5QD8N;CPb4LQ5omT0x@_8 zV#d^3n!8>KvxvK_>0TiEcDpf1bb=8R7DMW8ci+h}39N836(9&j9!oQ+ED;yE?#v}F z3<31~OJ|TvG>6s_v~~IFOMM3ONK@mcX0)(!CM(nSINLC*^t-sI-etJUjQ-^d7p7a{ z$C~#IC&p;s31qjgJ#DqqJ zmF(AHJoK>1FL)4VJ^!>7Gu%GeJX4iGVzBQAVz=Wa{G_P$HHg64fs7_=4Ydr1$GV?< z%&m#IWkv}+DYEcV?uTnOvvCfO`~xf~u{p;TaxYFokoSyAT&pzYHNDWRUJ>)dg>?~ zqU1|~5Gf)|%bFn*;kgMi5s@OP(K|&Y32UoKB+J>4D=$*VS)uLzCd>K?mERJ9O~LPy zt4`vD!#P5}>EoIkRex7UhsaovGpz{eA3kTGN4l0>r%W!jpY`C|Q{&Ycnk@ zj&quSimP0p*XKKZ{QF}sE*Hu9c`p*nBp&?eUmdhGjR=`AOPXHFU%=PQ&hV)Yg4ka@ zGQf&|x^VHS9n?OZV1JRbwfy2*GONW+Yag7Y^#TJzlZ^Z|HHs%dQu$UJ((&g{Kj}@G zu;^}`PqFkpOGQ4g2wVT+5&8PuUT2zmnbsu^LS8>QD|?4BUGB{+FuG_mv1KsWXWQ|Z zssNH5RYlPlo6!siEH_`=EmiL|Yh@<%ph3K4l}dUo2rvu1Q1Pl+ZJSl+XJAEl6%ri8KfC2=5If7WIu@8lS1w?)+C|1CV$7lQB zdi@31a`=zUBA=w4|L$4glkX zub^g&@5|UJ8&_|SDz0@_NH)=&>d{_|SRkW=w)e-&MO0;e_B}@JwzPeGgb&uEw&t6{ zYDs_2Df1m>0&Qdmb&ySz7RmGf7Ey|M?bbi|IK7HNerow>YiR&=y^wYQ*G0#Qtchkx zAn{L%N=vH}0$JM4>oK#6djt<-&qL==gf3$~CqU!P6O43N?5?%Bwj{x~Z|Xv5_pcK3 zb~%zKnR6`rysASH-NsqwMZ1V_O}(4XY*nH%+JX{~oyyKi#kDp(cx7lfc^#Asfr3Hc zG6g^mkmYSqRtP2m6ARqj5OP?Uq5tQoWX0d!p?M9eNBaLgMBe@Ih6o0s_bF^$YY>s9 zaI}5VRjBToSwbDd7BVdUO6n?xn`M@9L`=gmX1Z$S?$tz{4NeX&S7Bx!MjR>dKKR8I zr`!x|Iv3v!8FOXph459wL2W%&@5NNK!rL(Wt*Z~R-JW@9HH0`DI+ZW>t&LygcFEs1 z%T{Z)*tnH}9-*f8|1rA94VpVV#4 zPG%_7iKiFt*6xoIZ8M!AxTJV>-bhUh#-4Xkd$u(2*hu|d#7_q@*U?{ikPjJa{ub<1 zZC6g-A7}UDcHQN8R1fF+g~$iN&vkLmCB54$ko&}sXZd6WwfUF3rye}4XiUyJD742A MMGGTd6JtyM3sYLs0RR91 literal 0 HcmV?d00001 diff --git a/android-app/app/src/main/java/com/example/livestreaming/FansListActivity.java b/android-app/app/src/main/java/com/example/livestreaming/FansListActivity.java index 6d917769..c9f2eb33 100644 --- a/android-app/app/src/main/java/com/example/livestreaming/FansListActivity.java +++ b/android-app/app/src/main/java/com/example/livestreaming/FansListActivity.java @@ -13,7 +13,7 @@ import com.example.livestreaming.databinding.ActivityFansListBinding; import com.example.livestreaming.net.ApiResponse; import com.example.livestreaming.net.ApiService; import com.example.livestreaming.net.PageResponse; -import com.example.livestreaming.net.RetrofitClient; +import com.example.livestreaming.net.ApiClient; import java.util.ArrayList; import java.util.List; @@ -58,7 +58,7 @@ public class FansListActivity extends AppCompatActivity { if (isLoading) return; isLoading = true; - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); Call>>> call = apiService.getFollowersList(currentPage, 20); call.enqueue(new Callback>>>() { @@ -96,7 +96,7 @@ public class FansListActivity extends AppCompatActivity { } } else { Toast.makeText(FansListActivity.this, - apiResponse.getMsg() != null ? apiResponse.getMsg() : "获取粉丝列表失败", + apiResponse.getMessage() != null ? apiResponse.getMessage() : "获取粉丝列表失败", Toast.LENGTH_SHORT).show(); } } else { diff --git a/android-app/app/src/main/java/com/example/livestreaming/FollowingListActivity.java b/android-app/app/src/main/java/com/example/livestreaming/FollowingListActivity.java index c64c3a22..cab286c5 100644 --- a/android-app/app/src/main/java/com/example/livestreaming/FollowingListActivity.java +++ b/android-app/app/src/main/java/com/example/livestreaming/FollowingListActivity.java @@ -13,7 +13,7 @@ import com.example.livestreaming.databinding.ActivityFollowingListBinding; import com.example.livestreaming.net.ApiResponse; import com.example.livestreaming.net.ApiService; import com.example.livestreaming.net.PageResponse; -import com.example.livestreaming.net.RetrofitClient; +import com.example.livestreaming.net.ApiClient; import java.util.ArrayList; import java.util.List; @@ -58,7 +58,7 @@ public class FollowingListActivity extends AppCompatActivity { if (isLoading) return; isLoading = true; - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); Call>>> call = apiService.getFollowingList(currentPage, 20); call.enqueue(new Callback>>>() { @@ -94,7 +94,7 @@ public class FollowingListActivity extends AppCompatActivity { } } else { Toast.makeText(FollowingListActivity.this, - apiResponse.getMsg() != null ? apiResponse.getMsg() : "获取关注列表失败", + apiResponse.getMessage() != null ? apiResponse.getMessage() : "获取关注列表失败", Toast.LENGTH_SHORT).show(); } } else { diff --git a/android-app/app/src/main/java/com/example/livestreaming/ProfileActivity.java b/android-app/app/src/main/java/com/example/livestreaming/ProfileActivity.java index 5dc3ebba..cd98c15b 100644 --- a/android-app/app/src/main/java/com/example/livestreaming/ProfileActivity.java +++ b/android-app/app/src/main/java/com/example/livestreaming/ProfileActivity.java @@ -679,7 +679,7 @@ public class ProfileActivity extends AppCompatActivity { */ private void loadFollowStats() { com.example.livestreaming.net.ApiService apiService = - com.example.livestreaming.net.RetrofitClient.getInstance(this).getApiService(); + com.example.livestreaming.net.ApiClient.getService(this); retrofit2.Call>> call = apiService.getFollowStats(null); // null表示查询当前用户 diff --git a/android-app/app/src/main/java/com/example/livestreaming/PublishWorkActivity.java b/android-app/app/src/main/java/com/example/livestreaming/PublishWorkActivity.java index 5aa7fb84..7dd0d7eb 100644 --- a/android-app/app/src/main/java/com/example/livestreaming/PublishWorkActivity.java +++ b/android-app/app/src/main/java/com/example/livestreaming/PublishWorkActivity.java @@ -638,7 +638,7 @@ public class PublishWorkActivity extends AppCompatActivity { RequestBody model = RequestBody.create(okhttp3.MediaType.parse("text/plain"), "works"); RequestBody pid = RequestBody.create(okhttp3.MediaType.parse("text/plain"), "0"); - ApiService apiService = ApiClient.getApiService(this); + ApiService apiService = ApiClient.getService(this); Call> call = apiService.uploadImage(body, model, pid); call.enqueue(new retrofit2.Callback>() { @@ -649,7 +649,7 @@ public class PublishWorkActivity extends AppCompatActivity { if (apiResponse.getCode() == 200 && apiResponse.getData() != null) { callback.onSuccess(apiResponse.getData().getUrl()); } else { - callback.onFailure(apiResponse.getMsg() != null ? apiResponse.getMsg() : "上传失败"); + callback.onFailure(apiResponse.getMessage() != null ? apiResponse.getMessage() : "上传失败"); } } else { callback.onFailure("上传失败"); @@ -687,7 +687,7 @@ public class PublishWorkActivity extends AppCompatActivity { RequestBody model = RequestBody.create(okhttp3.MediaType.parse("text/plain"), "works"); RequestBody pid = RequestBody.create(okhttp3.MediaType.parse("text/plain"), "0"); - ApiService apiService = ApiClient.getApiService(this); + ApiService apiService = ApiClient.getService(this); Call> call = apiService.uploadVideo(body, model, pid); call.enqueue(new retrofit2.Callback>() { @@ -698,7 +698,7 @@ public class PublishWorkActivity extends AppCompatActivity { if (apiResponse.getCode() == 200 && apiResponse.getData() != null) { callback.onSuccess(apiResponse.getData().getUrl()); } else { - callback.onFailure(apiResponse.getMsg() != null ? apiResponse.getMsg() : "上传失败"); + callback.onFailure(apiResponse.getMessage() != null ? apiResponse.getMessage() : "上传失败"); } } else { callback.onFailure("上传失败"); @@ -762,7 +762,7 @@ public class PublishWorkActivity extends AppCompatActivity { request.setVideoUrl(videoUrl); request.setImageUrls(imageUrls); - ApiService apiService = ApiClient.getApiService(this); + ApiService apiService = ApiClient.getService(this); Call> call = apiService.publishWork(request); call.enqueue(new retrofit2.Callback>() { @@ -777,7 +777,7 @@ public class PublishWorkActivity extends AppCompatActivity { finish(); } else { Toast.makeText(PublishWorkActivity.this, - apiResponse.getMsg() != null ? apiResponse.getMsg() : "发布失败", + apiResponse.getMessage() != null ? apiResponse.getMessage() : "发布失败", Toast.LENGTH_SHORT).show(); } } else { diff --git a/android-app/app/src/main/java/com/example/livestreaming/RoomDetailActivity.java b/android-app/app/src/main/java/com/example/livestreaming/RoomDetailActivity.java index a6eb75c8..10a05907 100644 --- a/android-app/app/src/main/java/com/example/livestreaming/RoomDetailActivity.java +++ b/android-app/app/src/main/java/com/example/livestreaming/RoomDetailActivity.java @@ -34,7 +34,6 @@ import com.example.livestreaming.net.CreateRechargeResponse; import com.example.livestreaming.net.OrderPayRequest; import com.example.livestreaming.net.OrderPayResultResponse; import com.example.livestreaming.net.RechargeOptionResponse; -import com.example.livestreaming.net.RetrofitClient; import com.example.livestreaming.net.Room; import com.example.livestreaming.net.StreamConfig; import com.example.livestreaming.ShareUtils; @@ -1112,7 +1111,7 @@ public class RoomDetailActivity extends AppCompatActivity { * 加载充值选项列表 */ private void loadRechargeOptions(RechargeAdapter adapter, View dialogView) { - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); Call>> call = apiService.getRechargeOptions(); call.enqueue(new Callback>>() { @@ -1135,7 +1134,7 @@ public class RoomDetailActivity extends AppCompatActivity { adapter.setOptions(options); } else { Toast.makeText(RoomDetailActivity.this, - "加载充值选项失败: " + apiResponse.getMsg(), + "加载充值选项失败: " + apiResponse.getMessage(), Toast.LENGTH_SHORT).show(); // 使用默认选项 setDefaultRechargeOptions(adapter); @@ -1178,7 +1177,7 @@ public class RoomDetailActivity extends AppCompatActivity { * 创建充值订单 */ private void createRechargeOrder(RechargeOption selectedOption, androidx.appcompat.app.AlertDialog rechargeDialog) { - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); CreateRechargeRequest request = new CreateRechargeRequest( Integer.parseInt(selectedOption.getId()), @@ -1203,7 +1202,7 @@ public class RoomDetailActivity extends AppCompatActivity { showPaymentMethodDialog(orderId, selectedOption, rechargeDialog); } else { Toast.makeText(RoomDetailActivity.this, - "创建充值订单失败: " + apiResponse.getMsg(), + "创建充值订单失败: " + apiResponse.getMessage(), Toast.LENGTH_SHORT).show(); } } else { @@ -1264,10 +1263,10 @@ public class RoomDetailActivity extends AppCompatActivity { */ private void processPayment(String orderId, String payType, String payChannel, RechargeOption selectedOption, androidx.appcompat.app.AlertDialog rechargeDialog) { - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); OrderPayRequest payRequest = new OrderPayRequest(orderId, payType, payChannel); - Call> call = apiService.payment(payRequest); + Call> call = apiService.processPayment(payRequest); call.enqueue(new Callback>() { @Override @@ -1293,7 +1292,7 @@ public class RoomDetailActivity extends AppCompatActivity { simulateRechargeSuccess(selectedOption, rechargeDialog); } else { Toast.makeText(RoomDetailActivity.this, - "支付失败: " + apiResponse.getMsg(), + "支付失败: " + apiResponse.getMessage(), Toast.LENGTH_SHORT).show(); } } else { diff --git a/android-app/app/src/main/java/com/example/livestreaming/SearchActivity.java b/android-app/app/src/main/java/com/example/livestreaming/SearchActivity.java index 9b287f4b..a3683950 100644 --- a/android-app/app/src/main/java/com/example/livestreaming/SearchActivity.java +++ b/android-app/app/src/main/java/com/example/livestreaming/SearchActivity.java @@ -18,7 +18,7 @@ import com.example.livestreaming.net.ApiResponse; import com.example.livestreaming.net.ApiService; import com.example.livestreaming.net.HotSearchResponse; import com.example.livestreaming.net.PageResponse; -import com.example.livestreaming.net.RetrofitClient; +import com.example.livestreaming.net.ApiClient; import com.example.livestreaming.net.Room; import com.example.livestreaming.net.SearchHistoryResponse; @@ -151,7 +151,7 @@ public class SearchActivity extends AppCompatActivity { Log.d(TAG, "执行搜索: " + keyword); - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); Call>>> call = apiService.searchLiveRooms(keyword, null, null, 1, 20); @@ -191,9 +191,9 @@ public class SearchActivity extends AppCompatActivity { } } else { Toast.makeText(SearchActivity.this, - "搜索失败: " + apiResponse.getMsg(), + "搜索失败: " + apiResponse.getMessage(), Toast.LENGTH_SHORT).show(); - Log.e(TAG, "搜索失败: " + apiResponse.getMsg()); + Log.e(TAG, "搜索失败: " + apiResponse.getMessage()); } } else { Toast.makeText(SearchActivity.this, @@ -253,7 +253,7 @@ public class SearchActivity extends AppCompatActivity { private void loadHotSearch() { Log.d(TAG, "加载热门搜索"); - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); Call>> call = apiService.getHotSearch(2, 10); // 2-直播间 call.enqueue(new Callback>>() { @@ -282,7 +282,7 @@ public class SearchActivity extends AppCompatActivity { * 加载搜索建议(可选功能) */ private void loadSearchSuggestions(String keyword) { - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); Call>> call = apiService.getSearchSuggestions(keyword, 2, 10); // 2-直播间 call.enqueue(new Callback>>() { diff --git a/android-app/app/src/main/java/com/example/livestreaming/UserProfileReadOnlyActivity.java b/android-app/app/src/main/java/com/example/livestreaming/UserProfileReadOnlyActivity.java index 5ebf5e0e..cfda302a 100644 --- a/android-app/app/src/main/java/com/example/livestreaming/UserProfileReadOnlyActivity.java +++ b/android-app/app/src/main/java/com/example/livestreaming/UserProfileReadOnlyActivity.java @@ -12,7 +12,7 @@ import androidx.recyclerview.widget.GridLayoutManager; import com.example.livestreaming.databinding.ActivityUserProfileReadOnlyBinding; import com.example.livestreaming.net.ApiResponse; import com.example.livestreaming.net.ApiService; -import com.example.livestreaming.net.RetrofitClient; +import com.example.livestreaming.net.ApiClient; import com.google.android.material.tabs.TabLayout; import java.util.ArrayList; @@ -101,7 +101,7 @@ public class UserProfileReadOnlyActivity extends AppCompatActivity { try { int userId = Integer.parseInt(currentUserId); - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); Call>> call = apiService.checkFollowStatus(userId); call.enqueue(new Callback>>() { @@ -137,7 +137,7 @@ public class UserProfileReadOnlyActivity extends AppCompatActivity { Map requestBody = new HashMap<>(); requestBody.put("userId", userId); - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); Call>> call = apiService.followUser(requestBody); call.enqueue(new Callback>>() { @@ -152,7 +152,7 @@ public class UserProfileReadOnlyActivity extends AppCompatActivity { Toast.makeText(UserProfileReadOnlyActivity.this, "关注成功", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(UserProfileReadOnlyActivity.this, - apiResponse.getMsg() != null ? apiResponse.getMsg() : "关注失败", + apiResponse.getMessage() != null ? apiResponse.getMessage() : "关注失败", Toast.LENGTH_SHORT).show(); } } else { @@ -179,7 +179,7 @@ public class UserProfileReadOnlyActivity extends AppCompatActivity { Map requestBody = new HashMap<>(); requestBody.put("userId", userId); - ApiService apiService = RetrofitClient.getInstance(this).getApiService(); + ApiService apiService = ApiClient.getService(this); Call>> call = apiService.unfollowUser(requestBody); call.enqueue(new Callback>>() { @@ -194,7 +194,7 @@ public class UserProfileReadOnlyActivity extends AppCompatActivity { Toast.makeText(UserProfileReadOnlyActivity.this, "取消关注成功", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(UserProfileReadOnlyActivity.this, - apiResponse.getMsg() != null ? apiResponse.getMsg() : "取消关注失败", + apiResponse.getMessage() != null ? apiResponse.getMessage() : "取消关注失败", Toast.LENGTH_SHORT).show(); } } else { @@ -224,17 +224,6 @@ public class UserProfileReadOnlyActivity extends AppCompatActivity { } } - private void updateFollowButton() { - if (binding == null) return; - if (isFollowing) { - binding.addFriendButton.setText("已关注"); - binding.addFriendButton.setAlpha(0.7f); - } else { - binding.addFriendButton.setText("关注"); - binding.addFriendButton.setAlpha(1f); - } - } - private void setupTabsAndWorks() { if (binding == null) return; diff --git a/android-app/app/src/main/java/com/example/livestreaming/WorkDetailActivity.java b/android-app/app/src/main/java/com/example/livestreaming/WorkDetailActivity.java index 3c6fa8f6..925778eb 100644 --- a/android-app/app/src/main/java/com/example/livestreaming/WorkDetailActivity.java +++ b/android-app/app/src/main/java/com/example/livestreaming/WorkDetailActivity.java @@ -443,7 +443,7 @@ public class WorkDetailActivity extends AppCompatActivity { try { long worksId = Long.parseLong(workItem.getId()); - ApiService apiService = ApiClient.getApiService(this); + ApiService apiService = ApiClient.getService(this); Call> call; if (isLiked) { @@ -480,7 +480,7 @@ public class WorkDetailActivity extends AppCompatActivity { workItem.setLikeCount(oldCount); updateLikeButton(); Toast.makeText(WorkDetailActivity.this, - apiResponse.getMsg() != null ? apiResponse.getMsg() : "操作失败", + apiResponse.getMessage() != null ? apiResponse.getMessage() : "操作失败", Toast.LENGTH_SHORT).show(); } } else { @@ -514,7 +514,7 @@ public class WorkDetailActivity extends AppCompatActivity { try { long worksId = Long.parseLong(workItem.getId()); - ApiService apiService = ApiClient.getApiService(this); + ApiService apiService = ApiClient.getService(this); Call> call; if (isFavorited) { @@ -544,7 +544,7 @@ public class WorkDetailActivity extends AppCompatActivity { isFavorited = oldFavorited; updateFavoriteButton(); Toast.makeText(WorkDetailActivity.this, - apiResponse.getMsg() != null ? apiResponse.getMsg() : "操作失败", + apiResponse.getMessage() != null ? apiResponse.getMessage() : "操作失败", Toast.LENGTH_SHORT).show(); } } else { @@ -699,7 +699,7 @@ public class WorkDetailActivity extends AppCompatActivity { try { long worksId = Long.parseLong(workItem.getId()); - ApiService apiService = ApiClient.getApiService(this); + ApiService apiService = ApiClient.getService(this); Call> call = apiService.deleteWork(worksId); call.enqueue(new retrofit2.Callback>() { @@ -712,7 +712,7 @@ public class WorkDetailActivity extends AppCompatActivity { finish(); } else { Toast.makeText(WorkDetailActivity.this, - apiResponse.getMsg() != null ? apiResponse.getMsg() : "删除失败", + apiResponse.getMessage() != null ? apiResponse.getMessage() : "删除失败", Toast.LENGTH_SHORT).show(); } } else { @@ -787,7 +787,7 @@ public class WorkDetailActivity extends AppCompatActivity { try { long worksId = Long.parseLong(workId); - ApiService apiService = ApiClient.getApiService(this); + ApiService apiService = ApiClient.getService(this); Call> call = apiService.getWorkDetail(worksId); call.enqueue(new retrofit2.Callback>() { @@ -813,7 +813,7 @@ public class WorkDetailActivity extends AppCompatActivity { setupActionButton(); } else { Toast.makeText(WorkDetailActivity.this, - apiResponse.getMsg() != null ? apiResponse.getMsg() : "获取作品详情失败", + apiResponse.getMessage() != null ? apiResponse.getMessage() : "获取作品详情失败", Toast.LENGTH_SHORT).show(); finish(); } diff --git a/android-app/app/src/main/java/com/example/livestreaming/net/ApiService.java b/android-app/app/src/main/java/com/example/livestreaming/net/ApiService.java index 76a46fce..e7f34063 100644 --- a/android-app/app/src/main/java/com/example/livestreaming/net/ApiService.java +++ b/android-app/app/src/main/java/com/example/livestreaming/net/ApiService.java @@ -349,15 +349,10 @@ public interface ApiService { // ==================== 支付集成 ==================== - @GET("api/front/gift/recharge/options") - Call>> getRechargeOptions(); - - @POST("api/front/gift/recharge/create") - Call> createRecharge(@Body CreateRechargeRequest body); - @GET("api/front/pay/alipay/queryPayResult") Call> queryAliPayResult(@Query("orderNo") String orderNo); @POST("api/front/pay/payment") - Call> payment(@Body OrderPayRequest body); + Call> processPayment(@Body OrderPayRequest body); + }