Commit 41ae675a9023d77a53ad35df1fe3578161246355

Authored by 张旭
2 parents d10ae240 8bb40c64
metaCode/Classes/Environment/CNLiveEnvironment.swift
@@ -11,6 +11,10 @@ import Foundation @@ -11,6 +11,10 @@ import Foundation
11 let APPId: String = CNLiveEnvironmentManager.shared.appId 11 let APPId: String = CNLiveEnvironmentManager.shared.appId
12 ///当前应用的APPKey 12 ///当前应用的APPKey
13 let APPKey: String = CNLiveEnvironmentManager.shared.appKey 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 let APPLoginHost: String! = CNLiveEnvironmentManager.shared.loginHost 19 let APPLoginHost: String! = CNLiveEnvironmentManager.shared.loginHost
16 ///当前应用的Secret 20 ///当前应用的Secret
@@ -19,6 +23,8 @@ let APPSecret: String = CNLiveEnvironmentManager.shared.appSecret @@ -19,6 +23,8 @@ let APPSecret: String = CNLiveEnvironmentManager.shared.appSecret
19 let APPBaseMCUrl: String = CNLiveEnvironmentManager.shared.base_mc_url 23 let APPBaseMCUrl: String = CNLiveEnvironmentManager.shared.base_mc_url
20 /// 网家家内接口 24 /// 网家家内接口
21 let APPBaseWjjUrl: String = CNLiveEnvironmentManager.shared.base_wjj_url 25 let APPBaseWjjUrl: String = CNLiveEnvironmentManager.shared.base_wjj_url
  26 +/// 网家家内电商接口
  27 +let APPBaseWjjShopUrl: String = CNLiveEnvironmentManager.shared.base_mjj_shop_url
