zoukankan      html  css  js  c++  java
  • xmlrpc(2)first demo_v2

            [XmlRpcMethod("blogger.getUsersBlogs", Description = "获取博客信息")]
            
    public BlogInfo[] getUsersBlogs(string appKey, string username, string password)
            
    {
                BlogInfo[] infoarr 
    = new BlogInfo[1];
                
    for (int i = 0; i < 1; i++)
                
    {
                    Member member 
    = GetUser(username, password);
                    
    if (member != null)
                    
    {
                        infoarr[i].url 
    = GetAppPath() + "Blog/User/Default.aspx?UserName=" + HttpContext.Current.Server.UrlEncode(member.UserName);
                        infoarr[i].blogName 
    = GetBlogSetting(Convert.ToInt32(member.MemberID)).BlogName;
                        infoarr[i].blogid 
    = member.MemberID.ToString();
                    }

                }


                
    return infoarr;
            }


            [XmlRpcMethod(
    "metaWeblog.getCategories", Description = "获取分类列表")]
            
    public CategoryInfo[] getCategories(string blogid, string username, string password)
            
    {

                TList
    <BlogKind> list = GetBlogKind(int.Parse(blogid));

                CategoryInfo[] infoarr 
    = new CategoryInfo[list.Count];

                
    for (int i = 0; i < infoarr.Length; i++)
                
    {
                    infoarr[i].categoryid 
    = list[i].BlogKindID.ToString();
                    infoarr[i].description 
    = list[i].KindName;
                    infoarr[i].htmlUrl 
    = "";
                    infoarr[i].rssUrl 
    = "";
                    infoarr[i].title 
    = list[i].KindName;
                }


                
    return infoarr;
            }


            [XmlRpcMethod(
    "metaWeblog.newPost", Description = "发表日志")]
            
    public string newPost(string blogid, string username, string password, CookComputing.MetaWeblog.Post post, bool publish)
            
    {
                Member member 
    = GetUser(username, password);
                
    if (member != null)
                
    {
                    BlogTopic xBlogTopic 
    = new BlogTopic();

                    xBlogTopic.Title 
    = post.title;
                    xBlogTopic.Content 
    = post.description;
                    xBlogTopic.Weather 
    = 0;
                    xBlogTopic.Face 
    = 1;
                    xBlogTopic.CommentNum 
    = 0;
                    xBlogTopic.IsBast 
    = 0;
                    xBlogTopic.IsShow 
    = 1;
                    xBlogTopic.ComeFrom 
    = username;
                    xBlogTopic.Summary 
    = "";
                    xBlogTopic.IsTop 
    = 0;
                    xBlogTopic.LastIp 
    = HttpContext.Current.Request.Url.Host;
                    xBlogTopic.Hits 
    = 0;
                    xBlogTopic.CheckInTime 
    = DateTime.Now;
                    xBlogTopic.Status 
    = 1;
                    xBlogTopic.MemberID 
    = Convert.ToInt32(blogid);
                    xBlogTopic.Tags 
    = "";
                    xBlogTopic.BlogSystemTypeID 
    = null;
                    xBlogTopic.Score 
    = 0;
                    
    if (!string.IsNullOrEmpty(post.categories[0]))
                    
    {
                        
    foreach (CategoryInfo info in getCategories(blogid, username, password))
                        
    {
                            
    if (info.title == post.categories[0])
                            
    {
                                xBlogTopic.BlogKindID 
    = int.Parse(info.categoryid);
                                
    break;
                            }

                        }

                    }

                    xBlogTopic.BastTime 
    = null;

                    BlogTopicSystem.Instance.Create(xBlogTopic);

                    
    return xBlogTopic.BlogTopicID.ToString();
                }

                
    return "0";
            }

  • 相关阅读:
    【Python】【Nodejs】下载单张图片到本地,Python和Nodejs的比较
    【pyhon】nvshens图片批量下载爬虫1.01
    【pyhon】Python里的字符串查找函数find和java,js里的indexOf相似,找到返回序号,找不到返回-1
    【pyhon】nvshens图片批量下载爬虫
    【python】下载网络文件到本地
    【python】列出http://www.cnblogs.com/xiandedanteng中所有博文的标题
    【python】列出http://www.cnblogs.com/xiandedanteng/p/中的标题
    【python】如何安装requests
    【python】如何安装BeautifulSoup4
    day16_ajax学习笔记
  • 原文地址:https://www.cnblogs.com/nasa/p/634093.html
Copyright © 2011-2022 走看看