// 添加笔记本内容 // [ok] public static NoteContent AddNoteContent(NoteContent noteContent) { noteContent.CreatedTime = Tools.FixUrlTime(noteContent.CreatedTime); noteContent.UpdatedTime = Tools.FixUrlTime(noteContent.UpdatedTime); noteContent.UpdatedUserId = noteContent.UserId; InsertNoteContent(noteContent); // 更新笔记图片 NoteImageService.UpdateNoteImages(noteContent.UserId, noteContent.NoteId, "", noteContent.Content); return(noteContent); }
// getDirtyNotes, 把note的图片, 附件信息都发送给客户端 // 客户端保存到本地, 再获取图片, 附件 // 得到所有图片, 附件信息 // 查images表, attachs表 // [待测] public static NoteFile[] getFiles(long noteId) { var noteImages = NoteImageService.getImagesByNoteId(noteId); var noteAttachs = AttachService.getAttachsByNoteId(noteId); Dictionary <long, NoteFile[]> noteFilesMap = new Dictionary <long, NoteFile[]>(100); throw new Exception(); }
// getDirtyNotes, 把note的图片, 附件信息都发送给客户端 // 客户端保存到本地, 再获取图片, 附件 /// <summary> /// 得到所有图片, 附件信息 /// 查images表, attachs表 /// [待测] /// </summary> /// <param name="noteIds"></param> /// <returns></returns> public static Dictionary <long, List <APINoteFile> > getFiles(long[] noteIds) { var noteImages = NoteImageService.getImagesByNoteIds(noteIds); var noteAttachs = AttachService.getAttachsByNoteIds(noteIds); Dictionary <long, List <APINoteFile> > noteFilesMap = new Dictionary <long, List <APINoteFile> >(100); //if (noteImages != null && noteImages.Length > 0) //{ // foreach (var item in noteImages) // { // NoteFile noteFile=new NoteFile() // { // FileId=item.FileId, // Type=item.Type // }; // if (noteFilesMap.ContainsKey(item.note)) // { // noteFilesMap[item.NoteId].Add(noteFile); // } // else // { // noteFilesMap.Add(item.NoteId,new List<NoteFile>()); // noteFilesMap[item.NoteId].Add(noteFile); // } // } //} if (noteAttachs != null && noteAttachs.Length > 0) { foreach (var item in noteAttachs) { APINoteFile noteFile = new APINoteFile() { FileId = item.AttachId.ToString("x"), Type = item.Type, Title = item.Title, IsAttach = true }; if (noteFilesMap.ContainsKey(item.NoteId)) { noteFilesMap[item.NoteId].Add(noteFile); } else { noteFilesMap.Add(item.NoteId, new List <APINoteFile>()); noteFilesMap[item.NoteId].Add(noteFile); } } } return(noteFilesMap); }
// 添加笔记本内容 // [ok] public NoteContent AddNoteContent(NoteContent noteContent) { noteContent.CreatedTime = Tools.FixUrlTime(noteContent.CreatedTime); noteContent.UpdatedTime = Tools.FixUrlTime(noteContent.UpdatedTime); noteContent.UpdatedUserId = noteContent.UserId; //todo:在数据库加密的情况下,不进行索引 if (!this.config.SecurityConfig.DataBaseEncryption) { UpdataVector(ref noteContent); } InsertNoteContent(noteContent); // 更新笔记图片 NoteImageService.UpdateNoteImages(noteContent.UserId, noteContent.NoteId, "", noteContent.Content); return(noteContent); }