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";
            }

  • 相关阅读:
    JQUERY
    五分钟技术演讲
    T-SQL基础--chp10可编程对象学习笔记[下]
    SQL中用SET赋值和用SELECT赋值的区别。
    Can't find file: './mysql/plugin.frm' (errno: 13)[mysql数据目录迁移错位]错误解决
    jetty属性
    JRebel 5.3.2
    vue+mongoodb+node连接数据库
    css样式
    超出文本显示一行文字
  • 原文地址:https://www.cnblogs.com/nasa/p/634093.html
Copyright © 2011-2022 走看看