Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
iOSTeam
/
Majiabao
/
TealiveModule
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
44ba1167
authored
Jan 08, 2024
by
pierce
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录模块的逻辑补全(还差第三方登录)
parent
71a72df0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
680 additions
and
164 deletions
LocalPodSpec/GDRouter/GDRouter/Classes/Service/Module/GDTestRouter.swift
LocalPodSpec/GDRouter/GDRouter/Classes/Service/Module/GDUserManagerRouter.swift
LocalPodSpec/GDToolBox/GDToolBox/Classes/Base/Base/BaseViewController.swift
LocalPodSpec/GDToolBox/GDToolBox/Classes/Foundation/Network/Basic/ErrorTracker.swift
LocalPodSpec/GDToolBox/GDToolBox/Classes/GDConfiguration.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule.xcodeproj/project.pbxproj
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Auth/View/GDRealNameAuthViewController.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Auth/ViewModel/GDIDCardImageAuthViewModel.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Auth/ViewModel/GDRealNameAuthViewModel.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/BindPhone/ViewModel/GDBindPhoneViewModel.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Login/LoginViewController.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Login/View/LoginByPhoneViewController/ForgetPassword/GDUserForgetPasswordController.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Login/View/LoginByPhoneViewController/LoginByPhoneWithPasswordViewController/LoginByPhoneWithPasswordViewController.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Login/View/LoginByPhoneViewController/LoginByVerificationCodeViewController/LoginByVerificationCodeViewController.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Register/View/GDUserBindPhoneViewController.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Register/View/GDUserRegisterInfoController.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Register/ViewModel/GDUserBindPhoneViewModel.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Network/GDLoginHttpHelper.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Network/GDLoginManagerAPI.swift
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Network/GDLoginManagerProvider.swift
Module/GDSocialCenter/GDSocialCenter.xcodeproj/project.pbxproj
Module/GDSocialCenter/GDSocialCenter/GDSocialCenter.h
Module/GDTest/GDTest/Module/GDTestModule.swift
Module/GDUserInfoManager/GDUserInfoManager/GDUserManagerUDKey.swift
Module/GDUserInfoManager/GDUserInfoManager/Module/GDUserInfoManagerModule.swift
Module/GDUserInfoManager/GDUserInfoManager/Network/GDUserInfoHttpHelper.swift
Module/GDUserInfoManager/GDUserInfoManager/Network/GDUserInfoManagerAPI.swift
Module/GDUserInfoManager/GDUserInfoManager/UserInfo/GDUserCenter.swift
TealiveModule.xcworkspace/contents.xcworkspacedata
LocalPodSpec/GDRouter/GDRouter/Classes/Service/Module/GDTestRouter.swift
View file @
44ba1167
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
//
//
import
Foundation
import
Foundation
import
UIKit
/// 开发环境
/// 开发环境
public
enum
GDEnv
:
Int
{
public
enum
GDEnv
:
Int
{
...
@@ -21,9 +22,9 @@ public enum GDEnv: Int {
...
@@ -21,9 +22,9 @@ public enum GDEnv: Int {
// 不用这个
// 不用这个
@objc
public
protocol
GDTestRouter
{
@objc
public
protocol
GDTestRouter
{
}
}
public
protocol
GDTestSwiftRouter
:
GDTestRouter
{
public
protocol
GDTestSwiftRouter
:
GDTestRouter
{
var
env
:
GDEnv
{
get
}
var
env
:
GDEnv
{
get
}
func
envViewController
()
->
UIViewController
}
}
LocalPodSpec/GDRouter/GDRouter/Classes/Service/Module/GDUserManagerRouter.swift
View file @
44ba1167
...
@@ -8,6 +8,12 @@
...
@@ -8,6 +8,12 @@
import
UIKit
import
UIKit
import
GDToolBox
import
GDToolBox
public
struct
GDUserManagerPublicUDKey
{
// 历史用户信息
public
static
let
historyUserArray
=
"user_historyUserArray"
}
// 不用这个
// 不用这个
@objc
public
protocol
GDUserManagerRouter
{
@objc
public
protocol
GDUserManagerRouter
{
...
@@ -19,6 +25,81 @@ public protocol GDUserManagerSwiftRouter: GDUserManagerRouter {
...
@@ -19,6 +25,81 @@ public protocol GDUserManagerSwiftRouter: GDUserManagerRouter {
var
uid
:
String
?
{
get
}
var
uid
:
String
?
{
get
}
/// token
/// token
var
token
:
String
?
{
get
}
var
token
:
String
?
{
get
}
// 是否登录
var
isLogin
:
BehaviorRelay
<
Bool
>
{
get
}
var
autoLogin
:
Bool
{
get
}
/// 是否允许游客模式
var
visitorModeEnable
:
BehaviorRelay
<
Bool
>
{
get
}
/// 是否是游客模式
var
isVisitor
:
BehaviorRelay
<
Bool
>
{
get
}
// 用户数据
var
user
:
BehaviorRelay
<
GDUserModel
>
{
get
}
/// 是否显示位置
var
showLocation
:
BehaviorRelay
<
Bool
>
{
get
}
var
newRegisterUser
:
BehaviorRelay
<
Bool
>
{
get
}
/// 获取用户信息
func
getUserInfo
()
->
Single
<
Void
>
/// 手机账号密码登录
/// - Parameters:
/// - phone: 手机号码
/// - pwd: 密码
/// - Returns: 登录Single
func
login
(
phone
:
String
,
pwd
:
String
)
->
Single
<
Void
>
/// 验证码登录
/// - Parameters:
/// - phone: 手机号码
/// - verifyCode: 验证码
/// - Returns: Single Subject
func
login
(
phone
:
String
,
verifyCode
:
String
)
->
Single
<
Void
>
/// 秒验快捷登录
/// - Parameters:
/// - apptoken: apptoken
/// - optoken: optoken
/// - opName: 运营商名字
func
loginQuick
(
apptoken
:
String
,
optoken
:
String
,
opName
:
String
)
->
Single
<
Void
>
/// 执行自动登录
func
login
(
for
model
:
GDUserModel
,
completionHandler
:
((
Bool
)
->
Void
)?)
/// 执行自动登录
func
excuteAutoLogin
(
completionHandler
:
((
Bool
)
->
Void
)?)
/// 重置用户信息
func
refreshUserInfo
()
/// 执行登录成功后的操作
/// - Parameter completionHandler: 结果回调
func
excuteLogin
(
completionHandler
:
@escaping
(
Bool
,
Error
?)
->
Void
)
/// 验证当前是否允许游客模式
func
verifyShouldShowVisitorMode
()
/// 进入游客模式
func
visitorLogin
()
// MARK: - 用户资料存储
// 获取全部历史用户
func
getAllHistoryUser
()
->
Array
<
Dictionary
<
String
,
Any
>>
?
// 获取最新历史用户
func
getLatestHistoryUser
()
->
GDUserModel
?
/// 删除历史用户
func
removeLatestUser
()
// 查找历史用户
func
getHistoryUser
(
uid
:
String
)
->
GDUserModel
?
}
}
public
struct
GDUserModel
:
Convertable
{
public
struct
GDUserModel
:
Convertable
{
...
...
LocalPodSpec/GDToolBox/GDToolBox/Classes/Base/Base/BaseViewController.swift
View file @
44ba1167
...
@@ -325,7 +325,7 @@ open class BaseViewController: UIViewController {
...
@@ -325,7 +325,7 @@ open class BaseViewController: UIViewController {
}
}
// MARK: Utility
// MARK: Utility
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
if
endEditingWhenTouch
{
if
endEditingWhenTouch
{
self
.
view
.
endEditing
(
true
)
self
.
view
.
endEditing
(
true
)
...
...
LocalPodSpec/GDToolBox/GDToolBox/Classes/Foundation/Network/Basic/ErrorTracker.swift
View file @
44ba1167
...
@@ -10,7 +10,7 @@ import Foundation
...
@@ -10,7 +10,7 @@ import Foundation
import
RxSwift
import
RxSwift
import
RxCocoa
import
RxCocoa
public
final
class
ErrorTracker
:
SharedSequenceConvertibleType
{
public
final
class
ErrorTracker
:
NSObject
,
SharedSequenceConvertibleType
{
// MARK: Rx
// MARK: Rx
public
typealias
SharingStrategy
=
DriverSharingStrategy
public
typealias
SharingStrategy
=
DriverSharingStrategy
...
...
LocalPodSpec/GDToolBox/GDToolBox/Classes/GDConfiguration.swift
View file @
44ba1167
...
@@ -276,6 +276,6 @@ public struct GDSDK {
...
@@ -276,6 +276,6 @@ public struct GDSDK {
}
}
public
struct
ReviewInfo
{
public
struct
ReviewInfo
{
static
let
gd_phone
=
"13787777777"
public
static
let
gd_phone
=
"13787777777"
static
let
gd_uid
=
"27542549"
public
static
let
gd_uid
=
"27542549"
}
}
Module/GDLoginAndRegistModule/GDLoginAndRegistModule.xcodeproj/project.pbxproj
View file @
44ba1167
...
@@ -32,6 +32,9 @@
...
@@ -32,6 +32,9 @@
BE6F42B72B4900390058C826
/* GDBindPhoneView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE6F42A12B4900390058C826
/* GDBindPhoneView.swift */
;
};
BE6F42B72B4900390058C826
/* GDBindPhoneView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE6F42A12B4900390058C826
/* GDBindPhoneView.swift */
;
};
BEB7BBB42B490D9800B3D9B1
/* GDLoginWebUrl.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BEB7BBB32B490D9800B3D9B1
/* GDLoginWebUrl.swift */
;
};
BEB7BBB42B490D9800B3D9B1
/* GDLoginWebUrl.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BEB7BBB32B490D9800B3D9B1
/* GDLoginWebUrl.swift */
;
};
BEB7BBB92B4936B000B3D9B1
/* GDUserForgetPasswordController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BEB7BBB82B4936B000B3D9B1
/* GDUserForgetPasswordController.swift */
;
};
BEB7BBB92B4936B000B3D9B1
/* GDUserForgetPasswordController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BEB7BBB82B4936B000B3D9B1
/* GDUserForgetPasswordController.swift */
;
};
BEB7BC152B4BEC4B00B3D9B1
/* GDLoginHttpHelper.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BEB7BC122B4BEC4B00B3D9B1
/* GDLoginHttpHelper.swift */
;
};
BEB7BC162B4BEC4B00B3D9B1
/* GDLoginManagerProvider.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BEB7BC132B4BEC4B00B3D9B1
/* GDLoginManagerProvider.swift */
;
};
BEB7BC172B4BEC4B00B3D9B1
/* GDLoginManagerAPI.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BEB7BC142B4BEC4B00B3D9B1
/* GDLoginManagerAPI.swift */
;
};
/* End PBXBuildFile section */
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
...
@@ -64,6 +67,9 @@
...
@@ -64,6 +67,9 @@
BE6F42A12B4900390058C826
/* GDBindPhoneView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GDBindPhoneView.swift
;
sourceTree
=
"<group>"
;
};
BE6F42A12B4900390058C826
/* GDBindPhoneView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GDBindPhoneView.swift
;
sourceTree
=
"<group>"
;
};
BEB7BBB32B490D9800B3D9B1
/* GDLoginWebUrl.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GDLoginWebUrl.swift
;
sourceTree
=
"<group>"
;
};
BEB7BBB32B490D9800B3D9B1
/* GDLoginWebUrl.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GDLoginWebUrl.swift
;
sourceTree
=
"<group>"
;
};
BEB7BBB82B4936B000B3D9B1
/* GDUserForgetPasswordController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GDUserForgetPasswordController.swift
;
sourceTree
=
"<group>"
;
};
BEB7BBB82B4936B000B3D9B1
/* GDUserForgetPasswordController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GDUserForgetPasswordController.swift
;
sourceTree
=
"<group>"
;
};
BEB7BC122B4BEC4B00B3D9B1
/* GDLoginHttpHelper.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GDLoginHttpHelper.swift
;
sourceTree
=
"<group>"
;
};
BEB7BC132B4BEC4B00B3D9B1
/* GDLoginManagerProvider.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GDLoginManagerProvider.swift
;
sourceTree
=
"<group>"
;
};
BEB7BC142B4BEC4B00B3D9B1
/* GDLoginManagerAPI.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GDLoginManagerAPI.swift
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
/* Begin PBXFrameworksBuildPhase section */
...
@@ -136,6 +142,9 @@
...
@@ -136,6 +142,9 @@
BE6F422B2B48FD070058C826
/* Network */
=
{
BE6F422B2B48FD070058C826
/* Network */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
BEB7BC122B4BEC4B00B3D9B1
/* GDLoginHttpHelper.swift */
,
BEB7BC142B4BEC4B00B3D9B1
/* GDLoginManagerAPI.swift */
,
BEB7BC132B4BEC4B00B3D9B1
/* GDLoginManagerProvider.swift */
,
);
);
path
=
Network
;
path
=
Network
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -515,6 +524,7 @@
...
@@ -515,6 +524,7 @@
BE6F42B52B4900390058C826
/* LoginViewController.swift in Sources */
,
BE6F42B52B4900390058C826
/* LoginViewController.swift in Sources */
,
BE6F42B62B4900390058C826
/* GDBindPhoneViewModel.swift in Sources */
,
BE6F42B62B4900390058C826
/* GDBindPhoneViewModel.swift in Sources */
,
BE6F42AD2B4900390058C826
/* GDAgreementConfirmView.swift in Sources */
,
BE6F42AD2B4900390058C826
/* GDAgreementConfirmView.swift in Sources */
,
BEB7BC152B4BEC4B00B3D9B1
/* GDLoginHttpHelper.swift in Sources */
,
BE6F42B12B4900390058C826
/* LoginByVerificationCodeViewController.swift in Sources */
,
BE6F42B12B4900390058C826
/* LoginByVerificationCodeViewController.swift in Sources */
,
BE6F42A62B4900390058C826
/* GDIDCardImageAuthViewController.swift in Sources */
,
BE6F42A62B4900390058C826
/* GDIDCardImageAuthViewController.swift in Sources */
,
BEB7BBB92B4936B000B3D9B1
/* GDUserForgetPasswordController.swift in Sources */
,
BEB7BBB92B4936B000B3D9B1
/* GDUserForgetPasswordController.swift in Sources */
,
...
@@ -522,8 +532,10 @@
...
@@ -522,8 +532,10 @@
BE6F42B32B4900390058C826
/* LoginByPhoneWithPasswordViewController.swift in Sources */
,
BE6F42B32B4900390058C826
/* LoginByPhoneWithPasswordViewController.swift in Sources */
,
BE6F42B72B4900390058C826
/* GDBindPhoneView.swift in Sources */
,
BE6F42B72B4900390058C826
/* GDBindPhoneView.swift in Sources */
,
BE6F42A42B4900390058C826
/* GDRealNameAuthViewModel.swift in Sources */
,
BE6F42A42B4900390058C826
/* GDRealNameAuthViewModel.swift in Sources */
,
BEB7BC162B4BEC4B00B3D9B1
/* GDLoginManagerProvider.swift in Sources */
,
BE6F42AC2B4900390058C826
/* GDUserBindPhoneViewController.swift in Sources */
,
BE6F42AC2B4900390058C826
/* GDUserBindPhoneViewController.swift in Sources */
,
BE6F42A82B4900390058C826
/* GDRealNameAuthViewController.swift in Sources */
,
BE6F42A82B4900390058C826
/* GDRealNameAuthViewController.swift in Sources */
,
BEB7BC172B4BEC4B00B3D9B1
/* GDLoginManagerAPI.swift in Sources */
,
BE6F42A32B4900390058C826
/* GDHumanIdentifyModel.swift in Sources */
,
BE6F42A32B4900390058C826
/* GDHumanIdentifyModel.swift in Sources */
,
BE6F42A92B4900390058C826
/* GDUserBindPhoneViewModel.swift in Sources */
,
BE6F42A92B4900390058C826
/* GDUserBindPhoneViewModel.swift in Sources */
,
BE6F42A22B4900390058C826
/* GDHumanIdentifyView.swift in Sources */
,
BE6F42A22B4900390058C826
/* GDHumanIdentifyView.swift in Sources */
,
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Auth/View/GDRealNameAuthViewController.swift
View file @
44ba1167
...
@@ -219,7 +219,7 @@ class GDRealNameAuthViewController: BaseViewController {
...
@@ -219,7 +219,7 @@ class GDRealNameAuthViewController: BaseViewController {
})
.
disposed
(
by
:
disposeBag
)
})
.
disposed
(
by
:
disposeBag
)
viewModel
.
state
.
filter
{
$0
==
.
hadPhone
}
.
map
{
_
in
UserCenter
.
shared
.
user
.
value
.
phone
??
""
}
.
bind
(
to
:
phoneTextView
.
rx
.
text
)
.
disposed
(
by
:
disposeBag
)
viewModel
.
state
.
filter
{
$0
==
.
hadPhone
}
.
map
{
_
in
GDRouter
.
UserRouter
?
.
user
.
value
.
phone
??
""
}
.
bind
(
to
:
phoneTextView
.
rx
.
text
)
.
disposed
(
by
:
disposeBag
)
viewModel
.
state
.
subscribe
(
onNext
:
{[
weak
self
]
(
state
)
in
viewModel
.
state
.
subscribe
(
onNext
:
{[
weak
self
]
(
state
)
in
switch
state
{
switch
state
{
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Auth/ViewModel/GDIDCardImageAuthViewModel.swift
View file @
44ba1167
...
@@ -33,14 +33,14 @@ class GDIDCardImageAuthViewModel: BaseViewModel, ViewModelType {
...
@@ -33,14 +33,14 @@ class GDIDCardImageAuthViewModel: BaseViewModel, ViewModelType {
}
}
FTIndicator
.
showProgress
(
withMessage
:
""
)
FTIndicator
.
showProgress
(
withMessage
:
""
)
self
.
provider
.
realNameAuth
(
name
:
params
.
name
,
idNumber
:
params
.
idnumber
,
phone
:
params
.
phone
,
images
:
params
.
images
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
GDLoginHttpHelper
.
shared
.
realNameAuth
(
name
:
params
.
name
,
idNumber
:
params
.
idnumber
,
phone
:
params
.
phone
,
images
:
params
.
images
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
complete
.
onNext
(
true
)
complete
.
onNext
(
true
)
}
)
{
(
error
)
in
}
,
onFailure
:
{
(
error
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
guard
let
error
=
error
as?
MoyaError
else
{
return
}
guard
let
error
=
error
as?
MoyaError
else
{
return
}
FTIndicator
.
showToastMessage
(
error
.
msg
)
FTIndicator
.
showToastMessage
(
error
.
msg
)
}
.
disposed
(
by
:
self
.
disposeBag
)
}
)
.
disposed
(
by
:
self
.
disposeBag
)
})
.
disposed
(
by
:
disposeBag
)
})
.
disposed
(
by
:
disposeBag
)
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Auth/ViewModel/GDRealNameAuthViewModel.swift
View file @
44ba1167
...
@@ -10,6 +10,7 @@ import UIKit
...
@@ -10,6 +10,7 @@ import UIKit
import
RxSwift
import
RxSwift
import
RxCocoa
import
RxCocoa
import
GDToolBox
import
GDToolBox
import
GDRouter
enum
GDRealNameAuthState
:
Equatable
{
enum
GDRealNameAuthState
:
Equatable
{
case
noPhone
case
noPhone
...
@@ -25,24 +26,24 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
...
@@ -25,24 +26,24 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
override
init
()
{
override
init
()
{
super
.
init
()
super
.
init
()
UserCenter
.
shared
.
getUserInfo
()
.
subscribe
{
(
_
)
in
GDRouter
.
UserRouter
?
.
getUserInfo
()
.
subscribe
{
(
_
)
in
if
let
phone
=
UserCenter
.
shared
.
user
.
value
.
phone
{
if
let
phone
=
GDRouter
.
UserRouter
?
.
user
.
value
.
phone
{
if
phone
.
count
>
0
{
if
phone
.
count
>
0
{
if
self
.
state
.
value
==
.
no
ne
||
self
.
state
.
value
==
.
no
Phone
{
if
self
.
state
.
value
==
.
noPhone
{
self
.
state
.
accept
(
.
hadPhone
)
self
.
state
.
accept
(
.
hadPhone
)
}
}
}
}
}
}
}
on
Error
:
{
(
_
)
in
}
on
Failure
:
{
(
_
)
in
}
.
disposed
(
by
:
disposeBag
)
}
.
disposed
(
by
:
disposeBag
)
// 校验是否有手机号码绑定
// 校验是否有手机号码绑定
UserCenter
.
shared
.
user
.
map
{
$0
.
phone
}
.
subscribe
(
onNext
:
{[
weak
self
]
(
phone
)
in
GDRouter
.
UserRouter
?
.
user
.
map
{
$0
.
phone
}
.
subscribe
(
onNext
:
{[
weak
self
]
(
phone
)
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
if
phone
?
.
count
??
0
>
0
{
if
phone
?
.
count
??
0
>
0
{
if
self
.
state
.
value
==
.
no
ne
||
self
.
state
.
value
==
.
no
Phone
{
if
self
.
state
.
value
==
.
noPhone
{
self
.
state
.
accept
(
.
hadPhone
)
self
.
state
.
accept
(
.
hadPhone
)
}
}
}
}
...
@@ -66,11 +67,11 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
...
@@ -66,11 +67,11 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
input
.
verifyCodeAction
.
drive
(
onNext
:
{[
weak
self
]
(
phone
)
in
input
.
verifyCodeAction
.
drive
(
onNext
:
{[
weak
self
]
(
phone
)
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
err
=
ErrorTracker
()
let
err
=
ErrorTracker
()
self
.
provider
.
getManulRealNameAuthVerifyCode
(
phone
:
phone
)
.
trackError
(
err
)
.
subscribe
(
onNext
:
{
(
json
)
in
GDLoginHttpHelper
.
shared
.
getManulRealNameAuthVerifyCode
(
phone
:
phone
)
.
trackError
(
err
)
.
subscribe
(
onNext
:
{
(
json
)
in
countDown
.
accept
(
60
)
countDown
.
accept
(
60
)
Observable
<
Int
>.
interval
(
1
,
scheduler
:
MainScheduler
.
instance
)
Observable
<
Int
>.
interval
(
.
milliseconds
(
1
)
,
scheduler
:
MainScheduler
.
instance
)
.
take
While
{
_
in
countDown
.
value
>
0
}
.
take
(
while
:
{
_
in
countDown
.
value
>
0
})
.
map
{
_
in
countDown
.
value
-
1
}
.
map
{
_
in
countDown
.
value
-
1
}
.
bind
(
to
:
countDown
)
.
bind
(
to
:
countDown
)
.
disposed
(
by
:
self
.
disposeBag
)
.
disposed
(
by
:
self
.
disposeBag
)
...
@@ -117,7 +118,7 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
...
@@ -117,7 +118,7 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
break
break
}
}
self
.
provider
.
checkRealNameAuthParams
(
name
:
params
.
name
,
idNumber
:
params
.
idNumber
,
phone
:
params
.
phone
,
verifyCode
:
params
.
verifyCode
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
GDLoginHttpHelper
.
shared
.
checkRealNameAuthParams
(
name
:
params
.
name
,
idNumber
:
params
.
idNumber
,
phone
:
params
.
phone
,
verifyCode
:
params
.
verifyCode
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
isCommiting
=
false
isCommiting
=
false
switch
self
.
state
.
value
{
switch
self
.
state
.
value
{
case
.
hadPhone
,
.
hadPhoneReady
:
case
.
hadPhone
,
.
hadPhoneReady
:
...
@@ -126,7 +127,7 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
...
@@ -126,7 +127,7 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
self
.
state
.
accept
(
.
noPhoneReady
(
name
:
params
.
name
,
id
:
params
.
idNumber
,
phone
:
params
.
phone
))
self
.
state
.
accept
(
.
noPhoneReady
(
name
:
params
.
name
,
id
:
params
.
idNumber
,
phone
:
params
.
phone
))
}
}
}
)
{
(
error
)
in
}
,
onFailure
:
{
(
error
)
in
isCommiting
=
false
isCommiting
=
false
guard
let
error
=
error
as?
MoyaError
else
{
return
}
guard
let
error
=
error
as?
MoyaError
else
{
return
}
if
error
.
code
==
-
37
{
if
error
.
code
==
-
37
{
...
@@ -141,7 +142,7 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
...
@@ -141,7 +142,7 @@ class GDRealNameAuthViewModel: BaseViewModel, ViewModelType {
FTIndicator
.
showToastMessage
(
error
.
msg
)
FTIndicator
.
showToastMessage
(
error
.
msg
)
}
}
}
.
disposed
(
by
:
self
.
disposeBag
)
}
)
.
disposed
(
by
:
self
.
disposeBag
)
})
.
disposed
(
by
:
disposeBag
)
})
.
disposed
(
by
:
disposeBag
)
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/BindPhone/ViewModel/GDBindPhoneViewModel.swift
View file @
44ba1167
...
@@ -57,13 +57,13 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -57,13 +57,13 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
return
return
}
}
self
.
provider
.
bindPhone
(
with
:
data
.
phone
,
veirfyCode
:
data
.
verifyCode
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
GDLoginHttpHelper
.
shared
.
bindPhone
(
with
:
data
.
phone
,
veirfyCode
:
data
.
verifyCode
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
FTIndicator
.
showToastMessage
(
"手机号绑定成功"
)
FTIndicator
.
showToastMessage
(
"手机号绑定成功"
)
success
.
onNext
(
true
)
success
.
onNext
(
true
)
}
)
{
(
error
)
in
}
,
onFailure
:
{
(
error
)
in
guard
let
error
=
error
as?
MoyaError
else
{
return
}
guard
let
error
=
error
as?
MoyaError
else
{
return
}
FTIndicator
.
showToastMessage
(
error
.
msg
)
FTIndicator
.
showToastMessage
(
error
.
msg
)
}
.
disposed
(
by
:
self
.
disposeBag
)
}
)
.
disposed
(
by
:
self
.
disposeBag
)
})
.
disposed
(
by
:
disposeBag
)
})
.
disposed
(
by
:
disposeBag
)
return
Output
(
success
:
success
,
verifyCodeCountDown
:
countDown
.
asDriver
())
return
Output
(
success
:
success
,
verifyCodeCountDown
:
countDown
.
asDriver
())
...
@@ -77,7 +77,7 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -77,7 +77,7 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
private
func
getVerifyCode
(
phone
:
String
)
{
private
func
getVerifyCode
(
phone
:
String
)
{
guard
verifyCodeRequesting
==
false
else
{
return
}
guard
verifyCodeRequesting
==
false
else
{
return
}
verifyCodeRequesting
=
true
verifyCodeRequesting
=
true
provider
.
getBindPhoneVerifyCode
(
phone
:
phone
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
(
_
)
in
GDLoginHttpHelper
.
shared
.
getBindPhoneVerifyCode
(
phone
:
phone
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
(
_
)
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
delay
(
1
)
{[
weak
self
]
in
delay
(
1
)
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -87,13 +87,13 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -87,13 +87,13 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
// 开始倒计时
// 开始倒计时
self
.
countDown
.
accept
(
60
)
self
.
countDown
.
accept
(
60
)
Observable
<
Int
>.
interval
(
1
,
scheduler
:
MainScheduler
.
instance
)
Observable
<
Int
>.
interval
(
.
milliseconds
(
1000
)
,
scheduler
:
MainScheduler
.
instance
)
.
take
While
{
_
in
self
.
countDown
.
value
>
0
}
.
take
(
while
:
{
_
in
self
.
countDown
.
value
>
0
})
.
map
{
_
in
self
.
countDown
.
value
-
1
}
.
map
{
_
in
self
.
countDown
.
value
-
1
}
.
bind
(
to
:
self
.
countDown
)
.
bind
(
to
:
self
.
countDown
)
.
disposed
(
by
:
self
.
disposeBag
)
.
disposed
(
by
:
self
.
disposeBag
)
}
)
{
[
weak
self
]
(
error
)
in
}
,
onFailure
:
{
[
weak
self
]
(
error
)
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
delay
(
1
)
{[
weak
self
]
in
delay
(
1
)
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -105,7 +105,7 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -105,7 +105,7 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
}
}
if
error
.
code
==
-
74
{
if
error
.
code
==
-
74
{
// 需要人机验证
// 需要人机验证
self
.
provider
.
getHumanIdentifyData
(
with
:
phone
)
.
subscribe
{[
weak
self
]
(
model
)
in
GDLoginHttpHelper
.
shared
.
getHumanIdentifyData
(
with
:
phone
)
.
subscribe
{[
weak
self
]
(
model
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -121,14 +121,14 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -121,14 +121,14 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
// 开始倒计时
// 开始倒计时
self
.
countDown
.
accept
(
60
)
self
.
countDown
.
accept
(
60
)
Observable
<
Int
>.
interval
(
1
,
scheduler
:
MainScheduler
.
instance
)
Observable
<
Int
>.
interval
(
.
milliseconds
(
1000
)
,
scheduler
:
MainScheduler
.
instance
)
.
take
While
{
_
in
self
.
countDown
.
value
>
0
}
.
take
(
while
:
{
_
in
self
.
countDown
.
value
>
0
})
.
map
{
_
in
self
.
countDown
.
value
-
1
}
.
map
{
_
in
self
.
countDown
.
value
-
1
}
.
bind
(
to
:
self
.
countDown
)
.
bind
(
to
:
self
.
countDown
)
.
disposed
(
by
:
self
.
disposeBag
)
.
disposed
(
by
:
self
.
disposeBag
)
}
}
}
on
Error
:
{
(
error
)
in
}
on
Failure
:
{
(
error
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
guard
let
error
=
error
as?
MoyaError
else
{
guard
let
error
=
error
as?
MoyaError
else
{
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
...
@@ -140,7 +140,7 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -140,7 +140,7 @@ class GDBindPhoneViewModel: BaseViewModel, ViewModelType {
FTIndicator
.
showToastMessage
(
error
.
msg
)
FTIndicator
.
showToastMessage
(
error
.
msg
)
}
}
self
.
countDown
.
accept
(
0
)
self
.
countDown
.
accept
(
0
)
}
.
disposed
(
by
:
disposeBag
)
}
)
.
disposed
(
by
:
disposeBag
)
}
}
private
func
bindPhone
(
phone
:
String
,
verifyCode
:
String
)
{
private
func
bindPhone
(
phone
:
String
,
verifyCode
:
String
)
{
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Login/LoginViewController.swift
View file @
44ba1167
This diff is collapsed.
Click to expand it.
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Login/View/LoginByPhoneViewController/ForgetPassword/GDUserForgetPasswordController.swift
View file @
44ba1167
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
//
//
import
UIKit
import
UIKit
import
GDToolBox
import
GDRouter
class
GDUserForgetPasswordController
:
BaseViewController
{
class
GDUserForgetPasswordController
:
BaseViewController
{
...
@@ -331,7 +333,7 @@ class GDUserForgetPasswordController: BaseViewController {
...
@@ -331,7 +333,7 @@ class GDUserForgetPasswordController: BaseViewController {
guard
let
phone
=
self
.
phoneTextField
.
text
else
{
return
}
guard
let
phone
=
self
.
phoneTextField
.
text
else
{
return
}
guard
self
.
verifyCountDown
.
value
==
0
else
{
return
}
guard
self
.
verifyCountDown
.
value
==
0
else
{
return
}
FTIndicator
.
showProgress
(
withMessage
:
""
,
userInteractionEnable
:
false
)
FTIndicator
.
showProgress
(
withMessage
:
""
,
userInteractionEnable
:
false
)
Application
.
shared
.
provider
.
getForgetPasswordVerifyCode
(
phone
:
phone
)
.
subscribe
{[
weak
self
]
json
in
GDLoginHttpHelper
.
shared
.
getForgetPasswordVerifyCode
(
phone
:
phone
)
.
subscribe
{[
weak
self
]
json
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
self
?
.
verifyCountDown
.
accept
(
60
)
self
?
.
verifyCountDown
.
accept
(
60
)
...
@@ -345,7 +347,7 @@ class GDUserForgetPasswordController: BaseViewController {
...
@@ -345,7 +347,7 @@ class GDUserForgetPasswordController: BaseViewController {
}
}
},
repeats
:
true
)
},
repeats
:
true
)
}
on
Error
:
{
error
in
}
on
Failure
:
{
error
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
guard
let
error
=
error
as?
MoyaError
else
{
guard
let
error
=
error
as?
MoyaError
else
{
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
...
@@ -354,7 +356,7 @@ class GDUserForgetPasswordController: BaseViewController {
...
@@ -354,7 +356,7 @@ class GDUserForgetPasswordController: BaseViewController {
if
error
.
code
==
-
74
{
if
error
.
code
==
-
74
{
// 需要人机验证
// 需要人机验证
Application
.
shared
.
provider
.
getHumanIdentifyData
(
with
:
phone
)
.
subscribe
{[
weak
self
]
(
model
)
in
GDLoginHttpHelper
.
shared
.
getHumanIdentifyData
(
with
:
phone
)
.
subscribe
{[
weak
self
]
(
model
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -381,7 +383,7 @@ class GDUserForgetPasswordController: BaseViewController {
...
@@ -381,7 +383,7 @@ class GDUserForgetPasswordController: BaseViewController {
},
repeats
:
true
)
},
repeats
:
true
)
}
}
}
on
Error
:
{
(
error
)
in
}
on
Failure
:
{
(
error
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
guard
let
error
=
error
as?
MoyaError
else
{
guard
let
error
=
error
as?
MoyaError
else
{
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
...
@@ -415,11 +417,11 @@ class GDUserForgetPasswordController: BaseViewController {
...
@@ -415,11 +417,11 @@ class GDUserForgetPasswordController: BaseViewController {
}
}
Application
.
shared
.
provider
.
resetPassword
(
phone
:
phone
,
verifyCode
:
self
.
verifyCodeTextField
.
text
??
""
,
pwd
:
self
.
pwdTextField
.
text
??
""
)
.
subscribe
{
json
in
GDLoginHttpHelper
.
shared
.
resetPassword
(
phone
:
phone
,
verifyCode
:
self
.
verifyCodeTextField
.
text
??
""
,
pwd
:
self
.
pwdTextField
.
text
??
""
)
.
subscribe
{
json
in
FTIndicator
.
showToastMessage
(
"修改密码成功"
)
FTIndicator
.
showToastMessage
(
"修改密码成功"
)
UserCenter
.
shared
.
refreshUserInfo
()
GDRouter
.
UserRouter
?
.
refreshUserInfo
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
on
Error
:
{
error
in
}
on
Failure
:
{
error
in
guard
let
error
=
error
as?
MoyaError
else
{
guard
let
error
=
error
as?
MoyaError
else
{
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
return
return
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Login/View/LoginByPhoneViewController/LoginByPhoneWithPasswordViewController/LoginByPhoneWithPasswordViewController.swift
View file @
44ba1167
...
@@ -10,6 +10,7 @@ import UIKit
...
@@ -10,6 +10,7 @@ import UIKit
import
RxSwift
import
RxSwift
import
RxCocoa
import
RxCocoa
import
GDToolBox
import
GDToolBox
import
GDRouter
class
LoginByPhoneWithPasswordViewController
:
BaseViewController
{
class
LoginByPhoneWithPasswordViewController
:
BaseViewController
{
...
@@ -66,7 +67,7 @@ class LoginByPhoneWithPasswordViewController: BaseViewController {
...
@@ -66,7 +67,7 @@ class LoginByPhoneWithPasswordViewController: BaseViewController {
phoneTextField
.
clearButtonMode
=
.
whileEditing
phoneTextField
.
clearButtonMode
=
.
whileEditing
self
.
view
.
addSubview
(
phoneTextField
)
self
.
view
.
addSubview
(
phoneTextField
)
if
let
arr
:
Array
<
Dictionary
<
String
,
Any
>>
=
UserDefaults
.
standard
.
array
(
forKey
:
GDUser
Default
.
User
.
historyUserArray
)
as?
Array
<
Dictionary
<
String
,
Any
>>
{
if
let
arr
:
Array
<
Dictionary
<
String
,
Any
>>
=
UserDefaults
.
standard
.
array
(
forKey
:
GDUser
ManagerPublicUDKey
.
historyUserArray
)
as?
Array
<
Dictionary
<
String
,
Any
>>
{
if
let
latestUser
=
arr
.
first
{
if
let
latestUser
=
arr
.
first
{
phoneTextField
.
text
=
latestUser
[
"phone"
]
as?
String
phoneTextField
.
text
=
latestUser
[
"phone"
]
as?
String
}
}
...
@@ -254,14 +255,14 @@ class LoginByPhoneWithPasswordViewController: BaseViewController {
...
@@ -254,14 +255,14 @@ class LoginByPhoneWithPasswordViewController: BaseViewController {
// 开始登录
// 开始登录
FTIndicator
.
showProgress
(
withMessage
:
""
,
userInteractionEnable
:
false
)
FTIndicator
.
showProgress
(
withMessage
:
""
,
userInteractionEnable
:
false
)
UserCenter
.
shared
.
login
(
phone
:
phone
,
pwd
:
password
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
_
in
GDRouter
.
UserRouter
?
.
login
(
phone
:
phone
,
pwd
:
password
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
_
in
// 登录成功,无需操作
// 登录成功,无需操作
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
self
?
.
view
.
endEditing
(
true
)
self
?
.
view
.
endEditing
(
true
)
self
?
.
loginSuccessHandler
?()
self
?
.
loginSuccessHandler
?()
}
)
{
error
in
}
,
onFailure
:
{
error
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
// 登录失败
// 登录失败
if
let
error
=
error
as?
MoyaError
{
if
let
error
=
error
as?
MoyaError
{
...
@@ -270,17 +271,7 @@ class LoginByPhoneWithPasswordViewController: BaseViewController {
...
@@ -270,17 +271,7 @@ class LoginByPhoneWithPasswordViewController: BaseViewController {
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
}
}
// FIXME: 登录失败逻辑
})
.
disposed
(
by
:
disposeBag
)
// if let error = error as? MoyaError {
// switch error.code {
// case -10, -11:
//
// default:
// <#code#>
// }
// }
}
.
disposed
(
by
:
disposeBag
)
}
}
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Login/View/LoginByPhoneViewController/LoginByVerificationCodeViewController/LoginByVerificationCodeViewController.swift
View file @
44ba1167
...
@@ -10,6 +10,8 @@ import UIKit
...
@@ -10,6 +10,8 @@ import UIKit
import
RxSwift
import
RxSwift
import
RxCocoa
import
RxCocoa
import
GDToolBox
import
GDToolBox
import
GDRouter
import
SecVerify
class
LoginByVerificationCodeViewController
:
BaseViewController
{
class
LoginByVerificationCodeViewController
:
BaseViewController
{
...
@@ -338,7 +340,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -338,7 +340,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
}
}
// 不填入历史登录手机号码
// 不填入历史登录手机号码
// if let userData =
UserModel
.getLatestHistoryUser() {
// if let userData =
GDRouter.UserRouter?
.getLatestHistoryUser() {
// phoneTextField.text = userData.phone
// phoneTextField.text = userData.phone
// if userData.phone?.count == 11 && !self.verificationCodeIsSend {
// if userData.phone?.count == 11 && !self.verificationCodeIsSend {
// self.phoneValue.onNext(userData.phone!)
// self.phoneValue.onNext(userData.phone!)
...
@@ -351,7 +353,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -351,7 +353,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
// }
// }
// 审核账号处理
// 审核账号处理
phoneTextField
.
rx
.
text
.
orEmpty
.
map
{
$0
==
ReviewInfo
.
phone
}
.
distinctUntilChanged
()
.
subscribe
(
onNext
:
{[
weak
self
]
(
isReviewAccount
)
in
phoneTextField
.
rx
.
text
.
orEmpty
.
map
{
$0
==
ReviewInfo
.
gd_
phone
}
.
distinctUntilChanged
()
.
subscribe
(
onNext
:
{[
weak
self
]
(
isReviewAccount
)
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
if
isReviewAccount
{
if
isReviewAccount
{
self
.
verificationCodeTextField
.
textMaxLength
=
0
self
.
verificationCodeTextField
.
textMaxLength
=
0
...
@@ -435,7 +437,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -435,7 +437,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
FTIndicator
.
showProgress
(
withMessage
:
""
)
FTIndicator
.
showProgress
(
withMessage
:
""
)
let
phone
=
phoneTextField
.
text
??
""
let
phone
=
phoneTextField
.
text
??
""
// 获取验证码
// 获取验证码
Application
.
shared
.
provider
.
requestLoginVerifyCode
(
phone
:
phone
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
response
in
GDLoginHttpHelper
.
shared
.
requestLoginVerifyCode
(
phone
:
phone
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
response
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
delay
(
1
)
{[
weak
self
]
in
delay
(
1
)
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -444,7 +446,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -444,7 +446,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
self
.
verificationCodeSendSuccess
()
self
.
verificationCodeSendSuccess
()
}
)
{
[
weak
self
]
(
error
)
in
}
,
onFailure
:
{
[
weak
self
]
(
error
)
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
delay
(
1
)
{[
weak
self
]
in
delay
(
1
)
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -472,16 +474,16 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -472,16 +474,16 @@ class LoginByVerificationCodeViewController: BaseViewController {
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
}
}
}
.
disposed
(
by
:
disposeBag
)
}
)
.
disposed
(
by
:
disposeBag
)
}
}
// 验证码发送成功
// 验证码发送成功
func
verificationCodeSendSuccess
()
{
func
verificationCodeSendSuccess
()
{
self
.
changeVerificationCodeBtn
(
status
:
false
)
self
.
changeVerificationCodeBtn
(
status
:
false
)
self
.
verificationCodeBtn
.
setTitle
(
"60s后重新获取"
,
for
:
.
normal
)
self
.
verificationCodeBtn
.
setTitle
(
"60s后重新获取"
,
for
:
.
normal
)
Observable
<
Int
>.
interval
(
1
,
scheduler
:
MainScheduler
.
instance
)
.
takeWhile
{
(
event
)
->
Bool
in
Observable
<
Int
>.
interval
(
.
milliseconds
(
1000
),
scheduler
:
MainScheduler
.
instance
)
.
take
(
while
:
{
event
in
!
(
event
==
59
)
!
(
event
==
59
)
}
.
subscribe
(
onNext
:
{
[
weak
self
]
(
event
)
in
}
)
.
subscribe
(
onNext
:
{
[
weak
self
]
(
event
)
in
self
?
.
verificationCodeBtn
.
setTitle
(
"
\(
60
-
(
event
+
1
)
)
s后重新获取"
,
for
:
.
normal
)
self
?
.
verificationCodeBtn
.
setTitle
(
"
\(
60
-
(
event
+
1
)
)
s后重新获取"
,
for
:
.
normal
)
},
onCompleted
:
{
[
weak
self
]
in
},
onCompleted
:
{
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -517,19 +519,19 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -517,19 +519,19 @@ class LoginByVerificationCodeViewController: BaseViewController {
}
}
// 校验是否是苹果账号
// 校验是否是苹果账号
if
phone
==
ReviewInfo
.
phone
{
if
phone
==
ReviewInfo
.
gd_
phone
{
FTIndicator
.
showProgress
(
withMessage
:
""
,
userInteractionEnable
:
false
)
FTIndicator
.
showProgress
(
withMessage
:
""
,
userInteractionEnable
:
false
)
UserCenter
.
shared
.
login
(
phone
:
ReviewInfo
.
phone
,
pwd
:
verificationCodeTextField
.
text
??
""
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
(
_
)
in
GDRouter
.
UserRouter
?
.
login
(
phone
:
ReviewInfo
.
gd_
phone
,
pwd
:
verificationCodeTextField
.
text
??
""
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
(
_
)
in
// 登录成功,无需操作
// 登录成功,无需操作
self
?
.
view
.
endEditing
(
true
)
self
?
.
view
.
endEditing
(
true
)
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
}
)
{
error
in
}
,
onFailure
:
{
error
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
// 登录失败
// 登录失败
if
let
error
=
error
as?
MoyaError
{
if
let
error
=
error
as?
MoyaError
{
FTIndicator
.
showToastMessage
(
error
.
msg
)
FTIndicator
.
showToastMessage
(
error
.
msg
)
}
}
}
.
disposed
(
by
:
disposeBag
)
}
)
.
disposed
(
by
:
disposeBag
)
return
return
}
}
...
@@ -538,12 +540,12 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -538,12 +540,12 @@ class LoginByVerificationCodeViewController: BaseViewController {
// 开始登录
// 开始登录
FTIndicator
.
showProgress
(
withMessage
:
""
,
userInteractionEnable
:
false
)
FTIndicator
.
showProgress
(
withMessage
:
""
,
userInteractionEnable
:
false
)
UserCenter
.
shared
.
login
(
phone
:
phone
,
verifyCode
:
verificationCode
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
_
in
GDRouter
.
UserRouter
?
.
login
(
phone
:
phone
,
verifyCode
:
verificationCode
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
_
in
// 登录成功,无需操作
// 登录成功,无需操作
self
?
.
view
.
endEditing
(
true
)
self
?
.
view
.
endEditing
(
true
)
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
SVSDKHyVerify
.
finishLoginVc
(
animated
:
false
,
completion
:
nil
)
SVSDKHyVerify
.
finishLoginVc
(
animated
:
false
,
completion
:
nil
)
}
)
{
error
in
}
,
onFailure
:
{
error
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
// 登录失败
// 登录失败
if
let
error
=
error
as?
MoyaError
{
if
let
error
=
error
as?
MoyaError
{
...
@@ -560,7 +562,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -560,7 +562,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
}
else
{
}
else
{
FTIndicator
.
showToastMessage
(
"未知错误"
)
FTIndicator
.
showToastMessage
(
"未知错误"
)
}
}
}
.
disposed
(
by
:
disposeBag
)
}
)
.
disposed
(
by
:
disposeBag
)
}
}
...
@@ -574,7 +576,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -574,7 +576,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
/// 开启人机验证
/// 开启人机验证
func
excuteHumanIdentify
(
with
phone
:
String
)
{
func
excuteHumanIdentify
(
with
phone
:
String
)
{
Application
.
shared
.
provider
.
getHumanIdentifyData
(
with
:
phone
)
.
subscribe
{[
weak
self
]
(
model
)
in
GDLoginHttpHelper
.
shared
.
getHumanIdentifyData
(
with
:
phone
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
(
model
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -590,7 +592,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -590,7 +592,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
self
.
verificationCodeSendSuccess
()
self
.
verificationCodeSendSuccess
()
}
}
}
onError
:
{[
weak
self
]
(
error
)
in
}
,
onFailure
:
{[
weak
self
]
(
error
)
in
delay
(
1
)
{[
weak
self
]
in
delay
(
1
)
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
verifyCodeRequesting
=
false
self
.
verifyCodeRequesting
=
false
...
@@ -601,7 +603,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
...
@@ -601,7 +603,7 @@ class LoginByVerificationCodeViewController: BaseViewController {
return
return
}
}
FTIndicator
.
showToastMessage
(
error
.
msg
)
FTIndicator
.
showToastMessage
(
error
.
msg
)
}
.
disposed
(
by
:
disposeBag
)
}
)
.
disposed
(
by
:
disposeBag
)
}
}
deinit
{
deinit
{
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Register/View/GDUserBindPhoneViewController.swift
View file @
44ba1167
...
@@ -67,8 +67,8 @@ class GDUserBindPhoneViewController: BaseViewController {
...
@@ -67,8 +67,8 @@ class GDUserBindPhoneViewController: BaseViewController {
skipBtn
.
setTitleColor
(
.
black
,
for
:
.
normal
)
skipBtn
.
setTitleColor
(
.
black
,
for
:
.
normal
)
skipBtn
.
rx
.
tap
.
subscribe
(
onNext
:
{
(
_
)
in
skipBtn
.
rx
.
tap
.
subscribe
(
onNext
:
{
(
_
)
in
GDStatistics
.
track
(
.
bindPhoneSkip
)
GDStatistics
.
track
(
.
bindPhoneSkip
)
UserCenter
.
shared
.
newRegisterUser
.
accept
(
true
)
GDRouter
.
UserRouter
?
.
newRegisterUser
.
accept
(
true
)
UserCenter
.
shared
.
excuteLogin
{
(
success
,
error
)
in
GDRouter
.
UserRouter
?
.
excuteLogin
{
(
success
,
error
)
in
if
!
success
{
if
!
success
{
FTIndicator
.
showToastMessage
(
"登录失败"
)
FTIndicator
.
showToastMessage
(
"登录失败"
)
}
}
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Register/View/GDUserRegisterInfoController.swift
View file @
44ba1167
...
@@ -11,6 +11,7 @@ import RxCocoa
...
@@ -11,6 +11,7 @@ import RxCocoa
import
RxSwift
import
RxSwift
import
Kingfisher
import
Kingfisher
import
GDToolBox
import
GDToolBox
import
SecVerify
class
GDUserRegisterInfoController
:
BaseViewController
{
class
GDUserRegisterInfoController
:
BaseViewController
{
...
@@ -411,7 +412,7 @@ class GDUserRegisterInfoController: BaseViewController {
...
@@ -411,7 +412,7 @@ class GDUserRegisterInfoController: BaseViewController {
faceImage
:
faceImage
,
faceImage
:
faceImage
,
gender
:
gender
.
string
,
gender
:
gender
.
string
,
platName
:
name
,
platName
:
name
,
touristfrom
:
UserCenter
.
shared
.
visitorRegisterFrom
?
.
rawValue
,
touristfrom
:
GDRouter
.
UserRouter
?
.
visitorRegisterFrom
?
.
rawValue
,
platFacePath
:
facepath
)
platFacePath
:
facepath
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
.
subscribe
(
onSuccess
:
{
(
json
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
...
@@ -424,7 +425,7 @@ class GDUserRegisterInfoController: BaseViewController {
...
@@ -424,7 +425,7 @@ class GDUserRegisterInfoController: BaseViewController {
if
let
loginHandler
=
self
.
loginHandler
{
if
let
loginHandler
=
self
.
loginHandler
{
// 有登陆回调处理,直接登录
// 有登陆回调处理,直接登录
UserCenter
.
shared
.
excuteLogin
{
(
success
,
error
)
in
GDRouter
.
UserRouter
?
.
excuteLogin
{
(
success
,
error
)
in
loginHandler
()
loginHandler
()
}
}
}
else
{
}
else
{
...
@@ -452,7 +453,7 @@ class GDUserRegisterInfoController: BaseViewController {
...
@@ -452,7 +453,7 @@ class GDUserRegisterInfoController: BaseViewController {
if
let
token
=
platUserInfo
?[
GDSocialLoginInfoKey
.
appleToken
]
as?
String
{
if
let
token
=
platUserInfo
?[
GDSocialLoginInfoKey
.
appleToken
]
as?
String
{
// token 不能为空
// token 不能为空
FTIndicator
.
showProgress
(
withMessage
:
nil
,
userInteractionEnable
:
false
)
FTIndicator
.
showProgress
(
withMessage
:
nil
,
userInteractionEnable
:
false
)
viewModel
.
provider
.
appleRegister
(
token
:
token
,
nickname
:
nickname
,
faceImage
:
faceImage
,
gender
:
gender
.
string
,
platName
:
name
,
platFacePath
:
facepath
,
touristfrom
:
UserCenter
.
shared
.
visitorRegisterFrom
?
.
rawValue
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
viewModel
.
provider
.
appleRegister
(
token
:
token
,
nickname
:
nickname
,
faceImage
:
faceImage
,
gender
:
gender
.
string
,
platName
:
name
,
platFacePath
:
facepath
,
touristfrom
:
GDRouter
.
UserRouter
?
.
visitorRegisterFrom
?
.
rawValue
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
// 保存登录信息
// 保存登录信息
let
uid
=
json
[
"uid"
]
.
stringValue
let
uid
=
json
[
"uid"
]
.
stringValue
...
@@ -461,7 +462,7 @@ class GDUserRegisterInfoController: BaseViewController {
...
@@ -461,7 +462,7 @@ class GDUserRegisterInfoController: BaseViewController {
UserCenter
.
reduce
(
action
:
.
login
(
uuid
:
""
,
pwd
:
""
,
phone
:
""
,
uid
:
uid
,
token
:
token
))
UserCenter
.
reduce
(
action
:
.
login
(
uuid
:
""
,
pwd
:
""
,
phone
:
""
,
uid
:
uid
,
token
:
token
))
if
let
loginHandler
=
self
.
loginHandler
{
if
let
loginHandler
=
self
.
loginHandler
{
UserCenter
.
shared
.
excuteLogin
{
(
success
,
error
)
in
GDRouter
.
UserRouter
?
.
excuteLogin
{
(
success
,
error
)
in
loginHandler
()
loginHandler
()
}
}
}
else
{
}
else
{
...
@@ -485,7 +486,7 @@ class GDUserRegisterInfoController: BaseViewController {
...
@@ -485,7 +486,7 @@ class GDUserRegisterInfoController: BaseViewController {
/// 秒验注册
/// 秒验注册
private
func
commitQuickRegisterInfo
()
{
private
func
commitQuickRegisterInfo
()
{
// 秒验
// 秒验
UserCenter
.
shared
.
registerQuick
(
apptoken
:
apptoken
??
""
,
optoken
:
optoken
??
""
,
opName
:
opName
??
""
,
faceImage
:
faceImage
,
nickname
:
nickname
,
sex
:
gender
)
.
subscribe
(
onSuccess
:
{
(
_
)
in
GDRouter
.
UserRouter
?
.
registerQuick
(
apptoken
:
apptoken
??
""
,
optoken
:
optoken
??
""
,
opName
:
opName
??
""
,
faceImage
:
faceImage
,
nickname
:
nickname
,
sex
:
gender
)
.
subscribe
(
onSuccess
:
{
(
_
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
// 已经注册用户,完善用户资料,转跳到选择性别界面
// 已经注册用户,完善用户资料,转跳到选择性别界面
// 完成后需要dismiss
// 完成后需要dismiss
...
@@ -514,7 +515,7 @@ class GDUserRegisterInfoController: BaseViewController {
...
@@ -514,7 +515,7 @@ class GDUserRegisterInfoController: BaseViewController {
}
}
FTIndicator
.
showProgress
(
withMessage
:
nil
)
FTIndicator
.
showProgress
(
withMessage
:
nil
)
UserCenter
.
shared
.
registerVerifyCode
(
phone
:
phone
,
verifyCode
:
verifyCode
,
faceImage
:
faceImage
,
nickname
:
nickname
,
sex
:
gender
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
(
_
)
in
GDRouter
.
UserRouter
?
.
registerVerifyCode
(
phone
:
phone
,
verifyCode
:
verifyCode
,
faceImage
:
faceImage
,
nickname
:
nickname
,
sex
:
gender
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
(
_
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
self
?
.
loginHandler
?()
self
?
.
loginHandler
?()
...
...
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Features/Register/ViewModel/GDUserBindPhoneViewModel.swift
View file @
44ba1167
...
@@ -10,6 +10,7 @@ import UIKit
...
@@ -10,6 +10,7 @@ import UIKit
import
RxCocoa
import
RxCocoa
import
RxSwift
import
RxSwift
import
GDToolBox
import
GDToolBox
import
GDRouter
enum
BindPhoneType
{
enum
BindPhoneType
{
case
socialPlatRegister
case
socialPlatRegister
...
@@ -58,7 +59,7 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -58,7 +59,7 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
guard
verifyCodeRequesting
==
false
else
{
return
}
guard
verifyCodeRequesting
==
false
else
{
return
}
verifyCodeRequesting
=
true
verifyCodeRequesting
=
true
GDStatistics
.
track
(
.
bindPhoneGetVerifyCode
)
GDStatistics
.
track
(
.
bindPhoneGetVerifyCode
)
provider
.
getBindPhoneVerifyCode
(
phone
:
phone
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
(
_
)
in
GDLoginHttpHelper
.
shared
.
getBindPhoneVerifyCode
(
phone
:
phone
)
.
subscribe
(
onSuccess
:
{[
weak
self
]
(
_
)
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
delay
(
1
)
{[
weak
self
]
in
delay
(
1
)
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
...
@@ -67,10 +68,12 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -67,10 +68,12 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
// 启动计时器
// 启动计时器
self
.
countDown
.
accept
(
60
)
self
.
countDown
.
accept
(
60
)
Observable
<
Int
>.
interval
(
1
,
scheduler
:
MainScheduler
.
instance
)
.
takeWhile
{
(
num
)
->
Bool
in
Observable
<
Int
>.
interval
(
.
milliseconds
(
1000
),
scheduler
:
MainScheduler
.
instance
)
return
self
.
countDown
.
value
>
0
.
take
(
while
:
{
_
in
}
.
map
{
_
in
self
.
countDown
.
value
-
1
}
.
bind
(
to
:
self
.
countDown
)
.
disposed
(
by
:
self
.
disposeBag
)
return
self
.
countDown
.
value
>
0
})
{[
weak
self
]
(
error
)
in
})
.
map
{
_
in
self
.
countDown
.
value
-
1
}
.
bind
(
to
:
self
.
countDown
)
.
disposed
(
by
:
self
.
disposeBag
)
},
onFailure
:
{
[
weak
self
]
(
error
)
in
delay
(
1
)
{[
weak
self
]
in
delay
(
1
)
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
verifyCodeRequesting
=
false
self
.
verifyCodeRequesting
=
false
...
@@ -87,7 +90,7 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -87,7 +90,7 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
}
else
{
}
else
{
FTIndicator
.
showToastMessage
(
error
.
msg
)
FTIndicator
.
showToastMessage
(
error
.
msg
)
}
}
}
.
disposed
(
by
:
disposeBag
)
}
)
.
disposed
(
by
:
disposeBag
)
}
}
...
@@ -107,11 +110,11 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -107,11 +110,11 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
GDStatistics
.
track
(
.
bindPhoneBindAction
)
GDStatistics
.
track
(
.
bindPhoneBindAction
)
FTIndicator
.
showProgress
(
withMessage
:
nil
)
FTIndicator
.
showProgress
(
withMessage
:
nil
)
provider
.
bindPhone
(
with
:
phone
,
veirfyCode
:
verifyCode
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
GDLoginHttpHelper
.
shared
.
bindPhone
(
with
:
phone
,
veirfyCode
:
verifyCode
)
.
subscribe
(
onSuccess
:
{
(
json
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
if
self
.
bindPhoneType
==
.
socialPlatRegister
{
if
self
.
bindPhoneType
==
.
socialPlatRegister
{
UserCenter
.
shared
.
newRegisterUser
.
accept
(
true
)
GDRouter
.
UserRouter
?
.
newRegisterUser
.
accept
(
true
)
UserCenter
.
shared
.
excuteLogin
{
(
success
,
error
)
in
GDRouter
.
UserRouter
?
.
excuteLogin
{
(
success
,
error
)
in
if
!
success
{
if
!
success
{
FTIndicator
.
showToastMessage
(
"登录失败"
)
FTIndicator
.
showToastMessage
(
"登录失败"
)
completionHandler
(
false
)
completionHandler
(
false
)
...
@@ -123,18 +126,18 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -123,18 +126,18 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
completionHandler
(
true
)
completionHandler
(
true
)
}
}
}
)
{
(
error
)
in
}
,
onFailure
:
{
(
error
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
let
error
=
error
as!
MoyaError
let
error
=
error
as!
MoyaError
FTIndicator
.
showToastMessage
(
error
.
msg
)
FTIndicator
.
showToastMessage
(
error
.
msg
)
completionHandler
(
false
)
completionHandler
(
false
)
}
.
disposed
(
by
:
disposeBag
)
}
)
.
disposed
(
by
:
disposeBag
)
}
}
/// 开启人机验证
/// 开启人机验证
func
excuteHumanIdentify
(
with
phone
:
String
)
{
func
excuteHumanIdentify
(
with
phone
:
String
)
{
provider
.
getHumanIdentifyData
(
with
:
phone
)
.
subscribe
{
[
weak
self
]
(
model
)
in
GDLoginHttpHelper
.
shared
.
getHumanIdentifyData
(
with
:
phone
)
.
subscribe
(
onSuccess
:
{
[
weak
self
]
(
model
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
let
view
=
GDHumanIdentifyView
(
type
:
.
bindPhone
)
let
view
=
GDHumanIdentifyView
(
type
:
.
bindPhone
)
...
@@ -147,19 +150,19 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
...
@@ -147,19 +150,19 @@ class GDUserBindPhoneViewModel: BaseViewModel, ViewModelType {
view
.
successHandler
=
{[
weak
self
]
in
view
.
successHandler
=
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
countDown
.
accept
(
60
)
self
.
countDown
.
accept
(
60
)
Observable
<
Int
>.
interval
(
1
,
scheduler
:
MainScheduler
.
instance
)
.
takeWhile
{
(
num
)
->
Bool
in
Observable
<
Int
>.
interval
(
.
milliseconds
(
1000
),
scheduler
:
MainScheduler
.
instance
)
.
take
(
while
:
{
_
in
return
self
.
countDown
.
value
>
0
return
self
.
countDown
.
value
>
0
}
.
map
{
_
in
self
.
countDown
.
value
-
1
}
.
bind
(
to
:
self
.
countDown
)
.
disposed
(
by
:
self
.
disposeBag
)
}
)
.
map
{
_
in
self
.
countDown
.
value
-
1
}
.
bind
(
to
:
self
.
countDown
)
.
disposed
(
by
:
self
.
disposeBag
)
}
}
}
onError
:
{[
weak
self
]
(
error
)
in
}
,
onFailure
:
{
(
error
)
in
FTIndicator
.
dismissProgress
()
FTIndicator
.
dismissProgress
()
guard
let
error
=
error
as?
MoyaError
else
{
guard
let
error
=
error
as?
MoyaError
else
{
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
FTIndicator
.
showToastMessage
(
MoyaError
.
networkError
()
.
msg
)
return
return
}
}
FTIndicator
.
showToastMessage
(
error
.
msg
)
FTIndicator
.
showToastMessage
(
error
.
msg
)
}
.
disposed
(
by
:
disposeBag
)
}
)
.
disposed
(
by
:
disposeBag
)
}
}
}
}
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Network/GDLoginHttpHelper.swift
0 → 100644
View file @
44ba1167
//
// GDUserInfoHttpHelper.swift
// GDLogin
//
// Created by pierce on 2024/1/4.
//
import
Foundation
import
RxSwift
import
SwiftyJSON
import
GDToolBox
import
GDRouter
class
GDLoginHttpHelper
{
let
disposeBag
=
DisposeBag
()
let
loginProvider
=
GDLoginProvider
.
defaultNetworking
()
static
let
shared
=
GDLoginHttpHelper
()
func
getForgetPasswordVerifyCode
(
phone
:
String
)
->
Single
<
JSON
>
{
loginProvider
.
request
(
.
getForgetPasswordVerifyCode
(
phone
:
phone
))
.
mapToJSON
()
}
/// 获取人机验证图形验证码
/// - Parameter phone: 手机号码
/// - Returns:
func
getHumanIdentifyData
(
with
phone
:
String
)
->
Single
<
GDHumanIdentifyModel
>
{
loginProvider
.
request
(
.
getHumanIdentifyData
(
phone
:
phone
))
.
mapToModel
(
type
:
GDHumanIdentifyModel
.
self
)
}
/// 验证人机验证图形验证码
/// - Parameters:
/// - checkType: 短信类型
/// - data: 结果
/// - Returns:
func
verifyHumanIdentify
(
with
checkType
:
String
,
data
:
String
)
->
Single
<
JSON
>
{
loginProvider
.
request
(
.
verifyHumanIdentifyData
(
data
:
data
,
checkType
:
checkType
))
.
mapToJSON
()
}
/// 验证人机验证图形验证码
func
resetPassword
(
phone
:
String
,
verifyCode
:
String
,
pwd
:
String
)
->
Single
<
JSON
>
{
loginProvider
.
request
(
.
resetPassword
(
phone
:
phone
,
verifyCode
:
verifyCode
,
pwd
:
pwd
))
.
mapToJSON
()
}
/// 获取实名认证验证码
/// - Parameter phone: 手机号码
/// - Returns:
func
getManulRealNameAuthVerifyCode
(
phone
:
String
)
->
Single
<
JSON
>
{
return
loginProvider
.
request
(
.
manulRealNameAuthGetVerifyCode
(
phone
:
phone
))
.
mapToJSON
()
}
/// 校验实名认证参数
/// - Parameters:
/// - name: 真实姓名
/// - idNumber: 身份证号码
/// - phone: 电话号码
/// - verifyCode: 验证码
/// - Returns:
func
checkRealNameAuthParams
(
name
:
String
,
idNumber
:
String
,
phone
:
String
,
verifyCode
:
String
)
->
Single
<
JSON
>
{
return
loginProvider
.
request
(
.
checkRealNameAuthParams
(
realname
:
name
,
id
:
idNumber
,
phone
:
phone
,
verifyCode
:
verifyCode
))
.
mapToJSON
()
}
/// 实名认证
/// - Parameters:
/// - name: 姓名
/// - idNumber: 身份证号
/// - phone: 手机号码
/// - images: 图片数组
/// - Returns:
func
realNameAuth
(
name
:
String
,
idNumber
:
String
,
phone
:
String
,
images
:
[
UIImage
])
->
Single
<
JSON
>
{
return
loginProvider
.
request
(
.
realNameAuth
(
name
:
name
,
idNumber
:
idNumber
,
phone
:
phone
,
images
:
images
))
.
mapToJSON
()
}
/// 获取绑定手机的验证码
/// - Parameter phone: 手机号码
/// - Returns:
func
getBindPhoneVerifyCode
(
phone
:
String
)
->
Single
<
JSON
>
{
return
loginProvider
.
request
(
.
bingPhoneGetVerifyCode
(
phone
:
phone
))
.
mapToJSON
()
}
/// 绑定手机
/// - Parameters:
/// - phone: 手机号码
/// - veirfyCode: 验证码
/// - Returns:
func
bindPhone
(
with
phone
:
String
,
veirfyCode
:
String
)
->
Single
<
JSON
>
{
return
loginProvider
.
request
(
.
bindPhone
(
phone
:
phone
,
verifyCode
:
veirfyCode
))
.
mapToJSON
()
}
func
requestLoginVerifyCode
(
phone
:
String
)
->
Single
<
RequestResponse
>
{
return
loginProvider
.
request
(
.
loginGetVerifyCode
(
phone
:
phone
))
.
mapToRequestResponse
()
}
}
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Network/GDLoginManagerAPI.swift
0 → 100644
View file @
44ba1167
//
// GDToolBoxSetupAPI.swift
// GDToolBox
//
// Created by Jim Chan on 2022/12/13.
//
import
Foundation
import
Moya
import
GDRouter
import
GDToolBox
enum
GDLoginAPI
{
/// 获取忘记密码的验证码
case
getForgetPasswordVerifyCode
(
phone
:
String
)
/// 重设密码
case
resetPassword
(
phone
:
String
,
verifyCode
:
String
,
pwd
:
String
)
// 请求验证码登录的验证码
case
loginGetVerifyCode
(
phone
:
String
)
/// 获取人机验证图形验证码
case
getHumanIdentifyData
(
phone
:
String
)
/// 验证人机验证图形验证码
case
verifyHumanIdentifyData
(
data
:
String
,
checkType
:
String
)
// 实名认证
case
manulRealNameAuthGetVerifyCode
(
phone
:
String
)
// 实名认证参数校验
case
checkRealNameAuthParams
(
realname
:
String
,
id
:
String
,
phone
:
String
,
verifyCode
:
String
)
// 实名认证
case
realNameAuth
(
name
:
String
,
idNumber
:
String
,
phone
:
String
,
images
:
[
UIImage
])
// 第三方登录绑定手机时获取验证码
case
bingPhoneGetVerifyCode
(
phone
:
String
)
// 绑定手机
case
bindPhone
(
phone
:
String
,
verifyCode
:
String
)
}
extension
GDLoginAPI
:
TargetType
{
var
baseURL
:
URL
{
switch
self
{
case
.
verifyHumanIdentifyData
,
.
getHumanIdentifyData
:
return
URL
(
string
:
GDRouter
.
HostRouter
?
.
openapi
??
""
)
!
default
:
return
URL
(
string
:
GDRouter
.
HostRouter
?
.
apiAddress
??
""
)
??
URL
(
fileURLWithPath
:
""
)
}
}
var
path
:
String
{
switch
self
{
case
.
getForgetPasswordVerifyCode
:
return
"/account/user/findpwdcap.html"
case
.
getHumanIdentifyData
:
return
"/captcha/slide/get.html"
case
.
loginGetVerifyCode
:
return
"/account/user/logincap/v2.html"
case
.
verifyHumanIdentifyData
:
return
"/captcha/slide/check.html"
case
.
resetPassword
:
return
"/account/user/resetpassword.html"
case
.
manulRealNameAuthGetVerifyCode
:
return
"/user/obtainauthcode.html"
case
.
checkRealNameAuthParams
:
return
"/user/checksubinfo.html"
case
.
realNameAuth
:
return
"/user/rnanew.html"
case
.
bingPhoneGetVerifyCode
:
return
"/account/bindphone/getcap.html"
case
.
bindPhone
:
return
"/account/bindphone/bind.html"
}
}
var
parameters
:
[
String
:
Any
]
{
var
params
:
[
String
:
Any
]
=
GDRouter
.
HostRouter
?
.
genarateParames
([:])
??
[:]
switch
self
{
case
let
.
getForgetPasswordVerifyCode
(
phone
):
params
[
"phone"
]
=
phone
case
let
.
resetPassword
(
phone
,
verifyCode
,
pwd
):
params
[
"phone"
]
=
phone
params
[
"verifycode"
]
=
verifyCode
params
[
"password"
]
=
pwd
case
.
loginGetVerifyCode
(
let
phone
):
params
[
"phone"
]
=
phone
case
let
.
getHumanIdentifyData
(
phone
):
params
[
"phone"
]
=
phone
case
let
.
verifyHumanIdentifyData
(
data
,
checkType
):
params
[
"data"
]
=
data
params
[
"checktype"
]
=
checkType
case
.
manulRealNameAuthGetVerifyCode
(
let
phone
):
params
[
"phone"
]
=
phone
case
.
checkRealNameAuthParams
(
let
realname
,
let
id
,
let
phone
,
let
verifyCode
):
params
[
"realname"
]
=
realname
params
[
"idcard"
]
=
id
params
[
"phone"
]
=
phone
params
[
"yzauthcode"
]
=
verifyCode
case
.
realNameAuth
(
let
name
,
let
idNumber
,
let
phone
,
_
):
params
[
"realname"
]
=
name
params
[
"idnumber"
]
=
idNumber
params
[
"phone"
]
=
phone
case
.
bingPhoneGetVerifyCode
(
let
phone
):
params
[
"phone"
]
=
phone
case
.
bindPhone
(
let
phone
,
let
verifyCode
):
params
[
"phone"
]
=
phone
params
[
"verifycode"
]
=
verifyCode
default
:
break
;
}
return
params
}
var
parametersEncoding
:
ParameterEncoding
{
return
URLEncoding
.
httpBody
}
var
task
:
Task
{
switch
self
{
default
:
return
.
requestParameters
(
parameters
:
parameters
,
encoding
:
parametersEncoding
)
}
}
var
method
:
Moya
.
Method
{
.
post
}
var
headers
:
[
String
:
String
]?
{
nil
}
}
Module/GDLoginAndRegistModule/GDLoginAndRegistModule/Network/GDLoginManagerProvider.swift
0 → 100644
View file @
44ba1167
//
// GDToolBoxSetupProvider.swift
// GDToolBox
//
// Created by Jim Chan on 2022/12/13.
//
import
Foundation
import
Moya
import
GDToolBox
import
RxSwift
import
RxCocoa
struct
GDLoginProvider
:
NetServiceType
{
typealias
T
=
GDLoginAPI
var
provider
:
BaseProvider
<
T
>
static
func
defaultNetworking
()
->
GDLoginProvider
{
return
GDLoginProvider
(
provider
:
BaseProvider
<
T
>
())
}
func
request
(
_
token
:
T
,
retryTime
:
Int
=
0
)
->
Single
<
Moya
.
Response
>
{
provider
.
request
(
token
,
retryTime
:
retryTime
)
}
}
Module/GDSocialCenter/GDSocialCenter.xcodeproj/project.pbxproj
0 → 100644
View file @
44ba1167
This diff is collapsed.
Click to expand it.
Module/GDSocialCenter/GDSocialCenter/GDSocialCenter.h
0 → 100644
View file @
44ba1167
//
// GDSocialCenter.h
// GDSocialCenter
//
// Created by pierce on 2024/1/8.
//
#import <Foundation/Foundation.h>
//! Project version number for GDSocialCenter.
FOUNDATION_EXPORT
double
GDSocialCenterVersionNumber
;
//! Project version string for GDSocialCenter.
FOUNDATION_EXPORT
const
unsigned
char
GDSocialCenterVersionString
[];
// In this header, you should import all the public headers of your framework using statements like #import <GDSocialCenter/PublicHeader.h>
Module/GDTest/GDTest/Module/GDTestModule.swift
View file @
44ba1167
...
@@ -18,6 +18,9 @@ public class GDTestModule: NSObject, GDTestRouter {
...
@@ -18,6 +18,9 @@ public class GDTestModule: NSObject, GDTestRouter {
}
}
return
.
product
return
.
product
}
}
func
envViewController
()
->
UIViewController
{
GDEnvViewController
()
}
}
}
extension
GDTestModule
:
BifrostModuleProtocol
{
extension
GDTestModule
:
BifrostModuleProtocol
{
...
...
Module/GDUserInfoManager/GDUserInfoManager/GDUserManagerUDKey.swift
View file @
44ba1167
...
@@ -9,8 +9,6 @@ import Foundation
...
@@ -9,8 +9,6 @@ import Foundation
struct
GDUserManagerUDKey
{
struct
GDUserManagerUDKey
{
// 历史用户信息
static
let
historyUserArray
=
"user_historyUserArray"
/// 上一个登陆用户
/// 上一个登陆用户
static
let
lastUser
=
"lastUser"
static
let
lastUser
=
"lastUser"
// 自动登录
// 自动登录
...
...
Module/GDUserInfoManager/GDUserInfoManager/Module/GDUserInfoManagerModule.swift
View file @
44ba1167
...
@@ -10,21 +10,114 @@ import GDRouter
...
@@ -10,21 +10,114 @@ import GDRouter
import
GDToolBox
import
GDToolBox
import
Bifrost
import
Bifrost
@objc
public
class
GDUserInfoManagerModule
:
GDToolBoxUserCenterPlugin
,
GDUserManagerSwiftRouter
{
@objc
public
class
GDUserInfoManagerModule
:
NSObject
,
GDUserManagerSwiftRouter
{
public
override
var
uid
:
String
?
{
public
var
uid
:
String
?
{
GDUserCenter
.
shared
.
uid
GDUserCenter
.
shared
.
uid
}
}
public
override
var
token
:
String
?
{
public
var
token
:
String
?
{
GDUserCenter
.
shared
.
user
.
value
.
token
GDUserCenter
.
shared
.
user
.
value
.
token
}
}
open
override
var
isVisitor
:
Bool
{
GDUserCenter
.
shared
.
isVisitor
.
value
}
public
var
isLogin
:
BehaviorRelay
<
Bool
>
{
GDUserCenter
.
shared
.
isLogin
}
open
override
var
isUserLogin
:
Bool
{
GDUserCenter
.
shared
.
isLogin
.
value
}
open
override
var
nickname
:
String
?
{
GDUserCenter
.
shared
.
user
.
value
.
nickname
}
open
override
func
gd_userHadBeenKickOffline
()
{
public
var
autoLogin
:
Bool
{
GDUserCenter
.
autoLogin
}
GDUserCenter
.
shared
.
hadBeenKickOffline
()
public
var
visitorModeEnable
:
BehaviorRelay
<
Bool
>
{
GDUserCenter
.
shared
.
visitorModeEnable
}
public
var
isVisitor
:
BehaviorRelay
<
Bool
>
{
GDUserCenter
.
shared
.
isVisitor
}
public
var
user
:
BehaviorRelay
<
GDUserModel
>
{
GDUserCenter
.
shared
.
user
}
public
var
showLocation
:
BehaviorRelay
<
Bool
>
{
GDUserCenter
.
shared
.
showLocation
}
public
var
newRegisterUser
:
BehaviorRelay
<
Bool
>
{
GDUserCenter
.
shared
.
newRegisterUser
}
public
func
getUserInfo
()
->
Single
<
Void
>
{
GDUserCenter
.
shared
.
getUserInfo
()
}
/// 手机账号密码登录
/// - Parameters:
/// - phone: 手机号码
/// - pwd: 密码
/// - Returns: 登录Single
public
func
login
(
phone
:
String
,
pwd
:
String
)
->
Single
<
Void
>
{
GDUserCenter
.
shared
.
login
(
phone
:
phone
,
pwd
:
pwd
)
}
/// 验证码登录
/// - Parameters:
/// - phone: 手机号码
/// - verifyCode: 验证码
/// - Returns: Single Subject
public
func
login
(
phone
:
String
,
verifyCode
:
String
)
->
Single
<
Void
>
{
GDUserCenter
.
shared
.
login
(
phone
:
phone
,
verifyCode
:
verifyCode
)
}
/// 秒验快捷登录
/// - Parameters:
/// - apptoken: apptoken
/// - optoken: optoken
/// - opName: 运营商名字
public
func
loginQuick
(
apptoken
:
String
,
optoken
:
String
,
opName
:
String
)
->
Single
<
Void
>
{
GDUserCenter
.
shared
.
loginQuick
(
apptoken
:
apptoken
,
optoken
:
optoken
,
opName
:
opName
)
}
/// 执行自动登录
public
func
excuteAutoLogin
(
completionHandler
:
((
Bool
)
->
Void
)?)
{
GDUserCenter
.
shared
.
excuteAutoLogin
(
completionHandler
:
completionHandler
)
}
/// 重置用户信息
public
func
refreshUserInfo
()
{
GDUserCenter
.
shared
.
refreshUserInfo
()
}
/// 执行登录成功后的操作
/// - Parameter completionHandler: 结果回调
public
func
excuteLogin
(
completionHandler
:
@escaping
(
Bool
,
Error
?)
->
Void
)
{
GDUserCenter
.
shared
.
excuteLogin
(
completionHandler
:
completionHandler
)
}
/// 验证当前是否允许游客模式
public
func
verifyShouldShowVisitorMode
()
{
GDUserCenter
.
shared
.
verifyShouldShowVisitorMode
()
}
/// 进入游客模式
public
func
visitorLogin
()
{
GDUserCenter
.
shared
.
visitorLogin
()
}
// MARK: - 用户资料存储
// 获取全部历史用户
public
func
getAllHistoryUser
()
->
Array
<
Dictionary
<
String
,
Any
>>
?
{
GDUserModel
.
getAllHistoryUser
()
}
// 获取最新历史用户
public
func
getLatestHistoryUser
()
->
GDUserModel
?
{
GDUserModel
.
getLatestHistoryUser
()
}
/// 删除历史用户
public
func
removeLatestUser
()
{
GDUserModel
.
removeLatestUser
()
}
// 查找历史用户
public
func
getHistoryUser
(
uid
:
String
)
->
GDUserModel
?
{
GDUserModel
.
getHistoryUser
(
uid
:
uid
)
}
/// 执行自动登录
public
func
login
(
for
model
:
GDUserModel
,
completionHandler
:
((
Bool
)
->
Void
)?)
{
GDUserCenter
.
shared
.
login
(
for
:
model
,
completionHandler
:
completionHandler
)
}
}
}
}
...
@@ -48,7 +141,7 @@ extension GDUserInfoManagerModule: BifrostModuleProtocol {
...
@@ -48,7 +141,7 @@ extension GDUserInfoManagerModule: BifrostModuleProtocol {
}
}
public
func
setup
()
{
public
func
setup
()
{
GDToolBoxPlugins
.
shared
.
userPlugin
=
GDUserManagerPlugin
()
}
}
@objc
public
static
func
swiftLoad
()
{
@objc
public
static
func
swiftLoad
()
{
...
@@ -60,3 +153,22 @@ extension GDUserInfoManagerModule: BifrostModuleProtocol {
...
@@ -60,3 +153,22 @@ extension GDUserInfoManagerModule: BifrostModuleProtocol {
}
}
}
}
class
GDUserManagerPlugin
:
GDToolBoxUserCenterPlugin
{
public
override
var
uid
:
String
?
{
GDUserCenter
.
shared
.
uid
}
public
override
var
token
:
String
?
{
GDUserCenter
.
shared
.
user
.
value
.
token
}
open
override
var
isVisitor
:
Bool
{
GDUserCenter
.
shared
.
isVisitor
.
value
}
open
override
var
isUserLogin
:
Bool
{
GDUserCenter
.
shared
.
isLogin
.
value
}
open
override
var
nickname
:
String
?
{
GDUserCenter
.
shared
.
user
.
value
.
nickname
}
open
override
func
gd_userHadBeenKickOffline
()
{
GDUserCenter
.
shared
.
hadBeenKickOffline
()
}
}
Module/GDUserInfoManager/GDUserInfoManager/Network/GDUserInfoHttpHelper.swift
View file @
44ba1167
...
@@ -39,11 +39,6 @@ class GDUserInfoHttpHelper {
...
@@ -39,11 +39,6 @@ class GDUserInfoHttpHelper {
userProvider
.
request
(
.
visitorGetSocketInfo
)
.
mapToJSON
()
userProvider
.
request
(
.
visitorGetSocketInfo
)
.
mapToJSON
()
}
}
func
requestLoginVerifyCode
(
phone
:
String
)
->
Single
<
RequestResponse
>
{
return
userProvider
.
request
(
.
loginGetVerifyCode
(
phone
:
phone
))
.
mapToRequestResponse
()
}
func
syncUserInfo
()
->
Single
<
RequestResponse
>
{
func
syncUserInfo
()
->
Single
<
RequestResponse
>
{
return
userProvider
.
request
(
.
syncUserInfo
)
return
userProvider
.
request
(
.
syncUserInfo
)
.
mapToRequestResponse
()
.
mapToRequestResponse
()
...
...
Module/GDUserInfoManager/GDUserInfoManager/Network/GDUserInfoManagerAPI.swift
View file @
44ba1167
...
@@ -19,9 +19,7 @@ enum GDUserInfoManagerAPI {
...
@@ -19,9 +19,7 @@ enum GDUserInfoManagerAPI {
/// 游客模式获取socket信息
/// 游客模式获取socket信息
case
visitorGetSocketInfo
case
visitorGetSocketInfo
// 验证码登录
// 验证码登录
case
loginWithVerifyCode
(
phone
:
String
,
verificationCode
:
String
)
// 验证码登录
case
loginWithVerifyCode
(
phone
:
String
,
verificationCode
:
String
)
// 请求验证码登录的验证码
case
loginGetVerifyCode
(
phone
:
String
)
// 同步用户个人信息数据
// 同步用户个人信息数据
case
syncUserInfo
case
syncUserInfo
// 秒验快捷登录
// 秒验快捷登录
...
@@ -32,8 +30,6 @@ enum GDUserInfoManagerAPI {
...
@@ -32,8 +30,6 @@ enum GDUserInfoManagerAPI {
case
verifyCodeRegister
(
phone
:
String
,
verifycode
:
String
,
faceImage
:
UIImage
?,
nickname
:
String
,
sex
:
GDGender
,
shareid
:
String
?,
touristfrom
:
String
?)
case
verifyCodeRegister
(
phone
:
String
,
verifycode
:
String
,
faceImage
:
UIImage
?,
nickname
:
String
,
sex
:
GDGender
,
shareid
:
String
?,
touristfrom
:
String
?)
/// 获取密码登陆状态
/// 获取密码登陆状态
case
getStatusOfPwdLogin
case
getStatusOfPwdLogin
/// 获取忘记密码的验证码
case
getForgetPasswordVerifyCode
(
phone
:
String
)
// 获取城市代码
// 获取城市代码
case
getCityCode
(
coordinate
:
String
,
open
:
Bool
)
case
getCityCode
(
coordinate
:
String
,
open
:
Bool
)
// 修改昵称
// 修改昵称
...
@@ -52,8 +48,6 @@ extension GDUserInfoManagerAPI: TargetType {
...
@@ -52,8 +48,6 @@ extension GDUserInfoManagerAPI: TargetType {
switch
self
{
switch
self
{
case
.
login
:
case
.
login
:
return
"/account/user/login.html"
return
"/account/user/login.html"
case
.
loginGetVerifyCode
:
return
"/account/user/logincap/v2.html"
case
.
syncUserInfo
:
case
.
syncUserInfo
:
return
"/sync/me.html"
return
"/sync/me.html"
case
.
loginWithVerifyCode
:
case
.
loginWithVerifyCode
:
...
@@ -70,8 +64,6 @@ extension GDUserInfoManagerAPI: TargetType {
...
@@ -70,8 +64,6 @@ extension GDUserInfoManagerAPI: TargetType {
return
"/account/user/reg.html"
return
"/account/user/reg.html"
case
.
getStatusOfPwdLogin
:
case
.
getStatusOfPwdLogin
:
return
"/account/closePwdLoginStatus.html"
return
"/account/closePwdLoginStatus.html"
case
.
getForgetPasswordVerifyCode
:
return
"/account/user/findpwdcap.html"
case
.
getCityCode
:
case
.
getCityCode
:
return
"/room/getcitycode/v2.html"
return
"/room/getcitycode/v2.html"
case
.
updateNickname
:
case
.
updateNickname
:
...
@@ -85,8 +77,6 @@ extension GDUserInfoManagerAPI: TargetType {
...
@@ -85,8 +77,6 @@ extension GDUserInfoManagerAPI: TargetType {
case
.
login
(
let
phone
,
let
password
):
case
.
login
(
let
phone
,
let
password
):
params
[
"phone"
]
=
phone
params
[
"phone"
]
=
phone
params
[
"password"
]
=
password
params
[
"password"
]
=
password
case
.
loginGetVerifyCode
(
let
phone
):
params
[
"phone"
]
=
phone
case
.
loginWithVerifyCode
(
let
phone
,
let
verifyCode
):
case
.
loginWithVerifyCode
(
let
phone
,
let
verifyCode
):
params
[
"phone"
]
=
phone
params
[
"phone"
]
=
phone
params
[
"verifycode"
]
=
verifyCode
params
[
"verifycode"
]
=
verifyCode
...
@@ -119,8 +109,6 @@ extension GDUserInfoManagerAPI: TargetType {
...
@@ -119,8 +109,6 @@ extension GDUserInfoManagerAPI: TargetType {
if
let
touristfrom
=
touristfrom
{
if
let
touristfrom
=
touristfrom
{
params
[
"touristfrom"
]
=
touristfrom
params
[
"touristfrom"
]
=
touristfrom
}
}
case
let
.
getForgetPasswordVerifyCode
(
phone
):
params
[
"phone"
]
=
phone
case
.
getCityCode
(
let
coordinate
,
let
open
):
case
.
getCityCode
(
let
coordinate
,
let
open
):
params
[
"location"
]
=
coordinate
params
[
"location"
]
=
coordinate
params
[
"open"
]
=
open
?
1
:
0
params
[
"open"
]
=
open
?
1
:
0
...
...
Module/GDUserInfoManager/GDUserInfoManager/UserInfo/GDUserCenter.swift
View file @
44ba1167
...
@@ -170,7 +170,7 @@ extension GDUserModel {
...
@@ -170,7 +170,7 @@ extension GDUserModel {
// 获取全部历史用户
// 获取全部历史用户
static
func
getAllHistoryUser
()
->
Array
<
Dictionary
<
String
,
Any
>>
?
{
static
func
getAllHistoryUser
()
->
Array
<
Dictionary
<
String
,
Any
>>
?
{
let
userDefaults
=
UserDefaults
.
standard
let
userDefaults
=
UserDefaults
.
standard
if
let
arr
:
Array
<
Dictionary
<
String
,
Any
>>
=
userDefaults
.
array
(
forKey
:
GDUserManagerUDKey
.
historyUserArray
)
as?
Array
<
Dictionary
<
String
,
Any
>>
{
if
let
arr
:
Array
<
Dictionary
<
String
,
Any
>>
=
userDefaults
.
array
(
forKey
:
GDUserManager
Public
UDKey
.
historyUserArray
)
as?
Array
<
Dictionary
<
String
,
Any
>>
{
return
arr
return
arr
}
else
{
}
else
{
return
nil
return
nil
...
@@ -218,14 +218,14 @@ extension GDUserModel {
...
@@ -218,14 +218,14 @@ extension GDUserModel {
}
else
{
}
else
{
array
.
append
(
dict
)
array
.
append
(
dict
)
}
}
UserDefaults
.
standard
.
setValue
(
array
,
forKey
:
GDUserManagerUDKey
.
historyUserArray
)
UserDefaults
.
standard
.
setValue
(
array
,
forKey
:
GDUserManager
Public
UDKey
.
historyUserArray
)
UserDefaults
.
standard
.
setValue
(
dict
,
forKey
:
GDUserManagerUDKey
.
lastUser
)
UserDefaults
.
standard
.
setValue
(
dict
,
forKey
:
GDUserManagerUDKey
.
lastUser
)
}
}
}
else
{
}
else
{
if
let
userDict
=
self
.
convertToDict
()
{
if
let
userDict
=
self
.
convertToDict
()
{
let
array
:
Array
<
Dictionary
<
String
,
Any
>>
=
[
userDict
]
let
array
:
Array
<
Dictionary
<
String
,
Any
>>
=
[
userDict
]
UserDefaults
.
standard
.
setValue
(
array
,
forKey
:
GDUserManagerUDKey
.
historyUserArray
)
UserDefaults
.
standard
.
setValue
(
array
,
forKey
:
GDUserManager
Public
UDKey
.
historyUserArray
)
}
}
}
}
}
}
...
@@ -238,7 +238,7 @@ extension GDUserModel {
...
@@ -238,7 +238,7 @@ extension GDUserModel {
if
let
_uid
:
String
=
array
[
i
][
"uid"
]
as?
String
{
if
let
_uid
:
String
=
array
[
i
][
"uid"
]
as?
String
{
if
_uid
==
uid
{
if
_uid
==
uid
{
array
.
remove
(
at
:
i
)
array
.
remove
(
at
:
i
)
UserDefaults
.
standard
.
setValue
(
array
,
forKey
:
GDUserManagerUDKey
.
historyUserArray
)
UserDefaults
.
standard
.
setValue
(
array
,
forKey
:
GDUserManager
Public
UDKey
.
historyUserArray
)
break
break
}
}
}
}
...
@@ -254,12 +254,12 @@ extension GDUserModel {
...
@@ -254,12 +254,12 @@ extension GDUserModel {
}
}
}
}
if
var
historyArr
=
UserDefaults
.
standard
.
object
(
forKey
:
GDUserManagerUDKey
.
historyUserArray
)
as?
Array
<
Dictionary
<
String
,
Any
>>
{
if
var
historyArr
=
UserDefaults
.
standard
.
object
(
forKey
:
GDUserManager
Public
UDKey
.
historyUserArray
)
as?
Array
<
Dictionary
<
String
,
Any
>>
{
if
let
index
=
historyArr
.
firstIndex
(
where
:
{
$0
[
"uid"
]
as?
String
==
uid
})
{
if
let
index
=
historyArr
.
firstIndex
(
where
:
{
$0
[
"uid"
]
as?
String
==
uid
})
{
historyArr
[
index
][
"token"
]
=
""
historyArr
[
index
][
"token"
]
=
""
}
}
UserDefaults
.
standard
.
setValue
(
historyArr
,
forKey
:
GDUserManagerUDKey
.
historyUserArray
)
UserDefaults
.
standard
.
setValue
(
historyArr
,
forKey
:
GDUserManager
Public
UDKey
.
historyUserArray
)
}
}
}
}
}
}
...
...
TealiveModule.xcworkspace/contents.xcworkspacedata
View file @
44ba1167
...
@@ -7,21 +7,28 @@
...
@@ -7,21 +7,28 @@
<Group
<Group
location =
"group:Module"
location =
"group:Module"
name =
"Module"
>
name =
"Module"
>
<Group
location =
"container:"
name =
"BaseModules"
>
<FileRef
location =
"group:Module/GDSocialCenter/GDSocialCenter.xcodeproj"
>
</FileRef>
<FileRef
location =
"group:Module/GDUserInfoManager/GDUserInfoManager.xcodeproj"
>
</FileRef>
<FileRef
location =
"group:Module/GDDataManager/GDDataManager.xcodeproj"
>
</FileRef>
<FileRef
location =
"group:Module/HostManager/HostManager.xcodeproj"
>
</FileRef>
</Group>
<FileRef
<FileRef
location =
"group:GDTest/GDTest.xcodeproj"
>
location =
"group:GDTest/GDTest.xcodeproj"
>
</FileRef>
</FileRef>
<FileRef
<FileRef
location =
"group:GDLoginAndRegistModule/GDLoginAndRegistModule.xcodeproj"
>
location =
"group:GDLoginAndRegistModule/GDLoginAndRegistModule.xcodeproj"
>
</FileRef>
</FileRef>
<FileRef
location =
"group:GDUserInfoManager/GDUserInfoManager.xcodeproj"
>
</FileRef>
<FileRef
location =
"group:GDDataManager/GDDataManager.xcodeproj"
>
</FileRef>
<FileRef
location =
"group:HostManager/HostManager.xcodeproj"
>
</FileRef>
</Group>
</Group>
<FileRef
<FileRef
location =
"group:Pods/Pods.xcodeproj"
>
location =
"group:Pods/Pods.xcodeproj"
>
...
...
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