Commit 41ae675a9023d77a53ad35df1fe3578161246355
Merge branch 'master' of http://bj.gitlab.cnlive.com/ios-team/CNLiveMateCode
Showing
11 changed files
with
392 additions
and
53 deletions
metaCode/Classes/Environment/CNLiveEnvironment.swift
| ... | ... | @@ -11,6 +11,10 @@ import Foundation |
| 11 | 11 | let APPId: String = CNLiveEnvironmentManager.shared.appId |
| 12 | 12 | ///当前应用的APPKey |
| 13 | 13 | let APPKey: String = CNLiveEnvironmentManager.shared.appKey |
| 14 | +///网家家应用的APPID | |
| 15 | +let APPId_wjj: String = CNLiveEnvironmentManager.shared.appId_wjj | |
| 16 | +///网家家应用的APPKey | |
| 17 | +let APPKey_wjj: String = CNLiveEnvironmentManager.shared.appKey_wjj | |
| 14 | 18 | ///当前应用的登录请求域名 |
| 15 | 19 | let APPLoginHost: String! = CNLiveEnvironmentManager.shared.loginHost |
| 16 | 20 | ///当前应用的Secret |
| ... | ... | @@ -19,6 +23,8 @@ let APPSecret: String = CNLiveEnvironmentManager.shared.appSecret |
| 19 | 23 | let APPBaseMCUrl: String = CNLiveEnvironmentManager.shared.base_mc_url |
| 20 | 24 | /// 网家家内接口 |
| 21 | 25 | let APPBaseWjjUrl: String = CNLiveEnvironmentManager.shared.base_wjj_url |
| 26 | +/// 网家家内电商接口 | |
| 27 | +let APPBaseWjjShopUrl: String = CNLiveEnvironmentManager.shared.base_mjj_shop_url | |
| 22 | 28 | |
| 23 | 29 | ///当前APP的环境 |
| 24 | 30 | let APPCurrentEnvironment: CNLiveEnvironment = CNLiveEnvironmentManager.shared.currentEnvironment |
| ... | ... | @@ -48,6 +54,8 @@ class CNLiveEnvironmentManager: NSObject{ |
| 48 | 54 | |
| 49 | 55 | var appId: String |
| 50 | 56 | var appKey: String |
| 57 | + var appId_wjj: String | |
| 58 | + var appKey_wjj: String | |
| 51 | 59 | var appSecret: String |
| 52 | 60 | ///登录接口域名 |
| 53 | 61 | var loginHost: String |
| ... | ... | @@ -57,6 +65,8 @@ class CNLiveEnvironmentManager: NSObject{ |
| 57 | 65 | var base_wjj_url: String |
| 58 | 66 | /// 获取IM token 请求域名 |
| 59 | 67 | var img_token_url: String |
| 68 | + /// 网家家电商域名请求 | |
| 69 | + var base_mjj_shop_url: String | |
| 60 | 70 | |
| 61 | 71 | ///当前环境 |
| 62 | 72 | var currentEnvironment: CNLiveEnvironment |
| ... | ... | @@ -65,11 +75,14 @@ class CNLiveEnvironmentManager: NSObject{ |
| 65 | 75 | private override init() { |
| 66 | 76 | self.appId = "" |
| 67 | 77 | self.appKey = "" |
| 78 | + self.appId_wjj = "" | |
| 79 | + self.appKey_wjj = "" | |
| 68 | 80 | self.loginHost = "" |
| 69 | 81 | self.appSecret = "" |
| 70 | 82 | self.base_mc_url = "" |
| 71 | 83 | self.img_token_url = "" |
| 72 | 84 | self.base_wjj_url = "" |
| 85 | + self.base_mjj_shop_url = "" | |
| 73 | 86 | self.currentEnvironment = .development |
| 74 | 87 | } |
| 75 | 88 | //重新copy 和 mutableCopy 方法 |
| ... | ... | @@ -100,31 +113,40 @@ class CNLiveEnvironmentManager: NSObject{ |
| 100 | 113 | func developmentEnvironment(){ |
| 101 | 114 | self.appId = "802_li40qhp922" |
| 102 | 115 | self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac" |
| 116 | + self.appId_wjj = "769_jetj7bq525" | |
| 117 | + self.appKey_wjj = "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d" | |
| 103 | 118 | self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9" |
| 104 | 119 | self.loginHost = "https://api.cnlive.com" |
| 105 | 120 | self.img_token_url = "https://api.cnlive.com/open/api2" |
| 106 | 121 | self.base_mc_url = "https://metacode.cnlive.com/api" |
| 107 | 122 | self.base_wjj_url = "https://apiwjj.cnlive.com" |
| 123 | + self.base_mjj_shop_url = "https://manageshop.cnlive.com" | |
| 108 | 124 | } |
| 109 | 125 | //testFlight 环境配置 |
| 110 | 126 | func testFlightEnvironment(){ |
| 111 | 127 | self.appId = "802_li40qhp922" |
| 112 | 128 | self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac" |
| 129 | + self.appId_wjj = "769_jetj7bq525" | |
| 130 | + self.appKey_wjj = "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d" | |
| 113 | 131 | self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9" |
| 114 | 132 | self.loginHost = "https://api.cnlive.com" |
| 115 | 133 | self.img_token_url = "https://api.cnlive.com/open/api2" |
| 116 | 134 | self.base_mc_url = "https://metacode.cnlive.com/api" |
| 117 | 135 | self.base_wjj_url = "https://apiwjj.cnlive.com" |
| 136 | + self.base_mjj_shop_url = "https://manageshop.cnlive.com" | |
| 118 | 137 | } |
| 119 | 138 | //production 生产环境配置 |
| 120 | 139 | func productionEnvironment(){ |
| 121 | 140 | self.appId = "769_li40lrkt53" |
| 122 | 141 | self.appKey = "064f392f84dfe7bbe9f1eabeda53ea02044213019b0406" |
| 142 | + self.appId_wjj = "769_jetj7bq525" | |
| 143 | + self.appKey_wjj = "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d" | |
| 123 | 144 | self.appSecret = "68b5cc42fbdb466d56c2e22b00b1494feec8149f9dd32e" |
| 124 | 145 | self.loginHost = "https://api.cnlive.com" |
| 125 | 146 | self.img_token_url = "https://api.cnlive.com/open/api2" |
| 126 | 147 | self.base_mc_url = "https://metacode.cnlive.com/api" |
| 127 | 148 | self.base_wjj_url = "https://apiwjj.cnlive.com" |
| 149 | + self.base_mjj_shop_url = "https://manageshop.cnlive.com" | |
| 128 | 150 | } |
| 129 | 151 | |
| 130 | 152 | } | ... | ... |
metaCode/Classes/Extensions/NSObject+CNLiveExtensions.swift
| ... | ... | @@ -138,7 +138,7 @@ func jsonToModel(_ jsonStr:String,_ modelType:HandyJSON.Type) -> BaseModel { |
| 138 | 138 | /** |
| 139 | 139 | * Json转数组对象 |
| 140 | 140 | */ |
| 141 | -func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) ->[BaseModel] { | |
| 141 | +func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type,_ path: String) ->[BaseModel] { | |
| 142 | 142 | if jsonArrayStr == "" || jsonArrayStr.count == 0 { |
| 143 | 143 | #if DEBUG |
| 144 | 144 | print("jsonToModelArray:字符串为空") |
| ... | ... | @@ -149,7 +149,7 @@ func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) ->[Base |
| 149 | 149 | let data = jsonArrayStr.data(using: String.Encoding.utf8) |
| 150 | 150 | let peoplesArray = try! JSONSerialization.jsonObject(with:data!, options: JSONSerialization.ReadingOptions()) as? [AnyObject] |
| 151 | 151 | for people in peoplesArray! { |
| 152 | - modelArray.append(dictionaryToModel(people as! [String : Any], modelType,"")) | |
| 152 | + modelArray.append(dictionaryToModel(people as! [String : Any], modelType,path)) | |
| 153 | 153 | } |
| 154 | 154 | return modelArray |
| 155 | 155 | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
| ... | ... | @@ -121,6 +121,8 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel |
| 121 | 121 | self!.tableView.reloadData() |
| 122 | 122 | self!.tableView.mj_header?.endRefreshing() |
| 123 | 123 | self!.tableView.mj_footer?.endRefreshing() |
| 124 | + }else{ | |
| 125 | + | |
| 124 | 126 | } |
| 125 | 127 | if listBaseModel.total == listBaseModel.pageNum { |
| 126 | 128 | self!.tableView.mj_footer?.endRefreshing() | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineEarnListViewController.swift
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | 9 | import JXPagingView |
| 10 | +import MJRefresh | |
| 10 | 11 | |
| 11 | 12 | enum MineEarnShowType { |
| 12 | 13 | case record //积分记录 |
| ... | ... | @@ -35,26 +36,69 @@ class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewLi |
| 35 | 36 | return tableView |
| 36 | 37 | }() |
| 37 | 38 | |
| 39 | + lazy var dataArray: NSMutableArray = { | |
| 40 | + let dataArray = NSMutableArray() | |
| 41 | + return dataArray | |
| 42 | + }() | |
| 43 | + | |
| 44 | + var pageNum: NSInteger! | |
| 38 | 45 | var _callBack: CallBack! |
| 39 | 46 | var _show_type : MineEarnShowType! |
| 40 | 47 | init(show_type: MineEarnShowType) { |
| 48 | + pageNum = 1 | |
| 41 | 49 | super.init(nibName: nil, bundle: nil) |
| 42 | 50 | _show_type = show_type |
| 43 | 51 | } |
| 44 | 52 | |
| 53 | + func loadDataWithTradRecord(page: NSInteger) { | |
| 54 | + | |
| 55 | + if _show_type == .balance { | |
| 56 | + CNLiveMineViewModel.requestWithTradRecord(page: page) {result, respStatue in | |
| 57 | + if respStatue == .success { | |
| 58 | + self.dataArray.removeAllObjects() | |
| 59 | + self.dataArray.addObjects(from: result as! [MineTradingRecordModel]) | |
| 60 | + self.tableView.reloadData() | |
| 61 | + self.tableView.mj_header?.endRefreshing() | |
| 62 | + self.tableView.mj_footer?.endRefreshing() | |
| 63 | + } | |
| 64 | + } | |
| 65 | + } | |
| 66 | + if _show_type == .record { | |
| 67 | + CNLiveMineViewModel.requestWithIntegralRecord(page: page) { result, respStatue in | |
| 68 | + if respStatue == .success { | |
| 69 | + self.dataArray.removeAllObjects() | |
| 70 | + self.dataArray.addObjects(from: (result as! MineIntegralRecordModel).integralList) | |
| 71 | + self.tableView.reloadData() | |
| 72 | + self.tableView.mj_header?.endRefreshing() | |
| 73 | + self.tableView.mj_footer?.endRefreshing() | |
| 74 | + } | |
| 75 | + } | |
| 76 | + } | |
| 77 | + } | |
| 78 | + | |
| 45 | 79 | required init?(coder: NSCoder) { |
| 46 | 80 | fatalError("init(coder:) has not been implemented") |
| 47 | 81 | } |
| 48 | 82 | |
| 49 | 83 | override func viewDidLoad() { |
| 50 | 84 | super.viewDidLoad() |
| 51 | - | |
| 85 | + | |
| 86 | + loadDataWithTradRecord(page: self.pageNum) | |
| 52 | 87 | view.addSubview(tableView) |
| 53 | 88 | tableView.snp.makeConstraints { make in |
| 54 | 89 | make.top.bottom.equalToSuperview() |
| 55 | 90 | make.left.equalToSuperview().offset(20) |
| 56 | 91 | make.right.equalToSuperview().offset(-20) |
| 57 | 92 | } |
| 93 | + | |
| 94 | + addRefreshView() | |
| 95 | + } | |
| 96 | + | |
| 97 | + private func addRefreshView() { | |
| 98 | + tableView.mj_footer = MJRefreshFooter.init(refreshingBlock: {[weak self] in | |
| 99 | + self!.pageNum += 1 | |
| 100 | + self!.loadDataWithTradRecord(page: self!.pageNum) | |
| 101 | + }) | |
| 58 | 102 | } |
| 59 | 103 | } |
| 60 | 104 | extension CNLiveMineEarnListViewController { |
| ... | ... | @@ -64,14 +108,20 @@ extension CNLiveMineEarnListViewController { |
| 64 | 108 | } |
| 65 | 109 | |
| 66 | 110 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| 67 | - return 6 | |
| 111 | + return dataArray.count | |
| 68 | 112 | } |
| 69 | 113 | |
| 70 | 114 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 71 | 115 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kMIneBodyFiveViewCellIdentifier) as? MIneBodyFiveViewCell else { |
| 72 | 116 | return MIneBodyFiveViewCell() |
| 73 | 117 | } |
| 74 | - cell.setupWithDataSource(isLast: indexPath.row == 5) | |
| 118 | + if _show_type == .balance { | |
| 119 | + cell.setupWithBalanceDataSource(isLast: indexPath.row == dataArray.count - 1,dataModel: dataArray[indexPath.row] as! MineTradingRecordModel) | |
| 120 | + } | |
| 121 | + if _show_type == .record { | |
| 122 | + cell.setupWithRecordDataSource(isLast: indexPath.row == dataArray.count - 1,dataModel: dataArray[indexPath.row] as! MineIntegralRecordDescModel) | |
| 123 | + } | |
| 124 | + | |
| 75 | 125 | return cell |
| 76 | 126 | } |
| 77 | 127 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineEarnViewController.swift
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | import Foundation |
| 9 | 9 | import JXSegmentedView |
| 10 | 10 | import JXPagingView |
| 11 | +import MJRefresh | |
| 11 | 12 | |
| 12 | 13 | let kCNLiveSectionTitleHeight = 70//标题显示 |
| 13 | 14 | let kCNLiveSectionHeaderHeight = 200//头视图高度 |
| ... | ... | @@ -99,15 +100,17 @@ class CNLiveMineEarnViewController: CNLiveBaseViewController, JXPagingViewDelega |
| 99 | 100 | }() |
| 100 | 101 | |
| 101 | 102 | lazy var headerView: MineEarnHeaderView = { |
| 102 | - let headerView = MineEarnHeaderView.init(frame: CGRectMake(0, 0, KSreenWidth, CGFloat(kCNLiveSectionHeaderHeight))) | |
| 103 | + let headerView = MineEarnHeaderView.init(frame: CGRectMake(0, 0, KSreenWidth, CGFloat(kCNLiveSectionHeaderHeight)), checkModel: _checkModel) | |
| 103 | 104 | headerView.backgroundColor = .clear |
| 104 | 105 | return headerView |
| 105 | 106 | }() |
| 106 | 107 | |
| 107 | 108 | var _index : Int! |
| 108 | - init(index: Int) { | |
| 109 | + var _checkModel: MinePointCheckInModel! | |
| 110 | + init(index: Int, checkModel:MinePointCheckInModel) { | |
| 109 | 111 | super.init(nibName: nil, bundle: nil) |
| 110 | 112 | _index = index |
| 113 | + _checkModel = checkModel | |
| 111 | 114 | } |
| 112 | 115 | |
| 113 | 116 | required init?(coder: NSCoder) { |
| ... | ... | @@ -126,6 +129,12 @@ class CNLiveMineEarnViewController: CNLiveBaseViewController, JXPagingViewDelega |
| 126 | 129 | |
| 127 | 130 | view.addSubview(pagingView) |
| 128 | 131 | pagingView.listContainerView.didClickSelectedItem(at: _index) |
| 132 | + | |
| 133 | + pagingView.mainTableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: { [self] in | |
| 134 | + pagingView.mainTableView.mj_header?.endRefreshing() | |
| 135 | +// self!.pageNum = 1 | |
| 136 | +// self!.loadDataWithTradRecord(page: self!.pageNum) | |
| 137 | + }) | |
| 129 | 138 | } |
| 130 | 139 | } |
| 131 | 140 | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineQuestViewController.swift
| ... | ... | @@ -17,7 +17,8 @@ class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelega |
| 17 | 17 | tableView.backgroundColor = .clear |
| 18 | 18 | tableView.separatorStyle = .none |
| 19 | 19 | tableView.register(MineBodyFourViewCell.self, forCellReuseIdentifier: kMineBodyFourViewCellIdentifier) |
| 20 | - tableView.tableHeaderView = MineQuestHeaderView.init(frame: CGRectMake(0, 10, KSreenWidth, 150)) | |
| 20 | + let headerView = MineQuestHeaderView.init(frame: CGRectMake(0, 10, KSreenWidth, 150), checkModel: _checkModel) | |
| 21 | + tableView.tableHeaderView = headerView | |
| 21 | 22 | let footerView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth - 40, height: 10)) |
| 22 | 23 | footerView.clipsToBounds = true |
| 23 | 24 | footerView.backgroundColor = .white |
| ... | ... | @@ -56,19 +57,26 @@ class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelega |
| 56 | 57 | |
| 57 | 58 | lazy var dataArray: NSMutableArray = { |
| 58 | 59 | let dataArray = NSMutableArray.init() |
| 59 | - dataArray.add(["icon":"temp_quest_list_img01","name":"分享目击者视频","desc":"积分值+100 完成0/10"]) | |
| 60 | - dataArray.add(["icon":"temp_quest_list_img02","name":"分享目击者视频","desc":"积分值+100 完成0/10"]) | |
| 61 | - dataArray.add(["icon":"temp_quest_list_img03","name":"分享目击者视频","desc":"积分值+100 完成0/10"]) | |
| 62 | - dataArray.add(["icon":"temp_quest_list_img04","name":"分享目击者视频","desc":"积分值+100 完成0/10"]) | |
| 63 | 60 | return dataArray |
| 64 | 61 | }() |
| 65 | 62 | |
| 63 | + var _checkModel: MinePointCheckInModel! | |
| 64 | + init(checkModel:MinePointCheckInModel) { | |
| 65 | + super.init(nibName:nil, bundle:nil) | |
| 66 | + _checkModel = checkModel | |
| 67 | + } | |
| 68 | + | |
| 69 | + | |
| 70 | + required init?(coder: NSCoder) { | |
| 71 | + fatalError("init(coder:) has not been implemented") | |
| 72 | + } | |
| 66 | 73 | |
| 67 | 74 | override func viewDidLoad() { |
| 68 | 75 | super.viewDidLoad() |
| 69 | 76 | navigationBarHidden = false |
| 70 | 77 | titleName = "任务中心" |
| 71 | 78 | |
| 79 | + loadDataWithTaskList() | |
| 72 | 80 | view.addSubview(tableView) |
| 73 | 81 | tableView.snp.makeConstraints { make in |
| 74 | 82 | make.top.equalToSuperview().offset(KNavigationHeight) |
| ... | ... | @@ -78,6 +86,14 @@ class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelega |
| 78 | 86 | } |
| 79 | 87 | } |
| 80 | 88 | |
| 89 | + func loadDataWithTaskList() { | |
| 90 | + CNLiveMineViewModel.requestWithTaskList { result, respStatue in | |
| 91 | + if respStatue == .success { | |
| 92 | + self.dataArray.addObjects(from: result as! [MineTaskCheckListModel]) | |
| 93 | + self.tableView.reloadData() | |
| 94 | + } | |
| 95 | + } | |
| 96 | + } | |
| 81 | 97 | } |
| 82 | 98 | |
| 83 | 99 | extension CNLiveMineQuestViewController { |
| ... | ... | @@ -91,7 +107,7 @@ extension CNLiveMineQuestViewController { |
| 91 | 107 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kMineBodyFourViewCellIdentifier) as? MineBodyFourViewCell else { |
| 92 | 108 | return MineBodyFourViewCell() |
| 93 | 109 | } |
| 94 | - cell.setupWithData(dict: dataArray[indexPath.row] as! NSDictionary) | |
| 110 | + cell.setupWithData(listModel: dataArray[indexPath.row] as! MineTaskCheckListModel) | |
| 95 | 111 | return cell |
| 96 | 112 | } |
| 97 | 113 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
| ... | ... | @@ -52,6 +52,7 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, |
| 52 | 52 | return headerView |
| 53 | 53 | }() |
| 54 | 54 | |
| 55 | + var checkModel: MinePointCheckInModel! | |
| 55 | 56 | override func viewDidLoad() { |
| 56 | 57 | super.viewDidLoad() |
| 57 | 58 | view.backgroundColor = HexColor("#f9f9f9") |
| ... | ... | @@ -71,8 +72,10 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, |
| 71 | 72 | |
| 72 | 73 | public func loadDataWithPoint() { |
| 73 | 74 | CNLiveMineViewModel.requestWithCheckIn { [weak self] result, respStatue in |
| 74 | - print("\(result)") | |
| 75 | -// if respStatue == .succ | |
| 75 | + if respStatue == .success { | |
| 76 | + self?.checkModel = result as? MinePointCheckInModel | |
| 77 | + self?.tableView.reloadData() | |
| 78 | + } | |
| 76 | 79 | } |
| 77 | 80 | } |
| 78 | 81 | |
| ... | ... | @@ -105,7 +108,7 @@ extension CNLiveMineViewController { |
| 105 | 108 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 106 | 109 | if indexPath.section == 0 { |
| 107 | 110 | let cell = tableView.dequeueReusableCell(withIdentifier: kMineBodyThreeViewCellIdentifier) as! MineBodyThreeViewCell |
| 108 | - | |
| 111 | + cell.checkModel = self.checkModel | |
| 109 | 112 | return cell |
| 110 | 113 | } |
| 111 | 114 | if indexPath.section == 1 { |
| ... | ... | @@ -133,7 +136,7 @@ extension CNLiveMineViewController { |
| 133 | 136 | |
| 134 | 137 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 135 | 138 | if indexPath.section == 0 { |
| 136 | - self.navigationController?.pushViewController(CNLiveMineQuestViewController.init(), animated: true) | |
| 139 | + self.navigationController?.pushViewController(CNLiveMineQuestViewController.init(checkModel: checkModel), animated: true) | |
| 137 | 140 | } |
| 138 | 141 | if indexPath.section == 1 { |
| 139 | 142 | self.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(show_type: .info), animated: true) | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | // |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | - | |
| 9 | +import Kingfisher | |
| 10 | 10 | |
| 11 | 11 | class MineBodyOneListViewCell : UITableViewCell { |
| 12 | 12 | |
| ... | ... | @@ -351,7 +351,7 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 351 | 351 | |
| 352 | 352 | lazy var balanceNumberLabel: UILabel = { |
| 353 | 353 | let balanceNumberLabel = UILabel.init() |
| 354 | - balanceNumberLabel.text = "2130" | |
| 354 | + balanceNumberLabel.text = "0" | |
| 355 | 355 | balanceNumberLabel.font = BoldFont_19_Fit |
| 356 | 356 | balanceNumberLabel.textAlignment = .left |
| 357 | 357 | balanceNumberLabel.textColor = HexColor("#FFE4C4") |
| ... | ... | @@ -369,13 +369,25 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 369 | 369 | |
| 370 | 370 | lazy var pointNumberLabel: UILabel = { |
| 371 | 371 | let pointNumberLabel = UILabel.init() |
| 372 | - pointNumberLabel.text = "10.28W" | |
| 373 | 372 | pointNumberLabel.font = BoldFont_19_Fit |
| 373 | + pointNumberLabel.text = "0" | |
| 374 | 374 | pointNumberLabel.textAlignment = .left |
| 375 | 375 | pointNumberLabel.textColor = HexColor("#FFE4C4") |
| 376 | 376 | return pointNumberLabel |
| 377 | 377 | }() |
| 378 | 378 | |
| 379 | + var _checkModel : MinePointCheckInModel? | |
| 380 | + var checkModel : MinePointCheckInModel? { | |
| 381 | + get{ | |
| 382 | + return _checkModel | |
| 383 | + } | |
| 384 | + set{ | |
| 385 | + _checkModel = newValue | |
| 386 | + balanceNumberLabel.text = newValue?.money | |
| 387 | + pointNumberLabel.text = newValue?.integral | |
| 388 | + } | |
| 389 | + } | |
| 390 | + | |
| 379 | 391 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { |
| 380 | 392 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 381 | 393 | self.selectionStyle = .none |
| ... | ... | @@ -494,13 +506,13 @@ class MineBodyFourViewCell: UITableViewCell { |
| 494 | 506 | lazy var shareBtn: UIButton = { |
| 495 | 507 | let shareBtn = UIButton.init(type: .custom) |
| 496 | 508 | shareBtn.frame = CGRect(x: 0, y: 0, width: 70, height: 30) |
| 497 | - shareBtn.setTitle("去分享", for: .normal) | |
| 498 | - shareBtn.setImage(UIImage(named: "mine_list_icon_right_white_more"), for: .normal) | |
| 499 | 509 | shareBtn.setTitleColor(.white, for: .normal) |
| 500 | 510 | shareBtn.titleLabel?.font = Font_12 |
| 501 | - shareBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right) | |
| 502 | 511 | shareBtn.layer.cornerRadius = 15 |
| 503 | 512 | shareBtn.layer.masksToBounds = true |
| 513 | + shareBtn.setTitle("去完成", for: .normal) | |
| 514 | + shareBtn.setImage(UIImage(named: "mine_list_icon_right_white_more"), for: .normal) | |
| 515 | + shareBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right) | |
| 504 | 516 | return shareBtn |
| 505 | 517 | }() |
| 506 | 518 | |
| ... | ... | @@ -545,10 +557,14 @@ class MineBodyFourViewCell: UITableViewCell { |
| 545 | 557 | |
| 546 | 558 | } |
| 547 | 559 | |
| 548 | - func setupWithData(dict: NSDictionary) { | |
| 549 | - iconView.image = UIImage(named: "\(dict.object(forKey: "icon") ?? "")") | |
| 550 | - nameLabel.text = "\(dict.object(forKey: "name") ?? "")" | |
| 551 | - descLabel.text = "\(dict.object(forKey: "desc") ?? "")" | |
| 560 | + func setupWithData(listModel: MineTaskCheckListModel) { | |
| 561 | + | |
| 562 | + iconView.kf.setImage(with: URL(string: listModel.icon ?? "") , placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSizeMake(50, 50))) | |
| 563 | + nameLabel.text = listModel.title ?? "" | |
| 564 | + descLabel.text = "积分值+\(listModel.score ?? "")" | |
| 565 | + if listModel.taskId!.contains("check_in") { | |
| 566 | + shareBtn.setTitle("去签到", for: .normal) | |
| 567 | + } | |
| 552 | 568 | } |
| 553 | 569 | |
| 554 | 570 | required init?(coder: NSCoder) { |
| ... | ... | @@ -567,7 +583,6 @@ class MIneBodyFiveViewCell: UITableViewCell { |
| 567 | 583 | |
| 568 | 584 | lazy var nameLabel: UILabel = { |
| 569 | 585 | let nameLabel = UILabel.init() |
| 570 | - nameLabel.text = "签到" | |
| 571 | 586 | nameLabel.textColor = HexColor("#666666") |
| 572 | 587 | nameLabel.font = Font_16 |
| 573 | 588 | nameLabel.backgroundColor = .white |
| ... | ... | @@ -576,7 +591,6 @@ class MIneBodyFiveViewCell: UITableViewCell { |
| 576 | 591 | |
| 577 | 592 | lazy var descLabel: UILabel = { |
| 578 | 593 | let descLabel = UILabel.init() |
| 579 | - descLabel.text = "2013-01-23" | |
| 580 | 594 | descLabel.textColor = HexColor("#999999") |
| 581 | 595 | descLabel.font = Font_12 |
| 582 | 596 | descLabel.backgroundColor = .clear |
| ... | ... | @@ -585,7 +599,6 @@ class MIneBodyFiveViewCell: UITableViewCell { |
| 585 | 599 | |
| 586 | 600 | lazy var pointLabel: UILabel = { |
| 587 | 601 | let pointLabel = UILabel.init() |
| 588 | - pointLabel.text = "+1000 积分" | |
| 589 | 602 | pointLabel.textColor = HexColor("#F5A623") |
| 590 | 603 | pointLabel.font = BoldFont_16_Fit |
| 591 | 604 | pointLabel.backgroundColor = .clear |
| ... | ... | @@ -635,8 +648,26 @@ class MIneBodyFiveViewCell: UITableViewCell { |
| 635 | 648 | } |
| 636 | 649 | } |
| 637 | 650 | |
| 638 | - func setupWithDataSource(isLast: Bool) { | |
| 651 | + func setupWithBalanceDataSource(isLast: Bool, dataModel: MineTradingRecordModel) { | |
| 652 | + line_label.isHidden = isLast | |
| 653 | + nameLabel.text = dataModel.iconBean.nickName | |
| 654 | + descLabel.text = dataModel.time | |
| 655 | + | |
| 656 | + if dataModel.sum!.contains("-") { | |
| 657 | + pointLabel.text = "+\(dataModel.sum!)元" | |
| 658 | + } | |
| 659 | + if dataModel.sourceType!.contains("wjj_balance_transfer_refund") { | |
| 660 | + pointLabel.text = "+\(dataModel.sum!)元" | |
| 661 | + }else{ | |
| 662 | + pointLabel.text = "\(dataModel.sum ?? "")元" | |
| 663 | + } | |
| 664 | + } | |
| 665 | + | |
| 666 | + func setupWithRecordDataSource(isLast: Bool, dataModel: MineIntegralRecordDescModel) { | |
| 639 | 667 | line_label.isHidden = isLast |
| 668 | + nameLabel.text = dataModel.integralDesc | |
| 669 | + descLabel.text = dataModel.exchangeTime | |
| 670 | + pointLabel.text = "\(dataModel.integral ?? "")积分" | |
| 640 | 671 | } |
| 641 | 672 | |
| 642 | 673 | required init?(coder: NSCoder) { | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
| ... | ... | @@ -310,13 +310,17 @@ class MineQuestHeaderView: UIView { |
| 310 | 310 | pointBtn.backgroundColor = .clear |
| 311 | 311 | pointBtn.setTitle("积分收益", for: .normal) |
| 312 | 312 | pointBtn.setTitleColor(.white, for: .normal) |
| 313 | - pointBtn.setImage(UIImage(named: "mine_list_icon_right_white_more"), for: .normal) | |
| 314 | 313 | pointBtn.titleLabel?.font = Font_15 |
| 315 | 314 | pointBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right) |
| 316 | 315 | pointBtn.addTarget(self, action: #selector(pushEarnRecordAction), for: .touchUpInside) |
| 317 | 316 | return pointBtn |
| 318 | 317 | }() |
| 319 | 318 | |
| 319 | +// lazy var pointView: UIImageView = { | |
| 320 | +// | |
| 321 | +// return <#value#> | |
| 322 | +// }() | |
| 323 | + | |
| 320 | 324 | lazy var balanceBtn: UIButton = { |
| 321 | 325 | let balanceBtn = UIButton(type: .custom) |
| 322 | 326 | balanceBtn.size = CGSize(width: 102, height: 20) |
| ... | ... | @@ -332,7 +336,7 @@ class MineQuestHeaderView: UIView { |
| 332 | 336 | |
| 333 | 337 | lazy var pointLabel: UILabel = { |
| 334 | 338 | let pointLabel = UILabel.init() |
| 335 | - pointLabel.text = "10.28W" | |
| 339 | + pointLabel.text = "0" | |
| 336 | 340 | pointLabel.textColor = .white |
| 337 | 341 | pointLabel.backgroundColor = .clear |
| 338 | 342 | pointLabel.font = BoldFont_25_Fit |
| ... | ... | @@ -341,7 +345,7 @@ class MineQuestHeaderView: UIView { |
| 341 | 345 | |
| 342 | 346 | lazy var balanceLabel: UILabel = { |
| 343 | 347 | let balanceLabel = UILabel.init() |
| 344 | - balanceLabel.text = "3.15" | |
| 348 | + balanceLabel.text = "0" | |
| 345 | 349 | balanceLabel.textColor = .white |
| 346 | 350 | balanceLabel.backgroundColor = .clear |
| 347 | 351 | balanceLabel.font = BoldFont_25_Fit |
| ... | ... | @@ -358,10 +362,12 @@ class MineQuestHeaderView: UIView { |
| 358 | 362 | return descBtn |
| 359 | 363 | }() |
| 360 | 364 | |
| 361 | - override init(frame: CGRect) { | |
| 365 | + var _checkModel: MinePointCheckInModel! | |
| 366 | + init(frame: CGRect, checkModel : MinePointCheckInModel) { | |
| 362 | 367 | super.init(frame: frame) |
| 363 | 368 | self.backgroundColor = .clear |
| 364 | 369 | |
| 370 | + _checkModel = checkModel | |
| 365 | 371 | addSubview(mainView) |
| 366 | 372 | mainView.addSubview(pointBtn) |
| 367 | 373 | mainView.addSubview(balanceBtn) |
| ... | ... | @@ -369,6 +375,9 @@ class MineQuestHeaderView: UIView { |
| 369 | 375 | mainView.addSubview(balanceLabel) |
| 370 | 376 | mainView.addSubview(descBtn) |
| 371 | 377 | |
| 378 | + balanceLabel.text = checkModel.money | |
| 379 | + pointLabel.text = checkModel.integral | |
| 380 | + | |
| 372 | 381 | setupConstraints() |
| 373 | 382 | } |
| 374 | 383 | |
| ... | ... | @@ -404,11 +413,11 @@ class MineQuestHeaderView: UIView { |
| 404 | 413 | } |
| 405 | 414 | |
| 406 | 415 | @objc func pushEarnRecordAction() { |
| 407 | - currentViewController()?.navigationController?.pushViewController(CNLiveMineEarnViewController.init(index: 1), animated: true) | |
| 416 | + currentViewController()?.navigationController?.pushViewController(CNLiveMineEarnViewController.init(index: 0, checkModel: _checkModel), animated: true) | |
| 408 | 417 | } |
| 409 | 418 | |
| 410 | 419 | @objc func pushEarnBalanceAction() { |
| 411 | - currentViewController()?.navigationController?.pushViewController(CNLiveMineEarnViewController.init(index: 0), animated: true) | |
| 420 | + currentViewController()?.navigationController?.pushViewController(CNLiveMineEarnViewController.init(index: 1, checkModel: _checkModel), animated: true) | |
| 412 | 421 | } |
| 413 | 422 | |
| 414 | 423 | required init?(coder: NSCoder) { |
| ... | ... | @@ -470,7 +479,7 @@ class MineEarnHeaderView: UIView { |
| 470 | 479 | lazy var left_Label: UILabel = { |
| 471 | 480 | let left_Label = UILabel.init() |
| 472 | 481 | left_Label.backgroundColor = .clear |
| 473 | - left_Label.text = "1024.28W" | |
| 482 | + left_Label.text = "0" | |
| 474 | 483 | left_Label.textColor = .white |
| 475 | 484 | left_Label.textAlignment = .left |
| 476 | 485 | left_Label.font = BoldFont_18_Fit |
| ... | ... | @@ -480,7 +489,7 @@ class MineEarnHeaderView: UIView { |
| 480 | 489 | lazy var right_Label: UILabel = { |
| 481 | 490 | let right_Label = UILabel.init() |
| 482 | 491 | right_Label.backgroundColor = .clear |
| 483 | - right_Label.text = "10.28" | |
| 492 | + right_Label.text = "0" | |
| 484 | 493 | right_Label.textColor = .white |
| 485 | 494 | right_Label.textAlignment = .left |
| 486 | 495 | right_Label.font = BoldFont_18_Fit |
| ... | ... | @@ -519,8 +528,8 @@ class MineEarnHeaderView: UIView { |
| 519 | 528 | return tipLabel |
| 520 | 529 | }() |
| 521 | 530 | |
| 522 | - | |
| 523 | - override init(frame: CGRect) { | |
| 531 | + var _checkModel: MinePointCheckInModel! | |
| 532 | + init(frame: CGRect, checkModel: MinePointCheckInModel) { | |
| 524 | 533 | super.init(frame: frame) |
| 525 | 534 | |
| 526 | 535 | addSubview(mainView) |
| ... | ... | @@ -536,6 +545,9 @@ class MineEarnHeaderView: UIView { |
| 536 | 545 | mainView.addSubview(tipView) |
| 537 | 546 | tipView.addSubview(tipLabel) |
| 538 | 547 | |
| 548 | + left_Label.text = checkModel.integral | |
| 549 | + right_Label.text = checkModel.money | |
| 550 | + | |
| 539 | 551 | setupConstraints() |
| 540 | 552 | } |
| 541 | 553 | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
| ... | ... | @@ -290,12 +290,74 @@ final class MineAuthListModel: BaseModel , TableCodable { |
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | -// !!!: /Daren/integral/checkIn.action 数据返回 | |
| 293 | +// !!!: /Api/Index3/myOrderCount 数据返回 | |
| 294 | 294 | class MinePointCheckInModel: BaseModel { |
| 295 | - var scores = [String]() | |
| 296 | - var status: String? = "" | |
| 295 | + | |
| 296 | + var pay_order_count: String? = ""//待支付 数量 | |
| 297 | + var send_order_count: String? = ""//待发货 数量 | |
| 298 | + var confirm_order_count: Int = 0 //待收货 数量 | |
| 299 | + var cart_count: String? = "" //购物车数量 数量 | |
| 300 | + var money: String? = ""//补贴余额 | |
| 301 | + var coupon_count: String? = ""//优惠券数量 | |
| 302 | + var integral: String? = ""//积分数量 | |
| 303 | +} | |
| 304 | +// !!!: /Daren/integral/getTasks.action任务列表界面数据 | |
| 305 | +class MineTaskCheckListModel: BaseModel { | |
| 306 | + var icon: String? = "" | |
| 297 | 307 | var score: String? = "" |
| 298 | - var times: String? = "" | |
| 308 | + var status: String? = "" | |
| 309 | + var taskId: String? = "" | |
| 310 | + var taskType: String? = "" | |
| 311 | + var times: Int = 0 | |
| 312 | + var title: String? = "" | |
| 313 | + var totalCount: String? = "" | |
| 299 | 314 | var url: String? = "" |
| 300 | 315 | } |
| 316 | +// !!!: /Daren/transaction/getTransactionRecord.action 余额交易记录 | |
| 317 | +class MineTradingRecordModel: BaseModel { | |
| 318 | + | |
| 319 | + var disburseRecord: String? = ""//支出 | |
| 320 | + var incomeRecord: String? = "" //收入 | |
| 321 | + var fromId: String? = "" | |
| 322 | + var payType: String? = "" | |
| 323 | + var recordId: String? = "" | |
| 324 | + var sourceId: String? = "" | |
| 325 | + var sourceType: String? = "" | |
| 326 | + var sum: String? = "" | |
| 327 | + var time: String? = "" | |
| 328 | + | |
| 329 | + /// wjj_balance_transfer 转账标识 | |
| 330 | + /// wjj_balance_transfer_refund 退款标识 | |
| 331 | + /// wjj_balance_transfer_collection 确认收款标识 | |
| 332 | + /// wjj_balance_transfer_overdue_refund 转账过期 | |
| 333 | + var finalType: String? = "" | |
| 334 | + | |
| 335 | + var iconBean = MineTradingRecordUserModel() | |
| 336 | + | |
| 337 | + var fromType: String? = "" //1:收入 2:支出 0:全部 | |
| 338 | + var toType: String? = "" // 0全部(默认) 1收入 2支出 | |
| 339 | + var defray: String? = "" //总支出 | |
| 340 | + var income: String? = "" //总收入 | |
| 341 | +} | |
| 342 | + | |
| 343 | +class MineTradingRecordUserModel: BaseModel { | |
| 344 | + var image: String? = "" | |
| 345 | + var nickName: String? = "" | |
| 346 | + var userId: String? = "" | |
| 347 | +} | |
| 348 | + | |
| 349 | +// !!!: /Daren/integral/myIntegralRecord.action 积分明细列表 | |
| 350 | +class MineIntegralRecordModel: BaseModel { | |
| 351 | + var obtainIntegral: Int = 0 | |
| 352 | + var hasNext: Bool = false | |
| 353 | + var payIntegral: Int = 0 | |
| 354 | + var integralList = [MineIntegralRecordDescModel]() | |
| 355 | +} | |
| 356 | + | |
| 357 | +class MineIntegralRecordDescModel: BaseModel { | |
| 358 | + var exchangeTime: String? = "" | |
| 359 | + var state: String? = "" | |
| 360 | + var integral: String? = "" | |
| 361 | + var integralDesc: String? = "" | |
| 362 | +} | |
| 301 | 363 | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -64,7 +64,6 @@ class CNLiveMineViewModel: NSObject { |
| 64 | 64 | } |
| 65 | 65 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") |
| 66 | 66 | param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token") |
| 67 | - print("给后台的数据是=>\(param)") | |
| 68 | 67 | showLoading(message: "") |
| 69 | 68 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 70 | 69 | CNLiveNetworking.setupShowDataResult(false) |
| ... | ... | @@ -254,7 +253,7 @@ class CNLiveMineViewModel: NSObject { |
| 254 | 253 | /// - resultBlock: 返回 |
| 255 | 254 | static func requestAuthStandList(page: NSInteger, resultBlock: @escaping resultNewsBlock) { |
| 256 | 255 | let param = NSMutableDictionary() |
| 257 | - param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")//10458139 UserInfoManager.shared.userInfo.uid | |
| 256 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | |
| 258 | 257 | param.setValue("10", forKey: "pageSize") |
| 259 | 258 | param.setValue("\(page)", forKey: "page") |
| 260 | 259 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| ... | ... | @@ -590,19 +589,24 @@ class CNLiveMineViewModel: NSObject { |
| 590 | 589 | /// - Parameter resultBlock: 返回 |
| 591 | 590 | static func requestWithCheckIn(resultBlock: @escaping resultNewsBlock) { |
| 592 | 591 | let param = NSMutableDictionary() |
| 593 | - param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | |
| 592 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") | |
| 593 | + let custom_param = NSMutableDictionary() | |
| 594 | + custom_param.setValue(APPId_wjj, forKey: "appId") | |
| 595 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | |
| 594 | 596 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 595 | 597 | CNLiveNetworking.setupShowDataResult(false) |
| 596 | - CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjUrl+"/Daren/integral/checkIn.action", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 598 | + CNLiveNetworking.setupDSRequest(true) | |
| 599 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 600 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjShopUrl+"/Api/Index3/myOrderCount", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 597 | 601 | hiddenLoading() |
| 598 | 602 | if (error == nil) { |
| 599 | 603 | let resp = result as! NSDictionary |
| 600 | - let errorCode = "\(resp["errorCode"] ?? "0")" | |
| 601 | - if (errorCode == "0") { | |
| 604 | + let errorCode = "\(resp["code"] ?? "0")" | |
| 605 | + if (errorCode == "200") { | |
| 602 | 606 | let listModel = dictionaryToModel(resp as! [String : Any], MinePointCheckInModel.self,"data") as! MinePointCheckInModel |
| 603 | 607 | resultBlock(listModel,.success) |
| 604 | 608 | } else { |
| 605 | - showMessage(message: resp["errorMessage"] as! String) | |
| 609 | + showMessage(message: resp["message"] as! String) | |
| 606 | 610 | resultBlock(NSNull(),.failed) |
| 607 | 611 | } |
| 608 | 612 | } else { |
| ... | ... | @@ -620,7 +624,135 @@ class CNLiveMineViewModel: NSObject { |
| 620 | 624 | /// 获取任务列表接口 |
| 621 | 625 | /// - Parameter resultBlock: 返回 |
| 622 | 626 | static func requestWithTaskList(resultBlock: @escaping resultNewsBlock) { |
| 623 | - | |
| 627 | + let param = NSMutableDictionary() | |
| 628 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | |
| 629 | + let custom_param = NSMutableDictionary() | |
| 630 | + custom_param.setValue(APPId_wjj, forKey: "appId") | |
| 631 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | |
| 632 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 633 | + CNLiveNetworking.setupShowDataResult(false) | |
| 634 | + CNLiveNetworking.setupSignRequestKey(APPKey_wjj) | |
| 635 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 636 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjUrl+"/Daren/integral/getTasks.action", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in | |
| 637 | + hiddenLoading() | |
| 638 | + if (error == nil) { | |
| 639 | + let resp = result as! NSDictionary | |
| 640 | + let errorCode = "\(resp["errorCode"] ?? "0")" | |
| 641 | + if (errorCode == "0") { | |
| 642 | + let dict = resp["data"] as! NSDictionary | |
| 643 | + let array = dict["dailyTask"] as! NSArray | |
| 644 | + let tempArray = NSMutableArray() | |
| 645 | + for item in array { | |
| 646 | + let listModel = dictionaryToModel(item as! [String : Any], MineTaskCheckListModel.self,"") as! MineTaskCheckListModel | |
| 647 | + if listModel.taskId!.contains("check_in") { | |
| 648 | + tempArray.add(listModel) | |
| 649 | + } | |
| 650 | + } | |
| 651 | + resultBlock(tempArray,.success) | |
| 652 | + } else { | |
| 653 | + showMessage(message: resp["errorMessage"] as! String) | |
| 654 | + resultBlock(NSNull(),.failed) | |
| 655 | + } | |
| 656 | + } else { | |
| 657 | + if CNLiveNetworking.isNetworking() { | |
| 658 | + showMessage(message: "获取失败") | |
| 659 | + resultBlock(NSNull(),.failed) | |
| 660 | + } else { | |
| 661 | + showMessage(message: "似乎与网络断开链接") | |
| 662 | + resultBlock(NSNull(),.noNetwork) | |
| 663 | + } | |
| 664 | + } | |
| 665 | + } | |
| 666 | + } | |
| 667 | + | |
| 668 | + /// 获取网家家余额数据 | |
| 669 | + /// - Parameters: | |
| 670 | + /// - page: 页数 | |
| 671 | + /// - resultBlock: 返回 | |
| 672 | + static func requestWithTradRecord(page: NSInteger, resultBlock: @escaping resultNewsBlock) { | |
| 673 | + let param = NSMutableDictionary() | |
| 674 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "targetId") | |
| 675 | + param.setValue("0", forKey: "type")//0全部(默认) 1收入 2支出 | |
| 676 | + param.setValue("10", forKey: "pageSize") | |
| 677 | + param.setValue("\(page)", forKey: "pageNo") | |
| 678 | + let custom_param = NSMutableDictionary() | |
| 679 | + custom_param.setValue(APPId_wjj, forKey: "appId") | |
| 680 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | |
| 681 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 682 | + CNLiveNetworking.setupShowDataResult(false) | |
| 683 | + CNLiveNetworking.setupSignRequestKey(APPKey_wjj) | |
| 684 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 685 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjUrl+"/Daren/transaction/getTransactionRecord.action", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in | |
| 686 | + hiddenLoading() | |
| 687 | + if (error == nil) { | |
| 688 | + let resp = result as! NSDictionary | |
| 689 | + let errorCode = "\(resp["errorCode"] ?? "0")" | |
| 690 | + if (errorCode == "0") { | |
| 691 | + let dict = resp["data"] as! NSDictionary | |
| 692 | + let array = dict["list"] as! NSArray | |
| 693 | + let tempArray = NSMutableArray() | |
| 694 | + for item in array { | |
| 695 | + let listModel = dictionaryToModel(item as! [String : Any], MineTradingRecordModel.self,"") as! MineTradingRecordModel | |
| 696 | + tempArray.add(listModel) | |
| 697 | + } | |
| 698 | + resultBlock(tempArray,.success) | |
| 699 | + } else { | |
| 700 | + showMessage(message: resp["errorMessage"] as! String) | |
| 701 | + resultBlock(NSNull(),.failed) | |
| 702 | + } | |
| 703 | + } else { | |
| 704 | + if CNLiveNetworking.isNetworking() { | |
| 705 | + showMessage(message: "获取失败") | |
| 706 | + resultBlock(NSNull(),.failed) | |
| 707 | + } else { | |
| 708 | + showMessage(message: "似乎与网络断开链接") | |
| 709 | + resultBlock(NSNull(),.noNetwork) | |
| 710 | + } | |
| 711 | + } | |
| 712 | + } | |
| 713 | + } | |
| 714 | + | |
| 715 | + /// 获取积分明细 | |
| 716 | + /// - Parameters: | |
| 717 | + /// - page: 页数 | |
| 718 | + /// - resultBlock: 返回 | |
| 719 | + static func requestWithIntegralRecord(page: NSInteger, resultBlock: @escaping resultNewsBlock) { | |
| 720 | + let param = NSMutableDictionary() | |
| 721 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid") | |
| 722 | + param.setValue("2022-08-21", forKey: "startTime")//开始时间 | |
| 723 | + param.setValue("2022-09-20", forKey: "endTime")//开始时间 | |
| 724 | + param.setValue("1", forKey: "type") | |
| 725 | + param.setValue("10", forKey: "pageSize") | |
| 726 | + param.setValue("\(page)", forKey: "pageNo") | |
| 727 | + let custom_param = NSMutableDictionary() | |
| 728 | + custom_param.setValue(APPId_wjj, forKey: "appId") | |
| 729 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | |
| 730 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 731 | + CNLiveNetworking.setupShowDataResult(false) | |
| 732 | + CNLiveNetworking.setupSignRequestKey(APPKey_wjj) | |
| 733 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | |
| 734 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjUrl+"/Daren/integral/myIntegralRecord.action", param: (param as! [AnyHashable : Any]), cacheType: .networkOnly) { task, result, error in | |
| 735 | + hiddenLoading() | |
| 736 | + if (error == nil) { | |
| 737 | + let resp = result as! NSDictionary | |
| 738 | + let errorCode = "\(resp["errorCode"] ?? "0")" | |
| 739 | + if (errorCode == "0") { | |
| 740 | + let listModel = dictionaryToModel(resp as! [String : Any], MineIntegralRecordModel.self,"data") as! MineIntegralRecordModel | |
| 741 | + resultBlock(listModel,.success) | |
| 742 | + } else { | |
| 743 | + showMessage(message: resp["errorMessage"] as! String) | |
| 744 | + resultBlock(NSNull(),.failed) | |
| 745 | + } | |
| 746 | + } else { | |
| 747 | + if CNLiveNetworking.isNetworking() { | |
| 748 | + showMessage(message: "获取失败") | |
| 749 | + resultBlock(NSNull(),.failed) | |
| 750 | + } else { | |
| 751 | + showMessage(message: "似乎与网络断开链接") | |
| 752 | + resultBlock(NSNull(),.noNetwork) | |
| 753 | + } | |
| 754 | + } | |
| 755 | + } | |
| 624 | 756 | } |
| 625 | 757 | |
| 626 | 758 | /// 获取十位时间戳 | ... | ... |