Пример #1
0
        public string ProcessWxIMG(string mediaIds, string strCode, JH_Auth_UserB.UserInfo UserInfo, string strType = ".jpg")
        {
            try
            {
                WXHelp wx  = new WXHelp(UserInfo.QYinfo);
                string ids = "";
                foreach (var mediaId in mediaIds.Split(','))
                {
                    string fileToUpload = wx.GetMediaFile(mediaId, strType);

                    string             md5     = CommonHelp.PostFile(UserInfo.QYinfo, fileToUpload);
                    System.IO.FileInfo f       = new FileInfo(fileToUpload);
                    FT_File            newfile = new FT_File();
                    newfile.ComId          = UserInfo.User.ComId;
                    newfile.Name           = f.Name;
                    newfile.FileMD5        = md5.Replace("\"", "").Split(',')[0];
                    newfile.zyid           = md5.Split(',').Length == 2 ? md5.Split(',')[1] : md5.Split(',')[0];
                    newfile.FileSize       = f.Length.ToString();
                    newfile.FileVersin     = 0;
                    newfile.CRDate         = DateTime.Now;
                    newfile.CRUser         = UserInfo.User.UserName;
                    newfile.UPDDate        = DateTime.Now;
                    newfile.UPUser         = UserInfo.User.UserName;
                    newfile.FolderID       = 3;
                    newfile.FileExtendName = f.Extension.Substring(1);
                    newfile.ISYL           = "Y";
                    new FT_FileB().Insert(newfile);

                    if (ids == "")
                    {
                        ids = newfile.ID.ToString();
                    }
                    else
                    {
                        ids += "," + newfile.ID.ToString();
                    }
                }

                return(ids);
            }
            catch (Exception ex)
            {
                CommonHelp.WriteLOG(ex.ToString());
                return("");
            }
        }