get() public static method

public static get ( string url ) : string
url string
return string
示例#1
0
        /// <summary>
        /// 获取任务列表,数据有查询缓存
        /// </summary>
        /// <returns></returns>
        public List <TaskInfo> getTaskList()
        {
            tasks.Clear();

            RequestType type = getRequestType();

            string name = "index.php?m=my&f=task&t=json&type=assignedTo&orderBy=id_desc&recTotal=0&recPerPage=1000&pageID=1";

            if (type == RequestType.PATH_INFO)
            {
                name = "my-task-assignedTo-id_desc-0-1000-1.json";
            }
            string taskUrl = getAPIUrl(name);

            string       body   = HttpClient.get(taskUrl);
            ZentaoResult result = JsonConvert.DeserializeObject <ZentaoResult>(body);

            if (result.isSuccess())
            {
                TaskResult taskResult = JsonConvert.DeserializeObject <TaskResult>(result.data);

                foreach (TaskInfo task in taskResult.tasks)
                {
                    if (!task.status.Equals("done") && !task.status.Equals("done"))
                    {
                        tasks.Add(task);
                    }
                }

                return(tasks);
            }

            return(new List <TaskInfo>());
        }
示例#2
0
        /// <summary>
        /// 获取BUG列表: 此处的结果有数据缓存,最新的数据调用searchBugList
        /// </summary>
        /// <returns></returns>
        public List <BugInfo> getBugList()
        {
            bugs.Clear();

            RequestType type = getRequestType();
            string      name = "index.php?m=my&f=bug&t=json&type=assignedTo&orderBy=id_desc&recTotal=0&recPerPage=1000&pageID=1";

            if (type == RequestType.PATH_INFO)
            {
                name = "my-bug-assignedTo-id_desc-0-1000-1.json";
            }

            string bugUrl = this.getAPIUrl(name);

            string body = HttpClient.get(bugUrl);

            ZentaoResult result = JsonConvert.DeserializeObject <ZentaoResult>(body);

            if (result.isSuccess())
            {
                BugResult bugResult = JsonConvert.DeserializeObject <BugResult>(result.data);
                foreach (BugInfo bug in bugResult.bugs)
                {
                    if (bug.status.Equals("active"))
                    {
                        bugs.Add(bug);
                    }
                }

                return(bugs);
            }


            return(new List <BugInfo>());
        }
示例#3
0
        public static RequestType getRequestType(string url)
        {
            RequestType requestType;

            if (!requestTypeMap.ContainsKey(url))
            {
                string requrl = url + (url.EndsWith("/") ? "" : "/") + "index.php?mode=getconfig";

                string body = HttpClient.get(requrl);

                ConfigResult result = JsonConvert.DeserializeObject <ConfigResult>(body);

                requestType         = result.requestType.Equals("GET") ? RequestType.GET : RequestType.PATH_INFO;
                requestTypeMap[url] = requestType;
            }
            else
            {
                requestType = requestTypeMap[url];
            }

            return(requestType);
        }