示例#1
0
        private string UploadMaterial_news(int CG_Code, string fileName)
        {
            CT_Campaigns _cam = _b_cam.GetCampaign(CG_Code);

            if (_cam == null)
            {
                return(null);
            }
            string _Id_thumb = GetMaterialId_thumb(CG_Code, fileName);

            if (string.IsNullOrEmpty(_Id_thumb))
            {
                return(null);
            }
            string _content = GetHandleContent(fileName);

            if (string.IsNullOrEmpty(_content))
            {
                return(null);
            }
            High_news _new = new High_news()
            {
                thumb_media_id = _Id_thumb,
                title          = _cam.CG_Desc,
                content        = _content.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.AddMultimedium(new CT_Wechat_Multimedium
            {
                WM_CG_EV_Code   = CG_Code,
                WM_CG_EV_Type   = 1,
                WM_Tpe          = 5,
                WM_Media        = _content.Replace('\'', '"'),
                WM_Media_Id     = _u.MediaId,
                WM_Create_Dt    = _u.UploadDate,
                WM_Invalidation = _u.Invalidation,
                WM_fileName     = fileName
            });

            return(_u.MediaId);
        }
示例#2
0
        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);
        }