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
a1000be6
Commit
a1000be6
authored
Jan 05, 2024
by
David黄金龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
165a352f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
YHHomeViewController.swift
...axy/Classes/Modules/Home(首页)/C/YHHomeViewController.swift
+4
-1
YHHomePageViewModel.swift
...axy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
+1
-0
YHNetRequest.swift
galaxy/galaxy/Classes/Tools/NetWork/YHNetRequest.swift
+2
-2
No files found.
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeViewController.swift
View file @
a1000be6
...
...
@@ -25,8 +25,9 @@ class YHHomeViewController: YHBaseViewController {
initView
()
//2.网络请求
requestData
()
bind
()
requestData
()
}
...
...
@@ -44,6 +45,8 @@ class YHHomeViewController: YHBaseViewController {
private
func
bind
()
{
homeReqVM
.
subject
.
subscribe
(
onNext
:
{
model
in
print
(
"网络请求获取的数据是====>"
)
print
(
model
)
})
.
disposed
(
by
:
disposeBag
)
}
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/VM/YHHomePageViewModel.swift
View file @
a1000be6
...
...
@@ -12,6 +12,7 @@ import RxSwift
class
YHHomePageViewModel
{
//数据源
var
configModel
:
YHHomeCofigMode
?
let
subject
=
PublishSubject
<
YHHomeCofigMode
>
()
}
...
...
galaxy/galaxy/Classes/Tools/NetWork/YHNetRequest.swift
View file @
a1000be6
...
...
@@ -156,7 +156,7 @@ class YHNetRequest: NSObject {
if
statusCode
==
200
{
guard
let
suclock
=
self
.
success
else
{
return
}
let
dittt
=
self
.
handleJsonObjectNullValue
(
serverDict
)
suclock
(
dittt
as?
[
String
:
Any
]
??
[
""
:
""
],
statusCode
)
suclock
(
dittt
as?
[
String
:
Any
]
??
[
:
],
statusCode
)
}
else
{
let
errorModel
=
YHNetErrorModel
.
init
()
errorModel
.
responseErrorType
=
.
failType
...
...
@@ -170,7 +170,7 @@ class YHNetRequest: NSObject {
}
//处理对象为空的情况
func
handleJsonObjectNullValue
(
_
jsonObject
:
Any
)
->
Any
{
if
let
jsonArray
=
jsonObject
as?
Array
<
Any
>
{
let
noNullArray
:
[
Any
]
=
jsonArray
.
map
{
value
in
...
...
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