|
@@ -20,9 +20,6 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
public class func shared() -> SwiftMoyaNetWorkServiceUser {
|
|
|
return sharedInstance
|
|
|
}
|
|
|
-
|
|
|
- /// 数据回调
|
|
|
- typealias apiCallBack = (Any) -> (Void)
|
|
|
|
|
|
// MARK: - 微信注册/登录
|
|
|
/// 微信注册/登录
|
|
@@ -34,7 +31,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - username: 昵称
|
|
|
/// - gender: 性别 1男 2女
|
|
|
/// - completion: 回调
|
|
|
- func userWeiXinRegisterApi(open_id:String,union_id:String,avatar:String,username:String,gender:Int,completion: @escaping apiCallBack) {
|
|
|
+ func userWeiXinRegisterApi(open_id:String,union_id:String,avatar:String,username:String,gender:Int,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(open_id, forKey: "open_id")
|
|
|
parameters.updateValue(union_id, forKey: "union_id")
|
|
@@ -56,7 +53,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - mobile: 手机号
|
|
|
/// - sms_code: 短信验证码
|
|
|
/// - completion: 回调
|
|
|
- func userMobileRegisterApi(mobile:String,sms_code:String,invitationCode:String,completion: @escaping apiCallBack) {
|
|
|
+ func userMobileRegisterApi(mobile:String,sms_code:String,invitationCode:String,completion: @escaping successCallBack) {
|
|
|
|
|
|
if isMobileVerification(mobile: mobile) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
@@ -80,7 +77,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - mobile: 手机号
|
|
|
/// - password: 密码
|
|
|
/// - completion: 回调
|
|
|
- func userMobileLoginApi(mobile:String,password:String,completion: @escaping apiCallBack) {
|
|
|
+ func userMobileLoginApi(mobile:String,password:String,completion: @escaping successCallBack) {
|
|
|
|
|
|
if isMobileVerification(mobile: mobile) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
@@ -100,7 +97,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
///
|
|
|
/// - Parameters:
|
|
|
/// - completion: 回调
|
|
|
- func userRefreshApi(completion: @escaping apiCallBack) {
|
|
|
+ func userRefreshApi(completion: @escaping successCallBack) {
|
|
|
let parameters = Dictionary<String,Any>()
|
|
|
|
|
|
SwiftMoyaNetWorkManager.shared.requestObject(UserModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userRefresh(parameters: parameters))) { (userModel) in
|
|
@@ -132,7 +129,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - unionId: 微信unioId
|
|
|
/// - openId: 微信openId
|
|
|
/// - completion: 回调
|
|
|
- func userBindMobileApi(mobile:String,smsCode:String,unionId:String,openId:String,invitationCode:String,completion: @escaping apiCallBack) {
|
|
|
+ func userBindMobileApi(mobile:String,smsCode:String,unionId:String,openId:String,invitationCode:String,completion: @escaping successCallBack) {
|
|
|
|
|
|
if isMobileVerification(mobile: mobile) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
@@ -157,7 +154,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - Parameters:
|
|
|
/// - umLoginModel: UMLoginModel
|
|
|
/// - completion: 回调
|
|
|
- func userIsBindWeixinBindApi(umLoginModel:UMLoginModel,completion: @escaping apiCallBack) {
|
|
|
+ func userIsBindWeixinBindApi(umLoginModel:UMLoginModel,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(umLoginModel.union_id, forKey: "union_id")
|
|
|
parameters.updateValue(umLoginModel.open_id, forKey: "open_id")
|
|
@@ -197,7 +194,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - mobile: 手机号
|
|
|
/// - umLoginModel: 微信模型
|
|
|
/// - completion: 回调
|
|
|
- func userBindWeixinApi(mobile:String,umLoginModel:UMLoginModel,completion: @escaping apiCallBack) {
|
|
|
+ func userBindWeixinApi(mobile:String,umLoginModel:UMLoginModel,completion: @escaping successCallBack) {
|
|
|
|
|
|
if isMobileVerification(mobile: mobile) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
@@ -225,7 +222,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - unionId: 微信unionId
|
|
|
/// - openId: 微信openId
|
|
|
/// - completion: 回调
|
|
|
- func userUnbindWeixinApi(completion: @escaping apiCallBack) {
|
|
|
+ func userUnbindWeixinApi(completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
let userModel = UserModel.shared().getModel()
|
|
|
parameters.updateValue(userModel!.unionId! as Any, forKey: "union_id")
|
|
@@ -250,7 +247,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - password: 密码
|
|
|
/// - password_confirmation: 确认密码
|
|
|
/// - completion: 回调
|
|
|
- func userSetPasswordApi(mobile:String,password:String,password_confirmation:String,completion: @escaping apiCallBack) {
|
|
|
+ func userSetPasswordApi(mobile:String,password:String,password_confirmation:String,completion: @escaping successCallBack) {
|
|
|
|
|
|
if isMobileVerification(mobile: mobile) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
@@ -279,7 +276,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - type: 0所有列表,1自提列表,2快递
|
|
|
/// - city_id: 城市id
|
|
|
/// - completion: 回调
|
|
|
- func userSelfAndExpressAddressListApi(type:Int,completion: @escaping apiCallBack) {
|
|
|
+ func userSelfAndExpressAddressListApi(type:Int,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
let loacationModel = LocationModel.shared().object()
|
|
|
let baiduToCityModel = BaiduToCityFactory.shared.query(bjcityId: loacationModel!.cityCode)
|
|
@@ -308,7 +305,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - address: 详细地址
|
|
|
/// - zipcode: 邮政编码 710110
|
|
|
/// - completion: 回调
|
|
|
- func userAddExpressAddressApi(expressAddresModel:ExpressAddresModel, completion: @escaping apiCallBack) {
|
|
|
+ func userAddExpressAddressApi(expressAddresModel:ExpressAddresModel, completion: @escaping successCallBack) {
|
|
|
|
|
|
if isMobileVerification(mobile: expressAddresModel.contactMobile ?? "") {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
@@ -340,7 +337,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
///
|
|
|
/// - Parameters:
|
|
|
/// - id: 表id 修改适合传
|
|
|
- func userAddressIsDefaultApi(id:Int = 0,completion: @escaping apiCallBack) {
|
|
|
+ func userAddressIsDefaultApi(id:Int = 0,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(id, forKey: "id")
|
|
|
|
|
@@ -358,7 +355,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
///
|
|
|
/// - Parameters:
|
|
|
/// - id: 地址Id
|
|
|
- func userAddressDeleteApi(id:Int = 0,completion: @escaping apiCallBack) {
|
|
|
+ func userAddressDeleteApi(id:Int = 0,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(id, forKey: "id")
|
|
|
|
|
@@ -375,7 +372,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 自提点收货人列表
|
|
|
///
|
|
|
/// - Parameter completion: 成功回调
|
|
|
- func userExpreesContactsListApi(completion: @escaping apiCallBack) {
|
|
|
+ func userExpreesContactsListApi(completion: @escaping successCallBack) {
|
|
|
let parameters = Dictionary<String,Any>()
|
|
|
|
|
|
SwiftMoyaNetWorkManager.shared.requestObject(ContactListModel.self, target: MultiTarget(SwiftMoyaServiceUserApi.userExpreesContactsList(parameters: parameters))) { (contactListModel) in
|
|
@@ -388,7 +385,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 获取默认快递信息
|
|
|
///
|
|
|
/// - Parameter completion: 成功回调
|
|
|
- func userDefaultExpressApi(completion: @escaping apiCallBack) {
|
|
|
+ func userDefaultExpressApi(completion: @escaping successCallBack) {
|
|
|
let parameters = Dictionary<String,Any>()
|
|
|
|
|
|
SwiftMoyaNetWorkManager.shared.requestObject(ExpressAddresModel.self, target: MultiTarget(SwiftMoyaServiceUserApi.userDefaultExpress(parameters: parameters))) { (expressAddrModel) in
|
|
@@ -401,7 +398,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 获取默认快递信息
|
|
|
///
|
|
|
/// - Parameter completion: 成功回调
|
|
|
- func userDefaultContactApi(completion: @escaping apiCallBack) {
|
|
|
+ func userDefaultContactApi(completion: @escaping successCallBack) {
|
|
|
let parameters = Dictionary<String,Any>()
|
|
|
|
|
|
SwiftMoyaNetWorkManager.shared.requestObject(SelfMentionContactsModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userDefaultContact(parameters: parameters))) {(contactMdl) in
|
|
@@ -418,7 +415,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - mobile: 手机号码
|
|
|
/// - name: 用户名
|
|
|
/// - completion: 完成
|
|
|
- func userSaveExpreesContactsApi(id:Int = 0,mobile:String = "",name:String = "",completion: @escaping apiCallBack) {
|
|
|
+ func userSaveExpreesContactsApi(id:Int = 0,mobile:String = "",name:String = "",completion: @escaping successCallBack) {
|
|
|
|
|
|
if isMobileVerification(mobile: mobile) {
|
|
|
if name.count <= 0 {
|
|
@@ -448,7 +445,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - Parameters:
|
|
|
/// - id: 收货人id
|
|
|
/// - completion: 完成
|
|
|
- func userDelExpreesContactsApi(id:Int = 0,completion: @escaping apiCallBack) {
|
|
|
+ func userDelExpreesContactsApi(id:Int = 0,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(id, forKey: "id")
|
|
|
|
|
@@ -467,7 +464,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - Parameters:
|
|
|
/// - id: 收货人id
|
|
|
/// - completion: 完成
|
|
|
- func userSetExpreesContactsDefaultApi(id:Int = 0,completion: @escaping apiCallBack) {
|
|
|
+ func userSetExpreesContactsDefaultApi(id:Int = 0,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(id, forKey: "id")
|
|
|
|
|
@@ -487,7 +484,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - pickupNodeId: 自提点id
|
|
|
/// - address: 详细地址
|
|
|
/// - completion: 完成
|
|
|
- func userAddSelfAddressApi(cityId:Int = 0,cityName:String = "",pickupNodeId:Int = 0,address:String,completion: @escaping apiCallBack) {
|
|
|
+ func userAddSelfAddressApi(cityId:Int = 0,cityName:String = "",pickupNodeId:Int = 0,address:String,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(cityId, forKey: "city_id")
|
|
|
parameters.updateValue(cityName, forKey: "city_name")
|
|
@@ -509,7 +506,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - Parameters:
|
|
|
/// - deliveryMethodType: 0所有列表,1自提列表,2快递
|
|
|
/// - completion: 返回
|
|
|
- func userSetDeliverTypeApi(deliveryMethodType:String = "2",completion: @escaping apiCallBack) {
|
|
|
+ func userSetDeliverTypeApi(deliveryMethodType:String = "2",completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(deliveryMethodType, forKey: "deliver_type")
|
|
|
|
|
@@ -532,7 +529,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - Parameters:
|
|
|
/// - gender: 0位置 1男 2女
|
|
|
/// - completion: 回调
|
|
|
- func userGenderApi(gender:Int = 0,completion: @escaping apiCallBack) {
|
|
|
+ func userGenderApi(gender:Int = 0,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(gender, forKey: "gender")
|
|
|
//
|
|
@@ -550,7 +547,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 用户信息详情
|
|
|
///
|
|
|
/// - Parameter completion: 回调UserDetailModel
|
|
|
- func userMemberDetailApi(uid:Int,completion: @escaping apiCallBack) {
|
|
|
+ func userMemberDetailApi(uid:Int,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(uid, forKey: "uid")
|
|
|
|
|
@@ -564,7 +561,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 更新用户信息详情
|
|
|
///
|
|
|
/// - Parameter completion: 回调UserDetailModel
|
|
|
- func userMemberDetailUpDateApi(avatar:String,userName:String,signature:String,completion: @escaping apiCallBack) {
|
|
|
+ func userMemberDetailUpDateApi(avatar:String,userName:String,signature:String,completion: @escaping successCallBack) {
|
|
|
if avatar == "" {
|
|
|
SwiftProgressHUD.shared().showText("头像不能为空")
|
|
|
return
|
|
@@ -591,7 +588,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 用户关注列表
|
|
|
///
|
|
|
/// - Parameter completion: 回调UserDetailModel
|
|
|
- func userFollowsApi(uid:Int,page:Int = 1,completion: @escaping apiCallBack) {
|
|
|
+ func userFollowsApi(uid:Int,page:Int = 1,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(uid, forKey: "uid")
|
|
|
parameters.updateValue(page, forKey: "page")
|
|
@@ -606,7 +603,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 粉丝列表
|
|
|
///
|
|
|
/// - Parameter completion: 回调UserDetailModel
|
|
|
- func userFansApi(uid:Int,page:Int = 1,completion: @escaping apiCallBack) {
|
|
|
+ func userFansApi(uid:Int,page:Int = 1,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(page, forKey: "page")
|
|
|
parameters.updateValue(uid, forKey: "uid")
|
|
@@ -623,7 +620,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - Parameters:
|
|
|
/// - followUid: 被关注人id
|
|
|
/// - completion: 回调
|
|
|
- func userFollowApi(followUid:Int,completion: @escaping apiCallBack) {
|
|
|
+ func userFollowApi(followUid:Int,completion: @escaping successCallBack) {
|
|
|
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(followUid, forKey: "follow_uid")
|
|
@@ -643,7 +640,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - Parameters:
|
|
|
/// - followUid: 被取消关注人id
|
|
|
/// - completion: 回调
|
|
|
- func userCancelFollowApi(followUid:Int,completion: @escaping apiCallBack) {
|
|
|
+ func userCancelFollowApi(followUid:Int,completion: @escaping successCallBack) {
|
|
|
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(followUid, forKey: "follow_uid")
|
|
@@ -661,7 +658,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 用户消息消息首页
|
|
|
///
|
|
|
/// - Parameter completion: 回调
|
|
|
- func userMemberMessageIndexApi(completion: @escaping apiCallBack) {
|
|
|
+ func userMemberMessageIndexApi(completion: @escaping successCallBack) {
|
|
|
let parameters = Dictionary<String,Any>()
|
|
|
|
|
|
SwiftMoyaNetWorkManager.shared.requestObject(MessageIndexModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userMemberMessageIndex(parameters: parameters))) { (messageIndexModel) in
|
|
@@ -678,7 +675,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - messageShowTypes: 活动展示类型 0纯展示;1系统通知消息;2内容消息; 3活动消息; 4话题消息 ;5后台系统消息; 6评论消息; 7回复消息 ;8回复@ 消息;9攒内容消息 ;10收藏内容消息; 11分享内容消息 ;12关注消息
|
|
|
/// - page: 分页
|
|
|
/// - completion: 回调
|
|
|
- func userMemberMessageListApi(messageShowTypes:String,page:Int,completion: @escaping apiCallBack) {
|
|
|
+ func userMemberMessageListApi(messageShowTypes:String,page:Int,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(messageShowTypes, forKey: "message_show_types")
|
|
|
parameters.updateValue(page, forKey: "page")
|
|
@@ -694,7 +691,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// - Parameters:
|
|
|
/// - messageShowTypes: 活动展示类型 0纯展示;1系统通知消息;2内容消息; 3活动消息; 4话题消息 ;5后台系统消息; 6评论消息; 7回复消息 ;8回复@ 消息;9攒内容消息 ;10收藏内容消息; 11分享内容消息 ;12关注消息
|
|
|
/// - completion: 回调
|
|
|
- func userMemberReadMessageApi(messageShowTypes:String,completion: @escaping apiCallBack) {
|
|
|
+ func userMemberReadMessageApi(messageShowTypes:String,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(messageShowTypes, forKey: "message_show_types")
|
|
|
|
|
@@ -708,7 +705,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 粉丝列表
|
|
|
///
|
|
|
/// - Parameter completion: 回调UserDetailModel
|
|
|
- func userMemberSearchMemberApi(userName:String,page:Int = 1,completion: @escaping apiCallBack) {
|
|
|
+ func userMemberSearchMemberApi(userName:String,page:Int = 1,completion: @escaping successCallBack) {
|
|
|
var parameters = Dictionary<String,Any>()
|
|
|
parameters.updateValue(page, forKey: "page")
|
|
|
parameters.updateValue(userName, forKey: "username")
|
|
@@ -723,7 +720,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
|
|
|
/// 获取彩虹豆
|
|
|
///
|
|
|
/// - Parameter completion: 回调
|
|
|
- func userMemberGetTotalBeanApi(completion: @escaping apiCallBack) {
|
|
|
+ func userMemberGetTotalBeanApi(completion: @escaping successCallBack) {
|
|
|
let parameters = Dictionary<String,Any>()
|
|
|
SwiftMoyaNetWorkManager.shared.requestObject(TotalBeanModel.self,target: MultiTarget(SwiftMoyaServiceUserApi.userMemberGetTotalBean(parameters: parameters))) { (totalBeanModel) in
|
|
|
completion(totalBeanModel)
|