!110 bug fix: onRequest need appId

Merge pull request !110 from 符子坤/master
This commit is contained in:
openharmony_ci
2021-11-13 08:39:30 +00:00
committed by Gitee
@@ -154,6 +154,11 @@ static int32_t GenerateRequestParams(const CJson *jsonParams, CJson *requestPara
LOGE("Failed to get peerAuthId from jsonParams!");
return HC_ERR_JSON_GET;
}
const char *appId = GetStringFromJson(jsonParams, FIELD_APP_ID);
if (appId == NULL) {
LOGE("Failed to get appId from jsonParams!");
return HC_ERR_JSON_GET;
}
int32_t groupType = PEER_TO_PEER_GROUP;
if (GetIntFromJson(jsonParams, FIELD_GROUP_TYPE, &groupType) != HC_SUCCESS) {
LOGE("Failed to get groupType from jsonParams!");
@@ -171,6 +176,10 @@ static int32_t GenerateRequestParams(const CJson *jsonParams, CJson *requestPara
LOGE("Failed to add peerDeviceId to requestParams!");
return HC_ERR_JSON_FAIL;
}
if (AddStringToJson(requestParams, FIELD_APP_ID, appId) != HC_SUCCESS) {
LOGE("Failed to add appId to requestParams!");
return HC_ERR_JSON_FAIL;
}
return HC_SUCCESS;
}