private void AddMobile(string mobile, TblHssPassportRepository repository) { try { TblHssPassport oldEntity = repository.GetByUserCode(mobile); if (oldEntity == null) { TblHssPassport entity = new TblHssPassport() { CreateTime = DateTime.Now, CurrentLoginIp = "", LastLoginIp = "", LoginTimes = 0, OpenId = "", PassporId = IdGenerator.NextId(), UnionId = "", UserCode = mobile }; repository.Add(entity); } } catch (Exception ex) { LogWriter.Write(this, "创建家校互联登陆账号出错:" + ex.Message, LoggerType.Error); } }
/// <summary> /// 发送一组消息推送 /// <para>作 者:蔡亚康</para> /// <para>创建时间:2019-03-14</para> /// </summary> /// <param name="data">一组消息</param> public void Publish(StudentPassportChangeInDto data) { //当前采用线程池的线程处理! //后续家校互联独立后,才会考虑使用消息队列! Task.Run(() => { TblHssPassportRepository repository = new TblHssPassportRepository(); if (data.MobileAddList != null) { foreach (string mobile in data.MobileAddList) { this.AddMobile(mobile, repository); } } if (data.MobileDeleteList != null) { foreach (string mobile in data.MobileDeleteList) { repository.DeleteByUserCode(mobile); } } }); //base.SendMessage(data); }