|
@@ -11,6 +11,8 @@ import BFFramework
|
|
|
|
|
|
// MARK: 我的相关ViewModel
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/// 我的相关ViewModel
|
|
|
class PQMineViewModel: NSObject {
|
|
|
typealias completeHander = (_ userInfo: [String: Any]?, _ msg: String?) -> Void
|
|
@@ -139,4 +141,60 @@ class PQMineViewModel: NSObject {
|
|
|
completeHander(Int("\(response ?? "1")"), nil)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// 发送验证码
|
|
|
+ /// - Parameters:
|
|
|
+ /// - phoneNumber: <#phoneNumber description#>
|
|
|
+ /// - completeHander: <#completeHander description#>
|
|
|
+ /// - Returns: <#description#>
|
|
|
+ class func sendIndetifyCode(phoneNumber: String, completeHander: @escaping (_ isSuccess: Bool, _ msg: String?, _ codeId: String?) -> Void) {
|
|
|
+ SWNetRequest.postRequestData(url: PQENVUtil.shared.longvideoapi + sendIndetifyCodeUrl, parames: ["uid": BFLoginUserInfo.shared.uid, "phoneNumber": phoneNumber]) { response, _, error, _ in
|
|
|
+ if error != nil {
|
|
|
+ completeHander(false, error?.msg, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if response is NSNull || response == nil {
|
|
|
+ completeHander(false, "请稍后重试", nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let codeId: String? = "\(response ?? "")"
|
|
|
+ completeHander(true, "短信验证码已发送", codeId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 检查手机号
|
|
|
+ /// - Parameters:
|
|
|
+ /// - phoneNumber: <#phoneNumber description#>
|
|
|
+ /// - codeId: <#codeId description#>
|
|
|
+ /// - indetifyCode: <#indetifyCode description#>
|
|
|
+ /// - completeHander: <#completeHander description#>
|
|
|
+ /// - Returns: <#description#>
|
|
|
+ class func checkIndetifyCode(phoneNumber _: String, codeId: String, indetifyCode: String, completeHander: @escaping (_ isSuccess: Bool, _ msg: String?) -> Void) {
|
|
|
+ SWNetRequest.postRequestData(url: PQENVUtil.shared.longvideoapi + checkIndetifyCodeUrl, parames: ["uid": BFLoginUserInfo.shared.uid, "indetifyCode": indetifyCode, "codeId": codeId]) { response, _, error, _ in
|
|
|
+ if error != nil {
|
|
|
+ completeHander(false, error?.msg)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if response is NSNull || response == nil {
|
|
|
+ completeHander(false, "请稍后重试")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ completeHander(true, "验证码验证成功")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 修改手机号
|
|
|
+ /// - Parameters:
|
|
|
+ /// - phoneNumber: <#phoneNumber description#>
|
|
|
+ /// - completeHander: <#completeHander description#>
|
|
|
+ /// - Returns: <#description#>
|
|
|
+ class func updatePhone(phoneNumber: String, completeHander: @escaping (_ isSuccess: Bool, _ msg: String?) -> Void) {
|
|
|
+ SWNetRequest.postRequestData(url: PQENVUtil.shared.longvideoapi + updatePhoneUrl, parames: ["phoneNum": phoneNumber]) { _, _, error, _ in
|
|
|
+ if error != nil {
|
|
|
+ completeHander(false, error?.msg)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ completeHander(true, "修改手机号成功")
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|