上传宜搭测试代码

This commit is contained in:
sunny 2025-10-24 10:36:19 +08:00
parent 5af1e6407e
commit f7521389d1
2 changed files with 44 additions and 0 deletions

View File

@ -365,5 +365,41 @@ namespace MQTT_WinformV1
// 每秒更新一次时间显示
this.label4.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
}
//上传宜搭相关代码
private void yd_upload_test(object sender, EventArgs e)
{
if (toolStripStatusLabel1.Text != "已连接")
{
MessageBox.Show("请先连接MQTT网关");
return;
}
if (this.comboBox1.Text.Length == 0)
{
MessageBox.Show("请先导入配方信息,再刷新!");
}
//先获取token
string token = MqttClientService.GetDingDingToken();
if (!string.IsNullOrEmpty(token))
{
MessageBox.Show("获取 token 成功:" + token);
}
else
{
MessageBox.Show("获取 token 失败,请检查 AppKey/AppSecret");
}
bool result = MqttClientService.UploadTestDataToYida(token);
if (result)
MessageBox.Show("测试数据上传成功!");
else
MessageBox.Show("测试数据上传失败!");
}
}
}

View File

@ -267,5 +267,13 @@ namespace MqttClient
{
}
}
//上传宜搭代码
}
}