#include "dbapi.h" #include "util.h" using namespace protomsg; //获取服务器本机配置信息 bool dbapi_get_server_get_sn(void *handle, char *reply_msg) { const char *topic = DATA_URL_PREFIX("/version/snBus"); return bus_dbapi_get_str(handle, topic, &reply_msg); } bool dbapi_get_server_get_is_sys_expired(void *handle) { char *reply_msg = NULL; bool is_expired = false; bool ret = false; bool expire_val = false; ret = dbapi_get_server_get_sn(handle, reply_msg); if (ret && reply_msg != NULL) { // Read JSON and get root yyjson_doc *doc = yyjson_read(reply_msg, strlen(reply_msg), 0); yyjson_val *root = yyjson_doc_get_root(doc); yyjson_val *data = yyjson_obj_get(root, "expire"); expire_val = yyjson_get_bool(data); printf("expire: %d\n", expire_val); yyjson_doc_free(doc); } free(reply_msg); return expire_val; }