Commit f9b07a3c authored by DavidHuang's avatar DavidHuang

uat接口调节完成

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