コード例 #1
0
        public string GetData(string userName)
        {
            RecognitionProvider recognitionProvider = new RecognitionProvider();
            string  userId   = ChineseToPinyin(userName).ToLower();
            JObject jsonData = recognitionProvider.GetInfo(userId);

            if (jsonData == null)
            {
                return("查询失败");
            }
            jsonData.TryGetValue("result", out JToken value);
            JToken  infoArry = value["user_list"];
            string  info     = infoArry[0]["user_info"].ToString();
            JObject faceInfo = (JObject)JsonConvert.DeserializeObject(info);
            string  name     = faceInfo["UserName"].ToString();
            string  text     = faceInfo["value"].ToString();

            return($"姓名:{name}\r\n信息:{text}");
        }