/// <summary>
        /// 获取用户列表
        /// </summary>
        /// <param name="reqData"></param>
        /// <returns></returns>
        public XAIResGetUserList GetUserList(XAIReqGetUserList reqData)
        {
            LogModule.Info("XAI->BIDU:GetUserList--->入参:" + reqData.ToJson());
            string resJson;

            try
            {
                resJson = client.GroupGetusers(reqData.GroupId).ToJson();
            }
            catch (Exception ex)
            {
                throw new XAIException(7100, "请求人脸识别服务异常,请重试!" + ex.Message);
            }
            LogModule.Info("XAI->BIDU:GetUserList--->出参:" + resJson);
            var res = resJson.ToEntity <BIDUResponse>();

            if (res.error_code != 0)
            {
                throw new XAIException(7100, typeof(BIDUErrorCodeEnum).GetEnumName(res.error_code.ToInt()));
            }
            return(new XAIResGetUserList()
            {
                UserIdList = res.result.user_id_list
            });
        }
Exemple #2
0
        public JObject GetUserList(string groupid)
        {
            var client = new Baidu.Aip.Face.Face(API_KEY, SECRET_KEY);

            client.Timeout = 60000;  // 修改超时时间

            if (string.IsNullOrEmpty(groupid))
            {
                groupid = groupId;
            }

            var groups = client.GroupGetusers(groupid);

            return(groups);
        }
        public static void GroupGetusers()
        {
            var client = new Baidu.Aip.Face.Face(API_KEY, SECRET_KEY);

            client.Timeout = 60000;  // 修改超时时间
            var groupId = "F001";

            // 调用获取用户列表,可能会抛出网络等异常,请使用try/catch捕获
            //var result = client.GroupGetusers(groupId);
            //Console.WriteLine(result);
            // 如果有可选参数
            var options = new Dictionary <string, object> {
                { "start", 0 },
                { "length", 50 }
            };
            // 带参数调用获取用户列表
            var result = client.GroupGetusers(groupId, options);

            Console.WriteLine(result);
        }
Exemple #4
0
 /// <summary>
 /// 查询指定用户组中的用户列表。
 /// </summary>
 /// <param name="groupId"></param>
 /// <returns></returns>
 public static BaseResponse <GetUsersResult> GetUsers(string groupId, GetActionOption option = null)
 {
     return(Execute <GetUsersResult>(client.GroupGetusers(groupId, option?.Options)));
 }