public virtual WeiXinResponse GetResponse() { IDataSource dataSource = null; var data = new { title = "感谢您关注", content = "测试", image = "http://fx.51llgo.com", url = "http://mp.weixin.qq.com/s?__biz=MzI4MzEwODQ4Mw==&mid=401947642&idx=1&sn=c01694a4767684dd9fb9f2edf225abb8#rd" }; List <dynamic> dataItems = new List <dynamic>(); dataItems.Add(data); var command = new OTTCommand() { Command = "subscribe", CommandId = 1382, Data = JsonConvert.SerializeObject(dataItems), DataSource = "DataField", OTT = "WeiXin", SiteId = 0, Style = 3 }; dataSource = new DataFieldDataSource(command, WeiXin); if (dataSource != null) { return(dataSource.GetResponse()); } else { throw new Exception("没有匹配的数据源"); } }
public virtual WeiXinResponse GetResponse(OTTCommand command) { IDataSource dataSource = null; switch (command.DataSource) { case "text": dataSource = new DataFieldDataSource(command, this.WeiXin); break; case "DataField": // dataSource = new DataFieldDataSource(command, this.WeiXin); break; case "Article": // dataSource = new ArticleDataSource(command, this.WeiXin); break; case "Product": //dataSource = new ProductDataSource(command, this.WeiXin); break; case "CompanyInfo": // dataSource = new CompanyInfoDataSource(command, this.WeiXin); break; case "DataIndex": //dataSource = new SearchDataSource(command, this.WeiXin); break; case "User": //dataSource = new UserDataSource(command, this.WeiXin); break; } if (dataSource != null) { return(dataSource.GetResponse()); } else { throw new Exception("没有匹配的数据源"); } }