public void DeleteByPid(IUserService user, long pid) { ExceptionHelper.ThrowIfNull(user, nameof(user)); ExceptionHelper.ThrowIfNotId(pid, nameof(pid)); var uid = user.Uid; var entitys = _FootPrintRepository.Entities.Where(p => p.uid == uid && p.pid == pid); foreach (var entity in entitys) { entity.isEnable = false; } _FootPrintRepository.SaveChanges(); var delFids = entitys.Select(p => p.fid).ToArray(); var taskFactory = new TaskFactory(); taskFactory.StartNew(() => { foreach (var delFid in delFids) { _PushManager.DeleteFootPrint(delFid); } }); //_FootPrintRepository.Update(p =>p.uid==uid&&p.pid == pid, p => new Data.FootPrint() { isEnable = false }); }
public void OnUnpass() { //推送到图数据库 var taskFactory = new TaskFactory(); var fid = _FootPrintService.Fid; taskFactory.StartNew(() => { _FCRMAPIPushManager.DeleteFootPrint(fid, transmitToMQ: false); }); var uid = _FootPrintService.Uid; var remark = _FootPrintService.ExamineRemark; if (_FootPrintService.State == FootPrintState.UnPass) { var pid = _FootPrintService.Pid; string projName = ""; var proj = _ProjSourceManager.GetSource(pid); if (proj != null) { projName = proj.name; } var reason = ""; if (!string.IsNullOrWhiteSpace(remark)) { reason = ",原因:{" + remark + "}"; } var content = string.Format("您发布的#{0}#关联的足迹未通过审核,原因:{1},请重新发布,以免错失项目交流机会~", projName, reason); var request = new NotifyMessageRequest(ActionType.ADMIN_MESSAGE, 0, 0, new long[] { uid }, ContentType.Text, content); _NotifyServiceProxy.AdminNotify(request, true); } }
public bool RePushDeleteFootPrints(int start, int limit) { bool end = false; var source = _FootPrintRepository.Entities.Where(p => p.isEnable == false); var count = source.Count(); if (start + limit >= count) { end = true; } var fids = source.OrderBy(p => p.created).Select(p => p.fid).Take(start, limit).ToArray(); foreach (var fid in fids) { _PushManager.DeleteFootPrint(fid); } return(end); }