2022-09-01 19:05:09 +08:00
|
|
|
//
|
|
|
|
// XPRoomRedPacketPresenter.m
|
|
|
|
// xplan-ios
|
|
|
|
//
|
|
|
|
// Created by GreenLand on 2022/8/31.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "XPRoomRedPacketPresenter.h"
|
|
|
|
#import "XPRoomRedPacketProtocol.h"
|
|
|
|
#import "Api+RedPacket.h"
|
|
|
|
#import "AccountInfoStorage.h"
|
|
|
|
#import "WalletInfoModel.h"
|
|
|
|
#import "UserInfoModel.h"
|
|
|
|
#import "DESEncrypt.h"
|
|
|
|
#import "XPConstant.h"
|
|
|
|
|
|
|
|
@implementation XPRoomRedPacketPresenter
|
|
|
|
|
|
|
|
/// 获取钱包信息
|
|
|
|
- (void)getUserWalletInfo {
|
|
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
|
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
|
|
|
if (!uid.length) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
|
|
|
|
[[self getView] getUserWalletInfo:model];
|
|
|
|
}] uid:uid ticket:ticket];
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取当前用户信息
|
|
|
|
- (void)getUserModel {
|
|
|
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
|
|
|
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
UserInfoModel *userInfo = [UserInfoModel modelWithDictionary:data.data];
|
|
|
|
[[self getView] onGetUserInfoSuccess:userInfo];
|
|
|
|
} showLoading:NO] uid:uid];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)sendRedPacketWithNum:(NSString *)num goldNum:(NSString *)goldNum roomUid:(NSString *)roomUid type:(NSNumber *)type password:(NSString *)pwd message:(NSString *)message {
|
|
|
|
NSString *password = [DESEncrypt encryptUseDES:pwd key:KeyWithType(KeyType_PasswordEncode)];
|
|
|
|
[Api sendRedPacket:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
[[self getView] sendRedPacketSuccess];
|
2022-09-02 18:59:36 +08:00
|
|
|
}] num:num goldNum:goldNum roomUId:roomUid type:type password:password message:message];
|
2022-09-01 19:05:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|