Commit eed5749002492d25f4ef0e767ad8f56df077dd26

Authored by liushiyu
1 parent d4bb1991

提交登录修改

Showing 26 changed files with 527 additions and 160 deletions
... ... @@ -53,6 +53,7 @@ target 'metaCode' do
53 53 pod 'ZFPlayer/ijkplayer', :git => 'https://gitee.com/mirrors/ZFPlayer.git'
54 54 #分享
55 55 pod 'CNLiveShareToolKit'
  56 +# pod 'CNLiveTencentopenapi', :git => 'https://github.com/CNLiveiOSTeam/CNLiveTencentopenapi.git'
56 57 # pod 'CNLiveTencentopenapi'
57 58 # pod 'WechatOpenSDK'
58 59 #网家家输入组件
... ...
metaCode.xcodeproj/project.pbxproj
... ... @@ -206,7 +206,6 @@
206 206 79A212C22B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A212C12B0B5D0700BFA8E3 /* CNLiveShopBodyCouponManagerView.swift */; };
207 207 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */; };
208 208 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */; };
209   - 79B6CCD72B58C2630041B445 /* CNLiveShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B6CCD62B58C2630041B445 /* CNLiveShareView.swift */; };
210 209 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */; };
211 210 79BB1C142B05C51900C5720C /* CNLiveShopCouponViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */; };
212 211 79BB1C162B05C62900C5720C /* CNLiveShopBodyCouponView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB1C152B05C62900C5720C /* CNLiveShopBodyCouponView.swift */; };
... ... @@ -470,7 +469,6 @@
470 469 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCustomView.swift; sourceTree = "<group>"; };
471 470 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; };
472 471 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; };
473   - 79B6CCD62B58C2630041B445 /* CNLiveShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShareView.swift; sourceTree = "<group>"; };
474 472 79B6CCD82B58C5B50041B445 /* WechatOpenSDK-XCFramework.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = "WechatOpenSDK-XCFramework.xcframework"; path = "Pods/WechatOpenSDK-XCFramework/WechatOpenSDK-XCFramework.xcframework"; sourceTree = "<group>"; };
475 473 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; };
476 474 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponViewController.swift; sourceTree = "<group>"; };
... ... @@ -1121,14 +1119,6 @@
1121 1119 path = View;
1122 1120 sourceTree = "<group>";
1123 1121 };
1124   - 794294A82B4D3018008AAFA0 /* Share */ = {
1125   - isa = PBXGroup;
1126   - children = (
1127   - 79B6CCD62B58C2630041B445 /* CNLiveShareView.swift */,
1128   - );
1129   - path = Share;
1130   - sourceTree = "<group>";
1131   - };
1132 1122 79579CAA2AAAE905006E5B38 /* Database */ = {
1133 1123 isa = PBXGroup;
1134 1124 children = (
... ... @@ -1207,7 +1197,6 @@
1207 1197 796398912A260C0100D045EB /* Common */ = {
1208 1198 isa = PBXGroup;
1209 1199 children = (
1210   - 794294A82B4D3018008AAFA0 /* Share */,
1211 1200 792E57D52A3AA28E005834DB /* Util */,
1212 1201 7963989B2A260E6200D045EB /* Base */,
1213 1202 );
... ... @@ -1788,7 +1777,6 @@
1788 1777 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */,
1789 1778 79A212C02B0B5C5400BFA8E3 /* CNLiveShopCouponManagerViewController.swift in Sources */,
1790 1779 7C2703362A3AFD3A0061EC50 /* CNLiveEnvironment.swift in Sources */,
1791   - 79B6CCD72B58C2630041B445 /* CNLiveShareView.swift in Sources */,
1792 1780 798A44FD2A309EBA00815935 /* CNLiveTypeFeedBackViewController.swift in Sources */,
1793 1781 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */,
1794 1782 19CC4D522ADD129800308E2A /* CNUpSlideAnimationTransition.swift in Sources */,
... ...
metaCode/Classes/Common/Share/CNLiveShareView.swift deleted 100644 → 0
1   -//
2   -// CNLiveShareView.swift
3   -// metaCode
4   -//
5   -// Created by open on 2024/1/18.
6   -//
7   -
8   -import Foundation
9   -import UIKit
10   -
11   -class CNLiveShareView: UIView {
12   -
13   -}
metaCode/Classes/Environment/CNLiveEnvironment.swift
... ... @@ -146,8 +146,8 @@ class CNLiveEnvironmentManager: NSObject{
146 146 func developmentEnvironment(){
147 147 self.appId = "802_li40qhp922"
148 148 self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac"
149   - self.appId_wjj = "769_jetj7bq525"
150   - self.appKey_wjj = "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d"
  149 + self.appId_wjj = "802_jhlqbq4475"
  150 + self.appKey_wjj = "d25cf0dce30e7d7ddc7c857b85ab0dde670d491fc2ffe4"
151 151 self.appId_wjj_b = "769_jnjxdh3w53"
152 152 self.appKey_wjj_b = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpeLgK0vk5POU5PQ"
153 153 self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9"
... ...
metaCode/Classes/Main/LoginPage/ViewModel/CNLiveLoginViewModel.swift
... ... @@ -38,8 +38,8 @@ class CNLiveLoginViewModel : NSObject {
38 38 showLoading(message: "")
39 39 let param = ["mobile":phone,"countryCode":code]
40 40 let custom_param = NSMutableDictionary()
41   - custom_param.setValue(APPId, forKey: "appId")
42   - custom_param.setValue(APPKey, forKey: "appKey")
  41 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  42 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
43 43 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
44 44 CNLiveNetworking.setAllowRequestDefaultArgument(true)
45 45 CNLiveNetworking.setupShowDataResult(false)
... ... @@ -95,8 +95,8 @@ class CNLiveLoginViewModel : NSObject {
95 95 showLoading(message: "")
96 96 let param = ["userName":userName,"countryCode":countryCode,"verificationCode":verCode,"inviterId":""]
97 97 let custom_param = NSMutableDictionary()
98   - custom_param.setValue(APPId, forKey: "appId")
99   - custom_param.setValue(APPKey, forKey: "appKey")
  98 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  99 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
100 100 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
101 101 CNLiveNetworking.setAllowRequestDefaultArgument(true)
102 102 CNLiveNetworking.setupShowDataResult(false)
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
... ... @@ -65,8 +65,13 @@ class CNLiveMineViewModel: NSObject {
65 65 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
66 66 param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token")
67 67 showLoading(message: "")
  68 + let custom_param = NSMutableDictionary()
  69 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  70 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
  71 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
68 72 CNLiveNetworking.setAllowRequestDefaultArgument(true)
69 73 CNLiveNetworking.setupShowDataResult(false)
  74 + CNLiveNetworking.setupShowResult(true)
70 75 CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/user/updateUserById", param: param as! [String : Any], cacheType: .networkOnly) { task, result, error in
71 76 hiddenLoading()
72 77 if (error == nil) {
... ... @@ -100,6 +105,10 @@ class CNLiveMineViewModel: NSObject {
100 105 param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token")
101 106 param.setValue(UserInfoManager.shared.userInfo.access_token, forKey: "access_token")
102 107 showLoading(message: "修改头像中...")
  108 + let custom_param = NSMutableDictionary()
  109 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  110 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
  111 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
103 112 CNLiveNetworking.setAllowRequestDefaultArgument(true)
104 113 CNLiveNetworking.setupShowDataResult(false)
105 114 CNLiveNetworking.setupShowResult(true)
... ... @@ -144,6 +153,10 @@ class CNLiveMineViewModel: NSObject {
144 153 param.setValue(APPId, forKey: "appId")
145 154 param.setValue(APPSecret, forKey: "secret")
146 155 showLoading(message: "")
  156 + let custom_param = NSMutableDictionary()
  157 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  158 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
  159 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
147 160 CNLiveNetworking.setAllowRequestDefaultArgument(false)
148 161 CNLiveNetworking.setupShowDataResult(false)
149 162 CNLiveNetworking.requestNetwork(with: .POST, urlString: APPLoginHost+"/open/api2/token", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in
... ... @@ -199,8 +212,8 @@ class CNLiveMineViewModel: NSObject {
199 212 param.setValue(UIDevice.current.identifierForVendor?.uuidString.replacingOccurrences(of: "-", with: "") ?? "", forKey: "deviceId")
200 213 showLoading(message: "")
201 214 let custom_param = NSMutableDictionary()
202   - custom_param.setValue(APPId, forKey: "appId")
203   - custom_param.setValue(APPKey, forKey: "appKey")
  215 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  216 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
204 217 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
205 218 CNLiveNetworking.setAllowRequestDefaultArgument(true)
206 219 CNLiveNetworking.setupShowDataResult(false)
... ... @@ -227,8 +240,8 @@ class CNLiveMineViewModel: NSObject {
227 240 static func requestMessage(resultBlock: @escaping resultNewsBlock) {
228 241 showLoading(message: "")
229 242 let custom_param = NSMutableDictionary()
230   - custom_param.setValue(APPId, forKey: "appId")
231   - custom_param.setValue(APPKey, forKey: "appKey")
  243 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  244 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
232 245 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
233 246 CNLiveNetworking.setAllowRequestDefaultArgument(true)
234 247 CNLiveNetworking.setupShowDataResult(false)
... ... @@ -266,8 +279,8 @@ class CNLiveMineViewModel: NSObject {
266 279 param.setValue("30", forKey: "pageSize")
267 280 param.setValue("\(page)", forKey: "page")
268 281 let custom_param = NSMutableDictionary()
269   - custom_param.setValue(APPId, forKey: "appId")
270   - custom_param.setValue(APPKey, forKey: "appKey")
  282 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  283 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
271 284 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
272 285 CNLiveNetworking.setAllowRequestDefaultArgument(true)
273 286 CNLiveNetworking.setupShowDataResult(false)
... ... @@ -328,8 +341,8 @@ class CNLiveMineViewModel: NSObject {
328 341 param.setValue("\(page)", forKey: "page")
329 342 param.setValue("30", forKey: "pageSize")
330 343 let custom_param = NSMutableDictionary()
331   - custom_param.setValue(APPId, forKey: "appId")
332   - custom_param.setValue(APPKey, forKey: "appKey")
  344 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  345 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
333 346 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
334 347 CNLiveNetworking.setAllowRequestDefaultArgument(true)
335 348 CNLiveNetworking.setupShowDataResult(false)
... ... @@ -416,8 +429,8 @@ class CNLiveMineViewModel: NSObject {
416 429 request.httpBody = data
417 430 showLoading(message: "")
418 431 let custom_param = NSMutableDictionary()
419   - custom_param.setValue(APPId, forKey: "appId")
420   - custom_param.setValue(APPKey, forKey: "appKey")
  432 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  433 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
421 434 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
422 435 CNLiveNetworking.setAllowRequestDefaultArgument(false)
423 436 CNLiveNetworking.setupShowDataResult(false)
... ... @@ -457,8 +470,8 @@ class CNLiveMineViewModel: NSObject {
457 470 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
458 471 param.setValue(identityId, forKey: "identityId")
459 472 let custom_param = NSMutableDictionary()
460   - custom_param.setValue(APPId, forKey: "appId")
461   - custom_param.setValue(APPKey, forKey: "appKey")
  473 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  474 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
462 475 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
463 476 CNLiveNetworking.setAllowRequestDefaultArgument(true)
464 477 CNLiveNetworking.setupShowDataResult(false)
... ... @@ -509,8 +522,8 @@ class CNLiveMineViewModel: NSObject {
509 522 let param = NSMutableDictionary()
510 523 param.setValue("2", forKey: "appType")
511 524 let custom_param = NSMutableDictionary()
512   - custom_param.setValue(APPId, forKey: "appId")
513   - custom_param.setValue(APPKey, forKey: "appKey")
  525 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  526 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
514 527 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
515 528 CNLiveNetworking.setAllowRequestDefaultArgument(true)
516 529 CNLiveNetworking.setupShowDataResult(false)
... ... @@ -556,8 +569,8 @@ class CNLiveMineViewModel: NSObject {
556 569 param.setValue("\(page)", forKey: "page")
557 570 param.setValue("10", forKey: "pageSize")
558 571 let custom_param = NSMutableDictionary()
559   - custom_param.setValue(APPId, forKey: "appId")
560   - custom_param.setValue(APPKey, forKey: "appKey")
  572 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  573 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
561 574 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
562 575 CNLiveNetworking.setAllowRequestDefaultArgument(true)
563 576 CNLiveNetworking.setupShowDataResult(false)
... ...
metaCode/Classes/Main/VideoPage/Controller/CNLiveShortVideoViewController.swift
... ... @@ -72,8 +72,10 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
72 72 return dataArray
73 73 }()
74 74  
  75 +
75 76 var aid: String! = ""
76 77 var pageNum: NSInteger! = 1
  78 + var isSelectable: Bool! = false
77 79 var currentIndex: NSInteger! = 0
78 80 var footerRefreshView: CNLiveFooterRefresh!
79 81 var playerManager = ZFIJKPlayerManager.init()
... ... @@ -88,6 +90,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
88 90 init(aid: String,page: NSInteger, currentIndex: NSInteger, dataArray: [CNLiveAlbumListModel]) {
89 91 self.aid = aid
90 92 self.pageNum = page
  93 + self.isSelectable = true
91 94 self.currentIndex = currentIndex
92 95 super.init(nibName:nil, bundle:nil)
93 96 self.dataArray.addObjects(from: dataArray)
... ... @@ -101,12 +104,13 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
101 104 /// - Parameter aid: 专辑 id
102 105 init(aid: String) {
103 106 self.aid = aid
  107 + self.isSelectable = false
104 108 super.init(nibName:nil, bundle:nil)
105 109 }
106 110  
107 111 override func viewWillAppear(_ animated: Bool) {
108 112 super.viewWillAppear(animated)
109   - if self.dataArray.count == 0 {
  113 + if self.dataArray.count > 0 && self.isSelectable {
110 114 self.playTheIndex(index: self.currentIndex)
111 115 }
112 116 }
... ... @@ -152,9 +156,18 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
152 156 self.controlView.videoPlayer((self.player)!, currentTime: self.player.currentTime, totalTime: self.player.totalTime)
153 157 let index = self.dataURLArray.index(of: assetURL.absoluteString)
154 158 let homeModel = self.dataArray[index] as! CNLiveAlbumListModel
155   - if (homeModel.product!.albumProductType != "0") {
  159 + if (homeModel.product!.check == true) {
156 160 (self.player)!.stopCurrentPlayingCell()
157 161 }
  162 + if homeModel.product?.check == true {
  163 + if homeModel.product?.albumProductType != "0" {
  164 + (self.player)!.stopCurrentPlayingCell()
  165 + }
  166 + } else {
  167 + if homeModel.product?.albumProductType != "0" {
  168 + (self.player)!.stopCurrentPlayingCell()
  169 + }
  170 + }
158 171 }
159 172 // 更新另一个控制层的时间
160 173 player.playerPlayTimeChanged = { [weak self] asset, currentTime, duration in
... ... @@ -207,7 +220,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
207 220  
208 221 override func viewWillLayoutSubviews() {
209 222 super.viewWillLayoutSubviews()
210   - self.backBtn.frame = CGRectMake(15, CGRectGetMaxY(UIApplication.shared.statusBarFrame), 45, 45)
  223 + self.backBtn.frame = CGRectMake(15, KStatusBarHeight + 15, 45, 45)
211 224 }
212 225  
213 226 func requestData(resultBlock: @escaping () -> Void) {
... ... @@ -314,7 +327,7 @@ class CNLiveShortVideoViewController : CNLiveBaseViewController, UITableViewDele
314 327 extension CNLiveShortVideoViewController {
315 328  
316 329 func likeActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
317   - CNLiveShortVideoViewModel.requestRankWithLike(contentId: viewcell.homeModel.pid, contentTitle: viewcell.homeModel.title, contentSid: viewcell.homeModel.icon!.id, support: viewcell.homeModel.tool!.liked, tagName: viewcell.homeModel.tagName) {result, respStatue in
  330 + CNLiveShortVideoViewModel.requestRankWithLike(contentId: viewcell.homeModel.pid, contentTitle: viewcell.homeModel.title, contentSid: viewcell.homeModel.icon!.id, support: viewcell.homeModel.tool!.liked, isShare: false) {result, respStatue in
318 331 if respStatue == .success {
319 332 viewcell.homeModel.tool!.liked = !viewcell.homeModel.tool!.liked
320 333 if viewcell.homeModel.tool!.liked {
... ... @@ -333,16 +346,32 @@ extension CNLiveShortVideoViewController {
333 346 })
334 347 }
335 348 func shareActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
336   - CNLiveShareManager.showShareViewWithParam(forShareTitle: viewcell.homeModel.title, shareUrl: viewcell.homeModel.shareUrl, shareDesc: viewcell.homeModel.subTitle, shareImage: viewcell.homeModel.poster, screenFull: false, hiddenWjj: true, hiddenQQ: false, hiddenWB: true, hiddenLifeCircle: true, hiddenWechatCircle: false, hiddenWechat: false, hiddenSafari: true, formVC: self, topImage: [], topTitles: [], platformType: .all) { title in} completerBlock: {[weak self] resultType, platformType, typeString in
337   - guard let self = self else { return }
338   -
  349 + CNLiveShareManager.showShareViewWithParam(forShareTitle: viewcell.homeModel.title, shareUrl: viewcell.homeModel.shareUrl, shareDesc: viewcell.homeModel.subTitle, shareImage: viewcell.homeModel.poster, screenFull: false, hiddenWjj: true, hiddenQQ: false, hiddenWB: true, hiddenLifeCircle: true, hiddenWechatCircle: false, hiddenWechat: false, hiddenSafari: true, formVC: self, topImage: [], topTitles: [], platformType: .all) { title in} completerBlock: {resultType, platformType, typeString in
  350 + if resultType == .succ {
  351 + showLoading(message: "")
  352 + CNLiveShortVideoViewModel.requestRankWithLike(contentId: viewcell.homeModel.pid, contentTitle: viewcell.homeModel.title, contentSid: viewcell.homeModel.icon!.id, support: true, isShare: true) {result, respStatue in
  353 + if respStatue == .success {
  354 + viewcell.homeModel.tool?.shareNum = "\(Int(viewcell.homeModel.tool!.shareNum)! + 1)"
  355 + button.setTitle(viewcell.homeModel.tool?.shareNum, for: .normal)
  356 + }
  357 + }
  358 + }
339 359 }
340 360 }
341 361 func iconActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
342 362 self.navigationController?.pushViewController(CNLivePlayletHomePageController(aid: aid), animated: true)
343 363 }
344   - func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
345   -
  364 + func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: APButton) {
  365 + button.startAnimating()
  366 + CNLiveShortVideoViewModel.requestCollect(aid: aid, type: viewcell.homeModel.tool!.collectioned) { result, respStatue in
  367 + if respStatue == .success {
  368 + showMessage(message: result as! String)
  369 + viewcell.homeModel.tool!.collectioned = !viewcell.homeModel.tool!.collectioned
  370 + DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
  371 + button.isHidden = true
  372 + }
  373 + }
  374 + }
346 375 }
347 376 func listActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton) {
348 377 CNLiveShortVideoContentListView.showVideoContentListView(title: viewcell.homeModel.albumMsgModel!.albumName,dataArray: dataArray, result: {[weak self] listModel in
... ... @@ -366,7 +395,6 @@ extension CNLiveShortVideoViewController {
366 395 let index = self.dataArray.index(of: viewcell.homeModel as Any)
367 396 self.playTheIndex(index: index)
368 397 }
369   -
370 398 }
371 399 }
372 400  
... ...
metaCode/Classes/Main/VideoPage/Model/CNLiveShortVideoHomeModel.swift
... ... @@ -42,7 +42,7 @@ class ShortVideoHomeCommentFListModel: BaseModel {
42 42 var facepath: String? = ""
43 43 var content: String? = ""
44 44 var created_at: String? = ""
45   - var praise: String? = ""
  45 + var praise: Int? = 0
46 46 var plat: String? = ""
47 47 var isOffical: Bool? = false
48 48 var model: String? = ""
... ... @@ -57,34 +57,13 @@ class ShortVideoHomeCommentFListModel: BaseModel {
57 57 var textLayout: YYTextLayout!
58 58 var cellH: CGFloat! = 0
59 59  
60   -// override func mapping(mapper: HelpingMapper) {
61   -// mapper <<<
62   -// self.content <-- TransformOf(fromJSON: { (raw) -> String in
63   -// if raw!.count > 0 {
64   -// let modifier = CNLiveShortVideoMateCodeLinePositionModifier(font: medium_adapt_font(pointSize: 16), paddingTop: 5, paddingBottom: 5, lineHeightMultiple: 2)
65   -// let comment = CNLiveBusinessTools.replaceQQemoji(withCustomText: self.content ?? "")
66   -// let attributes = NSMutableAttributedString(attributedString: comment)
67   -// attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.white, range: NSRange(location: 0, length: comment.length))
68   -// attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: comment.length))
69   -// let textContainer = YYTextContainer(size: CGSize(width: KSreenWidth-80, height: CGFloat(HUGE)))
70   -// textContainer.linePositionModifier = modifier;
71   -// let textLayout = YYTextLayout(container: textContainer, text: attributes)
72   -// self.textLayout = textLayout
73   -// self.cellH = 70 + (textLayout?.textBoundingRect.size.height ?? 0)
74   -// }
75   -// return raw!
76   -// }, toJSON: { (tuple) -> String? in
77   -// return tuple
78   -// });
79   -// }
80   -
81 60 override func didFinishMapping() {
82 61 super.didFinishMapping()
83 62  
84 63 let modifier = CNLiveShortVideoMateCodeLinePositionModifier(font: medium_adapt_font(pointSize: 16), paddingTop: 5, paddingBottom: 5, lineHeightMultiple: 2)
85 64 let comment = CNLiveBusinessTools.replaceQQemoji(withCustomText: self.content ?? "")
86 65 let attributes = NSMutableAttributedString(attributedString: comment)
87   - attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.white, range: NSRange(location: 0, length: comment.length))
  66 + attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: HexColor("#333333")!, range: NSRange(location: 0, length: comment.length))
88 67 attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: comment.length))
89 68 let textContainer = YYTextContainer(size: CGSize(width: KSreenWidth-80, height: CGFloat(HUGE)))
90 69 textContainer.linePositionModifier = modifier;
... ... @@ -128,7 +107,7 @@ class ShortVideoHomeCommentRListItemModel: BaseModel {
128 107 let modifier = CNLiveShortVideoMateCodeLinePositionModifier(font: semibold_adapt_font(pointSize: 14), paddingTop: 0, paddingBottom: 0, lineHeightMultiple: 1.5)
129 108 let comment = CNLiveBusinessTools.replaceQQemoji(withCustomText: content ?? "")
130 109 let attributes = NSMutableAttributedString(attributedString: comment)
131   - attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.white, range: NSRange(location: 0, length: comment.length))
  110 + attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: HexColor("#333333")!, range: NSRange(location: 0, length: comment.length))
132 111 attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: comment.length))
133 112 let textContainer = YYTextContainer(size: CGSize(width: KSreenWidth-80-40, height: CGFloat(HUGE)))
134 113 textContainer.linePositionModifier = modifier;
... ...
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoCommentListView.swift
... ... @@ -12,8 +12,10 @@ import CNLiveCustomUI
12 12 import Kingfisher
13 13 import YYText
14 14 import APButton
  15 +import QMUIKit
15 16 typealias CloseCommentListResultBlock = (_ commentModel: Any) ->Void
16 17 typealias ReloadCommentListResultBlock = (_ commentModel: Any) ->Void
  18 +typealias ChangeCommentListResultBlock = (_ commentModel: Any) ->Void
17 19 typealias DeleteCommentListResultBlock = (_ commentModel: Any) ->Void
18 20 class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate {
19 21  
... ... @@ -25,13 +27,13 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
25 27  
26 28 lazy var contentView: UIView = {
27 29 let view = UIView.init()
28   - view.backgroundColor = HexColor("#010101")
  30 + view.backgroundColor = HexColor("#FEFFFF")
29 31 return view
30 32 }()
31 33  
32 34 lazy var closeButton: UIButton = {
33 35 let button = UIButton(type: .custom)
34   - button.setImage(UIImage(named: "short_video_close"), for: .normal)
  36 + button.setImage(UIImage(named: "short_video_comment_close"), for: .normal)
35 37 button.backgroundColor = .clear
36 38 button.addTarget(self, action: #selector(closeMethod), for: .touchUpInside)
37 39 return button
... ... @@ -39,7 +41,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
39 41  
40 42 lazy var titleLabel: UILabel = {
41 43 let label = UILabel()
42   - label.textColor = UIColor.white
  44 + label.textColor = HexColor("#333333")
43 45 label.font = semibold_adapt_font(pointSize: 19)
44 46 label.textAlignment = .left
45 47 label.text = "0条评论"
... ... @@ -50,7 +52,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
50 52  
51 53 lazy var sendButton: UIButton = {
52 54 let button = UIButton(type: .custom)
53   - button.backgroundColor = HexColor("#f8f8f8")
  55 + button.backgroundColor = HexColor("#F0F0F0")
54 56 button.setTitle("我来说一下...", for: .normal)
55 57 button.layer.cornerRadius = 20
56 58 button.layer.masksToBounds = true
... ... @@ -73,7 +75,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
73 75  
74 76 lazy var lineLabel: UILabel = {
75 77 let lineLabel = UILabel.init()
76   - lineLabel.backgroundColor = HexColor("#686868")
  78 + lineLabel.backgroundColor = HexColor("#E6E6E6")
77 79 return lineLabel
78 80 }()
79 81  
... ... @@ -86,11 +88,11 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
86 88 tableView.emptyDataSetDelegate = self
87 89 tableView.estimatedSectionFooterHeight = 0
88 90 tableView.estimatedSectionHeaderHeight = 0
89   - tableView.backgroundColor = HexColor("#010101")
  91 + tableView.backgroundColor = HexColor("#FEFFFF")
90 92 tableView.tableFooterView = UIView.init()
91 93 tableView.separatorStyle = .none
92 94 tableView.scrollsToTop = false
93   - tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: get_system_tabbar_ui_offsetHeight(), right: 0)
  95 + tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
94 96 tableView.contentInsetAdjustmentBehavior = .never;
95 97 tableView.register(CNLiveShortVideoCommentListTableViewCell.self, forCellReuseIdentifier: kShortVideoCommentListTableViewCellIdentifier)
96 98 return tableView
... ... @@ -101,6 +103,7 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
101 103 return array
102 104 }()
103 105  
  106 + var total_hd: Int! = 0
104 107 var videoId: String!
105 108 var contentSid: String!
106 109 var pageNum: NSInteger! = 0
... ... @@ -116,7 +119,8 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
116 119 }
117 120 let listArray = (result as! ShortVideoHomeCommentModel).comments
118 121 self.dataArray.addObjects(from: listArray)
119   - self.titleLabel.text = "\((result as! ShortVideoHomeCommentModel).total_hd ?? 0)条评论"
  122 + self.total_hd = (result as! ShortVideoHomeCommentModel).total_hd ?? 0
  123 + self.titleLabel.text = "\(self.total_hd ?? 0)条评论"
120 124 if self.tableView.mj_footer != nil {
121 125 self.tableView.mj_footer?.endRefreshing()
122 126 }
... ... @@ -144,16 +148,20 @@ class CNLiveShortVideoCommentListView: UIView, UITableViewDelegate, UITableViewD
144 148 }
145 149  
146 150 func addRefreshView() {
147   - self.tableView.mj_header = CNLiveHeaderRefresh(refreshingBlock: { [weak self] in
  151 + let headerRefreshView: CNLiveHeaderRefresh = CNLiveHeaderRefresh(refreshingBlock: { [weak self] in
148 152 guard let self = self else { return }
149 153 self.pageNum = 0
150 154 self.requestDataSource()
151 155 })
  156 + headerRefreshView.loadingView?.color = .black
  157 + self.tableView.mj_header = headerRefreshView
152 158 footerRefreshView = CNLiveFooterRefresh(refreshingBlock: { [weak self] in
153 159 guard let self = self else { return }
154 160 self.pageNum += 1
155 161 self.requestDataSource()
156 162 })
  163 + footerRefreshView.stateLabel!.textColor = .black
  164 + footerRefreshView.loadingView?.color = .black
157 165 }
158 166  
159 167 init(frame: CGRect, pid: String, toSid: String) {
... ... @@ -269,10 +277,31 @@ extension CNLiveShortVideoCommentListView {
269 277 guard let self = self else { return }
270 278 self.tableView.mj_header?.beginRefreshing()
271 279 }
  280 + cell.changeBlock = {[weak self] commentModel in
  281 + guard let self = self else { return }
  282 + self.titleLabel.text = "\(self.total_hd - 1)条评论"
  283 + }
272 284 cell.deleteBlock = {[weak self] commentModel in
273 285 guard let self = self else { return }
274   - self.dataArray.remove(commentModel)
275   - self.tableView.deleteRows(at: [indexPath], with: .automatic)
  286 + self.pageNum = 1
  287 + self.requestDataSource()
  288 +
  289 +// let tempArray = NSMutableArray(array: self.dataArray)
  290 +// let tempModel = commentModel as! ShortVideoHomeCommentFListModel
  291 +// tempArray.forEach { itemModel in
  292 +// let model: ShortVideoHomeCommentListModel = itemModel as! ShortVideoHomeCommentListModel
  293 +// if tempModel.commentId == model.comment.commentId {
  294 +// let index = self.dataArray.index(of: itemModel)
  295 +// let indexPath_current: IndexPath = IndexPath(row: index, section: 0)
  296 +// self.dataArray.remove(itemModel)
  297 +// self.tableView.beginUpdates()
  298 +// self.tableView.deleteRows(at: [indexPath_current], with: .automatic)
  299 +// self.tableView.endUpdates()
  300 +// self.titleLabel.text = "\(self.total_hd - (model.replyData.total_hd! + 1))条评论"
  301 +// self.tableView.reloadData()
  302 +// return
  303 +// }
  304 +// }
276 305 }
277 306 cell.videoId = videoId
278 307 cell.contentSid = contentSid
... ... @@ -287,7 +316,13 @@ extension CNLiveShortVideoCommentListView {
287 316 self.resultBlock(model)
288 317 }
289 318 func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? {
290   - return UIImage(named: "short_video_default")
  319 + return UIImage(named: "short_video_comment_empty")
  320 + }
  321 + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? {
  322 + let attributes = NSMutableAttributedString(string: "暂无评论~")
  323 + attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: HexColor("#666666")!, range: NSRange(location: 0, length: 5))
  324 + attributes.addAttribute(NSAttributedString.Key.font, value: medium_adapt_font(pointSize: 16), range: NSRange(location: 0, length: 5))
  325 + return attributes
291 326 }
292 327 }
293 328  
... ... @@ -303,9 +338,17 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
303 338 return imageView
304 339 }()
305 340  
  341 + lazy var owerView: UIImageView = {
  342 + let imageView = UIImageView.init()
  343 + imageView.image = UIImage(named: "short_video_comment_ower")
  344 + imageView.contentMode = .scaleAspectFill
  345 + imageView.isHidden = true
  346 + return imageView
  347 + }()
  348 +
306 349 lazy var titleLabel: UILabel = {
307 350 let titleLabel = UILabel.init()
308   - titleLabel.textColor = .white
  351 + titleLabel.textColor = HexColor("#AFAFAF")
309 352 titleLabel.lineBreakMode = .byTruncatingTail
310 353 titleLabel.numberOfLines = 2
311 354 titleLabel.font = medium_adapt_font(pointSize: 12)
... ... @@ -314,7 +357,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
314 357  
315 358 lazy var commentLabel: YYLabel = {
316 359 let commentLabel = YYLabel()
317   - commentLabel.textColor = .white
  360 + commentLabel.textColor = HexColor("#333333")
318 361 commentLabel.displaysAsynchronously = true
319 362 commentLabel.clearContentsBeforeAsynchronouslyDisplay = false
320 363 commentLabel.fadeOnAsynchronouslyDisplay = false
... ... @@ -332,7 +375,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
332 375  
333 376 lazy var timeLabel: UILabel = {
334 377 let timeLabel = UILabel.init()
335   - timeLabel.textColor = .white
  378 + timeLabel.textColor = HexColor("#969696")
336 379 timeLabel.font = light_adapt_font(pointSize: 13)
337 380 return timeLabel
338 381 }()
... ... @@ -343,6 +386,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
343 386 replyButton.activityIndicator.color = .white
344 387 replyButton.backgroundColor = .clear
345 388 replyButton.setTitle("回复", for: .normal)
  389 + replyButton.setTitleColor(HexColor("#969696"), for: .normal)
346 390 replyButton.titleLabel?.font = medium_adapt_font(pointSize: 13)
347 391 replyButton.addTarget(self, action: #selector(replyMethod), for: .touchUpInside)
348 392 return replyButton
... ... @@ -351,13 +395,13 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
351 395 lazy var likeButton: QMUIButton = {
352 396 let button = QMUIButton()
353 397 button.imagePosition = .left
354   - button.spacingBetweenImageAndTitle = 0
355   - button.setTitleColor(UIColor.white, for: .normal)
  398 + button.spacingBetweenImageAndTitle = 2
  399 + button.setTitleColor(HexColor("#333333"), for: .normal)
356 400 button.setTitle("0", for: .normal)
357 401 button.imageView?.contentMode = .scaleAspectFit
358   - button.setImage(UIImage(named: "short_video_zan_nomal"), for: .normal)
359   - button.setImage(UIImage(named: "short_video_zan_select"), for: .selected)
360   - button.titleLabel?.font = regular_adapt_font(pointSize: 14)
  402 + button.setImage(UIImage(named: "short_comment_zan_nomal"), for: .normal)
  403 + button.setImage(UIImage(named: "short_comment_zan_select"), for: .selected)
  404 + button.titleLabel?.font = semibold_adapt_font(pointSize: 14)
361 405 button.addTarget(self, action: #selector(likeActionMethod), for: .touchUpInside)
362 406 return button
363 407 }()
... ... @@ -369,7 +413,7 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
369 413 tableView.delegate = self
370 414 tableView.estimatedSectionFooterHeight = 0
371 415 tableView.estimatedSectionHeaderHeight = 0
372   - tableView.backgroundColor = HexColor("#010101")
  416 + tableView.backgroundColor = .white
373 417 tableView.tableFooterView = UIView.init()
374 418 tableView.separatorStyle = .none
375 419 tableView.scrollsToTop = false
... ... @@ -379,16 +423,18 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
379 423  
380 424 var videoId: String!
381 425 var contentSid: String!
  426 + var changeBlock: ChangeCommentListResultBlock!
382 427 var deleteBlock: DeleteCommentListResultBlock!
383 428 var reloadBlcok: ReloadCommentListResultBlock!
  429 + var deleteItemBlock: DeleteCommentListResultBlock!
384 430 var commentModel: ShortVideoHomeCommentFListModel!
385 431 var replyModel: ShortVideoHomeCommentRListModel!
386 432 var replyItemModel: ShortVideoHomeCommentRListItemModel!
387 433  
388 434 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
389 435 super.init(style: style, reuseIdentifier: reuseIdentifier)
390   - contentView.backgroundColor = .clear
391   - backgroundColor = .clear
  436 + contentView.backgroundColor = HexColor("#FEFFFF")
  437 + backgroundColor = HexColor("#FEFFFF")
392 438 selectionStyle = .none
393 439  
394 440 contentView.addSubview(iconView)
... ... @@ -404,6 +450,11 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
404 450 make.right.equalToSuperview().offset(-10)
405 451 make.height.equalTo(20)
406 452 }
  453 + contentView.addSubview(owerView)
  454 + owerView.snp.makeConstraints { make in
  455 + make.centerY.equalTo(titleLabel)
  456 + make.left.equalTo(titleLabel.snp.right).offset(10)
  457 + }
407 458 contentView.addSubview(commentLabel)
408 459 commentLabel.snp.makeConstraints { make in
409 460 make.top.equalTo(titleLabel.snp.bottom).offset(10)
... ... @@ -432,8 +483,6 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
432 483 make.top.equalTo(commentLabel.snp.bottom).offset(10)
433 484 }
434 485 contentView.addSubview(tableView)
435   -
436   -
437 486 }
438 487  
439 488 func setupWithDataSource(commentData: ShortVideoHomeCommentFListModel, replyData: ShortVideoHomeCommentRListModel, tableView_h: CGFloat) {
... ... @@ -443,8 +492,14 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
443 492 iconView.kf.setImage(with: URL(string: commentData.icon!), placeholder: UIImage(named: "short_video_default"))
444 493 titleLabel.text = commentData.nick
445 494 likeButton.isSelected = commentData.isPraised!
446   - likeButton.setTitle(commentData.praise, for: .normal)
  495 + likeButton.setTitle("\(commentData.praiseCount ?? 0)", for: .normal)
447 496 timeLabel.text = commentData.created_at
  497 + owerView.isHidden = !(contentSid == commentData.uid)
  498 + if ((contentSid == UserInfoManager.shared.userInfo.uid) || (commentData.uid == UserInfoManager.shared.userInfo.uid)) {
  499 + replyButton.setTitle("删除", for: .normal)
  500 + } else {
  501 + replyButton.setTitle("回复", for: .normal)
  502 + }
448 503 DispatchQueue.main.async {[weak self] in
449 504 guard let self = self else { return }
450 505 self.commentLabel.textLayout = commentData.textLayout
... ... @@ -475,6 +530,11 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
475 530 likeButton.isSelected = replyModel.isPraised!
476 531 likeButton.setTitle("\(replyModel.praiseCount ?? 0)", for: .normal)
477 532 timeLabel.text = replyModel.created_at
  533 + if ((contentSid == UserInfoManager.shared.userInfo.uid) || (replyItemModel.fromSid == UserInfoManager.shared.userInfo.uid)) {
  534 + replyButton.setTitle("删除", for: .normal)
  535 + } else {
  536 + replyButton.setTitle("回复", for: .normal)
  537 + }
478 538 DispatchQueue.main.async {[weak self] in
479 539 guard let self = self else { return }
480 540 self.commentLabel.textLayout = replyModel.textLayout
... ... @@ -487,34 +547,93 @@ class CNLiveShortVideoCommentListTableViewCell: UITableViewCell , UITableViewDel
487 547 }
488 548 }
489 549  
490   - @objc func replyMethod() {
491   - CNLiveContentToolTextView.showCommentViewForCustom(withCommType: .reply, fromNick: commentModel == nil ? replyItemModel.fromNick : commentModel.nick, firstRespFace: false, successBlcok: {[weak self] commentString, toolbarView in
492   - guard let self = self else { return }
493   - CNLiveShortVideoViewModel.requestCommentWithReply(commentId: self.commentModel.commentId!, comment: commentString ?? "", toSid: commentModel.uid!, fromSid: UserInfoManager.shared.userInfo.uid, level: "1") {[weak self] result, respStatue in
  550 + @objc func replyMethod(button: UIButton) {
  551 + if button.titleLabel?.text == "回复" {
  552 + CNLiveContentToolTextView.showCommentViewForCustom(withCommType: .reply, fromNick: commentModel == nil ? replyItemModel.fromNick : commentModel.nick, firstRespFace: false, successBlcok: {[weak self] commentString, toolbarView in
494 553 guard let self = self else { return }
495   - if respStatue == .success {
496   - showMessage(message: result as! String)
497   - self.reloadBlcok(self.commentModel == nil ? replyItemModel! : commentModel!)
  554 + CNLiveShortVideoViewModel.requestCommentWithReply(commentId: self.commentModel.commentId!, comment: commentString ?? "", toSid: commentModel.uid!, fromSid: UserInfoManager.shared.userInfo.uid, level: "1") {[weak self] result, respStatue in
  555 + guard let self = self else { return }
  556 + if respStatue == .success {
  557 + showMessage(message: result as! String)
  558 + self.reloadBlcok(self.commentModel == nil ? replyItemModel! : commentModel!)
  559 + }
  560 + }
  561 + }, dissBlock: { toolbarView in})
  562 + } else {
  563 +
  564 + AlertTool.systemAlert(title: "确认删除该条\(commentModel != nil ? "评论" : "回复")吗?", message: "", cancelTitle: "取消", confirmTitle: "确定") {[weak self] index in
  565 + guard let self = self else { return }
  566 + if index == 1 {
  567 + if commentModel != nil {
  568 + showLoading(message: "")
  569 + CNLiveShortVideoViewModel.requestCommentDelete(videoId: commentModel.topicId!, commentId: commentModel.commentId!) {[weak self] result, respStatue in
  570 + guard let self = self else { return }
  571 + if respStatue == .success {
  572 + self.deleteBlock(self.commentModel!)
  573 + }
  574 + }
  575 + }
  576 + if replyItemModel != nil {
  577 + showLoading(message: "")
  578 + CNLiveShortVideoViewModel.requestCommentReplyDelete(replyId: replyItemModel.replyId!, commentId: replyItemModel.commentId!) {[weak self] result, respStatue in
  579 + guard let self = self else { return }
  580 + if respStatue == .success {
  581 + self.deleteItemBlock(self.replyItemModel!)
  582 + }
  583 + }
  584 + }
498 585 }
499 586 }
500   - }, dissBlock: { toolbarView in})
  587 + }
501 588 }
502 589  
503 590 @objc func longPressGestureRecognizerAction(gestureRecognizer: UIGestureRecognizer) {
504 591 if gestureRecognizer.state == .began {
505 592 if commentModel.uid == UserInfoManager.shared.userInfo.uid || contentSid == UserInfoManager.shared.userInfo.uid {
506   - CNLiveShortVideoViewModel.requestCommentDelete(videoId: videoId, commentId: commentModel.commentId!) {[weak self] result, respStatue in
  593 + AlertTool.systemAlert(title: "确认删除该条评论吗?", message: "", cancelTitle: "取消", confirmTitle: "确定") {[weak self] index in
507 594 guard let self = self else { return }
508   - if respStatue == .success {
509   - self.deleteBlock(self.commentModel!)
  595 + if index == 1 {
  596 + showLoading(message: "")
  597 + CNLiveShortVideoViewModel.requestCommentDelete(videoId: self.videoId, commentId: self.commentModel.commentId!) {result, respStatue in
  598 + if respStatue == .success {
  599 + self.deleteBlock(self.commentModel!)
  600 + }
  601 + }
510 602 }
511 603 }
512 604 }
513 605 }
514 606 }
515 607  
516   - @objc func likeActionMethod() {
517   -
  608 + @objc func likeActionMethod(button: UIButton) {
  609 + let contentId: String = commentModel == nil ? replyItemModel.replyId! : commentModel.commentId!
  610 + let support: Bool = commentModel == nil ? replyItemModel.isPraised! : commentModel.isPraised!
  611 + let isComment: Bool = commentModel != nil
  612 + CNLiveShortVideoViewModel.requestCommentWithLike(contentId: contentId, support: support, isComment: isComment) {[weak self] result, respStatue in
  613 + guard let self = self else { return }
  614 + if respStatue == .success {
  615 + showMessage(message: result as! String)
  616 + if isComment {
  617 + commentModel.isPraised = !commentModel.isPraised!
  618 + if commentModel.isPraised! {
  619 + commentModel.praiseCount = commentModel.praiseCount! + 1
  620 + } else {
  621 + commentModel.praiseCount = commentModel.praiseCount! - 1
  622 + }
  623 + button.setTitle("\(commentModel.praiseCount ?? 0)", for: .normal)
  624 + button.isSelected = commentModel.isPraised!
  625 + } else {
  626 + replyItemModel.isPraised = !replyItemModel.isPraised!
  627 + if replyItemModel.isPraised! {
  628 + replyItemModel.praiseCount = replyItemModel.praiseCount! + 1
  629 + } else {
  630 + replyItemModel.praiseCount = replyItemModel.praiseCount! - 1
  631 + }
  632 + button.setTitle("\(replyItemModel.praiseCount ?? 0)", for: .normal)
  633 + button.isSelected = replyItemModel.isPraised!
  634 + }
  635 + }
  636 + }
518 637 }
519 638  
520 639 required init?(coder: NSCoder) {
... ... @@ -534,7 +653,27 @@ extension CNLiveShortVideoCommentListTableViewCell {
534 653 guard let cell = tableView.dequeueReusableCell(withIdentifier: kShortVideoReplyListTableViewCellIdentifier) as? CNLiveShortVideoCommentListTableViewCell else {
535 654 return CNLiveShortVideoCommentListTableViewCell()
536 655 }
537   - cell.setupWithReplyModel(replyModel: replyModel.replys[indexPath.row] )
  656 + cell.setupWithReplyModel(replyModel: replyModel.replys[indexPath.row])
  657 + cell.deleteItemBlock = {[weak self] commentModel in
  658 + guard let self = self else { return }
  659 + self.reloadBlcok(commentModel)
  660 +// let tempArray = NSMutableArray(array: replyModel.replys)
  661 +// let tempModel = commentModel as! ShortVideoHomeCommentRListItemModel
  662 +// tempArray.forEach { itemModel in
  663 +// let model: ShortVideoHomeCommentRListItemModel = itemModel as! ShortVideoHomeCommentRListItemModel
  664 +// if tempModel.replyId == model.replyId {
  665 +// let index = tempArray.index(of: model)
  666 +// let indexPath_current: IndexPath = IndexPath(row: index, section: 0)
  667 +// tempArray.remove(itemModel)
  668 +// self.replyModel.replys = tempArray as! [ShortVideoHomeCommentRListItemModel]
  669 +// self.tableView.beginUpdates()
  670 +// self.tableView.deleteRows(at: [indexPath_current], with: .automatic)
  671 +// self.tableView.endUpdates()
  672 +// self.changeBlock(itemModel)
  673 +// return
  674 +// }
  675 +// }
  676 + }
538 677 return cell
539 678 }
540 679 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
... ...
metaCode/Classes/Main/VideoPage/View/CNLiveShortVideoListTableViewCell.swift
... ... @@ -15,7 +15,7 @@ protocol CNLiveShortVideoListTableViewCellDelegate : AnyObject {
15 15 func commentActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
16 16 func shareActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
17 17 func iconActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
18   - func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
  18 + func faviActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: APButton)
19 19 func listActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
20 20 func payActionMethod(viewcell: CNLiveShortVideoListTableViewCell, button: UIButton)
21 21 }
... ... @@ -186,9 +186,14 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell {
186 186 likeBtn.isSelected = model.tool!.liked
187 187 titleLabel.text = model.shortTitle
188 188 descLabel.text = model.title
  189 + faviBtn.isHidden = model.albumMsgModel!.collection
189 190 listBtn.setTitle(model.albumMsgModel?.albumName, for: .normal)
190 191  
191   - hiddenView(isHidden: homeModel.product!.albumProductType != "0")
  192 +
  193 +
  194 +
  195 +
  196 +
192 197  
193 198 let imageV: UIImageView = payView.viewWithTag(1000) as! UIImageView
194 199 imageV.kf.indicatorType = .activity
... ... @@ -198,12 +203,24 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell {
198 203 let timeL: UILabel = payView.viewWithTag(1002) as! UILabel
199 204 timeL.text = model.duration
200 205 let payButton: APButton = payView.viewWithTag(1003) as! APButton
201   - if model.product?.albumProductType != "0" {
202   - payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal)
  206 +
  207 + if model.product?.check == true {
  208 + //免费
  209 + if model.product?.albumProductType == "0" {
  210 + hiddenView(isHidden: true)
  211 + } else {
  212 + hiddenView(isHidden: false)
  213 + payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal)
  214 + }
  215 + } else {
  216 + //需要付费
  217 + if model.product?.albumProductType == "0" {
  218 + hiddenView(isHidden: true)
  219 + } else {
  220 + hiddenView(isHidden: false)
  221 + payButton.setTitle("\(model.product!.point)积分解锁全集", for: .normal)
  222 + }
203 223 }
204   -// if model.product?.albumProductType == "2" {
205   -// payButton.setTitle("\(Double(model.product!.iosOriginalRmb)!/100.0)元解锁全集", for: .normal)
206   -// }
207 224 }
208 225  
209 226 open func hiddenView(isHidden: Bool) {
... ... @@ -219,7 +236,7 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell {
219 236 self.payView.isHidden = false
220 237 } else {
221 238 self.commentBtn.isHidden = false
222   - self.faviBtn.isHidden = false
  239 + self.faviBtn.isHidden = homeModel.albumMsgModel!.collection
223 240 self.shareBtn.isHidden = false
224 241 self.likeBtn.isHidden = false
225 242 self.iconBtn.isHidden = false
... ... @@ -321,7 +338,7 @@ class CNLiveShortVideoListTableViewCell: UITableViewCell {
321 338 }
322 339  
323 340 @objc func faviMothod(button: UIButton) {
324   - self.delegate.faviActionMethod(viewcell: self, button: button)
  341 + self.delegate.faviActionMethod(viewcell: self, button: button as! APButton)
325 342 }
326 343  
327 344 @objc func listMethod(button: UIButton) {
... ...
metaCode/Classes/Main/VideoPage/ViewModel/CNLiveShortVideoViewModel.swift
... ... @@ -11,6 +11,9 @@ import QMUIKit
11 11 typealias resultShortVideoBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void
12 12 class CNLiveShortVideoViewModel: NSObject {
13 13  
  14 + static let appId_c : String = APPId_wjj
  15 + static let appKey_c : String = APPKey_wjj
  16 +
14 17 /// 获取短视频数据
15 18 /// - Parameters:
16 19 /// - aid: 专辑 id
... ... @@ -23,8 +26,8 @@ class CNLiveShortVideoViewModel: NSObject {
23 26 param.setValue("10", forKey: "pageSize")
24 27 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
25 28 let custom_param = NSMutableDictionary()
26   - custom_param.setValue(APPId_wjj, forKey: "appId")
27   - custom_param.setValue(APPKey_wjj, forKey: "appKey")
  29 + custom_param.setValue(appId_c, forKey: "appId")
  30 + custom_param.setValue(appKey_c, forKey: "appKey")
28 31 CNLiveNetworking.setAllowRequestDefaultArgument(true)
29 32 CNLiveNetworking.setupShowDataResult(false)
30 33 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
... ... @@ -92,8 +95,8 @@ class CNLiveShortVideoViewModel: NSObject {
92 95 param.setValue(aid, forKey: "aid")
93 96 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
94 97 let custom_param = NSMutableDictionary()
95   - custom_param.setValue(APPId_wjj, forKey: "appId")
96   - custom_param.setValue(APPKey_wjj, forKey: "appKey")
  98 + custom_param.setValue( appId_c, forKey: "appId")
  99 + custom_param.setValue(appKey_c, forKey: "appKey")
97 100 CNLiveNetworking.setAllowRequestDefaultArgument(true)
98 101 CNLiveNetworking.setupShowDataResult(false)
99 102 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
... ... @@ -126,28 +129,36 @@ class CNLiveShortVideoViewModel: NSObject {
126 129 }
127 130  
128 131  
129   - /// 短视频点赞功能
  132 + /// 短视频点赞分享功能
130 133 /// - Parameters:
131 134 /// - contentId: 点赞内容 id
132 135 /// - contentTitle: 点赞的视频标题
133 136 /// - support: 1:点赞 0:取消点赞
  137 + /// - isShare: 是否是分享
134 138 /// - reultShortVideoBlock: 返回
135   - static func requestRankWithLike(contentId: String, contentTitle: String, contentSid: String, support: Bool,tagName: String,reultShortVideoBlock: @escaping resultShortVideoBlock) {
  139 + static func requestRankWithLike(contentId: String, contentTitle: String, contentSid: String, support: Bool,isShare: Bool,reultShortVideoBlock: @escaping resultShortVideoBlock) {
136 140 let param = NSMutableDictionary()
137   - param.setValue(contentId, forKey: "contentId")
138   - param.setValue(APPId, forKey: "appId")
  141 + if isShare {
  142 + param.setValue("\(contentId)_share", forKey: "contentId")
  143 + param.setValue("1", forKey: "support")
  144 + } else {
  145 + param.setValue(contentId, forKey: "contentId")
  146 + param.setValue(support ? "0":"1", forKey: "support")
  147 + }
  148 + param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId")
139 149 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
140 150 param.setValue(contentTitle, forKey: "contentTitle")
141 151 param.setValue(contentSid, forKey: "contentSid")
142   - param.setValue(support ? "1":"0", forKey: "support")
143 152 param.setValue("false", forKey: "isRank")
144 153 param.setValue("1", forKey: "isUgc")
145   - param.setValue(tagName, forKey: "contentTag")
  154 + param.setValue("i", forKey: "plat")
  155 + param.setValue("", forKey: "contentTag")
146 156 let custom_param = NSMutableDictionary()
147   - custom_param.setValue(APPId, forKey: "appId")
148   - custom_param.setValue(APPKey, forKey: "appKey")
  157 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId")
  158 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey_wjj, forKey: "appKey")
149 159 CNLiveNetworking.setAllowRequestDefaultArgument(true)
150 160 CNLiveNetworking.setupShowDataResult(false)
  161 + CNLiveNetworking.setupShowResult(true)
151 162 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
152 163 CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseTokenUrl+"/support/supportBySpIdForRank/insert", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
153 164 hiddenLoading()
... ... @@ -155,7 +166,51 @@ class CNLiveShortVideoViewModel: NSObject {
155 166 let resp = result as! NSDictionary
156 167 let errorCode = "\(resp["errorCode"] ?? "0")"
157 168 if (errorCode == "0") {
158   - reultShortVideoBlock(support ? "取消点赞成功" : "点赞成功", .success)
  169 + if isShare {
  170 + reultShortVideoBlock("分享成功", .success)
  171 + } else {
  172 + reultShortVideoBlock(support ? "取消点赞成功" : "点赞成功", .success)
  173 + }
  174 + } else {
  175 + showMessage(message: resp["errorMessage"] as! String)
  176 + reultShortVideoBlock(NSNull(),.failed)
  177 + }
  178 + } else {
  179 + if CNLiveNetworking.isNetworking() {
  180 + showMessage(message: "请求失败")
  181 + reultShortVideoBlock(NSNull(),.failed)
  182 + } else {
  183 + showMessage(message: "似乎与网络断开链接")
  184 + reultShortVideoBlock(NSNull(),.noNetwork)
  185 + }
  186 + }
  187 + }
  188 + }
  189 +
  190 + /// 对专辑进行收藏
  191 + /// - Parameters:
  192 + /// - aid: 专辑 id
  193 + /// - type: 是否收藏
  194 + /// - reultShortVideoBlock: 返回
  195 + static func requestCollect(aid: String, type: Bool,reultShortVideoBlock: @escaping resultShortVideoBlock) {
  196 + let param = NSMutableDictionary()
  197 + param.setValue(aid, forKey: "aid")
  198 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
  199 + param.setValue(type ? "2": "1", forKey: "type")
  200 + let custom_param = NSMutableDictionary()
  201 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId")
  202 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey_wjj, forKey: "appKey")
  203 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  204 + CNLiveNetworking.setupShowDataResult(false)
  205 + CNLiveNetworking.setupShowDataResult(true)
  206 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
  207 + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseCMSUrl+"/contentApi/albumCollect", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  208 + hiddenLoading()
  209 + if (error == nil) {
  210 + let resp = result as! NSDictionary
  211 + let errorCode = "\(resp["errorCode"] ?? "0")"
  212 + if (errorCode == "0") {
  213 + reultShortVideoBlock(type ? "取消收藏成功" : "收藏成功", .success)
159 214 } else {
160 215 showMessage(message: resp["errorMessage"] as! String)
161 216 reultShortVideoBlock(NSNull(),.failed)
... ... @@ -172,6 +227,8 @@ class CNLiveShortVideoViewModel: NSObject {
172 227 }
173 228 }
174 229  
  230 +
  231 +
175 232 //!!!: 评论相关
176 233  
177 234 /// 获取评论列表数
... ... @@ -183,13 +240,13 @@ class CNLiveShortVideoViewModel: NSObject {
183 240 let param = NSMutableDictionary()
184 241 param.setValue(pid, forKey: "topicId")
185 242 param.setValue("i", forKey: "plat")
186   - param.setValue(APPId, forKey: "appId")
  243 + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
187 244 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
188 245 param.setValue("\(page)", forKey: "seqId")
189 246 param.setValue("10", forKey: "count")
190 247 let custom_param = NSMutableDictionary()
191   - custom_param.setValue(APPId, forKey: "appId")
192   - custom_param.setValue(APPKey, forKey: "appKey")
  248 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  249 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
193 250 CNLiveNetworking.setAllowRequestDefaultArgument(true)
194 251 CNLiveNetworking.setupShowDataResult(false)
195 252 CNLiveNetworking.setupShowResult(true)
... ... @@ -231,14 +288,14 @@ class CNLiveShortVideoViewModel: NSObject {
231 288 static func requestCommentWithSend(videoId: String, comment: String, isAuthor: Bool,reultShortVideoBlock: @escaping resultShortVideoBlock) {
232 289 let param = NSMutableDictionary()
233 290 param.setValue(videoId, forKey: "topicId")
234   - param.setValue(APPId, forKey: "appId")
  291 + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
235 292 param.setValue("i", forKey: "plat")
236 293 param.setValue(comment.qmui_trim, forKey: "comment")
237 294 param.setValue(isAuthor ? "1" : "0", forKey: "isAuthor")
238 295 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
239 296 let custom_param = NSMutableDictionary()
240   - custom_param.setValue(APPId, forKey: "appId")
241   - custom_param.setValue(APPKey, forKey: "appKey")
  297 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  298 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
242 299 CNLiveNetworking.setAllowRequestDefaultArgument(true)
243 300 CNLiveNetworking.setupShowDataResult(false)
244 301 CNLiveNetworking.setupDSRequest(false)
... ... @@ -279,15 +336,15 @@ class CNLiveShortVideoViewModel: NSObject {
279 336 static func requestCommentWithReply(commentId: String, comment: String, toSid: String, fromSid: String, level: String,reultShortVideoBlock: @escaping resultShortVideoBlock) {
280 337 let param = NSMutableDictionary()
281 338 param.setValue(commentId, forKey: "commentId")
282   - param.setValue(APPId, forKey: "appId")
  339 + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
283 340 param.setValue(comment, forKey: "comment")
284 341 param.setValue(toSid, forKey: "toSid")
285 342 param.setValue(fromSid, forKey: "fromSid")
286 343 param.setValue(level, forKey: "level")
287 344 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
288 345 let custom_param = NSMutableDictionary()
289   - custom_param.setValue(APPId, forKey: "appId")
290   - custom_param.setValue(APPKey, forKey: "appKey")
  346 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  347 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
291 348 CNLiveNetworking.setAllowRequestDefaultArgument(true)
292 349 CNLiveNetworking.setupShowDataResult(false)
293 350 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
... ... @@ -326,8 +383,8 @@ class CNLiveShortVideoViewModel: NSObject {
326 383 param.setValue("\(page)", forKey: "seqId")//从 0 开始
327 384 param.setValue("10", forKey: "count")
328 385 let custom_param = NSMutableDictionary()
329   - custom_param.setValue(APPId, forKey: "appId")
330   - custom_param.setValue(APPKey, forKey: "appKey")
  386 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  387 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
331 388 CNLiveNetworking.setAllowRequestDefaultArgument(true)
332 389 CNLiveNetworking.setupShowDataResult(false)
333 390 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
... ... @@ -374,12 +431,12 @@ class CNLiveShortVideoViewModel: NSObject {
374 431 static func requestCommentDelete(videoId: String, commentId: String, reultShortVideoBlock: @escaping resultShortVideoBlock) {
375 432 let param = NSMutableDictionary()
376 433 param.setValue(commentId, forKey: "commentId")
377   - param.setValue(APPId, forKey: "appId")
  434 + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
378 435 param.setValue(videoId, forKey: "topicId")
379 436 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
380 437 let custom_param = NSMutableDictionary()
381   - custom_param.setValue(APPId, forKey: "appId")
382   - custom_param.setValue(APPKey, forKey: "appKey")
  438 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  439 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
383 440 CNLiveNetworking.setAllowRequestDefaultArgument(true)
384 441 CNLiveNetworking.setupShowDataResult(false)
385 442 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
... ... @@ -414,12 +471,12 @@ class CNLiveShortVideoViewModel: NSObject {
414 471 static func requestCommentReplyDelete(replyId: String, commentId: String, reultShortVideoBlock: @escaping resultShortVideoBlock) {
415 472 let param = NSMutableDictionary()
416 473 param.setValue(commentId, forKey: "commentId")
417   - param.setValue(APPId, forKey: "appId")
  474 + param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
418 475 param.setValue(replyId, forKey: "replyId")
419 476 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
420 477 let custom_param = NSMutableDictionary()
421   - custom_param.setValue(APPId, forKey: "appId")
422   - custom_param.setValue(APPKey, forKey: "appKey")
  478 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId, forKey: "appId")
  479 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey, forKey: "appKey")
423 480 CNLiveNetworking.setAllowRequestDefaultArgument(true)
424 481 CNLiveNetworking.setupShowDataResult(false)
425 482 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
... ... @@ -446,4 +503,52 @@ class CNLiveShortVideoViewModel: NSObject {
446 503 }
447 504 }
448 505  
  506 +
  507 + /// 对回复和评论进行点赞
  508 + /// - Parameters:
  509 + /// - contentId: 内容 id
  510 + /// - support: 是否点赞 0 取消 1点赞
  511 + /// - isComment: 是不是对评论进行点赞
  512 + /// - reultShortVideoBlock: 返回
  513 + static func requestCommentWithLike(contentId: String, support: Bool,isComment: Bool,reultShortVideoBlock: @escaping resultShortVideoBlock) {
  514 + let param = NSMutableDictionary()
  515 + if isComment {
  516 + param.setValue("ugc_hd_comment:\(contentId)", forKey: "id")
  517 + } else {
  518 + param.setValue("ugc_hd_reply:\(contentId)", forKey: "id")
  519 + }
  520 + param.setValue(support ? "0":"1", forKey: "support")
  521 + param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId")
  522 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
  523 + param.setValue("i", forKey: "plat")
  524 + let custom_param = NSMutableDictionary()
  525 + custom_param.setValue(CNLiveEnvironmentManager.shared.appId_wjj, forKey: "appId")
  526 + custom_param.setValue(CNLiveEnvironmentManager.shared.appKey_wjj, forKey: "appKey")
  527 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  528 + CNLiveNetworking.setupShowDataResult(false)
  529 + CNLiveNetworking.setupShowResult(true)
  530 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
  531 + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseTokenUrl+"/support/supportBySpId/insert", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  532 + hiddenLoading()
  533 + if (error == nil) {
  534 + let resp = result as! NSDictionary
  535 + let errorCode = "\(resp["errorCode"] ?? "0")"
  536 + if (errorCode == "0") {
  537 + reultShortVideoBlock(support ? "取消点赞成功" : "点赞成功", .success)
  538 + } else {
  539 + showMessage(message: resp["errorMessage"] as! String)
  540 + reultShortVideoBlock(NSNull(),.failed)
  541 + }
  542 + } else {
  543 + if CNLiveNetworking.isNetworking() {
  544 + showMessage(message: "请求失败")
  545 + reultShortVideoBlock(NSNull(),.failed)
  546 + } else {
  547 + showMessage(message: "似乎与网络断开链接")
  548 + reultShortVideoBlock(NSNull(),.noNetwork)
  549 + }
  550 + }
  551 + }
  552 + }
  553 +
449 554 }
... ...
metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_nomal.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_comment_zan_nomal@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_comment_zan_nomal@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_nomal.imageset/short_comment_zan_nomal@2x.png 0 → 100644

1.42 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_nomal.imageset/short_comment_zan_nomal@3x.png 0 → 100644

2.64 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_select.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_comment_zan_select@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_comment_zan_select@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_select.imageset/short_comment_zan_select@2x.png 0 → 100644

1.39 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_comment_zan_select.imageset/short_comment_zan_select@3x.png 0 → 100644

2.52 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_close.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_comment_close@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_comment_close@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_close.imageset/short_video_comment_close@2x.png 0 → 100644

572 Bytes

metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_close.imageset/short_video_comment_close@3x.png 0 → 100644

1.03 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_empty.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_comment_empty@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_comment_empty@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_empty.imageset/short_video_comment_empty@2x.png 0 → 100644

21.9 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_empty.imageset/short_video_comment_empty@3x.png 0 → 100644

48.1 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_ower.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "short_video_comment_ower@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "short_video_comment_ower@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_ower.imageset/short_video_comment_ower@2x.png 0 → 100644

1.44 KB

metaCode/Supporting Files/Assets.xcassets/Video/short_video_comment_ower.imageset/short_video_comment_ower@3x.png 0 → 100644

2.52 KB