/// <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); }