Commit 60e090ba by zhangyunjie

时序排序

parent cf0bfd16
//
//
......@@ -114,7 +114,9 @@ static OffcnIMSDKiOS *liveTelecastSDK;
-(void)sendMsgWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_type:(OffcnSDKMsgType)msg_type text:(NSString *)text filePath:(NSString *)filePath Finished:(void(^)(BOOL success,OffcnIMSendMsgModel *sendMsgModel,NSString *errorMessage))finished ProgressPercent:(void(^)(NSString *key, float percent))progressPercent{
KWeakSelf
NSString *tidStr = [NSString stringWithFormat:@"%@_%@",msg_toID,[SDGeneralTool getNowSSSTimeTimestamp]];
NSString *msg_seqStr = [SDGeneralTool getNowSSSTimeTimestamp];
NSString *send_timeStr = [SDGeneralTool getIMAllTimeWithSeconds:[msg_seqStr integerValue]];
NSString *tidStr = [NSString stringWithFormat:@"%@__%@",msg_toID,msg_seqStr];
if (msg_type == OffcnSDKMsgTypeText) {
if (!text || !text.length) {
......@@ -127,6 +129,8 @@ static OffcnIMSDKiOS *liveTelecastSDK;
BodyModel.msg_to = msg_toID;
BodyModel.msg_type = msg_type;
BodyModel.tid = tidStr;
BodyModel.msg_seq = [msg_seqStr integerValue];
BodyModel.send_time = send_timeStr;
MsgModel.msg = text;
BodyModel.msg = MsgModel;
BodyModel.isSentSuccess = 0;
......@@ -152,6 +156,8 @@ static OffcnIMSDKiOS *liveTelecastSDK;
BodyModel.msg_to = msg_toID;
BodyModel.msg_type = msg_type;
BodyModel.tid = tidStr;
BodyModel.msg_seq = [msg_seqStr integerValue];
BodyModel.send_time = send_timeStr;
BodyModel.isSentSuccess = 0;
BodyModel.bymyself = 1;
BodyModel.isRead = 0;
......@@ -227,6 +233,8 @@ static OffcnIMSDKiOS *liveTelecastSDK;
BodyModel.msg_to = msg_toID;
BodyModel.msg_type = msg_type;
BodyModel.tid = tidStr;
BodyModel.msg_seq = [msg_seqStr integerValue];
BodyModel.send_time = send_timeStr;
BodyModel.isSentSuccess = 0;
BodyModel.bymyself = 1;
BodyModel.isRead = 0;
......
//
//
......@@ -42,6 +42,8 @@
+(NSString *)getHHTimeWithSeconds:(NSTimeInterval)s;
+(NSString *)getIMAllTimeWithSeconds:(NSTimeInterval)s;
+ (NSString *)getTimeWithSeconds:(NSTimeInterval)s;
+(NSString *)getTimeWithDate:(NSDate *)date;
......
//
//
......@@ -245,6 +245,12 @@
NSDate *date = [NSDate dateWithTimeIntervalSince1970:s/1000];
return [format stringFromDate:date];
}
+(NSString *)getIMAllTimeWithSeconds:(NSTimeInterval)s{
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:s/1000];
return [format stringFromDate:date];
}
+(NSString *)getTimeWithSeconds:(NSTimeInterval)s{
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
......
//
//
......@@ -59,6 +59,7 @@
BodyModel.send_time = SendMsgModel.send_time;
BodyModel.session_id = SendMsgModel.session_id;
BodyModel.tid = SendMsgModel.tid;
BodyModel.msg_seq = [[[tid componentsSeparatedByString:@"__"] lastObject] integerValue];
BodyModel.isSentSuccess = 1;
BodyModel.msg_type = msg_type;
if (msg_type == 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment