fix: queryTaskIds 和 lookTaskDetail 改为 POST

服务端所有任务接口都要求 POST,GET 返回 405

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dongliang
2026-04-27 21:18:21 +09:30
parent 52949f4e3f
commit a455c82b59
3 changed files with 9 additions and 7 deletions

View File

@@ -23,13 +23,13 @@ interface TaskApi {
@GET("watchTask/myCurrentAttendance") @GET("watchTask/myCurrentAttendance")
suspend fun getAttendance(): ApiResponse<AttendanceInfo> suspend fun getAttendance(): ApiResponse<AttendanceInfo>
/** 获取任务ID列表(按状态筛选,旧版 queryTaskIds */ /** 获取任务列表(按状态筛选) */
@GET("watchTask/queryTaskIds") @POST("watchTask/queryTaskIds")
suspend fun getTaskIds(@Query("status") status: Int): ApiResponse<List<TaskItem>> suspend fun getTaskIds(@Body params: HashMap<String, Any>): ApiResponse<List<TaskItem>>
/** 任务详情 */ /** 任务详情 */
@GET("watchTask/lookTaskDetail") @POST("watchTask/lookTaskDetail")
suspend fun getTaskDetail(@Query("id") taskId: Long): ApiResponse<TaskDetail> suspend fun getTaskDetail(@Body params: HashMap<String, Any>): ApiResponse<TaskDetail>
/** 抢单 */ /** 抢单 */
@POST("task/grabTask") @POST("task/grabTask")

View File

@@ -61,7 +61,8 @@ class TaskDetailFragment : BaseFragment<FragmentTaskDetailBinding>() {
/** 获取任务详情 */ /** 获取任务详情 */
private fun fetchDetail(taskId: Long) { private fun fetchDetail(taskId: Long) {
viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.lifecycleScope.launch {
val result = safeApiCall { taskApi.getTaskDetail(taskId) } val params = hashMapOf<String, Any>("id" to taskId)
val result = safeApiCall { taskApi.getTaskDetail(params) }
when (result) { when (result) {
is ApiResult.Success -> { is ApiResult.Success -> {
result.data?.let { detail -> result.data?.let { detail ->

View File

@@ -118,7 +118,8 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
private fun fetchTasks() { private fun fetchTasks() {
viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.lifecycleScope.launch {
binding.swipeRefresh.isRefreshing = true binding.swipeRefresh.isRefreshing = true
val result = safeApiCall { taskApi.getTaskIds(currentStatus) } val params = hashMapOf<String, Any>("status" to currentStatus)
val result = safeApiCall { taskApi.getTaskIds(params) }
binding.swipeRefresh.isRefreshing = false binding.swipeRefresh.isRefreshing = false
when (result) { when (result) {