Ejemplo n.º 1
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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        //
        //
        /// <summary>
        /// 生成奖励流水(抵扣券、现金),加息券不记录
        /// </summary>
        /// <param name="UserActid">用户奖励id</param>
        /// <param name="registerid">用户id</param>
        /// <param name="bonusAmt">奖励金额</param>
        /// <param name="awardDescription">奖励描述</param>
        /// <param name="waterType">waterType 默认为0,当为邀请奖励时,存放被邀请人的id</param>
        /// <returns></returns>
        protected bool AddBonusAccoutWater(int UserActid, int registerid, decimal bonusAmt, string awardDescription, int waterType = 0)
        {
            B_bonus_account_water bbaw = new B_bonus_account_water();
            M_bonus_account_water mbaw = new M_bonus_account_water();

            mbaw.bonus_account_id       = UserActid;
            mbaw.membertable_registerid = registerid;
            mbaw.income             = bonusAmt;
            mbaw.expenditure        = 0.00M;
            mbaw.time_of_occurrence = DateTime.Now;
            mbaw.award_description  = awardDescription;
            mbaw.water_type         = waterType;
            bbaw.Add(mbaw);
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(M_bonus_account_water model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update bonus_account_water set ");
            strSql.Append("bonus_account_id=@bonus_account_id,");
            strSql.Append("membertable_registerid=@membertable_registerid,");
            strSql.Append("income=@income,");
            strSql.Append("expenditure=@expenditure,");
            strSql.Append("time_of_occurrence=@time_of_occurrence,");
            strSql.Append("reward_balance=@reward_balance,");
            strSql.Append("award_description=@award_description,");
            strSql.Append("water_type=@water_type");
            strSql.Append(" where account_water_id=@account_water_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@bonus_account_id",       SqlDbType.Int,        4),
                new SqlParameter("@membertable_registerid", SqlDbType.Int,        4),
                new SqlParameter("@income",                 SqlDbType.Decimal,   17),
                new SqlParameter("@expenditure",            SqlDbType.Decimal,   17),
                new SqlParameter("@time_of_occurrence",     SqlDbType.DateTime),
                new SqlParameter("@reward_balance",         SqlDbType.Decimal,   17),
                new SqlParameter("@award_description",      SqlDbType.NVarChar,  -1),
                new SqlParameter("@water_type",             SqlDbType.Int,        4),
                new SqlParameter("@account_water_id",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.bonus_account_id;
            parameters[1].Value = model.membertable_registerid;
            parameters[2].Value = model.income;
            parameters[3].Value = model.expenditure;
            parameters[4].Value = model.time_of_occurrence;
            parameters[5].Value = model.reward_balance;
            parameters[6].Value = model.award_description;
            parameters[7].Value = model.water_type;
            parameters[8].Value = model.account_water_id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public M_bonus_account_water DataRowToModel(DataRow row)
        {
            M_bonus_account_water model = new M_bonus_account_water();

            if (row != null)
            {
                if (row["account_water_id"] != null && row["account_water_id"].ToString() != "")
                {
                    model.account_water_id = int.Parse(row["account_water_id"].ToString());
                }
                if (row["bonus_account_id"] != null && row["bonus_account_id"].ToString() != "")
                {
                    model.bonus_account_id = int.Parse(row["bonus_account_id"].ToString());
                }
                if (row["membertable_registerid"] != null && row["membertable_registerid"].ToString() != "")
                {
                    model.membertable_registerid = int.Parse(row["membertable_registerid"].ToString());
                }
                if (row["income"] != null && row["income"].ToString() != "")
                {
                    model.income = decimal.Parse(row["income"].ToString());
                }
                if (row["expenditure"] != null && row["expenditure"].ToString() != "")
                {
                    model.expenditure = decimal.Parse(row["expenditure"].ToString());
                }
                if (row["time_of_occurrence"] != null && row["time_of_occurrence"].ToString() != "")
                {
                    model.time_of_occurrence = DateTime.Parse(row["time_of_occurrence"].ToString());
                }
                if (row["reward_balance"] != null && row["reward_balance"].ToString() != "")
                {
                    model.reward_balance = decimal.Parse(row["reward_balance"].ToString());
                }
                if (row["award_description"] != null)
                {
                    model.award_description = row["award_description"].ToString();
                }
                if (row["water_type"] != null && row["water_type"].ToString() != "")
                {
                    model.water_type = int.Parse(row["water_type"].ToString());
                }
            }
            return(model);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(M_bonus_account_water model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into bonus_account_water(");
            strSql.Append("bonus_account_id,membertable_registerid,income,expenditure,time_of_occurrence,reward_balance,award_description,water_type)");
            strSql.Append(" values (");
            strSql.Append("@bonus_account_id,@membertable_registerid,@income,@expenditure,@time_of_occurrence,@reward_balance,@award_description,@water_type)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@bonus_account_id",       SqlDbType.Int,        4),
                new SqlParameter("@membertable_registerid", SqlDbType.Int,        4),
                new SqlParameter("@income",                 SqlDbType.Decimal,   17),
                new SqlParameter("@expenditure",            SqlDbType.Decimal,   17),
                new SqlParameter("@time_of_occurrence",     SqlDbType.DateTime),
                new SqlParameter("@reward_balance",         SqlDbType.Decimal,   17),
                new SqlParameter("@award_description",      SqlDbType.NVarChar,  -1),
                new SqlParameter("@water_type",             SqlDbType.Int, 4)
            };
            parameters[0].Value = model.bonus_account_id;
            parameters[1].Value = model.membertable_registerid;
            parameters[2].Value = model.income;
            parameters[3].Value = model.expenditure;
            parameters[4].Value = model.time_of_occurrence;
            parameters[5].Value = model.reward_balance;
            parameters[6].Value = model.award_description;
            parameters[7].Value = model.water_type;

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

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

            strSql.Append("select  top 1 account_water_id,bonus_account_id,membertable_registerid,income,expenditure,time_of_occurrence,reward_balance,award_description,water_type from bonus_account_water ");
            strSql.Append(" where account_water_id=@account_water_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@account_water_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = account_water_id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(M_bonus_account_water model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(M_bonus_account_water model)
 {
     return(dal.Add(model));
 }
Ejemplo n.º 9
0
        public bool SendCash(int actID, int Registerid)
        {
            bool t = false;
            chuangtouEntities ef  = new chuangtouEntities();
            hx_ActivityTable  hat = new ActFacade().GetActivityModel(actID); //GetActTableInfo(ActTypeId, ActUser, 1);

            if (hat != null)
            {
                //判是否过期
                if (hat.ActStarttime <= DateTime.Now && DateTime.Now <= hat.ActEndtime)
                {
                    string               ActRule = hat.ActRule;
                    List <MAmtList>      mlist   = new List <MAmtList>();
                    JavaScriptSerializer js      = new JavaScriptSerializer();
                    //MActCash mc = new MActCash();
                    Mcoupon mcp = new Mcoupon();
                    mcp = js.Deserialize <Mcoupon>(ActRule);
                    //mlist = js.Deserialize<List<MAmtList>>(ActRule);

                    //检查分发奖励是否超过顶限,如果超过直接跳过
                    //int TopNum = B_usercenter.GetTopNum(hat.ActID);
                    //项目已经发放的金额
                    //decimal totalAmt = B_usercenter.GetTopAmtCount(hat.ActID);
                    //第一次投资获取对应奖励
                    decimal actamt = mcp.cash;//GetActAmt(mc, InvestAmt, TopNum);

                    //if (mc.TopAmt > totalAmt && mc.TopNum > TopNum)
                    //{

                    t = true;
                    if (actamt > 0)//大于 0里写入对应的奖励数据
                    {
                        hx_UserAct hua = new hx_UserAct();
                        hua.ActTypeId    = hat.ActTypeId;
                        hua.registerid   = Registerid;
                        hua.RewTypeID    = hat.RewTypeID;
                        hua.ActID        = hat.ActID;
                        hua.Amt          = actamt;
                        hua.Uselower     = 0.00M;
                        hua.Usehight     = 0.00M;
                        hua.AmtEndtime   = DateTime.Parse(hat.ActEndtime.ToString()).AddMonths(1);
                        hua.AmtUses      = 1; //没指定情况下默认为单独使用
                        hua.UseState     = 5; //现金未转账
                        hua.UseTime      = DateTime.Now;
                        hua.AmtProid     = 0; //未使用默认为0
                        hua.ISSmsOne     = 0;
                        hua.IsSmsThree   = 0;
                        hua.isSmsFifteen = 0;
                        hua.IsSmsSeven   = 0;
                        hua.isSmsSixteen = 0;
                        hua.OrderID      = decimal.Parse(Utils.Createcode());
                        hua.Createtime   = DateTime.Now;
                        hua.Title        = hat.ActName;
                        hua.UseLifeLoan  = "";
                        ef.hx_UserAct.Add(hua);
                        int i = ef.SaveChanges();
                        if (i > 0)
                        {
                            //录入成功,后进行转账操作
                            //1.获取用户对向
                            M_member_table p = new M_member_table();
                            B_member_table o = new B_member_table();
                            p = o.GetModel(Registerid);

                            if (p != null)
                            {
                                //2.调用商户向用户转账接口
                                Transfer   tf   = new Transfer();
                                ReTransfer retf = tf.ToUserTransfer(p.UsrCustId, actamt, hua.OrderID.ToString(), hua.ActID.ToString(), "/Thirdparty/ToUserTransfer");
                                if (retf != null)
                                {
                                    if (retf.RespCode == "000")
                                    {
                                        //3.事务处理操作账户及插入流水

                                        #region 验签缓存处理
                                        string cachename = retf.OrdId + "ToUserTransfer" + retf.InCustId;

                                        if (Utils.GeTThirdCache(cachename) == 0)
                                        {
                                            Utils.SetThirdCache(cachename);
                                            B_usercenter BUC = new B_usercenter();
                                            int          ic  = BUC.UpateActToUserTransfer(retf, 0); //用户余更新
                                            if (ic > 0)
                                            {
                                                string    sql = "SELECT registerid,username,mobile  from hx_member_table where UsrCustId='" + retf.InCustId + "'";
                                                DataTable dt  = DbHelperSQL.GET_DataTable_List(sql);
                                                if (dt.Rows.Count > 0)
                                                {
                                                    /*短信接口*/


                                                    #region 流水信息
                                                    B_usercenter ors = new B_usercenter();
                                                    decimal      di  = ors.GetUsridAvailable_balance(int.Parse(dt.Rows[0]["registerid"].ToString()));
                                                    // di = di + decimal.Parse(hua.Amt.ToString());
                                                    StringBuilder strSql = new StringBuilder();
                                                    strSql.Append("insert into hx_Capital_account_water(");
                                                    strSql.Append("membertable_registerid,income,expenditure,time_of_occurrence,account_balance,types_Finance,createtime,keyid,remarks)");
                                                    strSql.Append(" values (");
                                                    strSql.Append("" + int.Parse(dt.Rows[0]["registerid"].ToString()) + "," + decimal.Parse(hua.Amt.ToString()) + ",0,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + di + "," + (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.现金奖励.ToString()) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,'" + "现金奖励" + "')");

                                                    DbHelperSQL.RunSql(strSql.ToString());

                                                    strSql.Clear();
                                                    #endregion

                                                    #region 奖励流水
                                                    M_bonus_account_water mbaw = new M_bonus_account_water();
                                                    B_bonus_account_water bbaw = new B_bonus_account_water();
                                                    DateTime dte = DateTime.Now;
                                                    mbaw.bonus_account_id       = int.Parse(hua.ActID.ToString());
                                                    mbaw.membertable_registerid = int.Parse(dt.Rows[0]["registerid"].ToString());
                                                    mbaw.income             = decimal.Parse(retf.TransAmt);
                                                    mbaw.expenditure        = 0.00M;
                                                    mbaw.time_of_occurrence = DateTime.Now;

                                                    mbaw.award_description = hat.ActName + "奖励已汇入个人账户";
                                                    mbaw.water_type        = 0;
                                                    bbaw.Add(mbaw);

                                                    #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   = hat.ActName;
                                                    pm.MContext = "尊敬的用户" + dt.Rows[0]["username"].ToString() + ":您好!恭喜您成功" + hat.ActName + ",现金奖励 " + retf.TransAmt + "元。如有问题可咨询创利投的客服!";
                                                    pm.PubTime  = dti;
                                                    B_usercenter.AddMessage(pm);
                                                    #endregion
                                                }
                                            }

                                            t = true;
                                        }
                                        #endregion
                                    }
                                }
                            }
                        }
                    }
                    //}
                }
            }


            return(t);
        }
Ejemplo n.º 10
0
        /// <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);
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 发放奖励
        /// </summary>
        /// <param name="activity"></param>
        /// <param name="registerID"></param>
        public static void DrawBonus(hx_ActivityTable activity, int registerID, int effectiveDays)
        {
            //chuangtouEntities ef = new chuangtouEntities();
            M_bonus_account_water mbaw = new M_bonus_account_water();
            B_bonus_account_water bbaw = new B_bonus_account_water();

            DateTime dte = DateTime.Now;//当前时间截点

            //if (activity.ActEndtime >= dte && activity.ActStarttime <= dte)   //发布的时候要释放
            if (true)
            {
                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;
                if (activity.RewTypeID == 3)
                {
                    hua.UseLifeLoan = "3-0";
                }
                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   = Convert.ToDateTime(dte.AddDays(effectiveDays).ToShortDateString() + " 23:59:59"); //有效期为10天
                hua.AmtUses      = 1;                                                                                //没指定情况下默认为单独使用
                hua.UseState     = activity.RewTypeID == 1 ? 5 : 0;
                hua.AmtProid     = 0;                                                                                //未使用默认为0
                hua.ISSmsOne     = 0;
                hua.IsSmsThree   = 0;
                hua.isSmsFifteen = 0;
                hua.IsSmsSeven   = 0;
                hua.isSmsSixteen = 0;
                hua.Title        = activity.ActName;
                hua.Createtime   = dte;
                hua.OrderID      = decimal.Parse(Utils.Createcode());//根据日期生成单号
                ef.hx_UserAct.Add(hua);
                ef.SaveChanges();


                if (activity.RewTypeID == 1)  //当奖品为现金时
                {
                    Transfer       tf = new Transfer();
                    M_member_table p  = new M_member_table();
                    B_member_table o  = new B_member_table();
                    p = o.GetModel(registerID);
                    ReTransfer retf = tf.ToUserTransfer(p.UsrCustId, mcp.cash, hua.OrderID.ToString(), hua.ActID.ToString(), "/Thirdparty/ToUserTransfer");
                    if (retf != null)
                    {
                        if (retf.RespCode == "000")
                        {
                            //3.事务处理操作账户及插入流水
                            #region 验签缓存处理
                            string cachename = retf.OrdId + "ToUserTransfer" + retf.InCustId;
                            if (Utils.GeTThirdCache(cachename) == 0)
                            {
                                Utils.SetThirdCache(cachename);
                                B_usercenter BUC = new B_usercenter();
                                BUC.UpateActToUserTransfer(retf, 0);

                                //增加账户资金流水
                                hx_Capital_account_water Caw = new hx_Capital_account_water();

                                Caw.membertable_registerid = registerID;
                                Caw.income             = mcp.cash;
                                Caw.expenditure        = 0;
                                Caw.time_of_occurrence = dte;
                                Caw.account_balance    = p.available_balance + mcp.cash;
                                Caw.types_Finance      = 43;
                                Caw.createtime         = dte;
                                Caw.keyid   = 0;
                                Caw.remarks = "现金奖励";
                                ef.hx_Capital_account_water.Add(Caw);
                                ef.SaveChanges();
                            }
                            #endregion
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
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.));
                    }
                }
            }
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
        //汇付模拟发起的请求,没有携带用户的cookie,造成邀请丢失,邀请关系逻辑迁移至注册成功
        /// <summary>
        /// 注册成功汇付返回通知
        /// </summary>
        /// <returns></returns>
        public ActionResult Succ_Registered()
        {
            int            it        = -10000;
            string         username  = "";
            string         useremail = "";
            ReUserRegister m         = new ReUserRegister();

            m.CmdId     = DNTRequest.GetString("CmdId");
            m.RespCode  = DNTRequest.GetString("RespCode");
            m.RespDesc  = DNTRequest.GetString("RespDesc");
            m.MerCustId = DNTRequest.GetString("MerCustId");
            m.UsrId     = DNTRequest.GetString("UsrId");
            m.UsrCustId = DNTRequest.GetString("UsrCustId");
            m.BgRetUrl  = DNTRequest.GetString("BgRetUrl");
            m.TrxId     = DNTRequest.GetString("TrxId");
            m.RetUrl    = DNTRequest.GetString("RetUrl");
            m.MerPriv   = DNTRequest.GetString("MerPriv");
            m.IdType    = DNTRequest.GetString("IdType");
            m.IdNo      = DNTRequest.GetString("IdNo");
            m.UsrMp     = DNTRequest.GetString("UsrMp");
            useremail   = DNTRequest.GetString("UsrEmail");
            m.UsrEmail  = useremail;
            username    = HttpUtility.UrlDecode(DNTRequest.GetString("UsrName"));
            m.UsrName   = username;
            m.ChkValue  = DNTRequest.GetString("ChkValue");
            string        log    = "注册开户返回报文:" + FastJSON.toJOSN(m);
            StringBuilder chkVal = new StringBuilder();

            chkVal.Append(m.CmdId);
            chkVal.Append(m.RespCode);
            chkVal.Append(m.MerCustId);
            chkVal.Append(m.UsrId);
            chkVal.Append(m.UsrCustId);
            chkVal.Append(m.BgRetUrl);
            chkVal.Append(m.TrxId);
            chkVal.Append(m.RetUrl);
            chkVal.Append(m.MerPriv);
            string chkv = chkVal.ToString();
            //私钥文件的位置(这里是放在了站点的根目录下)
            string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk();
            int    ret        = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, m.ChkValue);

            log += ";ret:" + ret;
            if (ret == 0)
            {
                B_member_table ob = new B_member_table();
                M_member_table pm = new M_member_table();
                if (m.RespCode == "000")
                {
                    //为避免重复调用,增加缓存校验
                    string cachename = "UserRegister" + m.TrxId;
                    if (Utils.GeTThirdCache(cachename) == 0)
                    {
                        Utils.SetThirdCache(cachename);
                        M_bonus_account_water mbaw = new M_bonus_account_water();
                        B_bonus_account_water bbaw = new B_bonus_account_water();
                        B_usercenter          b    = new B_usercenter();
                        it   = b.Succ_Reg(m);
                        log += ";汇付开户成功后进行用户数据更新返回:" + it;
                        if (it > 0)
                        {
                            pm = ob.GetModel(Utils.GetUserSplit(m.UsrId));
                            ViewBag.registerid = pm.registerid;

                            //新人注册奖励
                            ActFacade act = new ActFacade();
                            log += ";注册ID:" + pm.registerid;
                            act.SendBonusAfterRegister(pm.registerid, EnumCommon.E_hx_ActivityTable.E_ActTargetPlatform.web);
                        }
                        else
                        {
                            /*第三方成功,本地服务器操作失败*/
                        }
                    }
                }
            }
            else
            {
                log += "验签不成功";
                /*验签不成功*/
            }
            LogInfo.WriteLog(log);
            return(View(m));
        }
Ejemplo n.º 15
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);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 活动企业向用户转账
        /// </summary>
        /// <returns></returns>
        public ActionResult ToUserTransfer()
        {
            //  Thread.Sleep(6000);
            string     str = "";
            ReTransfer p   = new ReTransfer();

            p.CmdId     = DNTRequest.GetString("CmdId");
            p.RespCode  = DNTRequest.GetString("RespCode");
            p.RespDesc  = HttpUtility.UrlDecode(DNTRequest.GetString("RespDesc"));
            p.OrdId     = DNTRequest.GetString("OrdId");
            p.OutCustId = DNTRequest.GetString("OutCustId");
            p.OutAcctId = DNTRequest.GetString("OutAcctId");
            p.TransAmt  = DNTRequest.GetString("TransAmt");
            p.InCustId  = DNTRequest.GetString("InCustId");
            p.InAcctId  = DNTRequest.GetString("InAcctId");
            p.RetUrl    = HttpUtility.UrlDecode(DNTRequest.GetString("RetUrl"));
            p.BgRetUrl  = HttpUtility.UrlDecode(DNTRequest.GetString("BgRetUrl"));
            p.MerPriv   = DNTRequest.GetString("MerPriv");
            p.ChkValue  = DNTRequest.GetString("ChkValue");
            StringBuilder builder = new StringBuilder();

            builder.Append(p.CmdId);
            builder.Append(p.RespCode);
            builder.Append(p.OrdId);
            builder.Append(p.OutCustId);
            builder.Append(p.OutAcctId);
            builder.Append(p.TransAmt);
            builder.Append(p.InCustId);
            builder.Append(p.InAcctId);
            builder.Append(HttpUtility.UrlDecode(p.RetUrl));
            builder.Append(HttpUtility.UrlDecode(p.BgRetUrl));
            builder.Append(p.MerPriv);
            string chkv = builder.ToString();
            //私钥文件的位置(这里是放在了站点的根目录下)
            string merKeyFile = AppDomain.CurrentDomain.BaseDirectory + Utils.GetPgPubk();

            int ret = DllInterop.VeriSignMsg(merKeyFile, chkv, chkv.Length, p.ChkValue);

            string log = "后台平台向用户活动转账后";

            log += "<br>1台验签:" + ret.ToString();

            log += "<br>1台主动投标返回报文:" + FastJSON.toJOSN(p);

            LogInfo.WriteLog(log);
            if (ret == 0)
            {
                if (p.RespCode == "000")
                {
                    #region 验签缓存处理
                    string cachename = p.OrdId + "ToUserTransfer" + p.InCustId;

                    if (Utils.GeTThirdCache(cachename) == 0)
                    {
                        Utils.SetThirdCache(cachename);
                        B_usercenter BUC = new B_usercenter();


                        int bid_records_id = DbHelperSQL.Execint(" select  amtproid from hx_UserAct where  OrderID='" + p.OrdId + "' and UseState=5");

                        int ic = BUC.UpateActToUserTransfer(p, bid_records_id);
                        if (ic > 0)
                        {
                            string    sql = "SELECT registerid,username,mobile  from hx_member_table where UsrCustId='" + p.InCustId + "'";
                            DataTable dt  = DbHelperSQL.GET_DataTable_List(sql);
                            if (dt.Rows.Count > 0)
                            {
                                int ActID            = int.Parse(p.MerPriv);
                                hx_ActivityTable hat = ef.hx_ActivityTable.Where(c => c.ActID == ActID).FirstOrDefault();



                                #region 流水信息

                                /*
                                 * B_usercenter ors = new B_usercenter();
                                 * decimal di = ors.GetUsridAvailable_balance(int.Parse(dt.Rows[0]["registerid"].ToString()));
                                 * // di = di + decimal.Parse(hua.Amt.ToString());
                                 * StringBuilder strSql = new StringBuilder();
                                 * strSql.Append("insert into hx_Capital_account_water(");
                                 * strSql.Append("membertable_registerid,income,expenditure,time_of_occurrence,account_balance,types_Finance,createtime,keyid,remarks)");
                                 * strSql.Append(" values (");
                                 * strSql.Append("" + int.Parse(dt.Rows[0]["registerid"].ToString()) + "," + decimal.Parse(p.TransAmt.ToString()) + ",0,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + di + "," + (int)Enum.Parse(typeof(EnumTypesFinance), EnumTypesFinance.现金奖励.ToString()) + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',0,'" + "现金奖励" + "')");
                                 *
                                 * DbHelperSQL.RunSql(strSql.ToString());
                                 *
                                 * strSql.Clear();
                                 */
                                #endregion

                                #region 奖励流水
                                M_bonus_account_water mbaw = new M_bonus_account_water();
                                B_bonus_account_water bbaw = new B_bonus_account_water();
                                DateTime dte = DateTime.Now;
                                mbaw.bonus_account_id       = int.Parse(hat.ActID.ToString());
                                mbaw.membertable_registerid = int.Parse(dt.Rows[0]["registerid"].ToString());
                                mbaw.income             = decimal.Parse(p.TransAmt);
                                mbaw.expenditure        = 0.00M;
                                mbaw.time_of_occurrence = DateTime.Now;

                                mbaw.award_description = hat.ActName + "奖励已汇入个人账户";
                                mbaw.water_type        = 0;
                                bbaw.Add(mbaw);

                                #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   = hat.ActName;
                                pm.MContext = "尊敬的用户" + dt.Rows[0]["username"].ToString() + ":您好!恭喜您成功投资了项目,现金奖励 " + p.TransAmt + "元。如有问题可咨询创利投的客服!";
                                pm.PubTime  = dti;
                                pm.Mtype    = 2;
                                B_usercenter.AddMessage(pm);
                                #endregion
                            }
                        }
                    }
                    #endregion

                    str = "RECV_ORD_ID_" + p.OrdId.ToString();
                }
                else
                {
                }
            }

            return(Content(str));
        }