/// <summary> /// 5月任性赚,“三重好礼”送不停 活动时间 2015年5月4日—2015年5月31日 /// </summary> /// public void MayPan(decimal TrAMT, int month, int Reg) { if (month == 3 || month == 6) //只有3个月和6个月才生成奖励记录 { M_Activity_schedule ma = new M_Activity_schedule(); B_Activity_schedule ba = new B_Activity_schedule(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); DateTime nowdate = DateTime.Now; DateTime startdate = new DateTime(2015, 06, 26, 00, 00, 00); DateTime enddate = new DateTime(2015, 07, 31, 23, 59, 59); if (startdate < nowdate && nowdate < enddate) //在有效范围之内则执行活动计划 { ma = ba.GetModel(8); //获取奖励对象 // ma = ba.GetModel(10); //获取奖励对象 // decimal rewardamt = GetAmt(TrAMT, month); mb.activity_schedule_id = ma.activity_schedule_id; mb.membertable_registerid = Reg; mb.activity_schedule_name = ma.activity_schedule_name; mb.amount_of_reward = rewardamt; mb.use_lower_limit = ma.use_lower_limit; mb.reward = ma.reward; mb.start_date = nowdate; mb.end_date = ma.end_date; mb.entry_time = nowdate; int bbid = bb.Add(mb); if (bbid > 0) //奖励记录成功后插入明细记录 { mbaw.bonus_account_id = bbid; mbaw.membertable_registerid = Reg; mbaw.income = rewardamt; mbaw.expenditure = 0.00M; mbaw.time_of_occurrence = mb.entry_time; // mbaw. mbaw.award_description = "7月“投资拿现金大奖” 活动时间 2015年7月1日—2015年7月31日 投资" + TrAMT.ToString() + "周期" + month.ToString() + "月 奖励" + rewardamt.ToString(); mbaw.water_type = 0; bbaw.Add(mbaw); } } } }
/// <summary> /// 发放奖励 /// </summary> /// <param name="activity"></param> /// <param name="registerID"></param> private void DrawBonus(hx_ActivityTable activity, int registerID) { chuangtouEntities ef = new chuangtouEntities(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); DateTime dte = DateTime.Now;//当前时间截点 //hx_ActivityTable act = ef.hx_ActivityTable.Where(c => c.ActID == activity.ActID).FirstOrDefault();//添加奖励类型 if (activity.ActEndtime >= dte && activity.ActStarttime <= dte) { Mcoupon mcp = new Mcoupon(); JavaScriptSerializer js = new JavaScriptSerializer(); mcp = js.Deserialize <Mcoupon>(activity.ActRule); hx_UserAct hua = new hx_UserAct(); hua.ActTypeId = activity.ActTypeId; hua.registerid = registerID; hua.RewTypeID = activity.RewTypeID; hua.ActID = activity.ActID; hua.Amt = mcp.cash; hua.Uselower = mcp.Msplitarr == null || mcp.Msplitarr.Count <= 0 ? 0 : mcp.Msplitarr[0].startAmt; hua.Usehight = mcp.Msplitarr == null || mcp.Msplitarr.Count <= 0 ? 0 : mcp.Msplitarr[0].endAmt; hua.AmtEndtime = activity.ActEndtime; hua.AmtUses = mcp.Uses; //没指定情况下默认为单独使用 hua.UseState = 0; //现金未转账 hua.AmtProid = 0; //未使用默认为0 hua.ISSmsOne = 0; hua.IsSmsThree = 0; hua.isSmsFifteen = 0; hua.IsSmsSeven = 0; hua.isSmsSixteen = 0; hua.Createtime = DateTime.Now; ef.hx_UserAct.Add(hua); int i = ef.SaveChanges(); mb.activity_schedule_id = activity.ActID; mb.membertable_registerid = registerID; mb.activity_schedule_name = activity.ActName; mb.amount_of_reward = decimal.Parse(hua.Amt.ToString()); mb.use_lower_limit = Convert.ToDecimal(hua.Uselower); mb.reward = 0; mb.start_date = Convert.ToDateTime(hua.Createtime); mb.end_date = Convert.ToDateTime(hua.AmtEndtime); mb.entry_time = dte; int bbid = bb.Add(mb); if (bbid > 0) //奖励记录成功后插入明细记录 { mbaw.bonus_account_id = bbid; mbaw.membertable_registerid = registerID; mbaw.income = decimal.Parse(hua.Amt.ToString()); mbaw.expenditure = 0.00M; mbaw.time_of_occurrence = DateTime.Now; mbaw.award_description = activity.ActName; mbaw.water_type = 0; bbaw.Add(mbaw); } } }
/// <summary> /// 12月份元旦活动转账专用 获取活动信息 短信通知部分需要更改 /// </summary> /// <param name="mc"></param> /// <param name="TrAMT"></param> /// <param name="TransAmt"></param> public void YuandaiToUserTransfer(M_CashAwards mc, decimal TrAMT, decimal TransAmt) { M_Transfer m = new M_Transfer(); m.Version = "10"; m.CmdId = "Transfer"; // m.OrdId = Utils.Createcode(); m.OrdId = mc.OrdId.ToString(); m.OutCustId = Utils.GetMerCustID(); m.OutAcctId = "MDT000001"; m.TransAmt = mc.Amounts.ToString("0.00"); m.InCustId = mc.UsrCustId; m.BgRetUrl = Utils.GetRe_url("Thirdparty/ToUserTransfer.aspx"); m.MerPriv = mc.proid.ToString(); StringBuilder chkVal = new StringBuilder(); chkVal.Append(m.Version); chkVal.Append(m.CmdId); chkVal.Append(m.OrdId); chkVal.Append(m.OutCustId); chkVal.Append(m.OutAcctId); chkVal.Append(m.TransAmt); chkVal.Append(m.InCustId); chkVal.Append(m.RetUrl); chkVal.Append(m.BgRetUrl); chkVal.Append(m.MerPriv); string chkv = chkVal.ToString(); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账加签chkv字符:" + chkv); //私钥文件的位置(这里是放在了站点的根目录下) string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetMerPr(); //需要指定提交字符串的长度 int len = Encoding.UTF8.GetBytes(chkv).Length; StringBuilder sbChkValue = new StringBuilder(256); //加签 int str = DllInterop.SignMsg(Utils.GetMerId(), merKeyFile, chkv, len, sbChkValue); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账加签字符:" + str.ToString()); m.ChkValue = sbChkValue.ToString(); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账提交信息:" + FastJSON.toJOSN(m)); LogInfo.WriteLog("ChkValue:" + m.ChkValue); using (var client = new WebClient()) { var values = new NameValueCollection(); values.Add("Version", m.Version); values.Add("CmdId", m.CmdId); values.Add("OrdId", m.OrdId); values.Add("OutCustId", m.OutCustId); values.Add("OutAcctId", m.OutAcctId); values.Add("TransAmt", m.TransAmt); values.Add("InCustId", m.InCustId); values.Add("InAcctId", m.InAcctId); values.Add("RetUrl", m.RetUrl); values.Add("BgRetUrl", m.BgRetUrl); values.Add("MerPriv", m.MerPriv); values.Add("ChkValue", m.ChkValue); string url = Utils.GetChinapnrUrl(); //同步发送form表单请求 byte[] result = client.UploadValues(url, "POST", values); var retStr = Encoding.UTF8.GetString(result); // Response.Write(retStr); LogInfo.WriteLog("12月份元旦活动自动扣款转账(商户用)返回报文" + retStr); ReTransfer reg = new ReTransfer(); var retloan = (ReTransfer)FastJSON.ToObject(retStr, reg); StringBuilder builder = new StringBuilder(); builder.Append(retloan.CmdId); builder.Append(retloan.RespCode); builder.Append(retloan.OrdId); builder.Append(retloan.OutCustId); builder.Append(retloan.OutAcctId); builder.Append(retloan.TransAmt); builder.Append(retloan.InCustId); builder.Append(retloan.InAcctId); builder.Append(HttpUtility.UrlDecode(retloan.RetUrl)); builder.Append(HttpUtility.UrlDecode(retloan.BgRetUrl)); builder.Append(retloan.MerPriv); var msg = builder.ToString(); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账返回参数:" + msg); //验签 string pgPubkFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk(); int ret = DllInterop.VeriSignMsg(pgPubkFile, msg, msg.Length, retloan.ChkValue); LogInfo.WriteLog("12月份元旦活动平台向用户活动转账验签ret:" + ret.ToString()); if (ret == 0) { if (retloan.RespCode == "000") { /* * string sql = "update hx_CashAwards set OrdIdstate=3 where OrdIdstate=1 and OrdId=" + retloan.OrdId + " and proid =" + retloan.MerPriv; * DbHelperSQL.RunSql(sql); * LogInfo.WriteLog("平台向用户活动转账验签更新"+ sql); */ // Response.Write(retloan.RespCode + " <br> "); B_usercenter BUC = new B_usercenter(); int dint = BUC.UpateAwa(retloan); LogInfo.WriteLog("12月份元旦活动事务执行返回:" + dint.ToString()); if (dint > 0) { B_member_table dmt = new B_member_table(); string sql = "SELECT registerid,username,mobile from hx_member_table where UsrCustId='" + retloan.InCustId + "'"; DataTable dt = DbHelperSQL.GET_DataTable_List(sql); if (dt.Rows.Count > 0) { //活动奖历 M_Activity_schedule ma = new M_Activity_schedule(); B_Activity_schedule ba = new B_Activity_schedule(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); DateTime dte = DateTime.Now; // ma = ba.GetModel(16); //测试平台 ma = ba.GetModel(15); //获取奖励对象 mb.activity_schedule_id = ma.activity_schedule_id; mb.membertable_registerid = int.Parse(dt.Rows[0]["registerid"].ToString()); mb.activity_schedule_name = ma.activity_schedule_name; mb.amount_of_reward = decimal.Parse(retloan.TransAmt); mb.use_lower_limit = ma.use_lower_limit; mb.reward = ma.reward; mb.start_date = dte; mb.end_date = dte; mb.entry_time = dte; mb.reward_state = 3; int bbid = bb.Add(mb); if (bbid > 0) //奖励记录成功后插入明细记录 { mbaw.bonus_account_id = bbid; mbaw.membertable_registerid = mb.membertable_registerid; mbaw.income = mb.amount_of_reward; mbaw.expenditure = 0.00M; mbaw.time_of_occurrence = mb.entry_time; // mbaw. mbaw.award_description = "已汇入个人账户"; mbaw.water_type = 0; bbaw.Add(mbaw); //短信通知 #region MyRegion //短信通知 string contxt = Utils.GetMSMEmailContext(20, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(contxt); sbsms = sbsms.Replace("#USERANEM#", dt.Rows[0]["username"].ToString()); sbsms = sbsms.Replace("#MONEY#", TrAMT.ToString("0.00")); sbsms = sbsms.Replace("#AMTM#", TransAmt.ToString("0.00")); string mobile = dt.Rows[0]["mobile"].ToString(); M_td_SMS_record psms = new M_td_SMS_record(); B_td_SMS_record osms = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.活动奖励.ToString()); psms.phone_number = mobile; psms.sendtime = DateTime.Now; psms.senduserid = int.Parse(dt.Rows[0]["registerid"].ToString()); psms.smstype = smstype; psms.smscontext = sbsms.ToString(); psms.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); psms.vcode = ""; osms.Add(psms); #endregion } #region MyRegion 系统消息 DateTime dti = DateTime.Now; M_td_System_message pm = new M_td_System_message(); pm.MReg = int.Parse(dt.Rows[0]["registerid"].ToString()); pm.Mstate = 0; pm.MTitle = "投资成功现金奖励"; pm.MContext = "尊敬的用户" + dt.Rows[0]["username"].ToString() + ":您好!恭喜您成功投资了项目,现金奖励 " + retloan.TransAmt + "元。如有问题可咨询创利投的客服!"; pm.PubTime = dti; B_usercenter.AddMessage(pm); #endregion } LogInfo.WriteLog("12月份元旦活动 平台向用户活动转账验签更新成功,需要写入消息"); } } else { //Response.Write(HttpUtility.UrlDecode(retloan.)); } } } }
public string Register(string Validatecode, string userpassword1, string mobile1, string username1, bool realMobileUser = false) { Utils.SetSYSDateTimeFormat(); string json = ""; //注册奖励 M_Activity_schedule ma = new M_Activity_schedule(); B_Activity_schedule ba = new B_Activity_schedule(); B_member_table o = new B_member_table(); M_member_table p = new M_member_table(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); string email1 = ""; string strvcode = realMobileUser ? "y" : ck.GetVcode(Validatecode, mobile1); string tid = "";//富爸爸参数uid //Utils.GetCookie("Cooperation", "tid");//渠道来源ID string invcode = Utils.GetInvCode(); // 用户邀请用户关系存在的时候,不走 新渠道机制(channel) #region 道 //渠道的cookie var cc_keyValue = Utils.GetInvCookie("channel"); string cInvitedcode = string.Empty; if (string.IsNullOrEmpty(invcode) && cc_keyValue.Count != 0) { cInvitedcode = cc_keyValue["Invitedcode"]; var channelInvitedCode = ef.hx_Channel.Where(c => c.ChannelName == "fubaba").Select(c => c.Invitedcode).FirstOrDefault(); if (cInvitedcode.Trim() == channelInvitedCode) { tid = cc_keyValue["uid"]; } } #endregion int ch = 0; if (Utils.GetCookie("Cooperation", "ch") != "") { try { ch = int.Parse(Utils.GetCookie("Cooperation", "ch"));//渠道来源 } catch { ch = 0; } } if (ch == 0) { if (invcode != "") { ch = 1; } } if (strvcode != null) { if (strvcode == "y") { string checkMob = ck.checkmobile(mobile1, 0); if (checkMob != "y") { json = @" {""rs"" : ""n"", ""error"" : ""手机号已被注册!""}"; return(json); } p.username = username1; p.password = DESEncrypt.Encrypt(userpassword1, ConfigurationManager.AppSettings["webp"].ToString()); p.mobile = mobile1; p.email = email1; p.usertypes = 0; p.invitedcode = Calculator.Getinvitedcode(); p.ismobile = 1; p.Channelsource = ch; p.Tid = tid; p.channel_invitedcode = cInvitedcode; LogInfo.WriteLog("用户注册内容:" + FastJSON.toJOSN(p) + " IP:" + Utils.GetRealIP()); int uid = o.Add(p); if (uid > 0) { CheckXiCai(p.mobile, cInvitedcode); //if (tid != "") //{ // Utils.GetCoopAPI(tid, uid.ToString(), 1); //} string keys = DESEncrypt.Encrypt(uid.ToString(), ConfigurationManager.AppSettings["webp"].ToString()); string keys1 = DESEncrypt.Encrypt(username1, ConfigurationManager.AppSettings["webp"].ToString()); M_td_SMS_record pm = new M_td_SMS_record(); B_td_SMS_record om = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.注册成功.ToString()); string smscontxt = Utils.GetMSMEmailContext(18, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(smscontxt); string mobile = mobile1; sbsms = sbsms.Replace("#USERANEM#", p.username.ToString()); pm.phone_number = mobile; pm.sendtime = DateTime.Now; pm.senduserid = uid; pm.smstype = smstype; pm.smscontext = sbsms.ToString(); pm.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); pm.vcode = ""; om.Add(pm); M_login mlogin = new M_login(); mlogin.userid = uid; mlogin.username = p.username; mlogin.codeno = Utils.SetSessioncode(); int remember = 0; if (Utils.LoginWriteSession(mlogin, remember) > 0) { string sql = "update hx_member_table set lastlogintime='" + DateTime.Now + "',lastloginIP='" + Utils.GetRealIP() + "' where registerid=" + uid.ToString(); LogInfo.WriteLog(sql); DbHelperSQL.ExecuteSql(sql); } #region MyRegion //记录邀请关系 LogInfo.WriteLog("注册:邀请码:" + invcode); if (invcode != "") { string codesql = "SELECT invcode from hx_td_Userinvitation where invpersonid=" + uid.ToString();//查询本人是否已经被邀请注册过 invcode='" + invcode + "' and LogInfo.WriteLog("codesql2:" + codesql); DataTable dtcode = DbHelperSQL.GET_DataTable_List(codesql); if (dtcode.Rows.Count == 0) { M_td_Userinvitation myao = new M_td_Userinvitation(); B_td_Userinvitation dyao = new B_td_Userinvitation(); int yaouids = Utils.GetCodeUid(); myao.invcode = invcode; myao.invtime = DateTime.Now; myao.invpersonid = uid; myao.Invpeopleid = yaouids; myao.InvitesStates = 0; myao.Invitereward = 0; int myaoint = dyao.Add(myao); } } #endregion MyRegion //记录邀请关系 json = @" {""rs"" : ""y"", ""url"" : ""/""}"; string temstr = "/opening_account/Index/" + uid.ToString(); json = json.Replace("/", temstr); return(json); } else { json = @" {""rs"" : ""n"", ""error"" : ""注册失败!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不对!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不存在或过期!""}"; } return(json); }
public string Register(string Validatecode, string userpassword1, string mobile1, string username1, bool realMobileUser = false) { Utils.SetSYSDateTimeFormat(); string json = ""; //注册奖历 M_Activity_schedule ma = new M_Activity_schedule(); B_Activity_schedule ba = new B_Activity_schedule(); B_member_table o = new B_member_table(); M_member_table p = new M_member_table(); B_bonus_account bb = new B_bonus_account(); M_bonus_account mb = new M_bonus_account(); M_bonus_account_water mbaw = new M_bonus_account_water(); B_bonus_account_water bbaw = new B_bonus_account_water(); string email1 = ""; string strvcode = realMobileUser ? "y" : ck.GetVcode(Validatecode, mobile1); //string strvcode = "y"; if ((Settings.Instance.SiteDomain.IndexOf(PublicURL.NewWXUrl) >= 0)) { strvcode = ck.GetVcodeWX(Validatecode, mobile1); } string tid = Utils.GetCookie("Cooperation", "tid"); int ch = 0; string invcode = Utils.GetInvCode(); #region 道 //渠道的cookie var cc_keyValue = Utils.GetInvCookie("channel"); string cInvitedcode = string.Empty; if (string.IsNullOrEmpty(invcode) && cc_keyValue.Count != 0) { cInvitedcode = cc_keyValue["Invitedcode"]; } #endregion if (Utils.GetCookie("Cooperation", "ch") != "") { try { ch = int.Parse(Utils.GetCookie("Cooperation", "ch")); } catch { ch = 0; } } if (ch == 0) { if (invcode != "") { ch = 3; } else { ch = 2; } } if (realMobileUser || strvcode != null) { if (realMobileUser || strvcode == "y") { string checkMob = ck.checkmobile(mobile1, 0); if (checkMob != "y") { json = @" {""rs"" : ""n"", ""error"" : ""手机号已被注册!""}"; return(json); } p.username = username1; p.password = DESEncrypt.Encrypt(userpassword1, ConfigurationManager.AppSettings["webp"].ToString()); p.mobile = mobile1; p.email = email1; p.usertypes = 0; p.invitedcode = Calculator.Getinvitedcode(); p.ismobile = 1; p.Channelsource = ch; p.Tid = tid; p.channel_invitedcode = cInvitedcode; LogInfo.WriteLog("用户注册内容:" + FastJSON.toJOSN(p) + " IP:" + Utils.GetRealIP()); int uid = o.Add(p);//注册成功返回会员ID if (uid > 0) { //记录用户信息到活动流量发放表里 2016.10.21-31日 //string CookCode = Utils.GetCookie("CookCode"); //if (!string.IsNullOrWhiteSpace(CookCode)) //{ // if (CookCode== "liumi") // { // AddReceiveInfo(uid); // } //} if (tid != "") { // Utils.GetCoopAPI(tid, uid.ToString(), 1); } string keys = DESEncrypt.Encrypt(uid.ToString(), ConfigurationManager.AppSettings["webp"].ToString()); string keys1 = DESEncrypt.Encrypt(username1, ConfigurationManager.AppSettings["webp"].ToString()); M_td_SMS_record pm = new M_td_SMS_record(); B_td_SMS_record om = new B_td_SMS_record(); int smstype = (int)Enum.Parse(typeof(EnumSMSType), EnumSMSType.注册成功.ToString()); string smscontxt = Utils.GetMSMEmailContext(18, 1); // 获取注册成功邮件内容 StringBuilder sbsms = new StringBuilder(smscontxt); string mobile = mobile1; sbsms = sbsms.Replace("#USERANEM#", p.username.ToString()); pm.phone_number = mobile; pm.sendtime = DateTime.Now; pm.senduserid = uid; pm.smstype = smstype; pm.smscontext = sbsms.ToString(); pm.orderid = SendSMS.Send_SMS(mobile, sbsms.ToString()); pm.vcode = ""; om.Add(pm); M_login mlogin = new M_login(); mlogin.userid = uid; mlogin.username = p.username; mlogin.codeno = Utils.SetSessioncode(); int remember = 0; FormsAuthentication.SignOut(); Utils.AddLoginCache(p.username, mlogin); string sql = "update hx_member_table set lastlogintime='" + DateTime.Now + "',lastloginIP='" + Utils.GetRealIP() + "' where registerid=" + uid.ToString(); DbHelperSQL.ExecuteSql(sql); #region MyRegion //记录邀请关系 LogInfo.WriteLog("注册:邀请码:" + invcode); if (invcode != "") { string codesql = "SELECT invcode from hx_td_Userinvitation where invpersonid=" + uid.ToString();//查询本人是否已经被邀请注册过 invcode='" + invcode + "' and LogInfo.WriteLog("codesql2:" + codesql); DataTable dtcode = DbHelperSQL.GET_DataTable_List(codesql); if (dtcode.Rows.Count == 0) { M_td_Userinvitation myao = new M_td_Userinvitation(); B_td_Userinvitation dyao = new B_td_Userinvitation(); int yaouids = Utils.GetCodeUid(); myao.invcode = invcode; myao.invtime = DateTime.Now; myao.invpersonid = uid; myao.Invpeopleid = yaouids; myao.InvitesStates = 0; myao.Invitereward = 0; int myaoint = dyao.Add(myao); } } #endregion MyRegion //记录邀请关系 json = @" {""rs"" : ""y"", ""url"" : ""/index.html"",""uid"":" + uid + "}"; string temstr = "/opening_account/Index/" + uid.ToString(); json = json.Replace("/index.html", temstr); return(json); } else { json = @" {""rs"" : ""n"", ""error"" : ""注册失败!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不对!""}"; return(json); } } else { json = @" {""rs"" : ""n"", ""error"" : ""验证码不存在或过期!""}"; } return(json); }