Kaynağa Gözat

发布接口创建

Chris 5 yıl önce
ebeveyn
işleme
3ad3f4f6ee

+ 4 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -581,6 +581,7 @@
 		BD7AB8432284390B0030646A /* OrderPaySelfPickInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD7AB8422284390B0030646A /* OrderPaySelfPickInfoCell.swift */; };
 		BD7AB8452284398A0030646A /* OrderPaySelfPickAddInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD7AB8442284398A0030646A /* OrderPaySelfPickAddInfoCell.swift */; };
 		BD929CCE22B904A30098C139 /* PublishViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD929CCD22B904A30098C139 /* PublishViewController.swift */; };
+		BD981A8F22C9FEEF0043D951 /* CommunityPublishModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD981A8E22C9FEEF0043D951 /* CommunityPublishModel.swift */; };
 		BDAA40F7228E947500CF841D /* OrderApplyRefundAccountCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAA40F6228E947500CF841D /* OrderApplyRefundAccountCell.swift */; };
 		BDAA40F9228E9ADA00CF841D /* OrderApplyRefundReasonCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAA40F8228E9ADA00CF841D /* OrderApplyRefundReasonCell.swift */; };
 		BDAA40FB228E9CC300CF841D /* OrderApplyRefundNoteInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAA40FA228E9CC300CF841D /* OrderApplyRefundNoteInfoCell.swift */; };
@@ -1332,6 +1333,7 @@
 		BD7AB8442284398A0030646A /* OrderPaySelfPickAddInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderPaySelfPickAddInfoCell.swift; sourceTree = "<group>"; };
 		BD9052C044FD3AE4E62D3929 /* Pods-RainbowPlanet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RainbowPlanet.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RainbowPlanet/Pods-RainbowPlanet.debug.xcconfig"; sourceTree = "<group>"; };
 		BD929CCD22B904A30098C139 /* PublishViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishViewController.swift; sourceTree = "<group>"; };
+		BD981A8E22C9FEEF0043D951 /* CommunityPublishModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityPublishModel.swift; sourceTree = "<group>"; };
 		BDAA40F6228E947500CF841D /* OrderApplyRefundAccountCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderApplyRefundAccountCell.swift; sourceTree = "<group>"; };
 		BDAA40F8228E9ADA00CF841D /* OrderApplyRefundReasonCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderApplyRefundReasonCell.swift; sourceTree = "<group>"; };
 		BDAA40FA228E9CC300CF841D /* OrderApplyRefundNoteInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderApplyRefundNoteInfoCell.swift; sourceTree = "<group>"; };
@@ -3835,6 +3837,7 @@
 				A72623E822C4AFF200AEF875 /* CommunityTopicsModel.swift */,
 				A7AA9F6422C63DCD0086498B /* CommunityFollowFeedModel.swift */,
 				A7AA9F6622C640F10086498B /* CommunityRecommendFeedModel.swift */,
+				BD981A8E22C9FEEF0043D951 /* CommunityPublishModel.swift */,
 			);
 			path = CommunityModel;
 			sourceTree = "<group>";
@@ -5941,6 +5944,7 @@
 				A7778CAB2244B12500C7C47A /* CountDownManager.swift in Sources */,
 				A775CBFE2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift in Sources */,
 				A71AA5212272E527008FF1A5 /* Extension+UINavigationController.swift in Sources */,
+				BD981A8F22C9FEEF0043D951 /* CommunityPublishModel.swift in Sources */,
 				A7D5F22D22BB689700F8E9AF /* WKWebViewEnum.swift in Sources */,
 				A7D07CD222B784B800186014 /* UserPersonalCenterHeaderView.swift in Sources */,
 				A7CC751822716202003C4F38 /* SetView.swift in Sources */,

+ 5 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishEditController/Controller/PublishEditController.swift

@@ -176,5 +176,10 @@ extension PublishEditController : UITableViewDelegate, UITableViewDataSource {
     func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
         return nil
     }
+}
+
+// MARK: - 逻辑处理
+extension PublishEditController {
+    
     
 }

+ 33 - 0
RainbowPlanet/RainbowPlanet/Service/Model/CommunityModel/CommunityPublishModel.swift

@@ -0,0 +1,33 @@
+//
+//  CommunityPublishModel.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/1.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+import ObjectMapper
+
+
+class CommunityPublishModel : NSObject, Mappable{
+    
+    var bean : String?
+    var h5url : String?
+    var postId : Int?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return CommunityPublishModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        bean <- map["bean"]
+        h5url <- map["h5url"]
+        postId <- map["post_id"]
+        
+    }
+}

