From a68e732e00cd9681ec454e7f5feca0c8700f4174 Mon Sep 17 00:00:00 2001 From: eeff <33566201+eeff@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:22:55 +0800 Subject: [PATCH] fix(xinao): algset/cack use key name `data` --- plugins/mqtt-xinao/xinao.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/mqtt-xinao/xinao.c b/plugins/mqtt-xinao/xinao.c index 17a836b7..c05e9898 100644 --- a/plugins/mqtt-xinao/xinao.c +++ b/plugins/mqtt-xinao/xinao.c @@ -414,6 +414,11 @@ char *xinao_ctx_gen_batch_resp_json(xinao_batch_ctx_t *ctx) json_t *cmd = json_object_get(ctx->root, "cmd"); int n_cmd = json_array_size(cmd); + // rename to `data` + json_incref(cmd); + json_object_del(ctx->root, "cmd"); + json_object_set_new(ctx->root, "data", cmd); + json_object_set_new(ctx->root, "ts", json_integer(global_timestamp)); json_object_set_new(ctx->root, "type", json_string("algset/cack"));