|
|
|
@ -49,6 +49,7 @@ enum APIConfig {
|
|
|
|
|
case latestCommentList(String, Int, Int)
|
|
|
|
|
|
|
|
|
|
case subCommentList(String, Int, Int)
|
|
|
|
|
case commentDetail(String)
|
|
|
|
|
|
|
|
|
|
case commentLike(String, [String: Any])
|
|
|
|
|
case sendComment([String: Any])
|
|
|
|
@ -69,6 +70,8 @@ enum APIConfig {
|
|
|
|
|
case deleteComment(String)
|
|
|
|
|
case thanks
|
|
|
|
|
|
|
|
|
|
case lastJournalCover
|
|
|
|
|
case journalDetailByID(String)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -143,6 +146,8 @@ extension APIConfig: TargetType {
|
|
|
|
|
return "luoo-comment/comment/new/\(journalId)/\(page)/\(size)"
|
|
|
|
|
case .subCommentList(let parentId, let page, let size):
|
|
|
|
|
return "luoo-comment/comment/comment/\(parentId)/\(page)/\(size)"
|
|
|
|
|
case .commentDetail(let commentId):
|
|
|
|
|
return "luoo-comment/comment/\(commentId)"
|
|
|
|
|
case .commentLike(let commentID, _):
|
|
|
|
|
return "luoo-comment/comment/thumbup/\(commentID)"
|
|
|
|
|
case .sendComment:
|
|
|
|
@ -176,12 +181,17 @@ extension APIConfig: TargetType {
|
|
|
|
|
return "luoo-comment/comment/\(commentId)"
|
|
|
|
|
case .thanks:
|
|
|
|
|
return "user/my/thanks"
|
|
|
|
|
|
|
|
|
|
case .lastJournalCover:
|
|
|
|
|
return "luoo-music/journal/collectLatestImage"
|
|
|
|
|
case .journalDetailByID(let journalID):
|
|
|
|
|
return "luoo-music/journal/\(journalID)"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var method: Moya.Method {
|
|
|
|
|
switch self {
|
|
|
|
|
case .wechatAccessToken, .journalList, .journalMusic, .countryCode, .imageCheckCode, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .collectSongList, .journalCollectList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .searchSong, .searchJournal, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .suggestions, .thanks, .collectJournalSongList, .otherMessageDetail, .journalDetail:
|
|
|
|
|
case .wechatAccessToken, .journalList, .journalMusic, .countryCode, .imageCheckCode, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .collectSongList, .journalCollectList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .searchSong, .searchJournal, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .suggestions, .thanks, .collectJournalSongList, .otherMessageDetail, .journalDetail, .commentDetail, .lastJournalCover, .journalDetailByID:
|
|
|
|
|
return .get
|
|
|
|
|
case .sendsms, .login, .autoLogin, .editAvatar, .like, .checkVersion, .logout, .sendComment, .feedback, .commentReport, .otherMessageList:
|
|
|
|
|
return .post
|
|
|
|
@ -189,13 +199,14 @@ extension APIConfig: TargetType {
|
|
|
|
|
return .put
|
|
|
|
|
case .cancelLike, .deleteComment:
|
|
|
|
|
return .delete
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var parameterEncoding: ParameterEncoding {
|
|
|
|
|
switch self {
|
|
|
|
|
case .wechatAccessToken, .journalList, .journalMusic, .countryCode, .sendsms, .imageCheckCode, .login, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .like, .cancelLike, .collectSongList, .journalCollectList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .searchSong, .searchJournal, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .suggestions, .commentReport, .deleteComment, .thanks, .collectJournalSongList, .otherMessageList, .otherMessageDetail, .checkVersion, .journalDetail:
|
|
|
|
|
case .wechatAccessToken, .journalList, .journalMusic, .countryCode, .sendsms, .imageCheckCode, .login, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .like, .cancelLike, .collectSongList, .journalCollectList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .searchSong, .searchJournal, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .suggestions, .commentReport, .deleteComment, .thanks, .collectJournalSongList, .otherMessageList, .otherMessageDetail, .checkVersion, .journalDetail, .commentDetail, .lastJournalCover, .journalDetailByID:
|
|
|
|
|
return URLEncoding.default
|
|
|
|
|
|
|
|
|
|
case .autoLogin, .editUserInfo, .editAvatar, .logout, .commentLike, .sendComment, .feedback:
|
|
|
|
@ -207,7 +218,7 @@ extension APIConfig: TargetType {
|
|
|
|
|
var task: Task {
|
|
|
|
|
var parameters: [String: Any] = [:]
|
|
|
|
|
switch self {
|
|
|
|
|
case .wechatAccessToken, .countryCode, .journalMusic, .imageCheckCode, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .commentReport, .deleteComment, .thanks, .otherMessageList, .otherMessageDetail, .journalDetail:
|
|
|
|
|
case .wechatAccessToken, .countryCode, .journalMusic, .imageCheckCode, .getUserInfo, .carousel, .otherUserInfo, .single, .journal, .messageList, .followingList, .followerList, .blackList, .hotCommentList, .latestCommentList, .subCommentList, .filterMenu, .journalRecommend, .searchCategory, .randomAudioTrack, .myThumbupList, .myCommentReplyList, .commentReport, .deleteComment, .thanks, .otherMessageList, .otherMessageDetail, .journalDetail, .commentDetail, .lastJournalCover, .journalDetailByID:
|
|
|
|
|
return .requestPlain
|
|
|
|
|
|
|
|
|
|
case .login(let dic), .journalList(let dic), .sendsms(let dic), .autoLogin(let dic), .editUserInfo(let dic), .like(let dic), .cancelLike(let dic), .logout(let dic), .checkVersion(let dic), .commentLike(_, let dic), .sendComment(let dic), .collectSongList(let dic), .journalCollectList(let dic), .suggestions(let dic), .searchSong(let dic), .searchJournal(let dic), .collectJournalSongList(let dic):
|
|
|
|
@ -253,7 +264,7 @@ extension APIConfig: TargetType {
|
|
|
|
|
|
|
|
|
|
var headers : [String : String]? {
|
|
|
|
|
switch self {
|
|
|
|
|
case .autoLogin, .getUserInfo, .journalList, .journalMusic, .otherUserInfo, .like, .cancelLike, .single, .journal, .collectSongList, .journalCollectList, .followingList, .messageList, .followerList, .blackList, .editUserInfo, .logout, .editAvatar, .hotCommentList, .latestCommentList, .subCommentList, .commentLike, .filterMenu, .journalRecommend, .searchSong, .searchJournal, .randomAudioTrack, .sendComment, .myThumbupList, .myCommentReplyList, .feedback, .suggestions, .commentReport, .deleteComment, .collectJournalSongList, .otherMessageList, .journalDetail:
|
|
|
|
|
case .autoLogin, .getUserInfo, .journalList, .journalMusic, .otherUserInfo, .like, .cancelLike, .single, .journal, .collectSongList, .journalCollectList, .followingList, .messageList, .followerList, .blackList, .editUserInfo, .logout, .editAvatar, .hotCommentList, .latestCommentList, .subCommentList, .commentLike, .filterMenu, .journalRecommend, .searchSong, .searchJournal, .randomAudioTrack, .sendComment, .myThumbupList, .myCommentReplyList, .feedback, .suggestions, .commentReport, .deleteComment, .collectJournalSongList, .otherMessageList, .journalDetail, .commentDetail, .lastJournalCover, .journalDetailByID:
|
|
|
|
|
return ["Authorization": AuthManager.shared.token?.basicToken ?? ""]
|
|
|
|
|
default:
|
|
|
|
|
return nil
|
|
|
|
|