Exemple #1
0
        /// <summary>
        /// 八月份活动   期限30天以上的标的才能享受
        /// </summary>
        /// <param name="TrAMT"></param>
        /// <param name="days"></param>
        /// <param name="Reg"></param>
        public void AugPan(decimal TrAMT, int days, M_CashAwards mc, string username)
        {
            decimal TransAmt = 0.00M;

            if (days >= 30)
            {
                M_Activity_schedule ma = new M_Activity_schedule();
                B_Activity_schedule ba = new B_Activity_schedule();

                DateTime nowdate = DateTime.Now;

                DateTime startdate = new DateTime(2015, 07, 26, 00, 00, 00);
                DateTime enddate   = new DateTime(2015, 09, 15, 23, 59, 59);
                if (startdate < nowdate && nowdate < enddate)   //在有效范围之内则执行活动计划
                {
                    TransAmt = GetAugPanAmt(TrAMT);

                    mc.Amounts = TransAmt;



                    B_CashAwards o = new B_CashAwards();

                    if (o.Add(mc) > 0)
                    {
                        ToUserTransfer(mc, TrAMT, TransAmt);
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 元旦活动
        /// </summary>
        /// <param name="TrAMT"></param>
        /// <param name="moth"></param>
        /// <param name="mc"></param>
        /// <param name="username"></param>
        public void Yuandai(decimal TrAMT, M_CashAwards mc, string username)
        {
            decimal             TransAmt = 0.00M;
            M_Activity_schedule ma       = new M_Activity_schedule();
            B_Activity_schedule ba       = new B_Activity_schedule();

            DateTime nowdate = DateTime.Now;

            DateTime startdate = new DateTime(2015, 12, 23, 00, 00, 00);
            DateTime enddate   = new DateTime(2016, 01, 01, 23, 59, 59);

            if (startdate < nowdate && nowdate < enddate)   //在有效范围之内则执行活动计划
            {
                //  TransAmt = GetSeptAmt(TrAMT);

                TransAmt = TrAMT * 0.02M;

                mc.Amounts = TransAmt;

                B_CashAwards o = new B_CashAwards();

                if (o.Add(mc) > 0)
                {
                    YuandaiToUserTransfer(mc, TrAMT, TransAmt);
                }
            }
        }
Exemple #3
0
        /// <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>
        public M_Activity_schedule DataRowToModel(DataRow row)
        {
            M_Activity_schedule model = new M_Activity_schedule();

            if (row != null)
            {
                if (row["activity_schedule_id"] != null && row["activity_schedule_id"].ToString() != "")
                {
                    model.activity_schedule_id = int.Parse(row["activity_schedule_id"].ToString());
                }
                if (row["activity_schedule_name"] != null)
                {
                    model.activity_schedule_name = row["activity_schedule_name"].ToString();
                }
                if (row["amount_of_reward"] != null && row["amount_of_reward"].ToString() != "")
                {
                    model.amount_of_reward = decimal.Parse(row["amount_of_reward"].ToString());
                }
                if (row["use_lower_limit"] != null && row["use_lower_limit"].ToString() != "")
                {
                    model.use_lower_limit = decimal.Parse(row["use_lower_limit"].ToString());
                }
                if (row["reward"] != null && row["reward"].ToString() != "")
                {
                    model.reward = int.Parse(row["reward"].ToString());
                }
                if (row["start_date"] != null && row["start_date"].ToString() != "")
                {
                    model.start_date = DateTime.Parse(row["start_date"].ToString());
                }
                if (row["end_date"] != null && row["end_date"].ToString() != "")
                {
                    model.end_date = DateTime.Parse(row["end_date"].ToString());
                }
                if (row["entry_time"] != null && row["entry_time"].ToString() != "")
                {
                    model.entry_time = DateTime.Parse(row["entry_time"].ToString());
                }
            }
            return(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(M_Activity_schedule model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update hx_Activity_schedule set ");
            strSql.Append("activity_schedule_name=@activity_schedule_name,");
            strSql.Append("amount_of_reward=@amount_of_reward,");
            strSql.Append("use_lower_limit=@use_lower_limit,");
            strSql.Append("reward=@reward,");
            strSql.Append("start_date=@start_date,");
            strSql.Append("end_date=@end_date");
            strSql.Append(" where activity_schedule_id=@activity_schedule_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@activity_schedule_name", SqlDbType.VarChar,   50),
                new SqlParameter("@amount_of_reward",       SqlDbType.Decimal,   17),
                new SqlParameter("@use_lower_limit",        SqlDbType.Decimal,   17),
                new SqlParameter("@reward",                 SqlDbType.Int,        4),
                new SqlParameter("@start_date",             SqlDbType.DateTime),
                new SqlParameter("@end_date",               SqlDbType.DateTime),
                new SqlParameter("@activity_schedule_id",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.activity_schedule_name;
            parameters[1].Value = model.amount_of_reward;
            parameters[2].Value = model.use_lower_limit;
            parameters[3].Value = model.reward;
            parameters[4].Value = model.start_date;
            parameters[5].Value = model.end_date;
            parameters[6].Value = model.activity_schedule_id;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(M_Activity_schedule model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into hx_Activity_schedule(");
            strSql.Append("activity_schedule_name,amount_of_reward,use_lower_limit,reward,start_date,end_date,entry_time)");
            strSql.Append(" values (");
            strSql.Append("@activity_schedule_name,@amount_of_reward,@use_lower_limit,@reward,@start_date,@end_date,@entry_time)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@activity_schedule_name", SqlDbType.VarChar,   50),
                new SqlParameter("@amount_of_reward",       SqlDbType.Decimal,   17),
                new SqlParameter("@use_lower_limit",        SqlDbType.Decimal,   17),
                new SqlParameter("@reward",                 SqlDbType.Int,        4),
                new SqlParameter("@start_date",             SqlDbType.DateTime),
                new SqlParameter("@end_date",               SqlDbType.DateTime),
                new SqlParameter("@entry_time",             SqlDbType.DateTime)
            };
            parameters[0].Value = model.activity_schedule_name;
            parameters[1].Value = model.amount_of_reward;
            parameters[2].Value = model.use_lower_limit;
            parameters[3].Value = model.reward;
            parameters[4].Value = model.start_date;
            parameters[5].Value = model.end_date;
            parameters[6].Value = model.entry_time;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public M_Activity_schedule GetModel(int activity_schedule_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 activity_schedule_id,activity_schedule_name,amount_of_reward,use_lower_limit,reward,start_date,end_date,entry_time from hx_Activity_schedule ");
            strSql.Append(" where activity_schedule_id=@activity_schedule_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@activity_schedule_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = activity_schedule_id;

            M_Activity_schedule model = new M_Activity_schedule();
            DataSet             ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #8
0
        /// <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.));
                    }
                }
            }
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        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);
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(M_Activity_schedule model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(M_Activity_schedule model)
 {
     return(dal.Add(model));
 }