Beispiel #1
0
        public static void AddMoney(Lebi_User user, decimal money, int type, Lebi_Order order, Lebi_Administrator admin, string description, string remark, bool fanxian = true)
        {
            if (money == 0)
            {
                return;
            }
            if (type == 192 || type == 193)
            {
                if (money > 0)
                {
                    money = 0 - money;
                }
            }
            Lebi_User_Money mo = new Lebi_User_Money();

            if (admin != null)
            {
                mo.Admin_id       = admin.id;
                mo.Admin_UserName = admin.UserName;
            }
            mo.Money = money;
            mo.Type_id_MoneyStatus = 181;
            mo.Type_id_MoneyType   = type;
            mo.User_id             = user.id;
            mo.User_UserName       = user.UserName;
            mo.User_RealName       = user.RealName;
            mo.Description         = description;
            mo.Remark = remark;
            if (order != null)
            {
                mo.Order_id    = order.id;
                mo.Order_Code  = order.Code;
                mo.Order_PayNo = order.PayNo;
            }
            //string money_ = B_Lebi_User_Money.GetValue("sum(Money)", "User_id=" + user.id + " and Type_id_MoneyStatus=181");
            //decimal Money = 0;
            //Decimal.TryParse(money_, out Money);
            if (type == 195)//返现
            {
                user.Money_fanxian = user.Money_fanxian + money;
            }
            if (type == 192 && fanxian == true)//消费
            {
                user.Money_fanxian = user.Money_fanxian + money;
                if (user.Money_fanxian < 0)
                {
                    user.Money_fanxian = 0;
                }
            }
            user.Money = user.Money + money;
            B_Lebi_User.Update(user);
            mo.Money_after         = user.Money;
            mo.Money_fanxian_after = user.Money_fanxian;
            B_Lebi_User_Money.Add(mo);
            //发送短信
            SMS.SendSMS_balance(user);
            //APP推送
            APP.Push_balance(user);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = RequestTool.RequestInt("id", 0);
            if (id == 0)
            {
                if (!EX_Admin.Power("user_money_add", "添加会员资金"))
                {
                    WindowNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("user_money_edit", "编辑会员资金"))
                {
                    WindowNoPower();
                }
            }
            int user_id = RequestTool.RequestInt("user_id", 0);

            model = B_Lebi_User_Money.GetModel(id);
            if (model == null)
            {
                model = new Lebi_User_Money();
                model.Type_id_MoneyStatus = 181; //有效资金
                model.Type_id_MoneyType   = 191; //充值
                Money = "";
            }
            else
            {
                Money   = FormatMoney(model.Money, "Number").ToString();
                user_id = model.User_id;
                mode    = "user";
            }
            Lebi_User user = B_Lebi_User.GetModel(user_id);

            if (user == null)
            {
                User_Name = RequestTool.RequestString("User_Name");
                user      = B_Lebi_User.GetModel("UserName=lbsql{'" + User_Name + "'}");
            }
            if (user != null)
            {
                mode      = "user";
                User_Name = user.UserName;
            }
            user_ids = RequestTool.RequestString("ids");
            if (user_ids != "")
            {
                users = B_Lebi_User.GetList("id in (lbsql{" + user_ids + "})", "id desc");
                mode  = "users";
            }
            su = new SearchUser(CurrentAdmin, CurrentLanguage.Code);
        }
