Commit f9b07a3c authored by DavidHuang's avatar DavidHuang

uat接口调节完成

parent 268cb7be
...@@ -76,18 +76,20 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget { ...@@ -76,18 +76,20 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
return imgView return imgView
}() }()
lazy var items: [PersonalModuleItem] = { // var items: [PersonalModuleItem] = {
var arrData = [ // var arrData = [
PersonalModuleItem(icon: "mine_item_card", title: "我的名片".local, type:.myCard), // PersonalModuleItem(icon: "mine_item_card", title: "我的名片".local, type:.myCard),
PersonalModuleItem(icon: "mine_item_msg", title: "我的消息".local, type:.myMessage), // PersonalModuleItem(icon: "mine_item_msg", title: "我的消息".local, type:.myMessage),
PersonalModuleItem(icon: "mine_item_scoreCenter", title: "积分中心".local, type:.scoreCenter), // PersonalModuleItem(icon: "mine_item_scoreCenter", title: "积分中心".local, type:.scoreCenter),
PersonalModuleItem(icon: "mine_item_code", title: "我的测评码".local, type:.myTestCode), // PersonalModuleItem(icon: "mine_item_code", title: "我的测评码".local, type:.myTestCode),
PersonalModuleItem(icon: "mine_item_appoint", title: "关于银河湾".local, type:.appointGalaxyBay), // PersonalModuleItem(icon: "mine_item_appoint", title: "关于银河湾".local, type:.appointGalaxyBay),
PersonalModuleItem(icon: "mine_item_activity", title: "我的活动".local, type:.myActivity), // PersonalModuleItem(icon: "mine_item_activity", title: "我的活动".local, type:.myActivity),
PersonalModuleItem(icon: "mine_item_about_us", title: "关于我们".local, type:. aboutUs) // PersonalModuleItem(icon: "mine_item_about_us", title: "关于我们".local, type:. aboutUs)
] // ]
return arrData // return arrData
}() // }()
var items: [PersonalModuleItem] = []
lazy var headerView: YHUserInfoHeaderView = { lazy var headerView: YHUserInfoHeaderView = {
let view = YHUserInfoHeaderView.createView() let view = YHUserInfoHeaderView.createView()
...@@ -151,10 +153,13 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget { ...@@ -151,10 +153,13 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
loadItems()
requestLikeCollectionCount() requestLikeCollectionCount()
getTotalUnreadMsgCount() getTotalUnreadMsgCount()
checkSettingRedPoint() checkSettingRedPoint()
self.headerView.updateAvatar() headerView.updateAvatar()
requstUserBasicInfo() requstUserBasicInfo()
} }
...@@ -253,6 +258,47 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget { ...@@ -253,6 +258,47 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
self.tableView .reloadData() self.tableView .reloadData()
} }
} }
//uat 添加items
func loadItems() {
if YHUatHelper.shared.getUatModuleStatusBy(module: YHUatModules(rawValue: 1)) {
let item = PersonalModuleItem(icon: "mine_item_card", title: "我的名片".local, type:.myCard)
items.append(item)
}
do {
let item = PersonalModuleItem(icon: "mine_item_msg", title: "我的消息".local, type:.myMessage)
items.append(item)
}
if YHUatHelper.shared.getUatModuleStatusBy(module: YHUatModules(rawValue: 2)) {
let item = PersonalModuleItem(icon: "mine_item_scoreCenter", title: "积分中心".local, type:.scoreCenter)
items.append(item)
}
if YHUatHelper.shared.getUatModuleStatusBy(module: YHUatModules(rawValue: 2)) {
let item = PersonalModuleItem(icon: "mine_item_code", title: "我的测评码".local, type:.myTestCode)
items.append(item)
}
if YHUatHelper.shared.getUatModuleStatusBy(module: YHUatModules(rawValue: 4)) {
let item = PersonalModuleItem(icon: "mine_item_appoint", title: "关于银河湾".local, type:.appointGalaxyBay)
items.append(item)
}
if YHUatHelper.shared.getUatModuleStatusBy(module: YHUatModules(rawValue: 5)) {
let item = PersonalModuleItem(icon: "mine_item_activity", title: "我的活动".local, type:.myActivity)
items.append(item)
}
if YHUatHelper.shared.getUatModuleStatusBy(module: YHUatModules(rawValue: 5)) {
let item = PersonalModuleItem(icon: "mine_item_about_us", title: "关于我们".local, type:. aboutUs)
items.append(item)
}
tableView.reloadData()
}
} }
extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
......
...@@ -48,20 +48,17 @@ extension YHUatHelperViewModel { ...@@ -48,20 +48,17 @@ extension YHUatHelperViewModel {
//请求灰度功能列表配置 //请求灰度功能列表配置
func getUatList(callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) { func getUatList(callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let params: [String : Any] = [ let params: [String] = ["1", "2","3", "4","5","6", "7","8","9"]
"module_numbers[0]": "1", var strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Uat.uatListApi
"module_numbers[1]": "2", for (index,item) in params.enumerated() {
"module_numbers[2]": "3", if index == 0 {
"module_numbers[3]": "4", strUrl = strUrl + "?module_numbers=" + item
"module_numbers[4]": "5", } else {
"module_numbers[5]": "6", strUrl = strUrl + "&module_numbers=" + item
"module_numbers[6]": "7", }
"module_numbers[7]": "8", }
"module_numbers[8]": "9",
]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Uat.uatListApi let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象 //1. json字符串 转 对象
guard let self = self else { return } guard let self = self else { return }
let dic = json.data let dic = json.data
......
...@@ -33,33 +33,39 @@ class YHAppVersionManager { ...@@ -33,33 +33,39 @@ class YHAppVersionManager {
func needShowRedPointOfSuggestVersionUpdate() -> Bool { func needShowRedPointOfSuggestVersionUpdate() -> Bool {
var isShowRedPoint = false var isShowRedPoint = false
// 判断版本更新逻辑 if YHUatHelper.shared.getUatModuleStatusBy(module: YHUatModules(rawValue: 9)) {
if let configModel = YHConfigManager.shared.reqVM.configModel, configModel.suggest_updating == true { // 判断版本更新逻辑
if configModel.max_version != UIDevice.appVersion() { if let configModel = YHConfigManager.shared.reqVM.configModel, configModel.suggest_updating == true {
if configModel.max_version != UIDevice.appVersion() {
if let showDateString = UserDefaults.standard.object(forKey: kShowRedPointOfSuggestLatestVersionDate) as? String {
if !showDateString.isEmpty, showDateString != self.getCurrentDateSaveKey() { // 需要更新且今天没有展示过 if let showDateString = UserDefaults.standard.object(forKey: kShowRedPointOfSuggestLatestVersionDate) as? String {
if !showDateString.isEmpty, showDateString != self.getCurrentDateSaveKey() { // 需要更新且今天没有展示过
isShowRedPoint = true
}
} else { // 没有任何一天展示过所以本地没有保存日期数据
isShowRedPoint = true isShowRedPoint = true
} }
} else { // 没有任何一天展示过所以本地没有保存日期数据
isShowRedPoint = true
} }
} }
} }
return isShowRedPoint return isShowRedPoint
} }
// 是否需要显示建议版本更新弹窗 // 是否需要显示建议版本更新弹窗
func needShowAlertViewOfSuggestVersionUpdate() -> Bool { func needShowAlertViewOfSuggestVersionUpdate() -> Bool {
var isShow = false var isShow = false
if let configModel = YHConfigManager.shared.reqVM.configModel, configModel.suggest_updating == true {
if let alertLatestVersion = UserDefaults.standard.object(forKey: YhConstant.kShowAlertOfSuggestLatestVersion) as? String { if YHUatHelper.shared.getUatModuleStatusBy(module: YHUatModules(rawValue: 9)) {
if !configModel.max_version.isEmpty, configModel.max_version != alertLatestVersion { if let configModel = YHConfigManager.shared.reqVM.configModel, configModel.suggest_updating == true {
if let alertLatestVersion = UserDefaults.standard.object(forKey: YhConstant.kShowAlertOfSuggestLatestVersion) as? String {
if !configModel.max_version.isEmpty, configModel.max_version != alertLatestVersion {
isShow = true
}
} else {
isShow = true isShow = true
} }
} else {
isShow = true
} }
} }
return isShow return isShow
......
...@@ -333,17 +333,20 @@ class YHNetRequest: NSObject { ...@@ -333,17 +333,20 @@ class YHNetRequest: NSObject {
#if DEBUG #if DEBUG
printLog("服务器返回数据是:\(obj)") printLog("服务器返回数据是:\(obj)")
#endif #endif
if obj.code == YHErrorCode.forceUpdate.rawValue { // 强制版本升级
DispatchQueue.main.async { if YHUatHelper.shared.getUatModuleStatusBy(module: YHUatModules(rawValue: 8)) {
YHAppVersionForceUpdateView.alertView().show() if obj.code == YHErrorCode.forceUpdate.rawValue { // 强制版本升级
// 发送强制更新通知 DispatchQueue.main.async {
NotificationCenter.default.post(name: YhConstant.YhNotification.didForceUpgradeNotifiction, object: nil) YHAppVersionForceUpdateView.alertView().show()
YHHUD.hide() // 发送强制更新通知
guard let errorBlock = self.failure else { return } NotificationCenter.default.post(name: YhConstant.YhNotification.didForceUpgradeNotifiction, object: nil)
let errorModel = YHErrorModel(errorCode: Int32(statusCode), errorMsg: errorResponseMsg) YHHUD.hide()
errorBlock(errorModel) guard let errorBlock = self.failure else { return }
let errorModel = YHErrorModel(errorCode: Int32(statusCode), errorMsg: errorResponseMsg)
errorBlock(errorModel)
}
return
} }
return
} }
if obj.code == YHErrorCode.tokenInvalidError.rawValue { if obj.code == YHErrorCode.tokenInvalidError.rawValue {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment