|
|
@ -16,8 +16,8 @@ def on_connect(client, userdata, flags, rc, properties=None):
|
|
|
|
def on_message(client, userdata, msg):
|
|
|
|
def on_message(client, userdata, msg):
|
|
|
|
print("收到消息: " + msg.topic + " " + str(msg.payload))
|
|
|
|
print("收到消息: " + msg.topic + " " + str(msg.payload))
|
|
|
|
|
|
|
|
|
|
|
|
if not os.path.exists("user.txt"):
|
|
|
|
if not os.path.exists("smp_coder/user.txt"):
|
|
|
|
with open("user.txt", "a") as f:
|
|
|
|
with open("smp_coder/user.txt", "a") as f:
|
|
|
|
f.write(msg.payload.decode("utf-8") + "\n")
|
|
|
|
f.write(msg.payload.decode("utf-8") + "\n")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
|
|