提交 a8255348 authored 作者: 陈泽健's avatar 陈泽健

处理富创项目的MQTT预约、修改和删除会议消息体,增加代码可维护性。补充标准版安卓信息的监听代码。

上级 1bc8bf65
......@@ -381,9 +381,9 @@ class Mqtt:
}
})
elif topic == "/meeting/message/sync" and config['action'] == 'add':
elif topic == "/meeting/message/sync":
return json.dumps({
"action": "add",
"action": config['action'],
"thirdMessageDTO": [{
"thirdPartyMeetingId": config['thirdPartyMeetingId'],
"messageCompere": "张三",
......
......@@ -102,4 +102,5 @@
- 输出富创项目的MQTT人脸签到订阅测试脚本,输出富创项目两个MQTT相关服务的README文档。
29. 2024-12-13
- 补充MQTT的消息监听,监听到消息后,会通过日志输出消息体内容,可用于所有预定项目测试使用。
- 补充富创项目的MQTT消息监听,监听到消息后,会通过日志输出消息体内容,可用于富创项目测试替代第三方工具使用。
\ No newline at end of file
- 补充富创项目的MQTT消息监听,监听到消息后,会通过日志输出消息体内容,可用于富创项目测试替代第三方工具使用。
- 处理富创项目的MQTT预约、修改和删除会议消息体,增加代码可维护性。补充标准版安卓信息的监听代码。
\ No newline at end of file
......@@ -7,15 +7,17 @@ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(
# MQTT 客户端回调函数
def on_connect(client, userdata, flags, rc):
logging.info("已连接到MQTT服务器")
client.subscribe(topic)
# 订阅多个主题
topics = ["/androidPanel/", "/uams/android/broadcast"]
for t in topics:
client.subscribe(t)
def on_message(client, userdata, msg):
logging.info(f"接收到消息: {msg.payload.decode()}")
logging.info(f"接收到消息: 主题={msg.topic}, 消息体={msg.payload.decode()}")
if __name__ == "__main__":
broker_address = "192.168.5.218"
port = 1883
topic = "/meeting/sign/result" # 替换为你需要订阅的主题
# 创建 MQTT 客户端实例
mqtt_client = mqtt.Client()
......
topic,action,thirdPartyMeetingId,thirdPartyRoomId,conferenceName,messageName,startTime,endTime,companyNumber
/meeting/message/sync,mod,6565416702283087871,1,1105会议室,富创测试会议1,2024-12-13 09:00:00.0,2024-12-13 09:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,mod,6565416702283087872,2,1201会议室,富创测试会议2,2024-12-13 10:00:00.0,2024-12-13 10:40:00.0,CN-JHP-UBAINS
/meeting/message/sync,mod,6565416702283087873,3,104会议室,富创测试会议3,2024-12-13 11:00:00.0,2024-12-13 11:40:00.0,CN-JHP-UBAINS
/meeting/message/sync,mod,6565416702283087874,4,403会议室,富创测试会议4,2024-12-13 12:00:00.0,2024-12-13 12:40:00.0,CN-JHP-UBAINS
/meeting/message/sync,mod,6565416702283087875,5,108会议室,富创测试会议5,2024-12-13 13:00:00.0,2024-12-13 13:40:00.0,CN-JHP-UBAINS
/meeting/message/sync,mod,6565416702283087876,6,107会议室,富创测试会议6,2024-12-13 14:00:00.0,2024-12-13 14:40:00.0,CN-JHP-UBAINS
/meeting/message/sync,mod,6565416702283087877,7,101会议室,富创测试会议7,2024-12-13 15:00:00.0,2024-12-13 15:40:00.0,CN-JHP-UBAINS
/meeting/message/sync,mod,6565416702283087878,8,102会议室,富创测试会议8,2024-12-13 16:00:00.0,2024-12-13 16:40:00.0,CN-JHP-UBAINS
\ No newline at end of file
topic,action,thirdPartyMeetingId,thirdPartyRoomId,conferenceName,messageName,startTime,endTime,companyNumber
/meeting/message/sync,add,6565416702283087871,1,1105会议室,富创测试会议1,2024-12-13 09:00:00.0,2024-12-13 09:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087872,2,1201会议室,富创测试会议2,2024-12-13 10:00:00.0,2024-12-13 10:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087873,3,104会议室,富创测试会议3,2024-12-13 11:00:00.0,2024-12-13 11:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087874,4,403会议室,富创测试会议4,2024-12-13 12:00:00.0,2024-12-13 12:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087875,5,108会议室,富创测试会议5,2024-12-13 13:00:00.0,2024-12-13 13:30:00.0,CN-JHP-UBAINS
\ No newline at end of file
/meeting/message/sync,del,6565416702283087871,1,1105会议室,富创测试会议1,2024-12-13 09:00:00.0,2024-12-13 09:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,del,6565416702283087872,2,1201会议室,富创测试会议2,2024-12-13 10:00:00.0,2024-12-13 10:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,del,6565416702283087873,3,104会议室,富创测试会议3,2024-12-13 11:00:00.0,2024-12-13 11:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,del,6565416702283087874,4,403会议室,富创测试会议4,2024-12-13 12:00:00.0,2024-12-13 12:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,del,6565416702283087875,5,108会议室,富创测试会议5,2024-12-13 13:00:00.0,2024-12-13 13:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,del,6565416702283087876,6,107会议室,富创测试会议6,2024-12-13 14:00:00.0,2024-12-13 14:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,del,6565416702283087877,7,106会议室,富创测试会议7,2024-12-13 15:00:00.0,2024-12-13 15:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,del,6565416702283087878,8,105会议室,富创测试会议8,2024-12-13 16:00:00.0,2024-12-13 16:30:00.0,CN-JHP-UBAINS
\ No newline at end of file
topic,action,thirdPartyMeetingId,thirdPartyRoomId,conferenceName,messageName,startTime,endTime,companyNumber
/meeting/message/sync,add,6565416702283087871,1,1105会议室,富创预约1,2024-12-13 09:10:00.0,2024-12-13 09:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087872,2,1201会议室,富创预约2,2024-12-13 10:10:00.0,2024-12-13 10:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087873,3,104会议室,富创预约3,2024-12-13 11:10:00.0,2024-12-13 11:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087874,4,403会议室,富创预约4,2024-12-13 12:10:00.0,2024-12-13 12:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087875,5,108会议室,富创预约5,2024-12-13 13:10:00.0,2024-12-13 13:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087876,6,107会议室,富创预约6,2024-12-13 14:10:00.0,2024-12-13 14:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087877,7,106会议室,富创预约7,2024-12-13 15:10:00.0,2024-12-13 15:30:00.0,CN-JHP-UBAINS
/meeting/message/sync,add,6565416702283087878,8,105会议室,富创预约8,2024-12-13 16:10:00.0,2024-12-13 16:30:00.0,CN-JHP-UBAINS
\ No newline at end of file
import logging
from hytest import *
from 预定系统.Base.Mqtt_Send import *
from 预定系统.Base.base import *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../测试数据/MQTT模块/富创项目_会议推送.csv')
# 构建会议预约CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../测试数据/MQTT模块/富创项目/富创项目_会议预约推送.csv')
# 构建会议预约CSV文件的绝对路径
# csv_file_path = os.path.join(current_dir, '../../测试数据/MQTT模块/富创项目/富创项目_会议修改推送.csv')
# 构建会议预约CSV文件的绝对路径
# csv_file_path = os.path.join(current_dir, '../../测试数据/MQTT模块/富创项目/富创项目_会议删除推送.csv')
if __name__ == "__main__":
# 读取配置文件
......
......@@ -8,7 +8,7 @@ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(
def on_connect(client, userdata, flags, rc):
logging.info("已连接到MQTT服务器")
# 订阅多个主题
topics = ["/androidPanel/", "/meeting/sign/result", "/meeting/message/sync"]
topics = ["/androidPanel/", "/meeting/sign/result", "/meeting/message/sync", "/uams/android/broadcast"]
for t in topics:
client.subscribe(t)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论