public Maticsoft.Model.SNS.Posts AddPost(Maticsoft.Model.SNS.Posts Post, int AblumId, long Pid, int PhotoCateId, string PhotoAddress = "", string MapLng = "", string MapLat = "", bool CreatePost = true) { Maticsoft.Model.SNS.Products pModel = new Maticsoft.Model.SNS.Products(); Maticsoft.BLL.SNS.Tags tags = new Maticsoft.BLL.SNS.Tags(); if (Post.Type == 2) { ITopClient topClient = TaoBaoConfig.GetTopClient(); TaobaokeItemsDetailGetRequest request = new TaobaokeItemsDetailGetRequest { Fields = "num_iid,title,price,num_iid,title,cid,nick,desc,price,post_fee,express_fee,ems_fee,item_img.url,click_url,shop_click_url,num,props_name,detail_url,pic_url", NumIids = Pid.ToString() }; TaobaokeItemsDetailGetResponse response = topClient.Execute<TaobaokeItemsDetailGetResponse>(request); Maticsoft.BLL.SNS.CategorySource source = new Maticsoft.BLL.SNS.CategorySource(); Item item = new Item(); item = (response.TaobaokeItemDetails.Count > 0) ? response.TaobaokeItemDetails[0].Item : null; pModel.ProductUrl = (response.TaobaokeItemDetails.Count > 0) ? response.TaobaokeItemDetails[0].ClickUrl : ""; if (response.TaobaokeItemDetails.Count < 1) { ItemGetRequest request2 = new ItemGetRequest { Fields = "num_iid,title,price,num_iid,title,cid,nick,desc,price,item_img.url,click_url,shop_click_url,num,props_name,detail_url,pic_url", NumIid = new long?(Pid) }; item = topClient.Execute<ItemGetResponse>(request2).Item; pModel.ProductUrl = item.DetailUrl; } Maticsoft.Model.SNS.CategorySource model = source.GetModel(3, Convert.ToInt32(item.Cid)); pModel.CategoryID = (model != null) ? model.SnsCategoryId : 0; pModel.NormalImageUrl = item.PicUrl; pModel.ThumbImageUrl = item.PicUrl + "_300x300.jpg"; pModel.Price = new decimal?(Globals.SafeDecimal(item.Price, (decimal) 0M)); pModel.ProductID = Pid; pModel.ProductName = item.Title; Post.ProductName = pModel.ProductName; pModel.ProductSourceID = 3; pModel.CreatedDate = DateTime.Now; pModel.CreatedNickName = Post.CreatedNickName; pModel.CreateUserID = Post.CreatedUserID; string str = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_check_product"); if (!string.IsNullOrEmpty(str)) { pModel.Status = (str == "0") ? 1 : 0; Post.Status = (str == "0") ? 1 : 0; } else { pModel.Status = 1; Post.Status = 1; } if (FilterWords.ContainsModWords(Post.Description)) { pModel.Status = 0; Post.Status = 0; } else { Post.Description = FilterWords.ReplaceWords(Post.Description); } pModel.ShareDescription = Post.Description; ItemGetRequest request3 = new ItemGetRequest { Fields = "props_name", NumIid = new long?(Pid) }; string propsName = topClient.Execute<ItemGetResponse>(request3).Item.PropsName; pModel.Tags = tags.GetTagStr(propsName); Post.ProductName = pModel.ProductName; if (!string.IsNullOrEmpty(Post.Description)) { Post.Description = Post.Description + "</br><a target='_blank' style='color: #FF7CAE' href='{ProductUrl} '>" + Post.ProductName + "</a>"; } else { Post.Description = "<a target='_blank' style='color: #FF7CAE' href='{ProductUrl} '>" + Post.ProductName + "</a>"; } } else if (Post.Type == 0) { string str3; if (!string.IsNullOrEmpty(Post.ImageUrl)) { str3 = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_check_photo"); if (!string.IsNullOrEmpty(str3)) { Post.Status = (str3 == "0") ? 1 : 0; } else { Post.Status = 1; } } else if (!string.IsNullOrEmpty(Post.VideoUrl) && (Post.VideoUrl.Length > 5)) { Post.Type = 3; str3 = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_check_video"); if (!string.IsNullOrEmpty(str3)) { Post.Status = (str3 == "0") ? 1 : 0; } else { Post.Status = 1; } } else if (!string.IsNullOrEmpty(Post.AudioUrl)) { str3 = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_check_audio"); if (!string.IsNullOrEmpty(str3)) { Post.Status = (str3 == "0") ? 1 : 0; } else { Post.Status = 1; } } else { str3 = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("chk_check_word"); if (!string.IsNullOrEmpty(str3)) { Post.Status = (str3 == "0") ? 1 : 0; } else { Post.Status = 1; } } } else if ((Post.Type == 1) && !string.IsNullOrEmpty(Post.ImageUrl)) { string str4 = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_check_picture"); if (!string.IsNullOrEmpty(str4)) { Post.Status = (str4 == "0") ? 1 : 0; } else { Post.Status = 1; } } string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_ProductAndPhotoRecommandState"); int recommandStateInt = (valueByCache != null) ? Globals.SafeInt(valueByCache, 0) : 0; if (FilterWords.ContainsModWords(Post.Description)) { Post.Status = 0; } else { Post.Description = FilterWords.ReplaceWords(Post.Description); } Maticsoft.Model.SNS.Posts posts = this.dal.AddPost(Post, AblumId, Pid, PhotoCateId, pModel, recommandStateInt, PhotoAddress, MapLng, MapLat, CreatePost); Maticsoft.BLL.SNS.ReferUsers users = new Maticsoft.BLL.SNS.ReferUsers(); if (posts != null) { users.AddEx(Post.Description, EnumHelper.ReferType.Post, posts.PostID, ""); } return posts; }
public List<CType> GetTagListByCidEx(int Cid) { List<CType> list = new List<CType>(); Maticsoft.BLL.SNS.Tags tags = new Maticsoft.BLL.SNS.Tags(); foreach (Maticsoft.Model.SNS.TagType type in this.GetModelList(" Cid=" + Cid)) { CType item = new CType { MTagType = type }; List<Maticsoft.Model.SNS.Tags> list3 = new List<Maticsoft.Model.SNS.Tags>(); list3 = tags.DataTableToList(tags.GetListByPage("TypeId=" + type.ID, "", 1, 5).Tables[0]); item.Taglist = list3; list.Add(item); } return list; }