mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-10-26 21:22:16 +08:00 
			
		
		
		
	feat: update openim pull message by seq (#1498)
This commit is contained in:
		
							parent
							
								
									0efc235f45
								
							
						
					
					
						commit
						5b697d5e95
					
				| @ -1202,6 +1202,40 @@ EOF | |||||||
|   openim::test::check_error "$response" |   openim::test::check_error "$response" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | # Pulls messages by sequence. | ||||||
|  | openim::test::pull_msg_by_seq() { | ||||||
|  |   local userID="${1}" | ||||||
|  |   local conversationID="${2}" | ||||||
|  |   local beginSeq="${3}" | ||||||
|  |   local endSeq="${4}" | ||||||
|  |   local num="${5}" | ||||||
|  |   local order="${6}"  # Assuming 0 for ascending, 1 for descending | ||||||
|  | 
 | ||||||
|  |   # Construct the request body | ||||||
|  |   local request_body=$(cat <<EOF | ||||||
|  | { | ||||||
|  |   "userID": "${userID}", | ||||||
|  |   "seqRanges": [ | ||||||
|  |     { | ||||||
|  |       "conversationID": "${conversationID}", | ||||||
|  |       "begin": ${beginSeq}, | ||||||
|  |       "end": ${endSeq}, | ||||||
|  |       "num": ${num} | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   "order": ${order} | ||||||
|  | } | ||||||
|  | EOF | ||||||
|  | ) | ||||||
|  |   echo "$request_body" | ||||||
|  | 
 | ||||||
|  |   # Send the request | ||||||
|  |   local response=$(${CCURL} "${Token}" "${OperationID}" "${Header}" "${INSECURE_OPENIMAPI}/msg/pull_msg_by_seq" -d "${request_body}") | ||||||
|  | 
 | ||||||
|  |   # Check the response for errors | ||||||
|  |   openim::test::check_error "$response" | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # Revokes a message. | # Revokes a message. | ||||||
| openim::test::revoke_msg() { | openim::test::revoke_msg() { | ||||||
|   local userID="${1}" |   local userID="${1}" | ||||||
| @ -1266,11 +1300,23 @@ function openim::test::msg() | |||||||
|   echo "Searching for messages between ${SEND_USER_ID} and ${RECV_USER_ID}..." |   echo "Searching for messages between ${SEND_USER_ID} and ${RECV_USER_ID}..." | ||||||
|   openim::test::search_msg "${MANAGER_USERID_1}" "${RECV_USER_ID}" "${MSG_TYPE}" "${SEARCH_TIME}" "${SESSION_TYPE}" "${PAGE_NUMBER}" "${SHOW_NUMBER}" |   openim::test::search_msg "${MANAGER_USERID_1}" "${RECV_USER_ID}" "${MSG_TYPE}" "${SEARCH_TIME}" "${SESSION_TYPE}" "${PAGE_NUMBER}" "${SHOW_NUMBER}" | ||||||
| 
 | 
 | ||||||
|  |   # 3. Pull messages by sequence. | ||||||
|  |   local CONVERSATION_ID="ci_${SEND_USER_ID}_${RECV_USER_ID}" # Adjust as per your conversation ID format | ||||||
|  |   local BEGIN_SEQ=0 | ||||||
|  |   local END_SEQ=10 | ||||||
|  |   local NUM=5 | ||||||
|  |   local ORDER=0 # Assuming 0 for ascending order | ||||||
|  |   openim::test::pull_msg_by_seq "${RECV_USER_ID}" "${CONVERSATION_ID}" "${BEGIN_SEQ}" "${END_SEQ}" "${NUM}" "${ORDER}" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   # Assuming message sending was successful and returned a sequence number. | ||||||
|  |   local SEQ_NUMBER=1 # This should be the actual sequence number of the message sent. | ||||||
|  | 
 | ||||||
|   # 2. Revoke a message. |   # 2. Revoke a message. | ||||||
|   # TODO: |   # TODO: | ||||||
|   # openim::test::revoke_msg "${RECV_USER_ID}" "si_${SEND_USER_ID}_${RECV_USER_ID}" "${SEQ_NUMBER}" |   # openim::test::revoke_msg "${RECV_USER_ID}" "si_${SEND_USER_ID}_${RECV_USER_ID}" "${SEQ_NUMBER}" | ||||||
|    |    | ||||||
|   # 3. Clear all messages for a user. |   # 4. Clear all messages for a user. | ||||||
|   openim::test::user_clear_all_msg "${RECV_USER_ID}" |   openim::test::user_clear_all_msg "${RECV_USER_ID}" | ||||||
| 
 | 
 | ||||||
|   # Log the completion of the message test suite. |   # Log the completion of the message test suite. | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user