fix(tiebaapi): 修复回贴无法上传图片
This commit is contained in:
parent
fc444e076b
commit
47c29900e6
|
@ -197,7 +197,8 @@ interface ITiebaApi {
|
||||||
fun delThread(
|
fun delThread(
|
||||||
forumId: String,
|
forumId: String,
|
||||||
forumName: String,
|
forumName: String,
|
||||||
threadId: String
|
threadId: String,
|
||||||
|
tbs: String
|
||||||
): Call<CommonResponse>
|
): Call<CommonResponse>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,6 +218,7 @@ interface ITiebaApi {
|
||||||
forumName: String,
|
forumName: String,
|
||||||
threadId: String,
|
threadId: String,
|
||||||
postId: String,
|
postId: String,
|
||||||
|
tbs: String,
|
||||||
isFloor: Boolean,
|
isFloor: Boolean,
|
||||||
delMyPost: Boolean
|
delMyPost: Boolean
|
||||||
): Call<CommonResponse>
|
): Call<CommonResponse>
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.huanchengfly.tieba.api.models.*
|
||||||
import com.huanchengfly.tieba.api.models.web.ForumBean
|
import com.huanchengfly.tieba.api.models.web.ForumBean
|
||||||
import com.huanchengfly.tieba.api.models.web.HotMessageListBean
|
import com.huanchengfly.tieba.api.models.web.HotMessageListBean
|
||||||
import com.huanchengfly.tieba.api.retrofit.RetrofitTiebaApi
|
import com.huanchengfly.tieba.api.retrofit.RetrofitTiebaApi
|
||||||
|
import com.huanchengfly.tieba.api.urlDecode
|
||||||
import com.huanchengfly.tieba.post.base.BaseApplication
|
import com.huanchengfly.tieba.post.base.BaseApplication
|
||||||
import com.huanchengfly.tieba.post.models.DislikeBean
|
import com.huanchengfly.tieba.post.models.DislikeBean
|
||||||
import com.huanchengfly.tieba.post.models.MyInfoBean
|
import com.huanchengfly.tieba.post.models.MyInfoBean
|
||||||
|
@ -25,9 +26,14 @@ import java.net.URLEncoder
|
||||||
object MixedTiebaApiImpl : ITiebaApi {
|
object MixedTiebaApiImpl : ITiebaApi {
|
||||||
override fun personalized(loadType: Int, page: Int): Call<PersonalizedBean> = RetrofitTiebaApi.MINI_TIEBA_API.personalized(loadType, page)
|
override fun personalized(loadType: Int, page: Int): Call<PersonalizedBean> = RetrofitTiebaApi.MINI_TIEBA_API.personalized(loadType, page)
|
||||||
|
|
||||||
override fun agree(threadId: String, postId: String): Call<AgreeBean> = RetrofitTiebaApi.MINI_TIEBA_API.agree(postId, threadId)
|
override fun agree(
|
||||||
|
threadId: String,
|
||||||
|
postId: String
|
||||||
|
): Call<AgreeBean> =
|
||||||
|
RetrofitTiebaApi.MINI_TIEBA_API.agree(postId, threadId)
|
||||||
|
|
||||||
override fun disagree(threadId: String, postId: String): Call<AgreeBean> = RetrofitTiebaApi.MINI_TIEBA_API.disagree(postId, threadId)
|
override fun disagree(threadId: String,
|
||||||
|
postId: String): Call<AgreeBean> = RetrofitTiebaApi.MINI_TIEBA_API.disagree(postId, threadId)
|
||||||
|
|
||||||
override fun forumRecommend(): Call<ForumRecommend> = RetrofitTiebaApi.MINI_TIEBA_API.forumRecommend()
|
override fun forumRecommend(): Call<ForumRecommend> = RetrofitTiebaApi.MINI_TIEBA_API.forumRecommend()
|
||||||
|
|
||||||
|
@ -72,11 +78,34 @@ object MixedTiebaApiImpl : ITiebaApi {
|
||||||
|
|
||||||
override fun sign(forumName: String, tbs: String): Call<SignResultBean> = RetrofitTiebaApi.MINI_TIEBA_API.sign(forumName, tbs)
|
override fun sign(forumName: String, tbs: String): Call<SignResultBean> = RetrofitTiebaApi.MINI_TIEBA_API.sign(forumName, tbs)
|
||||||
|
|
||||||
override fun delThread(forumId: String, forumName: String, threadId: String): Call<CommonResponse> = RetrofitTiebaApi.MINI_TIEBA_API.delThread(forumId, forumName, threadId)
|
override fun delThread(
|
||||||
|
forumId: String,
|
||||||
|
forumName: String,
|
||||||
|
threadId: String,
|
||||||
|
tbs: String
|
||||||
|
): Call<CommonResponse> =
|
||||||
|
RetrofitTiebaApi.MINI_TIEBA_API.delThread(forumId, forumName, threadId, tbs)
|
||||||
|
|
||||||
override fun delPost(
|
override fun delPost(
|
||||||
forumId: String, forumName: String, threadId: String, postId: String, isFloor: Boolean, delMyPost: Boolean
|
forumId: String,
|
||||||
): Call<CommonResponse> = RetrofitTiebaApi.MINI_TIEBA_API.delPost(forumId, forumName, threadId, postId, is_floor = if (isFloor) 1 else 0, src = if (isFloor) 3 else 1, is_vip_del = if (delMyPost) 0 else 1, delete_my_post = if (delMyPost) 1 else 0)
|
forumName: String,
|
||||||
|
threadId: String,
|
||||||
|
postId: String,
|
||||||
|
tbs: String,
|
||||||
|
isFloor: Boolean,
|
||||||
|
delMyPost: Boolean
|
||||||
|
): Call<CommonResponse> =
|
||||||
|
RetrofitTiebaApi.MINI_TIEBA_API.delPost(
|
||||||
|
forumId,
|
||||||
|
forumName,
|
||||||
|
threadId,
|
||||||
|
postId,
|
||||||
|
tbs,
|
||||||
|
is_floor = if (isFloor) 1 else 0,
|
||||||
|
src = if (isFloor) 3 else 1,
|
||||||
|
is_vip_del = if (delMyPost) 0 else 1,
|
||||||
|
delete_my_post = if (delMyPost) 1 else 0
|
||||||
|
)
|
||||||
|
|
||||||
override fun searchPost(
|
override fun searchPost(
|
||||||
keyword: String, forumName: String, onlyThread: Boolean, page: Int, pageSize: Int
|
keyword: String, forumName: String, onlyThread: Boolean, page: Int, pageSize: Int
|
||||||
|
|
|
@ -96,9 +96,13 @@ interface WebTiebaApi {
|
||||||
@Query("ct") ct: String = "2"
|
@Query("ct") ct: String = "2"
|
||||||
): Call<SearchThreadBean>
|
): Call<SearchThreadBean>
|
||||||
|
|
||||||
@GET("/mo/q/cooluploadpic")
|
@Headers(
|
||||||
|
"${Header.FORCE_LOGIN}: ${Header.FORCE_LOGIN_TRUE}"
|
||||||
|
)
|
||||||
|
@POST("/mo/q/cooluploadpic")
|
||||||
|
@FormUrlEncoded
|
||||||
fun webUploadPic(
|
fun webUploadPic(
|
||||||
@Query("pic") base64: String?,
|
@Field("pic") base64: String?,
|
||||||
@Query("type") type: String = "ajax",
|
@Query("type") type: String = "ajax",
|
||||||
@Query("r") r: String = Math.random().toString()
|
@Query("r") r: String = Math.random().toString()
|
||||||
): Call<WebUploadPicBean>
|
): Call<WebUploadPicBean>
|
||||||
|
|
|
@ -49,19 +49,21 @@ public class UploadHelper {
|
||||||
next();
|
next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TiebaApi.getInstance().webUploadPic(photoInfoBean).enqueue(new Callback<WebUploadPicBean>() {
|
TiebaApi.getInstance()
|
||||||
@Override
|
.webUploadPic(photoInfoBean)
|
||||||
public void onResponse(@NotNull Call<WebUploadPicBean> call, @NotNull Response<WebUploadPicBean> response) {
|
.enqueue(new Callback<WebUploadPicBean>() {
|
||||||
photoInfoBean.setWebUploadPicBean(response.body());
|
@Override
|
||||||
callback.onProgress(now + 1, uploadList.size());
|
public void onResponse(@NotNull Call<WebUploadPicBean> call, @NotNull Response<WebUploadPicBean> response) {
|
||||||
next();
|
photoInfoBean.setWebUploadPicBean(response.body());
|
||||||
}
|
callback.onProgress(now + 1, uploadList.size());
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NotNull Call<WebUploadPicBean> call, @NotNull Throwable t) {
|
public void onFailure(@NotNull Call<WebUploadPicBean> call, @NotNull Throwable t) {
|
||||||
callback.onFailure(t.getMessage());
|
callback.onFailure(t.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
|
|
Loading…
Reference in New Issue