22 28
23 ///当前APP的环境 29 ///当前APP的环境
24 let APPCurrentEnvironment: CNLiveEnvironment = CNLiveEnvironmentManager.shared.currentEnvironment 30 let APPCurrentEnvironment: CNLiveEnvironment = CNLiveEnvironmentManager.shared.currentEnvironment
@@ -48,6 +54,8 @@ class CNLiveEnvironmentManager: NSObject{ @@ -48,6 +54,8 @@ class CNLiveEnvironmentManager: NSObject{
48 54
49 var appId: String 55 var appId: String
50 var appKey: String 56 var appKey: String
  57 + var appId_wjj: String
  58 + var appKey_wjj: String
51 var appSecret: String 59 var appSecret: String
52 ///登录接口域名 60 ///登录接口域名
53 var loginHost: String 61 var loginHost: String
@@ -57,6 +65,8 @@ class CNLiveEnvironmentManager: NSObject{ @@ -57,6 +65,8 @@ class CNLiveEnvironmentManager: NSObject{
57 var base_wjj_url: String 65 var base_wjj_url: String
58 /// 获取IM token 请求域名 66 /// 获取IM token 请求域名
59 var img_token_url: String 67 var img_token_url: String
  68 + /// 网家家电商域名请求
  69 + var base_mjj_shop_url: String
60 70
61 ///当前环境 71 ///当前环境
62 var currentEnvironment: CNLiveEnvironment 72 var currentEnvironment: CNLiveEnvironment
@@ -65,11 +75,14 @@ class CNLiveEnvironmentManager: NSObject{ @@ -65,11 +75,14 @@ class CNLiveEnvironmentManager: NSObject{
65 private override init() { 75 private override init() {
66 self.appId = "" 76 self.appId = ""
67 self.appKey = "" 77 self.appKey = ""
  78 + self.appId_wjj = ""
  79 + self.appKey_wjj = ""
68 self.loginHost = "" 80 self.loginHost = ""
69 self.appSecret = "" 81 self.appSecret = ""
70 self.base_mc_url = "" 82 self.base_mc_url = ""
71 self.img_token_url = "" 83 self.img_token_url = ""
72 self.base_wjj_url = "" 84 self.base_wjj_url = ""
  85 + self.base_mjj_shop_url = ""
73 self.currentEnvironment = .development 86 self.currentEnvironment = .development
74 } 87 }
75 //重新copy 和 mutableCopy 方法 88 //重新copy 和 mutableCopy 方法
@@ -100,31 +113,40 @@ class CNLiveEnvironmentManager: NSObject{ @@ -100,31 +113,40 @@ class CNLiveEnvironmentManager: NSObject{
100 func developmentEnvironment(){ 113 func developmentEnvironment(){
101 self.appId = "802_li40qhp922" 114 self.appId = "802_li40qhp922"
102 self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac" 115 self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac"
  116 + self.appId_wjj = "769_jetj7bq525"
  117 + self.appKey_wjj = "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d"
103 self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9" 118 self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9"
104 self.loginHost = "https://api.cnlive.com" 119 self.loginHost = "https://api.cnlive.com"
105 self.img_token_url = "https://api.cnlive.com/open/api2" 120 self.img_token_url = "https://api.cnlive.com/open/api2"
106 self.base_mc_url = "https://metacode.cnlive.com/api" 121 self.base_mc_url = "https://metacode.cnlive.com/api"
107 self.base_wjj_url = "https://apiwjj.cnlive.com" 122 self.base_wjj_url = "https://apiwjj.cnlive.com"
  123 + self.base_mjj_shop_url = "https://manageshop.cnlive.com"
108 } 124 }
109 //testFlight 环境配置 125 //testFlight 环境配置
110 func testFlightEnvironment(){ 126 func testFlightEnvironment(){
111 self.appId = "802_li40qhp922" 127 self.appId = "802_li40qhp922"
112 self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac" 128 self.appKey = "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac"
  129 + self.appId_wjj = "769_jetj7bq525"
  130 + self.appKey_wjj = "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d"
113 self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9" 131 self.appSecret = "3cc9f12db322a3d3656012ef929604cf6d6847471535f9"
114 self.loginHost = "https://api.cnlive.com" 132 self.loginHost = "https://api.cnlive.com"
115 self.img_token_url = "https://api.cnlive.com/open/api2" 133 self.img_token_url = "https://api.cnlive.com/open/api2"
116 self.base_mc_url = "https://metacode.cnlive.com/api" 134 self.base_mc_url = "https://metacode.cnlive.com/api"
117 self.base_wjj_url = "https://apiwjj.cnlive.com" 135 self.base_wjj_url = "https://apiwjj.cnlive.com"
  136 + self.base_mjj_shop_url = "https://manageshop.cnlive.com"
118 } 137 }
119 //production 生产环境配置 138 //production 生产环境配置
120 func productionEnvironment(){ 139 func productionEnvironment(){
121 self.appId = "769_li40lrkt53" 140 self.appId = "769_li40lrkt53"
122 self.appKey = "064f392f84dfe7bbe9f1eabeda53ea02044213019b0406" 141 self.appKey = "064f392f84dfe7bbe9f1eabeda53ea02044213019b0406"
  142 + self.appId_wjj = "769_jetj7bq525"
  143 + self.appKey_wjj = "0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d"
123 self.appSecret = "68b5cc42fbdb466d56c2e22b00b1494feec8149f9dd32e" 144 self.appSecret = "68b5cc42fbdb466d56c2e22b00b1494feec8149f9dd32e"
124 self.loginHost = "https://api.cnlive.com" 145 self.loginHost = "https://api.cnlive.com"
125 self.img_token_url = "https://api.cnlive.com/open/api2" 146 self.img_token_url = "https://api.cnlive.com/open/api2"
126 self.base_mc_url = "https://metacode.cnlive.com/api" 147 self.base_mc_url = "https://metacode.cnlive.com/api"
127 self.base_wjj_url = "https://apiwjj.cnlive.com" 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,7 +138,7 @@ func jsonToModel(_ jsonStr:String,_ modelType:HandyJSON.Type) -> BaseModel {
138 /** 138 /**
139 * Json转数组对象 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 if jsonArrayStr == "" || jsonArrayStr.count == 0 { 142 if jsonArrayStr == "" || jsonArrayStr.count == 0 {
143 #if DEBUG 143 #if DEBUG
144 print("jsonToModelArray:字符串为空") 144 print("jsonToModelArray:字符串为空")
@@ -149,7 +149,7 @@ func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) ->[Base @@ -149,7 +149,7 @@ func jsonArrayToModel(_ jsonArrayStr:String, _ modelType:HandyJSON.Type) ->[Base
149 let data = jsonArrayStr.data(using: String.Encoding.utf8) 149 let data = jsonArrayStr.data(using: String.Encoding.utf8)
150 let peoplesArray = try! JSONSerialization.jsonObject(with:data!, options: JSONSerialization.ReadingOptions()) as? [AnyObject] 150 let peoplesArray = try! JSONSerialization.jsonObject(with:data!, options: JSONSerialization.ReadingOptions()) as? [AnyObject]
151 for people in peoplesArray! { 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 return modelArray 154 return modelArray
155 155
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAddInfoViewController.swift
@@ -121,6 +121,8 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel @@ -121,6 +121,8 @@ class CNLiveMineAddInfoViewController : CNLiveBaseViewController, UITableViewDel
121 self!.tableView.reloadData() 121 self!.tableView.reloadData()
122 self!.tableView.mj_header?.endRefreshing() 122 self!.tableView.mj_header?.endRefreshing()
123 self!.tableView.mj_footer?.endRefreshing() 123 self!.tableView.mj_footer?.endRefreshing()
  124 + }else{
  125 +
124 } 126 }
125 if listBaseModel.total == listBaseModel.pageNum { 127 if listBaseModel.total == listBaseModel.pageNum {
126 self!.tableView.mj_footer?.endRefreshing() 128 self!.tableView.mj_footer?.endRefreshing()
metaCode/Classes/Main/MinePage/Controller/CNLiveMineEarnListViewController.swift
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 7
8 import Foundation 8 import Foundation
9 import JXPagingView 9 import JXPagingView
  10 +import MJRefresh
10 11
11 enum MineEarnShowType { 12 enum MineEarnShowType {
12 case record //积分记录 13 case record //积分记录
@@ -35,26 +36,69 @@ class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewLi @@ -35,26 +36,69 @@ class CNLiveMineEarnListViewController: CNLiveBaseViewController, JXPagingViewLi
35 return tableView 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 var _callBack: CallBack! 45 var _callBack: CallBack!
39 var _show_type : MineEarnShowType! 46 var _show_type : MineEarnShowType!
40 init(show_type: MineEarnShowType) { 47 init(show_type: MineEarnShowType) {
  48 + pageNum = 1
41 super.init(nibName: nil, bundle: nil) 49 super.init(nibName: nil, bundle: nil)
42 _show_type = show_type 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 required init?(coder: NSCoder) { 79 required init?(coder: NSCoder) {
46 fatalError("init(coder:) has not been implemented") 80 fatalError("init(coder:) has not been implemented")
47 } 81 }
48 82
49 override func viewDidLoad() { 83 override func viewDidLoad() {
50 super.viewDidLoad() 84 super.viewDidLoad()
51 - 85 +
  86 + loadDataWithTradRecord(page: self.pageNum)
52 view.addSubview(tableView) 87 view.addSubview(tableView)
53 tableView.snp.makeConstraints { make in 88 tableView.snp.makeConstraints { make in
54 make.top.bottom.equalToSuperview() 89 make.top.bottom.equalToSuperview()
55 make.left.equalToSuperview().offset(20) 90 make.left.equalToSuperview().offset(20)
56 make.right.equalToSuperview().offset(-20) 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 extension CNLiveMineEarnListViewController { 104 extension CNLiveMineEarnListViewController {
@@ -64,14 +108,20 @@ extension CNLiveMineEarnListViewController { @@ -64,14 +108,20 @@ extension CNLiveMineEarnListViewController {
64 } 108 }
65 109
66 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 110 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
67 - return 6 111 + return dataArray.count
68 } 112 }
69 113
70 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 114 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
71 guard let cell = tableView.dequeueReusableCell(withIdentifier: kMIneBodyFiveViewCellIdentifier) as? MIneBodyFiveViewCell else { 115 guard let cell = tableView.dequeueReusableCell(withIdentifier: kMIneBodyFiveViewCellIdentifier) as? MIneBodyFiveViewCell else {
72 return MIneBodyFiveViewCell() 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 return cell 125 return cell
76 } 126 }
77 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 127 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
metaCode/Classes/Main/MinePage/Controller/CNLiveMineEarnViewController.swift
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 import Foundation 8 import Foundation
9 import JXSegmentedView 9 import JXSegmentedView
10 import JXPagingView 10 import JXPagingView
  11 +import MJRefresh
11 12
12 let kCNLiveSectionTitleHeight = 70//标题显示 13 let kCNLiveSectionTitleHeight = 70//标题显示
13 let kCNLiveSectionHeaderHeight = 200//头视图高度 14 let kCNLiveSectionHeaderHeight = 200//头视图高度
@@ -99,15 +100,17 @@ class CNLiveMineEarnViewController: CNLiveBaseViewController, JXPagingViewDelega @@ -99,15 +100,17 @@ class CNLiveMineEarnViewController: CNLiveBaseViewController, JXPagingViewDelega
99 }() 100 }()
100 101
101 lazy var headerView: MineEarnHeaderView = { 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 headerView.backgroundColor = .clear 104 headerView.backgroundColor = .clear
104 return headerView 105 return headerView
105 }() 106 }()
106 107
107 var _index : Int! 108 var _index : Int!
108 - init(index: Int) { 109 + var _checkModel: MinePointCheckInModel!
  110 + init(index: Int, checkModel:MinePointCheckInModel) {
109 super.init(nibName: nil, bundle: nil) 111 super.init(nibName: nil, bundle: nil)
110 _index = index 112 _index = index
  113 + _checkModel = checkModel
111 } 114 }
112 115
113 required init?(coder: NSCoder) { 116 required init?(coder: NSCoder) {
@@ -126,6 +129,12 @@ class CNLiveMineEarnViewController: CNLiveBaseViewController, JXPagingViewDelega @@ -126,6 +129,12 @@ class CNLiveMineEarnViewController: CNLiveBaseViewController, JXPagingViewDelega
126 129
127 view.addSubview(pagingView) 130 view.addSubview(pagingView)
128 pagingView.listContainerView.didClickSelectedItem(at: _index) 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,7 +17,8 @@ class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelega
17 tableView.backgroundColor = .clear 17 tableView.backgroundColor = .clear
18 tableView.separatorStyle = .none 18 tableView.separatorStyle = .none
19 tableView.register(MineBodyFourViewCell.self, forCellReuseIdentifier: kMineBodyFourViewCellIdentifier) 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 let footerView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth - 40, height: 10)) 22 let footerView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth - 40, height: 10))
22 footerView.clipsToBounds = true 23 footerView.clipsToBounds = true
23 footerView.backgroundColor = .white 24 footerView.backgroundColor = .white
@@ -56,19 +57,26 @@ class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelega @@ -56,19 +57,26 @@ class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelega
56 57
57 lazy var dataArray: NSMutableArray = { 58 lazy var dataArray: NSMutableArray = {
58 let dataArray = NSMutableArray.init() 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 return dataArray 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 override func viewDidLoad() { 74 override func viewDidLoad() {
68 super.viewDidLoad() 75 super.viewDidLoad()
69 navigationBarHidden = false 76 navigationBarHidden = false
70 titleName = "任务中心" 77 titleName = "任务中心"
71 78
  79 + loadDataWithTaskList()
72 view.addSubview(tableView) 80 view.addSubview(tableView)
73 tableView.snp.makeConstraints { make in 81 tableView.snp.makeConstraints { make in
74 make.top.equalToSuperview().offset(KNavigationHeight) 82 make.top.equalToSuperview().offset(KNavigationHeight)
@@ -78,6 +86,14 @@ class CNLiveMineQuestViewController: CNLiveBaseViewController, UITableViewDelega @@ -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 extension CNLiveMineQuestViewController { 99 extension CNLiveMineQuestViewController {
@@ -91,7 +107,7 @@ extension CNLiveMineQuestViewController { @@ -91,7 +107,7 @@ extension CNLiveMineQuestViewController {
91 guard let cell = tableView.dequeueReusableCell(withIdentifier: kMineBodyFourViewCellIdentifier) as? MineBodyFourViewCell else { 107 guard let cell = tableView.dequeueReusableCell(withIdentifier: kMineBodyFourViewCellIdentifier) as? MineBodyFourViewCell else {
92 return MineBodyFourViewCell() 108 return MineBodyFourViewCell()
93 } 109 }
94 - cell.setupWithData(dict: dataArray[indexPath.row] as! NSDictionary) 110 + cell.setupWithData(listModel: dataArray[indexPath.row] as! MineTaskCheckListModel)
95 return cell 111 return cell
96 } 112 }
97 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 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,6 +52,7 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate,
52 return headerView 52 return headerView
53 }() 53 }()
54 54
  55 + var checkModel: MinePointCheckInModel!
55 override func viewDidLoad() { 56 override func viewDidLoad() {
56 super.viewDidLoad() 57 super.viewDidLoad()
57 view.backgroundColor = HexColor("#f9f9f9") 58 view.backgroundColor = HexColor("#f9f9f9")
@@ -71,8 +72,10 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, @@ -71,8 +72,10 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate,
71 72
72 public func loadDataWithPoint() { 73 public func loadDataWithPoint() {
73 CNLiveMineViewModel.requestWithCheckIn { [weak self] result, respStatue in 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,7 +108,7 @@ extension CNLiveMineViewController {
105 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 108 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
106 if indexPath.section == 0 { 109 if indexPath.section == 0 {
107 let cell = tableView.dequeueReusableCell(withIdentifier: kMineBodyThreeViewCellIdentifier) as! MineBodyThreeViewCell 110 let cell = tableView.dequeueReusableCell(withIdentifier: kMineBodyThreeViewCellIdentifier) as! MineBodyThreeViewCell
108 - 111 + cell.checkModel = self.checkModel
109 return cell 112 return cell
110 } 113 }
111 if indexPath.section == 1 { 114 if indexPath.section == 1 {
@@ -133,7 +136,7 @@ extension CNLiveMineViewController { @@ -133,7 +136,7 @@ extension CNLiveMineViewController {
133 136
134 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 137 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
135 if indexPath.section == 0 { 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 if indexPath.section == 1 { 141 if indexPath.section == 1 {
139 self.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(show_type: .info), animated: true) 142 self.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(show_type: .info), animated: true)
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 // 6 //
7 7
8 import Foundation 8 import Foundation
9 - 9 +import Kingfisher
10 10
11 class MineBodyOneListViewCell : UITableViewCell { 11 class MineBodyOneListViewCell : UITableViewCell {
12 12
@@ -351,7 +351,7 @@ class MineBodyThreeViewCell: UITableViewCell { @@ -351,7 +351,7 @@ class MineBodyThreeViewCell: UITableViewCell {
351 351
352 lazy var balanceNumberLabel: UILabel = { 352 lazy var balanceNumberLabel: UILabel = {
353 let balanceNumberLabel = UILabel.init() 353 let balanceNumberLabel = UILabel.init()
354 - balanceNumberLabel.text = "2130" 354 + balanceNumberLabel.text = "0"
355 balanceNumberLabel.font = BoldFont_19_Fit 355 balanceNumberLabel.font = BoldFont_19_Fit
356 balanceNumberLabel.textAlignment = .left 356 balanceNumberLabel.textAlignment = .left
357 balanceNumberLabel.textColor = HexColor("#FFE4C4") 357 balanceNumberLabel.textColor = HexColor("#FFE4C4")
@@ -369,13 +369,25 @@ class MineBodyThreeViewCell: UITableViewCell { @@ -369,13 +369,25 @@ class MineBodyThreeViewCell: UITableViewCell {
369 369
370 lazy var pointNumberLabel: UILabel = { 370 lazy var pointNumberLabel: UILabel = {
371 let pointNumberLabel = UILabel.init() 371 let pointNumberLabel = UILabel.init()
372 - pointNumberLabel.text = "10.28W"  
373 pointNumberLabel.font = BoldFont_19_Fit 372 pointNumberLabel.font = BoldFont_19_Fit
  373 + pointNumberLabel.text = "0"
374 pointNumberLabel.textAlignment = .left 374 pointNumberLabel.textAlignment = .left
375 pointNumberLabel.textColor = HexColor("#FFE4C4") 375 pointNumberLabel.textColor = HexColor("#FFE4C4")
376 return pointNumberLabel 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 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 391 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
380 super.init(style: style, reuseIdentifier: reuseIdentifier) 392 super.init(style: style, reuseIdentifier: reuseIdentifier)
381 self.selectionStyle = .none 393 self.selectionStyle = .none
@@ -494,13 +506,13 @@ class MineBodyFourViewCell: UITableViewCell { @@ -494,13 +506,13 @@ class MineBodyFourViewCell: UITableViewCell {
494 lazy var shareBtn: UIButton = { 506 lazy var shareBtn: UIButton = {
495 let shareBtn = UIButton.init(type: .custom) 507 let shareBtn = UIButton.init(type: .custom)
496 shareBtn.frame = CGRect(x: 0, y: 0, width: 70, height: 30) 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 shareBtn.setTitleColor(.white, for: .normal) 509 shareBtn.setTitleColor(.white, for: .normal)
500 shareBtn.titleLabel?.font = Font_12 510 shareBtn.titleLabel?.font = Font_12
501 - shareBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right)  
502 shareBtn.layer.cornerRadius = 15 511 shareBtn.layer.cornerRadius = 15
503 shareBtn.layer.masksToBounds = true 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 return shareBtn 516 return shareBtn
505 }() 517 }()
506 518
@@ -545,10 +557,14 @@ class MineBodyFourViewCell: UITableViewCell { @@ -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 required init?(coder: NSCoder) { 570 required init?(coder: NSCoder) {
@@ -567,7 +583,6 @@ class MIneBodyFiveViewCell: UITableViewCell { @@ -567,7 +583,6 @@ class MIneBodyFiveViewCell: UITableViewCell {
567 583
568 lazy var nameLabel: UILabel = { 584 lazy var nameLabel: UILabel = {
569 let nameLabel = UILabel.init() 585 let nameLabel = UILabel.init()
570 - nameLabel.text = "签到"  
571 nameLabel.textColor = HexColor("#666666") 586 nameLabel.textColor = HexColor("#666666")
572 nameLabel.font = Font_16 587 nameLabel.font = Font_16
573 nameLabel.backgroundColor = .white 588 nameLabel.backgroundColor = .white
@@ -576,7 +591,6 @@ class MIneBodyFiveViewCell: UITableViewCell { @@ -576,7 +591,6 @@ class MIneBodyFiveViewCell: UITableViewCell {
576 591
577 lazy var descLabel: UILabel = { 592 lazy var descLabel: UILabel = {
578 let descLabel = UILabel.init() 593 let descLabel = UILabel.init()
579 - descLabel.text = "2013-01-23"  
580 descLabel.textColor = HexColor("#999999") 594 descLabel.textColor = HexColor("#999999")
581 descLabel.font = Font_12 595 descLabel.font = Font_12
582 descLabel.backgroundColor = .clear 596 descLabel.backgroundColor = .clear
@@ -585,7 +599,6 @@ class MIneBodyFiveViewCell: UITableViewCell { @@ -585,7 +599,6 @@ class MIneBodyFiveViewCell: UITableViewCell {
585 599
586 lazy var pointLabel: UILabel = { 600 lazy var pointLabel: UILabel = {
587 let pointLabel = UILabel.init() 601 let pointLabel = UILabel.init()
588 - pointLabel.text = "+1000 积分"  
589 pointLabel.textColor = HexColor("#F5A623") 602 pointLabel.textColor = HexColor("#F5A623")
590 pointLabel.font = BoldFont_16_Fit 603 pointLabel.font = BoldFont_16_Fit
591 pointLabel.backgroundColor = .clear 604 pointLabel.backgroundColor = .clear
@@ -635,8 +648,26 @@ class MIneBodyFiveViewCell: UITableViewCell { @@ -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 line_label.isHidden = isLast 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 required init?(coder: NSCoder) { 673 required init?(coder: NSCoder) {
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
@@ -310,13 +310,17 @@ class MineQuestHeaderView: UIView { @@ -310,13 +310,17 @@ class MineQuestHeaderView: UIView {
310 pointBtn.backgroundColor = .clear 310 pointBtn.backgroundColor = .clear
311 pointBtn.setTitle("积分收益", for: .normal) 311 pointBtn.setTitle("积分收益", for: .normal)
312 pointBtn.setTitleColor(.white, for: .normal) 312 pointBtn.setTitleColor(.white, for: .normal)
313 - pointBtn.setImage(UIImage(named: "mine_list_icon_right_white_more"), for: .normal)  
314 pointBtn.titleLabel?.font = Font_15 313 pointBtn.titleLabel?.font = Font_15
315 pointBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right) 314 pointBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right)
316 pointBtn.addTarget(self, action: #selector(pushEarnRecordAction), for: .touchUpInside) 315 pointBtn.addTarget(self, action: #selector(pushEarnRecordAction), for: .touchUpInside)
317 return pointBtn 316 return pointBtn
318 }() 317 }()
319 318
  319 +// lazy var pointView: UIImageView = {
  320 +//
  321 +// return <#value#>
  322 +// }()
  323 +
320 lazy var balanceBtn: UIButton = { 324 lazy var balanceBtn: UIButton = {
321 let balanceBtn = UIButton(type: .custom) 325 let balanceBtn = UIButton(type: .custom)
322 balanceBtn.size = CGSize(width: 102, height: 20) 326 balanceBtn.size = CGSize(width: 102, height: 20)
@@ -332,7 +336,7 @@ class MineQuestHeaderView: UIView { @@ -332,7 +336,7 @@ class MineQuestHeaderView: UIView {
332 336
333 lazy var pointLabel: UILabel = { 337 lazy var pointLabel: UILabel = {
334 let pointLabel = UILabel.init() 338 let pointLabel = UILabel.init()
335 - pointLabel.text = "10.28W" 339 + pointLabel.text = "0"
336 pointLabel.textColor = .white 340 pointLabel.textColor = .white
337 pointLabel.backgroundColor = .clear 341 pointLabel.backgroundColor = .clear
338 pointLabel.font = BoldFont_25_Fit 342 pointLabel.font = BoldFont_25_Fit
@@ -341,7 +345,7 @@ class MineQuestHeaderView: UIView { @@ -341,7 +345,7 @@ class MineQuestHeaderView: UIView {
341 345
342 lazy var balanceLabel: UILabel = { 346 lazy var balanceLabel: UILabel = {
343 let balanceLabel = UILabel.init() 347 let balanceLabel = UILabel.init()
344 - balanceLabel.text = "3.15" 348 + balanceLabel.text = "0"
345 balanceLabel.textColor = .white 349 balanceLabel.textColor = .white
346 balanceLabel.backgroundColor = .clear 350 balanceLabel.backgroundColor = .clear
347 balanceLabel.font = BoldFont_25_Fit 351 balanceLabel.font = BoldFont_25_Fit
@@ -358,10 +362,12 @@ class MineQuestHeaderView: UIView { @@ -358,10 +362,12 @@ class MineQuestHeaderView: UIView {
358 return descBtn 362 return descBtn
359 }() 363 }()
360 364
361 - override init(frame: CGRect) { 365 + var _checkModel: MinePointCheckInModel!
  366 + init(frame: CGRect, checkModel : MinePointCheckInModel) {
362 super.init(frame: frame) 367 super.init(frame: frame)
363 self.backgroundColor = .clear 368 self.backgroundColor = .clear
364 369
  370 + _checkModel = checkModel
365 addSubview(mainView) 371 addSubview(mainView)
366 mainView.addSubview(pointBtn) 372 mainView.addSubview(pointBtn)
367 mainView.addSubview(balanceBtn) 373 mainView.addSubview(balanceBtn)
@@ -369,6 +375,9 @@ class MineQuestHeaderView: UIView { @@ -369,6 +375,9 @@ class MineQuestHeaderView: UIView {
369 mainView.addSubview(balanceLabel) 375 mainView.addSubview(balanceLabel)
370 mainView.addSubview(descBtn) 376 mainView.addSubview(descBtn)
371 377
  378 + balanceLabel.text = checkModel.money
  379 + pointLabel.text = checkModel.integral
  380 +
372 setupConstraints() 381 setupConstraints()
373 } 382 }
374 383
@@ -404,11 +413,11 @@ class MineQuestHeaderView: UIView { @@ -404,11 +413,11 @@ class MineQuestHeaderView: UIView {
404 } 413 }
405 414
406 @objc func pushEarnRecordAction() { 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 @objc func pushEarnBalanceAction() { 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 required init?(coder: NSCoder) { 423 required init?(coder: NSCoder) {
@@ -470,7 +479,7 @@ class MineEarnHeaderView: UIView { @@ -470,7 +479,7 @@ class MineEarnHeaderView: UIView {
470 lazy var left_Label: UILabel = { 479 lazy var left_Label: UILabel = {
471 let left_Label = UILabel.init() 480 let left_Label = UILabel.init()
472 left_Label.backgroundColor = .clear 481 left_Label.backgroundColor = .clear
473 - left_Label.text = "1024.28W" 482 + left_Label.text = "0"
474 left_Label.textColor = .white 483 left_Label.textColor = .white
475 left_Label.textAlignment = .left 484 left_Label.textAlignment = .left
476 left_Label.font = BoldFont_18_Fit 485 left_Label.font = BoldFont_18_Fit
@@ -480,7 +489,7 @@ class MineEarnHeaderView: UIView { @@ -480,7 +489,7 @@ class MineEarnHeaderView: UIView {
480 lazy var right_Label: UILabel = { 489 lazy var right_Label: UILabel = {
481 let right_Label = UILabel.init() 490 let right_Label = UILabel.init()
482 right_Label.backgroundColor = .clear 491 right_Label.backgroundColor = .clear
483 - right_Label.text = "10.28" 492 + right_Label.text = "0"
484 right_Label.textColor = .white 493 right_Label.textColor = .white
485 right_Label.textAlignment = .left 494 right_Label.textAlignment = .left
486 right_Label.font = BoldFont_18_Fit 495 right_Label.font = BoldFont_18_Fit
@@ -519,8 +528,8 @@ class MineEarnHeaderView: UIView { @@ -519,8 +528,8 @@ class MineEarnHeaderView: UIView {
519 return tipLabel 528 return tipLabel
520 }() 529 }()
521 530
522 -  
523 - override init(frame: CGRect) { 531 + var _checkModel: MinePointCheckInModel!
  532 + init(frame: CGRect, checkModel: MinePointCheckInModel) {
524 super.init(frame: frame) 533 super.init(frame: frame)
525 534
526 addSubview(mainView) 535 addSubview(mainView)
@@ -536,6 +545,9 @@ class MineEarnHeaderView: UIView { @@ -536,6 +545,9 @@ class MineEarnHeaderView: UIView {
536 mainView.addSubview(tipView) 545 mainView.addSubview(tipView)
537 tipView.addSubview(tipLabel) 546 tipView.addSubview(tipLabel)
538 547
  548 + left_Label.text = checkModel.integral
  549 + right_Label.text = checkModel.money
  550 +
539 setupConstraints() 551 setupConstraints()
540 } 552 }
541 553
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
@@ -290,12 +290,74 @@ final class MineAuthListModel: BaseModel , TableCodable { @@ -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 class MinePointCheckInModel: BaseModel { 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 var score: String? = "" 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 var url: String? = "" 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,7 +64,6 @@ class CNLiveMineViewModel: NSObject {
64 } 64 }
65 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") 65 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
66 param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token") 66 param.setValue(UserInfoManager.shared.userInfo.token, forKey: "token")
67 - print("给后台的数据是=>\(param)")  
68 showLoading(message: "") 67 showLoading(message: "")
69 CNLiveNetworking.setAllowRequestDefaultArgument(true) 68 CNLiveNetworking.setAllowRequestDefaultArgument(true)
70 CNLiveNetworking.setupShowDataResult(false) 69 CNLiveNetworking.setupShowDataResult(false)
@@ -254,7 +253,7 @@ class CNLiveMineViewModel: NSObject { @@ -254,7 +253,7 @@ class CNLiveMineViewModel: NSObject {
254 /// - resultBlock: 返回 253 /// - resultBlock: 返回
255 static func requestAuthStandList(page: NSInteger, resultBlock: @escaping resultNewsBlock) { 254 static func requestAuthStandList(page: NSInteger, resultBlock: @escaping resultNewsBlock) {
256 let param = NSMutableDictionary() 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 param.setValue("10", forKey: "pageSize") 257 param.setValue("10", forKey: "pageSize")
259 param.setValue("\(page)", forKey: "page") 258 param.setValue("\(page)", forKey: "page")
260 CNLiveNetworking.setAllowRequestDefaultArgument(true) 259 CNLiveNetworking.setAllowRequestDefaultArgument(true)
@@ -590,19 +589,24 @@ class CNLiveMineViewModel: NSObject { @@ -590,19 +589,24 @@ class CNLiveMineViewModel: NSObject {
590 /// - Parameter resultBlock: 返回 589 /// - Parameter resultBlock: 返回
591 static func requestWithCheckIn(resultBlock: @escaping resultNewsBlock) { 590 static func requestWithCheckIn(resultBlock: @escaping resultNewsBlock) {
592 let param = NSMutableDictionary() 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 CNLiveNetworking.setAllowRequestDefaultArgument(true) 596 CNLiveNetworking.setAllowRequestDefaultArgument(true)
595 CNLiveNetworking.setupShowDataResult(false) 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 hiddenLoading() 601 hiddenLoading()
598 if (error == nil) { 602 if (error == nil) {
599 let resp = result as! NSDictionary 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 let listModel = dictionaryToModel(resp as! [String : Any], MinePointCheckInModel.self,"data") as! MinePointCheckInModel 606 let listModel = dictionaryToModel(resp as! [String : Any], MinePointCheckInModel.self,"data") as! MinePointCheckInModel
603 resultBlock(listModel,.success) 607 resultBlock(listModel,.success)
604 } else { 608 } else {
605 - showMessage(message: resp["errorMessage"] as! String) 609 + showMessage(message: resp["message"] as! String)
606 resultBlock(NSNull(),.failed) 610 resultBlock(NSNull(),.failed)
607 } 611 }
608 } else { 612 } else {
@@ -620,7 +624,135 @@ class CNLiveMineViewModel: NSObject { @@ -620,7 +624,135 @@ class CNLiveMineViewModel: NSObject {
620 /// 获取任务列表接口 624 /// 获取任务列表接口
621 /// - Parameter resultBlock: 返回 625 /// - Parameter resultBlock: 返回
622 static func requestWithTaskList(resultBlock: @escaping resultNewsBlock) { 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 /// 获取十位时间戳