Beispiel #3
0
        /// <summary>
        /// 积分转换
        /// </summary>
        public void PointToMoney()
        {
            string t = RequestTool.RequestSafeString("t");

            if (!CurrentUserLevel.PointToMoney.Contains(t))
            {
                Response.Write("{\"msg\":\"" + Tag("非法提交") + "\"}");
                return;
            }
            string[] arr = t.Split(':');
            if (arr.Length != 2)
            {
                Response.Write("{\"msg\":\"" + Tag("非法提交") + "\"}");
                return;
            }
            if (Convert.ToDecimal(arr[0]) > Convert.ToDecimal(CurrentUser.Point))
            {
                Response.Write("{\"msg\":\"" + Tag("积分不足") + "\"}");
                return;
            }
            Lebi_User_Money model = new Lebi_User_Money();

            model.Money = Convert.ToDecimal(arr[1]);
            model.Type_id_MoneyStatus = 181;
            model.Type_id_MoneyType   = 194;
            model.Remark        = "积分兑换";
            model.Time_Update   = DateTime.Now;
            model.User_id       = CurrentUser.id;
            model.User_RealName = CurrentUser.RealName;
            model.User_UserName = CurrentUser.UserName;
            B_Lebi_User_Money.Add(model);

            Lebi_User_Point pmodel = new Lebi_User_Point();

            pmodel.Point = 0 - Convert.ToDecimal(arr[0]);
            pmodel.Type_id_PointStatus = 171;
            pmodel.Remark        = "积分兑换";
            pmodel.Time_Update   = DateTime.Now;
            pmodel.User_id       = CurrentUser.id;
            pmodel.User_RealName = CurrentUser.RealName;
            pmodel.User_UserName = CurrentUser.UserName;
            B_Lebi_User_Point.Add(pmodel);

            CurrentUser.Point = CurrentUser.Point - Convert.ToDecimal(arr[0]);
            CurrentUser.Money = CurrentUser.Money + Convert.ToDecimal(arr[1]);
            B_Lebi_User.Update(CurrentUser);
            //发送短信
            //Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id);
            SMS.SendSMS_balance(CurrentUser);
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="user"></param>
        /// <param name="money"></param>
        /// <param name="type"></param>
        /// <param name="admin"></param>
        /// <param name="description"></param>
        /// <param name="remark"></param>
        /// <param name="fanxian">是否包含返现款消费</param>
        public static void AddMoney(Lebi_User user, decimal money, int type, Lebi_Administrator admin, string description, string remark, bool fanxian = true)
        {
            if (money == 0)
            {
                return;
            }
            Lebi_User_Money mo = new Lebi_User_Money();

            if (admin != null)
            {
                mo.Admin_id       = admin.id;
                mo.Admin_UserName = admin.UserName;
            }
            mo.Money = money;
            mo.Type_id_MoneyStatus = 181;
            mo.Type_id_MoneyType   = type;
            mo.User_id             = user.id;
            mo.User_UserName       = user.UserName;
            mo.User_RealName       = user.RealName;
            mo.Description         = description;
            mo.Remark = remark;



            //string money_ = B_Lebi_User_Money.GetValue("sum(Money)", "User_id=" + user.id + " and Type_id_MoneyStatus=181");
            //decimal Money = 0;
            //Decimal.TryParse(money_, out Money);
            if (type == 195)//返现
            {
                user.Money_fanxian = user.Money_fanxian + money;
            }
            if (type == 192 && fanxian == true)//消费
            {
                user.Money_fanxian = user.Money_fanxian + money;
                if (user.Money_fanxian < 0)
                {
                    user.Money_fanxian = 0;
                }
            }
            user.Money = user.Money + money;
            B_Lebi_User.Update(user);
            mo.Money_after         = user.Money;
            mo.Money_fanxian_after = user.Money_fanxian;
            B_Lebi_User_Money.Add(mo);
            //发送短信
            if (ShopCache.GetBaseConfig().SMS_sendmode.Contains("SMSTPL_balance"))
            {
                SMS.SendSMS_balance(user);
            }
        }
Beispiel #5
0
        public bool checkusermoney(Lebi_Order order)
        {
            //<-{检查资金明细中是否有消费记录 by lebi.kingdge 2018.8.18
            Lebi_User_Money usermoney = B_Lebi_User_Money.GetModel("User_id = " + order.User_id + " and Type_id_MoneyType = 192 and Description like '%" + order.Code + "%'");

            if (usermoney == null)
            {
                return(false);
            }
            if (usermoney.Money != order.Money_Pay)
            {
                return(false);
            }
            return(true);
            //}->
        }
Beispiel #6
0
        /// <summary>
        /// 编辑会员资金
        /// </summary>
        public void UserMoney_Edit()
        {
            int        id                = RequestTool.RequestInt("id", 0);
            SearchUser su                = new SearchUser(CurrentAdmin, CurrentLanguage.Code);
            decimal    money             = RequestTool.RequestDecimal("Money", 0);
            int        Type_id_MoneyType = RequestTool.RequestInt("Type_id_MoneyType", 0);
            string     Remark            = RequestTool.RequestString("Remark");

            if (id > 0)
            {
                if (!EX_Admin.Power("user_money_edit", "编辑会员资金"))
                {
                    AjaxNoPower();
                    return;
                }
                Lebi_User_Money model = B_Lebi_User_Money.GetModel(id);
                Lebi_User       user  = B_Lebi_User.GetModel(model.User_id);
                Log.Add("编辑会员资金", "User_Money", id.ToString(), CurrentAdmin, user.UserName);
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("会员账号不存在") + "\"}");
                    return;
                }
                //model.Type_id_MoneyStatus = RequestTool.RequestInt("Type_id_MoneyStatus", 0);
                model.Type_id_MoneyType = Type_id_MoneyType;
                model.Admin_UserName    = CurrentAdmin.UserName;
                model.Admin_id          = CurrentAdmin.id;
                model.Remark            = Remark;
                model.Time_Update       = DateTime.Now;
                B_Lebi_User_Money.Update(model);
                //EX_User.UpdateUserMoney(user);
            }
            else
            {
                if (!EX_Admin.Power("user_money_add", "添加会员资金"))
                {
                    AjaxNoPower();
                    return;
                }
                string Mode          = RequestTool.RequestString("mode");
                string User_Name_To  = RequestTool.RequestString("User_Name_To");
                string UserLevel_ids = RequestTool.RequestString("UserLevel_ids");
                string User_ids      = RequestTool.RequestString("User_ids");
                string UserName_ids  = RequestTool.RequestString("UserName_ids");

                if (Mode == "user")
                {
                    Lebi_User user = B_Lebi_User.GetModel("UserName = lbsql{'" + User_Name_To + "'}");
                    if (user == null)
                    {
                        Response.Write("{\"msg\":\"" + Tag("会员账号不存在") + "\"}");
                        return;
                    }
                    Lebi_User_Money model = new Lebi_User_Money();
                    Log.Add("添加会员资金", "User_Money", id.ToString(), CurrentAdmin, User_Name_To + " ->" + RequestTool.RequestDecimal("Money", 0));
                    Money.AddMoney(user, money, Type_id_MoneyType, CurrentAdmin, "", Remark);
                }
                else
                {
                    string where = "";
                    if (User_ids == "")
                    {
                        where = "1=1 " + su.SQL;
                        Log.Add("添加会员资金", "User_Money", "", CurrentAdmin, su.Description + " ->" + RequestTool.RequestDecimal("Money", 0));
                    }
                    else
                    {
                        where = "id in (" + User_ids + ")";
                        Log.Add("添加会员资金", "User_Money", "", CurrentAdmin, UserName_ids + " ->" + RequestTool.RequestDecimal("Money", 0));
                    }
                    List <Lebi_User> modellist = B_Lebi_User.GetList(where, "");
                    foreach (Lebi_User user in modellist)
                    {
                        Money.AddMoney(user, money, Type_id_MoneyType, CurrentAdmin, "", Remark);
                    }
                }
            }
            string result = "{\"msg\":\"OK\"}";

            Response.Write(result);
        }
Beispiel #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_User_Money model)
 {
     D_Lebi_User_Money.Instance.Update(model);
 }
Beispiel #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_User_Money model)
 {
     return(D_Lebi_User_Money.Instance.Add(model));
 }
Beispiel #9
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_User_Money SafeBindForm(Lebi_User_Money model)
 {
     return(D_Lebi_User_Money.Instance.SafeBindForm(model));
 }