Пример #1
0
        /// <summary>
        /// 为会员分派奖金
        /// </summary>
        /// <param name="memberphone"></param>
        /// <param name="money"></param>
        /// <returns></returns>
        public string FenPaiMoney(string memberphone, decimal money)
        {
            string          result = "0";
            MemberInfoModel member = MemberInfoDAL.GetMember(memberphone);

            if (member == null)
            {
                return("0无此会员");
            }
            using (TransactionScope scope = new TransactionScope())
            {
                int rowcount = MemberCapitalDetailDAL.UpdateMemberDynamicFunds(member.ID, money, member.TruethName, member.MobileNum);
                if (rowcount < 1)
                {
                    return("0操作失败");
                }
                AmountChangeLogModel logmodel = new AmountChangeLogModel();
                logmodel.MemberID     = member.ID;
                logmodel.MemberName   = member.TruethName;
                logmodel.MemberPhone  = member.MobileNum;
                logmodel.OrderCode    = "";
                logmodel.OrderID      = 0;
                logmodel.ProduceMoney = money;
                logmodel.Remark       = "会员:" + member.MobileNum + " 得到系统派发的奖金";
                logmodel.Type         = 3;
                rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                if (rowcount < 1)
                {
                    return("0操作失败");
                }
                scope.Complete();
                result = "1";
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        /// 惩罚会员静态金额
        /// </summary>
        /// <param name="memberphone"></param>
        /// <param name="money"></param>
        /// <returns></returns>
        public string punishmentStaticMoney(int memberid, decimal money, string reason)
        {
            string          result = "0";
            MemberInfoModel member = MemberInfoDAL.GetMember(memberid);

            if (member == null)
            {
                return("0无此会员");
            }
            using (TransactionScope scope = new TransactionScope())
            {
                int rowcount = MemberCapitalDetailDAL.UpdateStaticPunishMoney(member.ID, money, member.TruethName, member.MobileNum);
                if (rowcount < 1)
                {
                    return("0操作失败");
                }
                AmountChangeLogModel logmodel = new AmountChangeLogModel();
                logmodel.MemberID     = member.ID;
                logmodel.MemberName   = member.TruethName;
                logmodel.MemberPhone  = member.MobileNum;
                logmodel.OrderCode    = "";
                logmodel.OrderID      = 0;
                logmodel.ProduceMoney = (0 - money);
                logmodel.Remark       = "会员:" + member.MobileNum + " 被平台惩罚:" + money.ToString() + " 元,原因:" + reason;
                logmodel.Type         = 3;
                rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                if (rowcount < 1)
                {
                    return("0操作失败");
                }
                try
                {
                    UserBehaviorLogModel log = new UserBehaviorLogModel();
                    log.AOrderCode     = "";
                    log.BehaviorSource = 2;
                    log.BehaviorType   = 10;
                    log.HOrderCode     = "";
                    log.MemberID       = member.ID;
                    log.MemberName     = member.TruethName;
                    log.MemberPhone    = member.MobileNum;
                    log.ProcAmount     = money;
                    log.Remark         = "会员:" + member.MobileNum + " 被惩罚静态资金" + money + "元";
                    rowcount           = UserBehaviorLogDAL.AddUserBehaviorLog(log);
                }
                catch { }
                scope.Complete();
                result = "1";
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        /// 为会员分派动态奖金
        /// </summary>
        /// <param name="memberphone"></param>
        /// <param name="money"></param>
        /// <returns></returns>
        public string FenPaiMoneyToDynamic(int memberid, decimal money)
        {
            string          result = "0";
            MemberInfoModel member = MemberInfoDAL.GetMember(memberid);

            if (member == null)
            {
                return("0无此会员");
            }
            using (TransactionScope scope = new TransactionScope())
            {
                int rowcount = MemberCapitalDetailDAL.UpdateMemberDynamicFunds(member.ID, money, member.TruethName, member.MobileNum);
                if (rowcount < 1)
                {
                    return("0操作失败");
                }
                AmountChangeLogModel logmodel = new AmountChangeLogModel();
                logmodel.MemberID     = member.ID;
                logmodel.MemberName   = member.TruethName;
                logmodel.MemberPhone  = member.MobileNum;
                logmodel.OrderCode    = "";
                logmodel.OrderID      = 0;
                logmodel.ProduceMoney = money;
                logmodel.Remark       = "会员:" + member.MobileNum + " 得到系统派发的奖金";
                logmodel.Type         = 3;
                rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                if (rowcount < 1)
                {
                    return("0操作失败");
                }
                try
                {
                    UserBehaviorLogModel log = new UserBehaviorLogModel();
                    log.AOrderCode     = "";
                    log.BehaviorSource = 2;
                    log.BehaviorType   = 9;
                    log.HOrderCode     = "";
                    log.MemberID       = member.ID;
                    log.MemberName     = member.TruethName;
                    log.MemberPhone    = member.MobileNum;
                    log.ProcAmount     = money;
                    log.Remark         = "会员:" + member.MobileNum + " 获得系统奖励动态资金" + money + "元";
                    rowcount           = UserBehaviorLogDAL.AddUserBehaviorLog(log);
                }
                catch { }
                scope.Complete();
                result = "1";
            }
            return(result);
        }
Пример #4
0
        /// <summary>
        /// 激活会员(外用)
        /// </summary>
        /// <param name="memberid"></param>
        /// <param name="phone"></param>
        /// <param name="activecode"></param>
        /// <returns></returns>
        public string ActiveMember(int memberid, string phone, string activecode, bool isauto, int souceid = 0)
        {
            string result = "0";

            if (isauto)
            {
                activecode = ActiveCodeDAL.GetRedamActiveCode(1);
            }
            MemberInfoModel member = null;

            if (memberid != 0)
            {
                member = MemberInfoDAL.GetNotActiveMember(memberid);
            }
            if (!string.IsNullOrWhiteSpace(phone))
            {
                member = MemberInfoDAL.GetMember(phone);
            }
            if (member == null)
            {
                result = "0无此会员";
                return(result);
            }
            if (member.MStatus != 1)
            {
                result = "0会员状态不正确";
                return(result);
            }
            ActiveCodeModel activecodemodel = ActiveCodeDAL.GetActiveCodeExtendModel(activecode);

            if (activecodemodel == null)
            {
                result = @"0无此激活码";
                return(result);
            }
            if (activecodemodel.AType == 2)
            {
                result = @"0激活码类型选择不正确";
                return(result);
            }
            if (activecodemodel.AStatus == 10)
            {
                result = @"0激活码已经使用";
                return(result);
            }
            if (activecodemodel.AMStatus == 3)
            {
                result = @"0激活码已经过期";
                return(result);
            }
            using (TransactionScope scope = new TransactionScope())
            {
                //更改会员的状态
                int rowcount = MemberInfoDAL.UpdateStatus(member.ID, 2);
                if (rowcount < 1)
                {
                    result = "0更新会员状态失败";
                    return(result);
                }
                //更改激活码的状态
                rowcount = ActiveCodeDAL.UpdateStatus(activecodemodel.ID, 10);
                if (rowcount < 1)
                {
                    result = "0更新激活码状态失败";
                    return(result);
                }
                if (activecodemodel.MID > 0)
                {
                    //更改会员机会码的使用状态
                    if (souceid > 0)
                    {
                        rowcount = ActiveCodeDAL.UpdateMemberActiveCodeToUse(souceid, member.MobileNum, activecodemodel.ActivationCode);
                        if (rowcount < 1)
                        {
                            result = "0更新会员激活码表状态失败";
                            return(result);
                        }
                    }
                    else
                    {
                        rowcount = ActiveCodeDAL.UpdateMemberActiveStatus(activecodemodel.MID, 2);
                        if (rowcount < 1)
                        {
                            result = "0更新会员激活码表状态失败";
                            return(result);
                        }
                    }
                    //插入使用日志
                    ActiveCodeLogModel logmodel = new ActiveCodeLogModel();
                    logmodel.ActiveCode  = activecodemodel.ActivationCode;
                    logmodel.Addtime     = DateTime.Now;
                    logmodel.AID         = activecodemodel.ID;
                    logmodel.MemberID    = activecodemodel.MemberID;
                    logmodel.MemberName  = activecodemodel.MemberName;
                    logmodel.MemberPhone = activecodemodel.MemberPhone;
                    logmodel.Remark      = "为会员:" + member.MobileNum + " 激活";
                    rowcount             = OperateLogDAL.AddActiveCodeLog(logmodel);
                    if (rowcount < 1)
                    {
                        result = "0写入日志失败";
                        return(result);
                    }
                }
                scope.Complete();
                result = "1";
            }
            return(result);
        }
Пример #5
0
        /// <summary>
        ///注册会员(已追加注册返还金额功能)
        /// </summary>
        public string AddMemberInfo(MemberInfoModel model)
        {
            string result = "1";
            string value  = SysAdminConfigDAL.GetConfigsByID(4);//得到注册返还金额

            #region 验证用户真实姓名 和手机
            int rows = MemberInfoDAL.GetMemberCountInfoByName(model.TruethName.Trim());
            if (rows > 2)
            {
                return("0用户姓名重复");
            }
            rows = MemberInfoDAL.GetMemberCountInfoByMobile(model.MobileNum.Trim());
            if (rows > 0)
            {
                return("0手机号已被注册");
            }
            //rows = MemberInfoDAL.GetMemberCountInfoByAlipayNum(model.AliPayNum.Trim());
            //if (rows > 0)
            //{
            //    return "0支付宝ID已被注册";
            //}
            rows = MemberInfoDAL.GetMemberCountInfoByAliPayName(model.AliPayName.Trim());
            if (rows > 0)
            {
                return("0支付宝账户已被注册");
            }
            #endregion
            using (TransactionScope scope = new TransactionScope())
            {
                int memberid = dal.AddMemberInfo(model);
                if (memberid < 1)
                {
                    return("0注册失败");
                }
                decimal amont = 0;
                if (!string.IsNullOrWhiteSpace(value))
                {
                    if (!decimal.TryParse(value, out amont))
                    {
                        return("0注册失败");
                    }
                    int row = MemberCapitalDetailDAL.UpdateMemberStaticFreezeMoney(memberid, amont, model.TruethName, model.MobileNum);
                    if (row < 1)
                    {
                        return("0注册失败");
                    }
                }
                //返还激活码金额
                AmountChangeLogModel logmodel = new AmountChangeLogModel();
                logmodel.MemberID     = memberid;
                logmodel.MemberName   = model.TruethName;
                logmodel.MemberPhone  = model.MobileNum;
                logmodel.ProduceMoney = amont;
                logmodel.Remark       = "会员注册激活码" + amont.ToString() + "元";
                logmodel.Type         = 5;
                int rowcount = OperateLogDAL.AddAmountChangeLog(logmodel);
                if (rowcount < 1)
                {
                    return("0注册失败");
                }
                if (model.MemberPhone != model.MobileNum)
                {
                    //插入推荐人信息表
                    MemberInfoModel soucemember = MemberInfoDAL.GetMember(model.MemberPhone);
                    if (soucemember.MStatus == 3)
                    {
                        return("0推荐人账户被冻结");
                    }
                    ReMemberRelationModel remodel = new ReMemberRelationModel();
                    remodel.MemberID         = soucemember.ID;
                    remodel.MemberTruthName  = soucemember.TruethName;
                    remodel.MemberPhone      = soucemember.MobileNum;
                    remodel.RecommMID        = memberid;
                    remodel.RecommMPhone     = model.MobileNum;
                    remodel.RecommMTruthName = model.TruethName;
                    rowcount = ReMemberRelationDAL.AddReMemberRelation(remodel);
                    if (rowcount < 1)
                    {
                        return("0注册失败");
                    }
                }
                //初始化会员扩展信息表
                MemberExtendInfoModel extendinfo = new MemberExtendInfoModel();
                extendinfo.MemberID        = memberid;
                extendinfo.MemberHelpCount = 0;
                extendinfo.LastHelpMoney   = 0;
                extendinfo.LastHelperTime  = DateTime.Now.AddYears(-1);
                rowcount = MemberExtendInfoDAL.AddModelExtendinfo(extendinfo);
                if (rowcount < 1)
                {
                    return("0注册失败");
                }
                scope.Complete();
                result = "1";
            }
            return(result);
        }