Example #1
0
        /// <summary>
        /// 更新推广主绑定关系,如果推广主之前与其他账户绑定,解绑重新绑定自身
        /// </summary>
        /// <param name="spreadId">推广主Id</param>
        /// <param name="spreadCode">推广码</param>
        /// <param name="spreadType">推广类型 0:推广主,1:电商馆,2:总代,3企业</param>
        public void UpdateRalationUserSpread(Guid spreadId, Guid spreadCode, int spreadType)
        {
            ContextSession contextSession = ContextFactory.CurrentThreadContext;

            var createOrgUserId = EBCSV.GetOrgCreateUser(spreadId);

            var userSpreader = UserSpreader.ObjectSet().FirstOrDefault(c => c.UserId == createOrgUserId);

            if (userSpreader != null)
            {
                var createUsers = EBCSV.GetMyCreateAccountList(createOrgUserId);
                if (createUsers != null && createUsers.Contains(userSpreader.SpreaderId))
                {
                    return;
                }
                contextSession.Delete(userSpreader);
            }
            UserSpreader uSpreaderNew = UserSpreader.CreateUserSpreader();

            uSpreaderNew.UserId        = createOrgUserId;
            uSpreaderNew.SpreaderId    = spreadId;
            uSpreaderNew.SpreadCode    = spreadCode;
            uSpreaderNew.IsDel         = false;
            uSpreaderNew.CreateOrderId = new Guid("00000000-0000-0000-0000-000000000000");
            uSpreaderNew.SubTime       = DateTime.Now;
            uSpreaderNew.ModifiedOn    = DateTime.Now;
            uSpreaderNew.WxOpenId      = "";
            contextSession.SaveObject(uSpreaderNew);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="title">后台接收消息的标题</param>
        /// <param name="content">后台接收消息的内容</param>
        /// <param name="mobilemess">手机接收的消息</param>
        /// <param name="state">1.只给手机发送2.只给后台发送3.同时给手机和后台发消息</param>
        /// <param name="appId"></param>
        /// <param name="afterSalesMessages"></param>
        public void SendMessageCommon(string title, string content, string mobilemess, int state, System.Guid appId, string Id, string code, ContextDTO contextDTO, bool isAfterSales)
        {
            Jinher.AMP.App.Deploy.ApplicationDTO applicationDTO = null;
            try
            {
                applicationDTO = APPBP.Instance.GetAppById(appId);
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("SendMessageCommon AppManagerSV服务异常:获取应用信息异常。title:{0},content:{1},mobilemess:{2},state:{3},appId:{4},Id:{5},code:{6}", title, content, mobilemess, state, appId, Id, code), ex);
            }

            try
            {
                if (applicationDTO != null && applicationDTO.OwnerId != null && applicationDTO.OwnerId.Value != Guid.Empty)
                {
                    List <Guid> LGuid    = new List <Guid>();
                    string      messages = mobilemess;
                    LGuid = EBCSV.GetOrderMenuUsers(applicationDTO);
                    if (LGuid == null || !LGuid.Any())
                    {
                        return;
                    }
                    System.Text.StringBuilder strOrgUserIds = new System.Text.StringBuilder();
                    foreach (Guid orgUserId in LGuid)
                    {
                        strOrgUserIds.Append(orgUserId).Append(",");
                    }
                    strOrgUserIds.Remove(strOrgUserIds.Length - 1, 1);
                    AddMessages(Id, strOrgUserIds.ToString(), appId, code, state, messages, "orderAppOwner", isAfterSales);

                    //后台发消息
                    Jinher.AMP.Info.Deploy.CustomDTO.MessageForAddDTO messageAdd = new Info.Deploy.CustomDTO.MessageForAddDTO();
                    //推送消息
                    messageAdd.PublishTime    = DateTime.Now;
                    messageAdd.ReceiverUserId = LGuid;

                    //messageAdd.SenderOrgId = employeeDTO.EBCOrganizationId;
                    messageAdd.SenderType = Info.Deploy.Enum.SenderType.System;
                    messageAdd.Title      = title;
                    messageAdd.Content    = content;
                    //messageAdd.MessageType = "OrgDisableMessage";
                    messageAdd.ReceiverRange = Info.Deploy.Enum.ReceiverRange.SpecifiedUser;

                    var retret = Jinher.AMP.BTP.TPS.InfoSV.Instance.AddSystemMessage(messageAdd);
                    LogHelper.Info(string.Format("SendMessageCommon后台发送消息服务成功。messageAdd:{0}", JsonHelper.JsonSerializer(messageAdd)));
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("SendMessageCommon发送消息服务异常:。title:{0},content:{1},mobilemess:{2},state:{3},appId:{4},Id:{5},code:{6}", title, content, mobilemess, state, appId, Id, code), ex);
            }
        }