Beispiel #1
0
 /// <summary>
 /// 获取职位列表
 /// </summary>
 /// <returns></returns>
 public ApiResult <List <EmployeeJobApiModel> > GetJoblist()
 {
     return(WebApiUtil.GetAPI <ApiResult <List <EmployeeJobApiModel> > >($"api/Employee/myjobs?Token={Token}"));
 }
Beispiel #2
0
 /// <summary>
 /// 切换公司
 /// </summary>
 /// <param name="TargetCompanyId"></param>
 /// <returns></returns>
 public ApiResult <List <FunctionItemApiModel> > SwitchCompany(string TargetCompanyId)
 {
     return(WebApiUtil.PostAPI <ApiResult <List <FunctionItemApiModel> > >(
                $"api/switch?Token={Token}&TargetCompanyId={TargetCompanyId}", null));
 }
Beispiel #3
0
 /// <summary>
 /// 获取权限信息
 /// </summary>
 /// <returns></returns>
 public ApiResult <List <FunctionItemApiModel> > GetFunc()
 {
     return(WebApiUtil.GetAPI <ApiResult <List <FunctionItemApiModel> > >(
                $"api/auth/myfunc?Token={Token}"));
 }
Beispiel #4
0
        public BookApiInfo ExecuteByIsbn(string isbn)
        {
            var url  = string.Format("https://www.googleapis.com/books/v1/volumes?q=isbn:{0}", isbn);
            var json = WebApiUtil.GetResponseText(url);

            BookApiInfo info = new BookApiInfo
            {
                ApiName          = "GoogleBooksApi",
                ResponseText     = json,
                ResponseDatetime = DateTime.Now,
            };
            var jres = JObject.Parse(json);

            info.ItemCount = jres["totalItems"].Value <int>();
            if (info.ItemCount > 0)
            {
                foreach (var item in jres["items"])
                {
                    BookApiInfo.Item bookItem = new BookApiInfo.Item();

                    var volumeItems = (JObject)item["volumeInfo"];
                    foreach (var kvp in volumeItems)
                    {
                        switch (kvp.Key)
                        {
                        case "title":
                            bookItem.Title = kvp.Value.Value <string>();
                            break;

                        case "subtitle":
                            bookItem.Subtitle = kvp.Value.Value <string>();
                            break;

                        case "publisher":
                            bookItem.Publisher = kvp.Value.Value <string>();
                            break;

                        case "authors":
                            bookItem.Authors = string.Join(" ,", kvp.Value.Values <string>());
                            break;

                        case "publishedDate":
                            bookItem.PublishedDate = kvp.Value.Value <string>();
                            break;

                        case "description":
                            bookItem.Description = kvp.Value.Value <string>();
                            break;

                        case "industryIdentifiers":
                            var industryIdentifiers = (JArray)kvp.Value;
                            foreach (var ind in industryIdentifiers)
                            {
                                var val = ind["identifier"].Value <string>();
                                switch (ind["type"].Value <string>())
                                {
                                case "ISBN_13":
                                    bookItem.Isbn13 = val;
                                    break;

                                case "ISBN_10":
                                    bookItem.Isbn10 = val;
                                    break;
                                }
                            }
                            break;

                        case "pageCount":
                            bookItem.PageCount = kvp.Value.Value <string>();
                            break;

                        case "language":
                            bookItem.Language = kvp.Value.Value <string>();
                            break;

                        case "infoLink":
                            bookItem.InfoLink = kvp.Value.Value <string>();
                            break;

                        case "printType":
                            bookItem.PrintType = kvp.Value.Value <string>();
                            break;

                        case "categories":
                            bookItem.Categories = string.Join(", ", kvp.Value.Values <string>());
                            break;
                        }
                    }
                    info.BookItems.Add(bookItem);
                }
            }
            return(info);
        }