+ 32 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift

@@ -116,6 +116,38 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
         }
     }
     
+    // MARK: - 发布内容
+    /// 发布内容
+    ///
+    /// - Parameters:
+    ///   - type: 类型:image图片,video视频,html富文本
+    ///   - img: 主图
+    ///   - topic_ids: 话题id,json字符串
+    ///   - video: 视频url,当type为video时必填
+    ///   - title: 类型:标题
+    ///   - content: 内容
+    ///   - location: 位置
+    ///   - imgs: 图集,type为image是必填,json字符串
+    ///   - page: 分页
+    ///   - completion: 回调
+    func communityPublishApi(type:String = "", img:String = "", topic_ids:String = "", video:String = "", title:String = "", content:String = "", location:String = "", imgs:String = "", page:Int = 1, completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue(type, forKey: "type")
+        parameters.updateValue(img, forKey: "img")
+        parameters.updateValue(topic_ids, forKey: "topic_ids")
+        parameters.updateValue(video, forKey: "video")
+        parameters.updateValue(title, forKey: "title")
+        parameters.updateValue(content, forKey: "content")
+        parameters.updateValue(location, forKey: "location")
+        parameters.updateValue(imgs, forKey: "imgs")
+        parameters.updateValue(page, forKey: "page")
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared.requestObject(CommunityPublishModel.self, target: MultiTarget(SwiftMoyaServiceCommunityApi.communityPublish(parameters: parameters))) { (CommunityPublishModel) in
+            SwiftProgressHUD.shared().hide()
+            completion(CommunityPublishModel)
+        }
+    }
+    
     // MARK: - 多关注页面feed流
     /// 多关注页面feed流
     ///

+ 14 - 3
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaServiceCommunityApi.swift

@@ -26,9 +26,13 @@ public let kCommunityPostMyApi = "/community/post/my"
 public let kCommunityTopicsApi = "/community/topic"
 
 // MARK: - 内容列表
-/// 内容列表
+/// 内容列表(Get)
 public let kCommunityPostsApi = "/community/post"
 
+// MARK: - 发布内容
+/// 发布内容(Post)
+public let kCommunityPublishApi = "/community/post"
+
 // MARK: - 关注页面feed流
 /// 关注页面feed流
 public let kCommunityFollowFeedApi = "/community/feed"
@@ -45,6 +49,7 @@ public let kCommunityPostSuggestApi = "/community/post/suggest"
 /// - communityPostMy: 个人中心内容
 /// - communityTopics: 话题列表
 /// - communityPosts: 内容列表
+/// - communityPublish: 发布内容
 /// - communityFeed: 关注页面feed流
 /// - communityPostSuggest: 关注页面feed流
 public enum SwiftMoyaServiceCommunityApi {
@@ -53,6 +58,7 @@ public enum SwiftMoyaServiceCommunityApi {
     case communityPostMy(parameters:Dictionary<String, Any>)
     case communityTopics(parameters:Dictionary<String, Any>)
     case communityPosts(parameters:Dictionary<String, Any>)
+    case communityPublish(parameters:Dictionary<String, Any>)
     case communityFollowFeed(parameters:Dictionary<String, Any>)
     case communityPostSuggest(parameters:Dictionary<String, Any>)
 }
@@ -66,6 +72,7 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityPostMy,
              .communityTopics,
              .communityPosts,
+             .communityPublish,
              .communityFollowFeed,
              .communityPostSuggest
             :
@@ -85,6 +92,8 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
             return kCommunityTopicsApi
         case .communityPosts:
             return kCommunityPostsApi
+        case .communityPublish:
+            return kCommunityPublishApi
         case .communityFollowFeed:
             return kCommunityFollowFeedApi
         case .communityPostSuggest:
@@ -94,7 +103,8 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
     
     public var method: Moya.Method {
         switch self {
-        case .communityMemberFollowTopic
+        case .communityMemberFollowTopic,
+             .communityPublish
             :
             return .post
         case .communityTopicCategory,
@@ -105,7 +115,6 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityPostSuggest
             :
             return .get
-            
         }
     }
     
@@ -117,6 +126,7 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityPostMy(var parameters),
              .communityTopics(var parameters),
              .communityPosts(var parameters),
+             .communityPublish(var parameters),
              .communityFollowFeed(var parameters),
              .communityPostSuggest(var parameters)
             :
@@ -146,6 +156,7 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityPostMy,
              .communityTopics,
              .communityPosts,
+             .communityPublish,
              .communityFollowFeed,
              .communityPostSuggest
             :