/// <summary> /// 对于活动的宣传,添加新的多媒体文件 /// </summary> /// <param name="o"></param> /// <returns></returns> public int AddMultimedium(CT_Wechat_Multimedium o) { string sql = "INSERT INTO CT_Wechat_Multimedia([WM_CG_EV_Code] ,[WM_CG_EV_Type] ,[WM_Tpe] ,[WM_Media],[WM_Media_Id] ,[WM_Create_Dt],[WM_Invalidation] ,[WM_fileName]) VALUES(" + o.WM_CG_EV_Code + "," + o.WM_CG_EV_Type + "," + o.WM_Tpe + ",'" + o.WM_Media + "','" + o.WM_Media_Id + "','" + o.WM_Create_Dt + "','" + o.WM_Invalidation + "','" + o.WM_fileName + "');"; int i = SqlHelper.ExecuteNonQuery(sql); return(i); }
/// <summary> /// 获取活动宣传相关的多媒体文件,缩列图,图文 CG_EV_Type=1 Campaign WM_Tpe=4,缩列图 WM_Tpe=5,图文模板 /// </summary> /// <param name="CG_EV_Code"></param> /// <param name="CG_EV_Type"></param> /// <param name="WM_Tpe"></param> /// <returns></returns> public CT_Wechat_Multimedium GETMultimedium(int CG_EV_Code, int CG_EV_Type, int WM_Tpe, string FileName) { string sql = "SELECT * FROM CT_Wechat_Multimedia WHERE WM_CG_EV_CODE=" + CG_EV_Code + " AND WM_CG_EV_TYPE=" + CG_EV_Type + " AND WM_Tpe=" + WM_Tpe + " AND WM_fileName='" + FileName + "';"; CT_Wechat_Multimedium o = DataHelper.ConvertToObject <CT_Wechat_Multimedium>(sql); return(o); }
/// <summary> /// 上床缩略图素材 /// </summary> /// <param name="_Multimed"></param> /// <returns></returns> private string UploadMaterial_thumb(CT_Wechat_Multimedium _Multimed) { UploadFileInfo _u = wechatHandle.ConvertMaterial(MaterialType.thumb, _Multimed.WM_Media); if (_u == null) { return(null); } int i = _d_wechat.UpdateMultimedium(_Multimed.WM_CG_EV_Code, _Multimed.WM_CG_EV_Type, _Multimed.WM_Tpe, _Multimed.WM_fileName, _u.MediaId, _u.Invalidation); return(_u.MediaId); }
/// <summary> /// 获取缩略图的MaID /// </summary> /// <param name="CG_Code"></param> /// <returns></returns> private string GetMaterialId_thumb(int CG_Code, string fileName) { CT_Wechat_Multimedium _Multimed = _d_wechat.GETMultimedium(CG_Code, 1, 4, fileName); if (_Multimed == null) { return(UploadMaterial_thumb(CG_Code, fileName)); } else if (_Multimed.WM_Invalidation < DateTime.Now) { return(UploadMaterial_thumb(_Multimed)); } else { return(_Multimed.WM_Media_Id); } }
private string UploadMaterial_news(CT_Wechat_Multimedium _Multimed) { CT_Campaigns _cam = _b_cam.GetCampaign(_Multimed.WM_CG_EV_Code); if (_cam == null) { return(null); } string _Id_thumb = GetMaterialId_thumb(_Multimed.WM_CG_EV_Code, _Multimed.WM_fileName); if (string.IsNullOrEmpty(_Id_thumb)) { return(null); } High_news _new = new High_news() { thumb_media_id = _Id_thumb, title = _cam.CG_Desc, content = _Multimed.WM_Media.Replace('"', '\''), }; IList <High_news> _Ihigh = new List <High_news>(); _Ihigh.Add(_new); string _news = wechatHandle.High_news(_Ihigh); if (string.IsNullOrEmpty(_news)) { return(null); } UploadFileInfo _u = wechatHandle.UploadImageText(_news); if (_u == null) { return(null); } int i = _d_wechat.UpdateMultimedium(_Multimed.WM_CG_EV_Code, _Multimed.WM_CG_EV_Type, _Multimed.WM_Tpe, _Multimed.WM_fileName, _u.MediaId, _u.Invalidation); return(_u.MediaId); }