Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
67aaf214
Commit
67aaf214
authored
May 23, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
网络线程 数据异步处理
parent
ea4c897f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
70 deletions
+114
-70
YHMyDocumentsDetailViewModel.swift
...uments(我的文书)/ViewModel/YHMyDocumentsDetailViewModel.swift
+18
-0
YHScorePersonInfoCell.swift
...Service(服务中心)/MyScore(我的评分)/V/YHScorePersonInfoCell.swift
+11
-11
YHPreviewMainViewController.swift
...ersonInfoList(个人信息预览)/C/YHPreviewMainViewController.swift
+1
-1
YHServiceCenterMainViewModel.swift
...ligentService(服务中心)/VM/YHServiceCenterMainViewModel.swift
+14
-6
YHMsgViewModel.swift
...alaxy/Classes/Modules/Message(消息)/VM/YHMsgViewModel.swift
+28
-16
YHNetRequest.swift
galaxy/galaxy/Classes/Tools/NetWork/YHNetRequest.swift
+42
-36
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyDocuments(我的文书)/ViewModel/YHMyDocumentsDetailViewModel.swift
View file @
67aaf214
...
@@ -335,6 +335,9 @@ private extension YHMyDocumentsDetailViewModel {
...
@@ -335,6 +335,9 @@ private extension YHMyDocumentsDetailViewModel {
let
tModel
=
YHHKPlanDocModel
()
let
tModel
=
YHHKPlanDocModel
()
tModel
.
title
=
"1、主要事业成就"
tModel
.
title
=
"1、主要事业成就"
tModel
.
content
=
model
.
career_achievement
.
defaultStringIfEmpty
(
detaultValue
:
""
)
tModel
.
content
=
model
.
career_achievement
.
defaultStringIfEmpty
(
detaultValue
:
""
)
if
tModel
.
content
.
count
>
100
{
tModel
.
content
=
tModel
.
content
.
slicing
(
from
:
0
,
length
:
100
)
??
""
}
tModel
.
type
=
.
planDocQuestion1
tModel
.
type
=
.
planDocQuestion1
tModel
.
isFirstData
=
true
tModel
.
isFirstData
=
true
arrHKPlanData
.
append
(
tModel
)
arrHKPlanData
.
append
(
tModel
)
...
@@ -345,6 +348,9 @@ private extension YHMyDocumentsDetailViewModel {
...
@@ -345,6 +348,9 @@ private extension YHMyDocumentsDetailViewModel {
let
tModel
=
YHHKPlanDocModel
()
let
tModel
=
YHHKPlanDocModel
()
tModel
.
title
=
"2、专业技能成就"
tModel
.
title
=
"2、专业技能成就"
tModel
.
content
=
model
.
professional_skills
.
defaultStringIfEmpty
(
detaultValue
:
""
)
tModel
.
content
=
model
.
professional_skills
.
defaultStringIfEmpty
(
detaultValue
:
""
)
if
tModel
.
content
.
count
>
100
{
tModel
.
content
=
tModel
.
content
.
slicing
(
from
:
0
,
length
:
100
)
??
""
}
tModel
.
type
=
.
planDocQuestion2
tModel
.
type
=
.
planDocQuestion2
arrHKPlanData
.
append
(
tModel
)
arrHKPlanData
.
append
(
tModel
)
...
@@ -355,6 +361,9 @@ private extension YHMyDocumentsDetailViewModel {
...
@@ -355,6 +361,9 @@ private extension YHMyDocumentsDetailViewModel {
let
tModel
=
YHHKPlanDocModel
()
let
tModel
=
YHHKPlanDocModel
()
tModel
.
title
=
"3、学业成就"
tModel
.
title
=
"3、学业成就"
tModel
.
content
=
model
.
academic_achievement
.
defaultStringIfEmpty
(
detaultValue
:
""
)
tModel
.
content
=
model
.
academic_achievement
.
defaultStringIfEmpty
(
detaultValue
:
""
)
if
tModel
.
content
.
count
>
100
{
tModel
.
content
=
tModel
.
content
.
slicing
(
from
:
0
,
length
:
100
)
??
""
}
tModel
.
type
=
.
planDocQuestion3
tModel
.
type
=
.
planDocQuestion3
arrHKPlanData
.
append
(
tModel
)
arrHKPlanData
.
append
(
tModel
)
...
@@ -365,6 +374,9 @@ private extension YHMyDocumentsDetailViewModel {
...
@@ -365,6 +374,9 @@ private extension YHMyDocumentsDetailViewModel {
let
tModel
=
YHHKPlanDocModel
()
let
tModel
=
YHHKPlanDocModel
()
tModel
.
title
=
"4、未来发展计划"
tModel
.
title
=
"4、未来发展计划"
tModel
.
content
=
model
.
plan_detail
.
defaultStringIfEmpty
(
detaultValue
:
""
)
tModel
.
content
=
model
.
plan_detail
.
defaultStringIfEmpty
(
detaultValue
:
""
)
if
tModel
.
content
.
count
>
100
{
tModel
.
content
=
tModel
.
content
.
slicing
(
from
:
0
,
length
:
100
)
??
""
}
tModel
.
type
=
.
planDocQuestion4
tModel
.
type
=
.
planDocQuestion4
arrHKPlanData
.
append
(
tModel
)
arrHKPlanData
.
append
(
tModel
)
...
@@ -375,6 +387,9 @@ private extension YHMyDocumentsDetailViewModel {
...
@@ -375,6 +387,9 @@ private extension YHMyDocumentsDetailViewModel {
let
tModel
=
YHHKPlanDocModel
()
let
tModel
=
YHHKPlanDocModel
()
tModel
.
title
=
"5、专业资格及奖项"
tModel
.
title
=
"5、专业资格及奖项"
tModel
.
content
=
model
.
qualifications_and_awards
.
defaultStringIfEmpty
(
detaultValue
:
""
)
tModel
.
content
=
model
.
qualifications_and_awards
.
defaultStringIfEmpty
(
detaultValue
:
""
)
if
tModel
.
content
.
count
>
100
{
tModel
.
content
=
tModel
.
content
.
slicing
(
from
:
0
,
length
:
100
)
??
""
}
tModel
.
type
=
.
planDocQuestion5
tModel
.
type
=
.
planDocQuestion5
arrHKPlanData
.
append
(
tModel
)
arrHKPlanData
.
append
(
tModel
)
...
@@ -385,6 +400,9 @@ private extension YHMyDocumentsDetailViewModel {
...
@@ -385,6 +400,9 @@ private extension YHMyDocumentsDetailViewModel {
let
tModel
=
YHHKPlanDocModel
()
let
tModel
=
YHHKPlanDocModel
()
tModel
.
title
=
"6、其他材料"
tModel
.
title
=
"6、其他材料"
tModel
.
content
=
model
.
other
.
defaultStringIfEmpty
(
detaultValue
:
""
)
tModel
.
content
=
model
.
other
.
defaultStringIfEmpty
(
detaultValue
:
""
)
if
tModel
.
content
.
count
>
100
{
tModel
.
content
=
tModel
.
content
.
slicing
(
from
:
0
,
length
:
100
)
??
""
}
tModel
.
type
=
.
planDocQuestion6
tModel
.
type
=
.
planDocQuestion6
arrHKPlanData
.
append
(
tModel
)
arrHKPlanData
.
append
(
tModel
)
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyScore(我的评分)/V/YHScorePersonInfoCell.swift
View file @
67aaf214
...
@@ -26,7 +26,7 @@ class YHScorePersonInfoCell: UITableViewCell {
...
@@ -26,7 +26,7 @@ class YHScorePersonInfoCell: UITableViewCell {
//头像
//头像
private
lazy
var
headImagV
:
UIImageView
=
{
private
lazy
var
headImagV
:
UIImageView
=
{
let
imageV
=
UIImageView
(
image
:
UIImage
(
named
:
"
score_header
_default"
))
let
imageV
=
UIImageView
(
image
:
UIImage
(
named
:
"
mine_head
_default"
))
imageV
.
contentMode
=
.
scaleAspectFill
imageV
.
contentMode
=
.
scaleAspectFill
imageV
.
layer
.
cornerRadius
=
20.5
imageV
.
layer
.
cornerRadius
=
20.5
imageV
.
clipsToBounds
=
true
imageV
.
clipsToBounds
=
true
...
@@ -264,15 +264,15 @@ extension YHScorePersonInfoCell {
...
@@ -264,15 +264,15 @@ extension YHScorePersonInfoCell {
private
func
handleCardImage
()
{
private
func
handleCardImage
()
{
guard
let
dataModel
=
dataModel
?
.
userinfo
,
dataModel
.
head_url
.
isEmpty
==
false
else
{
return
}
//
guard let dataModel = dataModel?.userinfo, dataModel.head_url.isEmpty == false else { return }
//
let
url
=
dataModel
.
head_url
//
let url = dataModel.head_url
if
url
.
isEmpty
==
false
{
//
if url.isEmpty == false {
self
.
requestVM
.
getPublicImageUrl
(
url
)
{[
weak
self
]
success
,
error
in
//
self.requestVM.getPublicImageUrl(url) {[weak self] success, error in
guard
let
self
=
self
else
{
return
}
//
guard let self = self else { return }
guard
success
!=
nil
else
{
return
}
//
guard success != nil else { return }
self
.
headImagV
.
kf
.
setImage
(
with
:
URL
(
string
:
success
),
placeholder
:
UIImage
(
named
:
"global_default_image"
))
//
self.headImagV.kf.setImage(with: URL(string: success), placeholder: UIImage(named: "global_default_image"))
}
//
}
}
//
}
}
}
}
}
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(我的信息流程)/PersonInfoList(个人信息预览)/C/YHPreviewMainViewController.swift
View file @
67aaf214
...
@@ -56,7 +56,7 @@ class YHPreviewMainViewController: YHBaseViewController {
...
@@ -56,7 +56,7 @@ class YHPreviewMainViewController: YHBaseViewController {
//头像
//头像
private
lazy
var
headImagV
:
UIImageView
=
{
private
lazy
var
headImagV
:
UIImageView
=
{
let
imageV
=
UIImageView
(
image
:
UIImage
(
named
:
"
score_header
_default"
))
let
imageV
=
UIImageView
(
image
:
UIImage
(
named
:
"
mine_head
_default"
))
imageV
.
contentMode
=
.
scaleAspectFill
imageV
.
contentMode
=
.
scaleAspectFill
imageV
.
layer
.
cornerRadius
=
26.5
imageV
.
layer
.
cornerRadius
=
26.5
imageV
.
clipsToBounds
=
true
imageV
.
clipsToBounds
=
true
...
...
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/VM/YHServiceCenterMainViewModel.swift
View file @
67aaf214
...
@@ -129,13 +129,21 @@ extension YHServiceCenterMainViewModel {
...
@@ -129,13 +129,21 @@ extension YHServiceCenterMainViewModel {
if
json
.
code
==
200
{
if
json
.
code
==
200
{
let
dic
=
json
.
data
let
dic
=
json
.
data
guard
let
resultModel
=
YHContactItemHoldModel
.
deserialize
(
dict
:
dic
as?
[
AnyHashable
:
Any
])
else
{
DispatchQueue
.
global
()
.
async
{
arrContactList
=
[]
guard
let
resultModel
=
YHContactItemHoldModel
.
deserialize
(
dict
:
dic
as?
[
AnyHashable
:
Any
])
else
{
callBackBlock
(
false
,
nil
)
return
DispatchQueue
.
main
.
async
{
self
.
arrContactList
=
[]
callBackBlock
(
false
,
nil
)
}
return
}
DispatchQueue
.
main
.
async
{
self
.
arrContactList
=
resultModel
.
orders
callBackBlock
(
true
,
nil
)
}
}
}
arrContactList
=
resultModel
.
orders
callBackBlock
(
true
,
nil
)
}
else
{
}
else
{
arrContactList
=
[]
arrContactList
=
[]
...
...
galaxy/galaxy/Classes/Modules/Message(消息)/VM/YHMsgViewModel.swift
View file @
67aaf214
...
@@ -24,7 +24,9 @@ class YHMsgViewModel: NSObject {
...
@@ -24,7 +24,9 @@ class YHMsgViewModel: NSObject {
if
json
.
code
==
200
{
if
json
.
code
==
200
{
guard
let
result
=
YHMsgListModel
.
deserialize
(
dict
:
dic
as?
Dictionary
)
else
{
guard
let
result
=
YHMsgListModel
.
deserialize
(
dict
:
dic
as?
Dictionary
)
else
{
let
error
=
YHErrorModel
(
errorCode
:
YHErrorCode
.
dictParseError
.
rawValue
,
errorMsg
:
YHErrorCode
.
dictParseError
.
description
())
let
error
=
YHErrorModel
(
errorCode
:
YHErrorCode
.
dictParseError
.
rawValue
,
errorMsg
:
YHErrorCode
.
dictParseError
.
description
())
callBackBlock
(
false
,
error
)
DispatchQueue
.
main
.
async
{
callBackBlock
(
false
,
error
)
}
return
return
}
}
self
.
msgList
=
result
self
.
msgList
=
result
...
@@ -33,8 +35,8 @@ class YHMsgViewModel: NSObject {
...
@@ -33,8 +35,8 @@ class YHMsgViewModel: NSObject {
self
.
msgList
.
draft
.
type
=
YHMessageType
.
draft
.
rawValue
self
.
msgList
.
draft
.
type
=
YHMessageType
.
draft
.
rawValue
self
.
msgList
.
signature
.
type
=
YHMessageType
.
fileSign
.
rawValue
self
.
msgList
.
signature
.
type
=
YHMessageType
.
fileSign
.
rawValue
self
.
msgList
.
dataSubmission
.
type
=
YHMessageType
.
infoSubmit
.
rawValue
self
.
msgList
.
dataSubmission
.
type
=
YHMessageType
.
infoSubmit
.
rawValue
callBackBlock
(
true
,
nil
)
callBackBlock
(
true
,
nil
)
}
else
{
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
callBackBlock
(
false
,
error
)
...
@@ -51,23 +53,33 @@ class YHMsgViewModel: NSObject {
...
@@ -51,23 +53,33 @@ class YHMsgViewModel: NSObject {
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
json
,
code
in
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
json
,
code
in
let
dic
=
json
.
data
let
dic
=
json
.
data
printLog
(
"model 是 ==>
\(
json
)
"
)
//
printLog("model 是 ==> \(json)")
if
json
.
code
==
200
{
if
json
.
code
==
200
{
DispatchQueue
.
global
()
.
async
{
guard
let
arr
=
[
YHDetailMessageModel
]
.
deserialize
(
array
:
dic
as?
[
Any
])
else
{
guard
let
arr
=
[
YHDetailMessageModel
]
.
deserialize
(
array
:
dic
as?
[
Any
])
else
{
let
error
=
YHErrorModel
(
errorCode
:
YHErrorCode
.
dictParseError
.
rawValue
,
errorMsg
:
YHErrorCode
.
dictParseError
.
description
())
self
.
msgDetailList
=
[]
DispatchQueue
.
main
.
async
{
callBackBlock
(
false
,
error
)
let
error
=
YHErrorModel
(
errorCode
:
YHErrorCode
.
dictParseError
.
rawValue
,
errorMsg
:
YHErrorCode
.
dictParseError
.
description
())
return
self
.
msgDetailList
=
[]
}
callBackBlock
(
false
,
error
)
self
.
msgDetailList
.
removeAll
()
}
for
item
in
arr
{
if
let
item
=
item
{
self
.
msgDetailList
.
append
(
item
)
return
}
DispatchQueue
.
main
.
async
{
self
.
msgDetailList
.
removeAll
()
for
item
in
arr
{
if
let
item
=
item
{
self
.
msgDetailList
.
append
(
item
)
}
}
callBackBlock
(
true
,
nil
)
}
}
}
}
callBackBlock
(
true
,
nil
)
}
else
{
}
else
{
self
.
msgDetailList
=
[]
self
.
msgDetailList
=
[]
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
...
...
galaxy/galaxy/Classes/Tools/NetWork/YHNetRequest.swift
View file @
67aaf214
...
@@ -96,7 +96,7 @@ class YHNetRequest: NSObject {
...
@@ -96,7 +96,7 @@ class YHNetRequest: NSObject {
requestHeader
.
add
(
name
:
"pass"
,
value
:
""
)
requestHeader
.
add
(
name
:
"pass"
,
value
:
""
)
requestHeader
.
add
(
name
:
"businessCode"
,
value
:
"4001001"
)
requestHeader
.
add
(
name
:
"businessCode"
,
value
:
"4001001"
)
let
appkey
=
"958364f87222c200a72414f492bf0e26"
let
appkey
=
"958364f87222c200a72414f492bf0e26"
let
signOrgiString
=
"appid="
+
"1"
+
"&"
+
"timestamp="
+
dateStr
+
"&"
+
"appkey="
+
appkey
let
signOrgiString
=
"appid="
+
"1"
+
"&"
+
"timestamp="
+
dateStr
+
"&"
+
"appkey="
+
appkey
let
sign
=
signOrgiString
.
md5
()
let
sign
=
signOrgiString
.
md5
()
...
@@ -311,47 +311,53 @@ class YHNetRequest: NSObject {
...
@@ -311,47 +311,53 @@ class YHNetRequest: NSObject {
}
}
if
statusCode
==
200
{
if
statusCode
==
200
{
guard
let
obj
=
NetWorkBaseModel
.
deserialize
(
from
:
serverDict
)
else
{
DispatchQueue
.
global
()
.
async
{
guard
let
errorBlock
=
self
.
failure
else
{
return
}
guard
let
obj
=
NetWorkBaseModel
.
deserialize
(
from
:
serverDict
)
else
{
let
errorModel
=
YHErrorModel
(
errorCode
:
Int32
(
statusCode
),
errorMsg
:
errorResponseMsg
)
guard
let
errorBlock
=
self
.
failure
else
{
return
}
errorBlock
(
errorModel
)
DispatchQueue
.
main
.
async
{
return
let
errorModel
=
YHErrorModel
(
errorCode
:
Int32
(
statusCode
),
errorMsg
:
errorResponseMsg
)
}
errorBlock
(
errorModel
)
}
return
}
#if DEBUG
#if DEBUG
printLog
(
"服务器返回数据是:
\(
obj
)
"
)
printLog
(
"服务器返回数据是:
\(
obj
)
"
)
#endif
#endif
if
obj
.
code
==
YHErrorCode
.
forceUpdate
.
rawValue
{
// 强制版本升级
if
obj
.
code
==
YHErrorCode
.
forceUpdate
.
rawValue
{
// 强制版本升级
DispatchQueue
.
main
.
async
{
DispatchQueue
.
main
.
async
{
YHAppVersionForceUpdateView
.
alertView
()
.
show
()
YHAppVersionForceUpdateView
.
alertView
()
.
show
()
// 发送强制更新通知
// 发送强制更新通知
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
didForceUpgradeNotifiction
,
object
:
nil
)
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
didForceUpgradeNotifiction
,
object
:
nil
)
YHHUD
.
hide
()
YHHUD
.
hide
()
guard
let
errorBlock
=
self
.
failure
else
{
return
}
guard
let
errorBlock
=
self
.
failure
else
{
return
}
let
errorModel
=
YHErrorModel
(
errorCode
:
Int32
(
statusCode
),
errorMsg
:
errorResponseMsg
)
let
errorModel
=
YHErrorModel
(
errorCode
:
Int32
(
statusCode
),
errorMsg
:
errorResponseMsg
)
errorBlock
(
errorModel
)
errorBlock
(
errorModel
)
}
return
}
}
return
}
if
obj
.
code
==
YHErrorCode
.
tokenInvalidError
.
rawValue
{
DispatchQueue
.
main
.
async
{
if
obj
.
code
==
YHErrorCode
.
tokenInvalidError
.
rawValue
{
YHLoginManager
.
shared
.
clearUserInfo
()
YHHUD
.
flash
(
message
:
"登录状态失效"
)
// 发送清空所有红点通知
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
didMarkAllMessagesReadedNotifiction
,
object
:
nil
)
UIViewController
.
current
?
.
navigationController
?
.
popToRootViewController
(
animated
:
false
)
goTabBarBy
(
tabType
:
.
home
)
YHHUD
.
hide
()
guard
let
errorBlock
=
self
.
failure
else
{
return
}
let
errorModel
=
YHErrorModel
(
errorCode
:
Int32
(
statusCode
),
errorMsg
:
errorResponseMsg
)
errorBlock
(
errorModel
)
}
return
}
DispatchQueue
.
main
.
async
{
DispatchQueue
.
main
.
async
{
YHLoginManager
.
shared
.
clearUserInfo
()
guard
let
suclock
=
self
.
success
else
{
return
}
YHHUD
.
flash
(
message
:
"登录状态失效"
)
suclock
(
obj
,
statusCode
)
// 发送清空所有红点通知
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
didMarkAllMessagesReadedNotifiction
,
object
:
nil
)
UIViewController
.
current
?
.
navigationController
?
.
popToRootViewController
(
animated
:
false
)
goTabBarBy
(
tabType
:
.
home
)
YHHUD
.
hide
()
guard
let
errorBlock
=
self
.
failure
else
{
return
}
let
errorModel
=
YHErrorModel
(
errorCode
:
Int32
(
statusCode
),
errorMsg
:
errorResponseMsg
)
errorBlock
(
errorModel
)
}
}
return
}
}
guard
let
suclock
=
self
.
success
else
{
return
}
suclock
(
obj
,
statusCode
)
}
else
{
}
else
{
guard
let
errorBlock
=
self
.
failure
else
{
return
}
guard
let
errorBlock
=
self
.
failure
else
{
return
}
if
statusCode
==
502
{
if
statusCode
==
502
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment