进房欢迎TA
This commit is contained in:
22
xplan-ios/Assets.xcassets/Room/RedPacket/room_enter_greeting.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/RedPacket/room_enter_greeting.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_enter_greeting@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_enter_greeting@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Room/RedPacket/room_enter_greeting.imageset/room_enter_greeting@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/RedPacket/room_enter_greeting.imageset/room_enter_greeting@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
xplan-ios/Assets.xcassets/Room/RedPacket/room_enter_greeting.imageset/room_enter_greeting@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/RedPacket/room_enter_greeting.imageset/room_enter_greeting@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
@@ -201,6 +201,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param roomUid 房间Uid
|
||||
+ (void)requestRedPacket:(HttpRequestHelperCompletion)completion uid:(NSString *)roomUid;
|
||||
|
||||
/// 获取欢迎Ta信息
|
||||
/// @param completion 完成
|
||||
/// @param uid 用户Uid
|
||||
/// @param toUid 目标用户Uid
|
||||
+ (void)requestMsgGetone:(HttpRequestHelperCompletion)completion uid:(NSString *)uid toUid:(NSString *)toUid;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -241,4 +241,12 @@
|
||||
[self makeRequest:@"room/red-envelop" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
|
||||
}
|
||||
|
||||
/// 获取欢迎Ta信息
|
||||
/// @param completion 完成
|
||||
/// @param uid 用户Uid
|
||||
/// @param toUid 目标用户Uid
|
||||
+ (void)requestMsgGetone:(HttpRequestHelperCompletion)completion uid:(NSString *)uid toUid:(NSString *)toUid {
|
||||
[self makeRequest:@"welcome/room/msg/getOne" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, toUid, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#import "Api+WishGift.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "UIView+Corner.h"
|
||||
#import "Api+Room.h"
|
||||
///Model
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
@@ -275,6 +276,51 @@
|
||||
}
|
||||
}
|
||||
[attribute appendAttributedString:[self createTextAttribute:@"进入了房间" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||
NSString *uid = [AccountInfoStorage instance].getUid;
|
||||
NSString *toUid = member.userId;
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
///如果是房主,并且不是自己进房消息,添加欢迎TA
|
||||
if (roomInfo.uid == [uid integerValue] && ![uid isEqualToString:toUid]) {
|
||||
NSAttributedString *welcome = [self createLocalImageAttribute:@"room_enter_greeting"];
|
||||
[attribute appendAttributedString:welcome];
|
||||
[attribute yy_setTextHighlightRange:NSMakeRange(attribute.length-welcome.length, welcome.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||||
///请求欢迎消息内容
|
||||
[Api requestMsgGetone:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSDictionary *dataDcit = data.data;
|
||||
NSString *msg = dataDcit[@"msg"];
|
||||
if (msg.length > 0) {
|
||||
/// 发动欢迎消息
|
||||
UserInfoModel * userInfo = [self.hostDelegate getUserInfo];
|
||||
XPMessageRemoteExtModel *extModel = [[XPMessageRemoteExtModel alloc] init];
|
||||
extModel.defUser = userInfo.defUser;
|
||||
extModel.erbanNo = userInfo.erbanNo;
|
||||
extModel.carName = userInfo.carName;
|
||||
extModel.inRoomNameplatePic = userInfo.nameplatePic;
|
||||
extModel.inRoomNameplateWord = userInfo.nameplateWord;
|
||||
extModel.charmUrl = userInfo.userLevelVo.charmUrl;
|
||||
extModel.experLevelSeq = userInfo.userLevelVo.experLevelSeq;
|
||||
extModel.experUrl = userInfo.userLevelVo.experUrl;
|
||||
extModel.newUser = userInfo.newUser;
|
||||
extModel.vipIcon = userInfo.userVipInfoVO.vipIcon;
|
||||
extModel.androidBubbleUrl = userInfo.androidBubbleUrl;
|
||||
extModel.iosBubbleUrl = userInfo.iosBubbleUrl;
|
||||
extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel;
|
||||
|
||||
NIMMessage * message = [[NIMMessage alloc] init];
|
||||
message.text = msg;
|
||||
NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[AccountInfoStorage instance].getUid];
|
||||
message.remoteExt = remoteExt;
|
||||
NSString *sessionId = [NSString stringWithFormat:@"%ld", [self.hostDelegate getRoomInfo].roomId];
|
||||
//构造会话
|
||||
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
|
||||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session completion:^(NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
}
|
||||
} uid:uid toUid:toUid];
|
||||
}];
|
||||
}
|
||||
messageInfo.content = attribute;
|
||||
return messageInfo;
|
||||
}
|
||||
|
Reference in New Issue
Block a user