From af7689e7db0925eb6bb8e792305684ee2bac2212 Mon Sep 17 00:00:00 2001 From: fengshuo <963787902@qq.com> Date: Mon, 17 Oct 2022 19:51:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AD=94=E5=8A=9B=E5=85=A8=E6=9C=8D=E7=A6=8F?= =?UTF-8?q?=E8=A2=8B=E7=A4=BC=E7=89=A9=E5=BC=80=E5=87=BA=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xplan-ios.xcodeproj/project.pbxproj | 6 + .../ModuleKit/SendGiftView/Api/Api+Gift.h | 4 + .../ModuleKit/SendGiftView/Api/Api+Gift.m | 7 ++ .../Model/GiftLuckyBroadcastModel.h | 27 ++++ .../Model/GiftLuckyBroadcastModel.m | 14 +++ .../SendGiftView/Presenter/XPGiftPresenter.h | 4 + .../SendGiftView/Presenter/XPGiftPresenter.m | 9 ++ .../SendGiftView/Protocol/XPGiftProtocol.h | 3 + .../View/XPGiftLuckyGiftBroadcastView.h | 3 + .../View/XPGiftLuckyGiftBroadcastView.m | 118 +++++++++++++++++- .../View/XPGiftWeekStarBroadcastView.m | 1 + .../SendGiftView/View/XPSendGiftView.m | 10 ++ 12 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftLuckyBroadcastModel.h create mode 100644 xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftLuckyBroadcastModel.m diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index a1290897..9494afe3 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -939,6 +939,7 @@ E8A30BF328534B17003B4873 /* Api+FindNew.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A30BF228534B17003B4873 /* Api+FindNew.m */; }; E8A30BF628534B35003B4873 /* FindNewUserInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A30BF528534B35003B4873 /* FindNewUserInfoModel.m */; }; E8A30BF928534E48003B4873 /* XPSessionFindNewEmptyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A30BF828534E48003B4873 /* XPSessionFindNewEmptyTableViewCell.m */; }; + E8A3538528FD67320014A784 /* GiftLuckyBroadcastModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3538428FD67320014A784 /* GiftLuckyBroadcastModel.m */; }; E8A6C28C27CF436300AC7442 /* XPHomeLikeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A6C28B27CF436300AC7442 /* XPHomeLikeViewController.m */; }; E8A6C28F27CF43D600AC7442 /* XPHomeAttentionTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A6C28E27CF43D600AC7442 /* XPHomeAttentionTableViewCell.m */; }; E8A6C29527CF441200AC7442 /* XPHomeAttentionCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A6C29427CF441200AC7442 /* XPHomeAttentionCollectionViewCell.m */; }; @@ -2911,6 +2912,8 @@ E8A30BF528534B35003B4873 /* FindNewUserInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FindNewUserInfoModel.m; sourceTree = ""; }; E8A30BF728534E48003B4873 /* XPSessionFindNewEmptyTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSessionFindNewEmptyTableViewCell.h; sourceTree = ""; }; E8A30BF828534E48003B4873 /* XPSessionFindNewEmptyTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSessionFindNewEmptyTableViewCell.m; sourceTree = ""; }; + E8A3538328FD67320014A784 /* GiftLuckyBroadcastModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftLuckyBroadcastModel.h; sourceTree = ""; }; + E8A3538428FD67320014A784 /* GiftLuckyBroadcastModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftLuckyBroadcastModel.m; sourceTree = ""; }; E8A6C28A27CF436300AC7442 /* XPHomeLikeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLikeViewController.h; sourceTree = ""; }; E8A6C28B27CF436300AC7442 /* XPHomeLikeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeLikeViewController.m; sourceTree = ""; }; E8A6C28D27CF43D600AC7442 /* XPHomeAttentionTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeAttentionTableViewCell.h; sourceTree = ""; }; @@ -6634,6 +6637,8 @@ 9B208A352779B50100F9E54A /* GiftNobleInfoModel.m */, 9B41D36C282649230048C588 /* XPWeekStarRankUserModel.h */, 9B41D36D282649230048C588 /* XPWeekStarRankUserModel.m */, + E8A3538328FD67320014A784 /* GiftLuckyBroadcastModel.h */, + E8A3538428FD67320014A784 /* GiftLuckyBroadcastModel.m */, ); path = Model; sourceTree = ""; @@ -9131,6 +9136,7 @@ E899C68C275093B800E189E5 /* XPUserCardMicroItemModel.m in Sources */, 9B6E8573281AB9B20041A321 /* XPRoomInsideRecommendCell.m in Sources */, E87A270027588445002DDC7A /* XPHomeListEmptyCollectionViewCell.m in Sources */, + E8A3538528FD67320014A784 /* GiftLuckyBroadcastModel.m in Sources */, E82325F5274E2E09003A3332 /* XPUserCardPresenter.m in Sources */, E80EC80B28ACD84000D133C5 /* QInputBarViewConfiguration.m in Sources */, E880B39E278BD49E00A83B0D /* XPAcrossRoomPKViewController.m in Sources */, diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Api/Api+Gift.h b/xplan-ios/Main/ModuleKit/SendGiftView/Api/Api+Gift.h index 5c30a346..a1ad88e1 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/Api/Api+Gift.h +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Api/Api+Gift.h @@ -68,6 +68,10 @@ NS_ASSUME_NONNULL_BEGIN roomUid:(NSString *)roomUid msg:(NSString *)msg uid:(NSString *)uid; + +/// 请求福袋全服礼物全服记录 +/// @param complection 完成 ++ (void)requestLuckGiftServerBagRecord:(HttpRequestHelperCompletion)complection; @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Api/Api+Gift.m b/xplan-ios/Main/ModuleKit/SendGiftView/Api/Api+Gift.m index 1dd4f7ea..dabc0712 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/Api/Api+Gift.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Api/Api+Gift.m @@ -25,6 +25,13 @@ [self makeRequest:@"gift/listV4" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, roomUid, nil]; } +/// 请求福袋全服礼物全服记录 +/// @param complection 完成 ++ (void)requestLuckGiftServerBagRecord:(HttpRequestHelperCompletion)complection { + [self makeRequest:@"gift/luckyBag/serviceMsg/record" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil]; +} + + /// 送礼物的接口 /// @param complection 完成 /// @param targetUids 送给谁的 diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftLuckyBroadcastModel.h b/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftLuckyBroadcastModel.h new file mode 100644 index 00000000..a744b459 --- /dev/null +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftLuckyBroadcastModel.h @@ -0,0 +1,27 @@ +// +// GiftLuckyBroadcastModel.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/17. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GiftLuckyBroadcastModel : NSObject +///礼物名称 +@property (nonatomic,strong) NSString *giftName; +///价格 +@property (nonatomic, assign)double goldPrice; +///幸运礼物 +@property (nonatomic,strong) NSString *luckyBagName; +///昵称 +@property (nonatomic,strong) NSString *nick; +///房间标题 +@property (nonatomic,strong) NSString *roomTitle; +///房间的uid +@property (nonatomic,strong) NSString *roomUid; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftLuckyBroadcastModel.m b/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftLuckyBroadcastModel.m new file mode 100644 index 00000000..77a5b245 --- /dev/null +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Model/GiftLuckyBroadcastModel.m @@ -0,0 +1,14 @@ +// +// GiftLuckyBroadcastModel.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/17. +// + +#import "GiftLuckyBroadcastModel.h" + +@implementation GiftLuckyBroadcastModel + + + +@end diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.h b/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.h index ab719a88..938f2394 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.h +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.h @@ -39,6 +39,10 @@ NS_ASSUME_NONNULL_BEGIN roomSendType:(RoomSendGiftType)roomSendType roomUid:(NSString *)roomUid msg:(NSString *)msg; + + +///全服福袋记录记录 +- (void)luckyGiftBroadcastRecord; @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.m b/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.m index 73725e44..3935a15e 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Presenter/XPGiftPresenter.m @@ -15,6 +15,7 @@ #import "WalletInfoModel.h" #import "GiftReceiveInfoModel.h" #import "UserInfoModel.h" +#import "GiftLuckyBroadcastModel.h" ///P #import "XPGiftProtocol.h" @@ -133,4 +134,12 @@ }] targetUids:targetUids giftNum:giftNum sendType:giftSendTypeStr giftId:giftId giftSource:giftSourceStr giftType:giftTypeStr roomUid:roomUid msg:msg uid:uid]; } +///全服福袋记录记录 +- (void)luckyGiftBroadcastRecord { + [Api requestLuckGiftServerBagRecord:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + NSArray * array = [GiftLuckyBroadcastModel modelsWithArray:data.data]; + [[self getView] luckyGiftBroadcastRecordSuccess:array]; + }]]; +} + @end diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/Protocol/XPGiftProtocol.h b/xplan-ios/Main/ModuleKit/SendGiftView/Protocol/XPGiftProtocol.h index 49f43a4a..a0e3cddf 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/Protocol/XPGiftProtocol.h +++ b/xplan-ios/Main/ModuleKit/SendGiftView/Protocol/XPGiftProtocol.h @@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN ///送礼物失败 - (void)sendGiftFailWithCode:(NSInteger)code msg:(NSString *)msg; +///获取全服福袋礼物记录 +- (void)luckyGiftBroadcastRecordSuccess:(NSArray *)records; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftLuckyGiftBroadcastView.h b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftLuckyGiftBroadcastView.h index 335a945d..682217f9 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftLuckyGiftBroadcastView.h +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftLuckyGiftBroadcastView.h @@ -20,6 +20,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak) id delegate; + +@property (nonatomic,strong) NSArray *records; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftLuckyGiftBroadcastView.m b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftLuckyGiftBroadcastView.m index 7aa0c54e..11248811 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftLuckyGiftBroadcastView.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftLuckyGiftBroadcastView.m @@ -8,10 +8,80 @@ #import "XPGiftLuckyGiftBroadcastView.h" ///Third #import +#import +#import ///Tool #import "ThemeColor.h" +///Model +#import "GiftLuckyBroadcastModel.h" -@interface XPGiftLuckyGiftBroadcastView() + +@interface XPGiftLuckyGiftBroadcastCell : UICollectionViewCell +@property (nonatomic,strong) YYLabel *titleLabel; +@property (nonatomic,strong) GiftLuckyBroadcastModel *giftInfo; +@end + +@implementation XPGiftLuckyGiftBroadcastCell + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + [self initSubViews]; + [self initSubViewConstraints]; + } + return self; +} + +#pragma mark - Private Method +- (void)initSubViews { + [self.contentView addSubview:self.titleLabel]; +} + +- (void)initSubViewConstraints { + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.contentView); + }]; +} + +- (NSMutableAttributedString *)createTextAttribute:(NSString *)text color:(UIColor *)color { + if (text == nil || text.length <= 0) { + text = @""; + } + NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithString:text attributes:nil]; + attribute.yy_font = [UIFont systemFontOfSize:12]; + attribute.yy_color = color; + return attribute; +} + +#pragma mark - Getters And Setters +- (void)setGiftInfo:(GiftLuckyBroadcastModel *)giftInfo { + _giftInfo = giftInfo; + if (_giftInfo) { + NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init]; + [attribute appendAttributedString:[self createTextAttribute:@"恭喜 " color:[UIColor whiteColor]]]; + NSString * nick = _giftInfo.nick; + if (nick.length > 6) { + nick = [nick substringToIndex:6]; + } + [attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@ " , nick] color:[ThemeColor colorWithHexString:@"#FFD436"]]]; + [attribute appendAttributedString:[self createTextAttribute:@"开出幸运福袋获得 " color:[UIColor whiteColor]]]; + [attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@ " , _giftInfo.luckyBagName] color:[ThemeColor colorWithHexString:@"#6FE3FF"]]]; + self.titleLabel.attributedText = attribute; + } +} + + + +- (YYLabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[YYLabel alloc] init]; + } + return _titleLabel; +} + +@end + +@interface XPGiftLuckyGiftBroadcastView() ///背景 @property (nonatomic, strong) UIImageView *bgImageView; @@ -19,6 +89,8 @@ @property (nonatomic, strong) UIImageView *playImageView; ///icon @property (nonatomic, strong) UIImageView *iconImageView; +///文字轮播 +@property (nonatomic, strong) SDCycleScrollView *cycleScrollView; @end @@ -38,6 +110,7 @@ [self addSubview:self.bgImageView]; [self addSubview:self.iconImageView]; [self addSubview:self.playImageView]; + [self addSubview:self.cycleScrollView]; } - (void)initSubViewConstraints { @@ -53,6 +126,12 @@ make.width.height.mas_equalTo(20); }]; + [self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.iconImageView.mas_right); + make.right.mas_equalTo(self.playImageView.mas_left).offset(-5); + make.top.bottom.mas_equalTo(self.bgImageView); + }]; + [self.playImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.right.bottom.mas_equalTo(self.bgImageView); make.width.mas_equalTo(67); @@ -65,6 +144,31 @@ [self.delegate xPGiftLuckyGiftBroadcastViewPlayDescClick]; } } +#pragma mark - SDCycleScrollViewDelegate +- (Class)customCollectionViewCellClassForCycleScrollView:(SDCycleScrollView *)view { + return XPGiftLuckyGiftBroadcastCell.class; +} + +- (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view { + XPGiftLuckyGiftBroadcastCell *myCell = (XPGiftLuckyGiftBroadcastCell *)cell; + GiftLuckyBroadcastModel * info = [self.records objectAtIndex:index]; + myCell.giftInfo = info; + +} +#pragma mark - Getters And Setters +- (void)setRecords:(NSArray *)records { + _records = records; + if (_records.count > 0) { + NSMutableArray * array = [NSMutableArray array]; + for (GiftLuckyBroadcastModel * item in _records) { + [array addObject:item.giftName]; + } + if (array.count > 0) { + self.cycleScrollView.imageURLStringsGroup = array; + [self.cycleScrollView autoScroll]; + } + } +} - (UIImageView *)bgImageView { if (!_bgImageView) { @@ -95,4 +199,16 @@ return _playImageView; } +- (SDCycleScrollView *)cycleScrollView { + if (!_cycleScrollView) { + _cycleScrollView = [[SDCycleScrollView alloc] init]; + _cycleScrollView.backgroundColor = [UIColor clearColor]; + _cycleScrollView.layer.masksToBounds = YES; + _cycleScrollView.delegate = self; + _cycleScrollView.showPageControl = NO; + _cycleScrollView.autoScrollTimeInterval = 3.0; + } + return _cycleScrollView; +} + @end diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftWeekStarBroadcastView.m b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftWeekStarBroadcastView.m index 9b087716..1a707656 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftWeekStarBroadcastView.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftWeekStarBroadcastView.m @@ -63,6 +63,7 @@ } - (void)initSubViewConstraints { + self.backgroundColor = [UIColor redColor]; [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(0); make.left.right.mas_equalTo(self).inset(10); diff --git a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPSendGiftView.m b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPSendGiftView.m index f350ebaa..70f811a9 100644 --- a/xplan-ios/Main/ModuleKit/SendGiftView/View/XPSendGiftView.m +++ b/xplan-ios/Main/ModuleKit/SendGiftView/View/XPSendGiftView.m @@ -81,6 +81,8 @@ @property (nonatomic,strong) NSArray *graffitiPoint; ///选择了滑块的类型 @property (nonatomic,assign) GiftSegmentType segmentType; +///福袋礼物全服记录 +@property (nonatomic,strong) NSArray *records; @end @implementation XPSendGiftView @@ -147,6 +149,7 @@ [self.presenter getUserWallInfo]; [self.presenter getNormalGiftList:self.roomUid]; [self.presenter getPackGiftList]; + [self.presenter luckyGiftBroadcastRecord]; } #pragma mark - Send Custom Message @@ -635,6 +638,13 @@ [self showErrorToast:msg]; } } + + +- (void)luckyGiftBroadcastRecordSuccess:(NSArray *)records { + self.records = records; + self.luckyBroadcastView.records = records; +} + #pragma mark - Event Response - (void)disMissViewRecognizer:(UITapGestureRecognizer *)tap { [self dismissViewControllerAnimated:YES completion:nil];