修复兑换钻石时,本地使用了金币数判断问题

This commit is contained in:
eggmanQQQ
2024-06-09 16:43:52 +08:00
parent 3e9181e60b
commit 8123b81811
2 changed files with 13 additions and 11 deletions

View File

@@ -40,10 +40,15 @@
} }
-(void)getExchangeDiamondInformation{ -(void)getExchangeDiamondInformation{
@kWeakify(self);
[Api getExchangeDiamondInformation:[self createHttpCompletion:^(BaseModel * _Nonnull data) { [Api getExchangeDiamondInformation:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
XPExchangeDiamondsModel *model = [XPExchangeDiamondsModel modelWithDictionary:data.data]; XPExchangeDiamondsModel *model = [XPExchangeDiamondsModel modelWithDictionary:data.data];
[[self getView]getExchangeDiamondInformation:model]; XPExchangeDiamondsModel *tempModel = [XPExchangeDiamondsModel modelWithDictionary:data.data];
} showLoading:YES]]; model.golds = tempModel.diamonds;
model.diamonds = tempModel.golds;
[[self getView] getExchangeDiamondInformation:model];
} showLoading:YES]];
} }
-(void)confirmExchangeDiamondWithGoldNum:(NSString *)goldNum diamondNum:(NSString *)diamondNum currency:(NSString *)currency{ -(void)confirmExchangeDiamondWithGoldNum:(NSString *)goldNum diamondNum:(NSString *)diamondNum currency:(NSString *)currency{
[Api confirmExchangeDiamond:[self createHttpCompletion:^(BaseModel * _Nonnull data) { [Api confirmExchangeDiamond:[self createHttpCompletion:^(BaseModel * _Nonnull data) {

View File

@@ -36,15 +36,12 @@
#pragma mark - Private Method #pragma mark - Private Method
- (void)initSubViews { - (void)initSubViews {
self.backgroundColor = [UIColor clearColor]; self.backgroundColor = [UIColor clearColor];
[self addSubview:self.myGoldView]; [self addSubview:self.myGoldView];
[self addSubview:self.myDiamondsView]; [self addSubview:self.myDiamondsView];
[self addSubview:self.confirmBtn]; [self addSubview:self.confirmBtn];
@kWeakify(self)
@kWeakify(self)
self.myGoldView.inputCounthandle = ^(NSString *_Nonnull goldNum,NSString *_Nonnull diamondNum) { self.myGoldView.inputCounthandle = ^(NSString *_Nonnull goldNum,NSString *_Nonnull diamondNum) {
@kStrongify(self) @kStrongify(self)
if(goldNum.integerValue == 0 && diamondNum.integerValue == 0){ if(goldNum.integerValue == 0 && diamondNum.integerValue == 0){
@@ -118,7 +115,7 @@
} }
if(self.diamondNum.doubleValue > self.model.maxDiamonds){ if(self.diamondNum.doubleValue > self.model.maxDiamonds){
[XNDJTDDLoadingTool showErrorWithMessage:[NSString stringWithFormat:YMLocalizedString(@"XPExchangeDiamondsView4"),self.model.maxDiamonds]]; [XNDJTDDLoadingTool showErrorWithMessage:[NSString stringWithFormat:YMLocalizedString(@"XPExchangeDiamondsView4"),self.model.maxDiamonds]];
return; return;
} }
[self.myGoldView resignResponder]; [self.myGoldView resignResponder];
[self.myDiamondsView resignResponder]; [self.myDiamondsView resignResponder];
@@ -228,12 +225,12 @@
-(void)setModel:(XPExchangeDiamondsModel *)model{ -(void)setModel:(XPExchangeDiamondsModel *)model{
_model = model; _model = model;
if(self.type == IncomeRecord_Gold){ if(self.type == IncomeRecord_Gold){
_titleNumView.text = [NSString stringWithFormat:YMLocalizedString(@"XPExchangeDiamondsItemView0"),@(_model.diamonds)]; _titleNumView.text = [NSString stringWithFormat:YMLocalizedString(@"XPExchangeDiamondsItemView0"),@(_model.golds)];
UIImage *image = [UIImage imageNamed:@"ms_exchange_coin_icon"]; UIImage *image = [UIImage imageNamed:@"ms_exchange_coin_icon"];
[_iconView setImage:image forState:UIControlStateNormal]; [_iconView setImage:image forState:UIControlStateNormal];
}else{ }else{
_titleNumView.text = [NSString stringWithFormat:YMLocalizedString(@"XPExchangeDiamondsItemView1"),_model.golds]; _titleNumView.text = [NSString stringWithFormat:YMLocalizedString(@"XPExchangeDiamondsItemView1"),_model.diamonds];
UIImage *image = [UIImage imageNamed:@"exchange_new_diamonds_icon"]; UIImage *image = [UIImage imageNamed:@"exchange_new_diamonds_icon"];
[_iconView setImage:image forState:UIControlStateNormal]; [_iconView setImage:image forState:UIControlStateNormal];
} }