コード例 #1
0
ファイル: Pay.ashx.cs プロジェクト: githexing/15Shopping
        public string GetSuanLiList(HttpContext context)
        {
            //string User = context.Request["UserID"];
            string UserCode = context.Request["UserCode"];
            string Pay      = context.Request["Pay"];    //1 什么币  2 什么币
            string Remark   = context.Request["Remark"]; //备注
            string Money    = context.Request["Money"];  //金额
            string Key      = context.Request["Key"];    //key


            int     Page   = 0;
            int     Mumber = 0;
            long    UserID = 0;
            decimal jine   = 0;

            if (string.IsNullOrEmpty(UserCode) || UserCode.Trim() == string.Empty)
            {
                return(ResultJson(ResultType.error, "请输入用户账号", ""));
            }
            AllCore AC = new AllCore();

            UserID = AC.userBLL.GetUserID(UserCode);
            if (UserID <= 0)
            {
                return(ResultJson(ResultType.error, "账号不存在!", ""));
            }
            if (!decimal.TryParse(Money, out jine))
            {
                return(ResultJson(ResultType.error, "金额不正确!", ""));
            }
            if (jine <= 0)
            {
                return(ResultJson(ResultType.error, "金额不能为0!", ""));
            }
            if (Pay == "1")
            {
                AC.UpdateAccount("", UserID, jine, 0);
            }
            else if (Pay == "2")
            {
            }
            else
            {
                return(ResultJson(ResultType.error, "支付类型错误!", ""));
            }



            SuanLiJournalService svc   = new SuanLiJournalService();
            SuanLiListModel      model = svc.GetSuanLiJournalList(UserID, Page, Mumber);

            return(ResultJson(ResultType.success, "", model));
        }
コード例 #2
0
        public void ProcessRequest(HttpContext context)
        {
            string  result    = "error";
            string  message   = "";
            string  dates     = "";
            string  strID     = context.Request["ID"];
            string  strUserID = context.Request["UserID"];
            decimal Money     = 0;

            long ID     = 0;
            long UserID = 0;

            if (string.IsNullOrEmpty(strID) || strID.Trim() == string.Empty || string.IsNullOrEmpty(strUserID) || strUserID.Trim() == string.Empty)
            {
                message = "账号不存在";
                SendResponse(context, result, message, dates);
                return;
            }
            try
            {
                ID     = long.Parse(strID);
                UserID = long.Parse(strUserID);
            }
            catch (Exception)
            {
                ID      = 0;
                UserID  = 0;
                message = "账号不存在";
                SendResponse(context, result, message, dates);
            }
            AllCore core = new AllCore();

            lgk.Model.tb_user userModel = core.userBLL.GetModel(UserID);

            SqlConnection conn = new SqlConnection(sconn);

            conn.Open();
            string         sql = string.Format("select ID,RandMoney from tb_Rand where ID=" + ID + " and Flag=0 and UserID= '" + UserID + "' ;");
            SqlDataAdapter da  = new SqlDataAdapter(sql, conn);
            DataTable      dt  = new DataTable();

            da.Fill(dt);
            conn.Close();
            if (dt.Rows.Count > 0)
            {
                Money = decimal.Parse(dt.Rows[0]["RandMoney"].ToString());
                conn.Open();
                string     sql_1 = "update tb_Rand set Flag=2,ClickTime=getdate() where ID='" + ID + "' and UserID= '" + UserID + "';update tb_user set BonusAccount+='" + Money + "' where UserID= '" + UserID + "'; ";
                SqlCommand cmd   = new SqlCommand(sql_1, conn);
                int        reInt = cmd.ExecuteNonQuery();
                conn.Close();
                if (reInt > 0)
                {
                    AllCore AC    = new AllCore();
                    var     model = AC.userBLL.GetModel(UserID);
                    dates   = "\"Account\":{\"Emoney\":\"" + model.Emoney.ToString() + "\",\"BonusAccount\":\"" + model.BonusAccount.ToString() + "\",\"ShengYuSuanLi\":\"" + Convert.ToInt32(model.User012) + "\"}";
                    result  = "success";
                    message = "领取成功!";
                    //明细记录
                    var Mjournal = new lgk.Model.tb_journal();
                    lgk.BLL.tb_journal Bjournal = new lgk.BLL.tb_journal();
                    Mjournal.UserID        = UserID;
                    Mjournal.InAmount      = Money;
                    Mjournal.OutAmount     = 0;
                    Mjournal.Remark        = "领取奖励分 ";
                    Mjournal.RemarkEn      = "Collect " + Money + " clouds";
                    Mjournal.JournalType   = 2;
                    Mjournal.BalanceAmount = model.BonusAccount;
                    Mjournal.JournalDate   = DateTime.Now;
                    Bjournal.Add(Mjournal);

                    //奖项记录
                    lgk.Model.tb_bonus Mbonus = new lgk.Model.tb_bonus();
                    lgk.BLL.tb_bonus   Bbonus = new lgk.BLL.tb_bonus();
                    Mbonus.AddTime    = DateTime.Now;
                    Mbonus.TypeID     = 1;
                    Mbonus.IsSettled  = 1;
                    Mbonus.FromUserID = UserID;
                    Mbonus.Amount     = Money;
                    Mbonus.UserID     = UserID;
                    Mbonus.Source     = "领取奖励分 ";
                    Mbonus.sf         = Money;
                    Mbonus.SourceEn   = "Collect " + Money + " clouds";
                    Mbonus.SttleTime  = DateTime.Now;
                    Bbonus.Add(Mbonus);

                    //如果冻结奖励分账户大于0,激活矿机时转入明细
                    if (userModel.User016 > 0)
                    {
                        core.UpdateAccount("User016", userModel.UserID, userModel.User016, 0);      //
                        core.UpdateAccount("BonusAccount", userModel.UserID, userModel.User016, 1); //

                        lgk.Model.tb_journal jourInfo = new lgk.Model.tb_journal();
                        jourInfo.UserID        = userModel.UserID;
                        jourInfo.Remark        = "奖励分账户进账,冻结奖励分转入奖励分账户";
                        jourInfo.RemarkEn      = "Cash withdrawal";
                        jourInfo.InAmount      = userModel.User016;
                        jourInfo.OutAmount     = 0;
                        jourInfo.BalanceAmount = core.userBLL.GetMoney(UserID, "BonusAccount");
                        jourInfo.JournalDate   = DateTime.Now;
                        jourInfo.JournalType   = (int)Library.AccountType.奖励分;
                        jourInfo.Journal01     = userModel.UserID;
                        core.journalBLL.Add(jourInfo);
                    }

                    SendResponse(context, result, message, dates);
                    //差一条记录
                }
            }
            message = "已经领取过";
            SendResponse(context, result, message, dates);
        }