示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="group"></param>
        /// <param name="account"></param>
        /// <returns></returns>
        public static List <Recharge> GetHistoryListByToday()
        {
            try
            {
                String          updated_at   = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:30:00");
                String          sql          = String.Format("select a.* from recharge_history a left join recharge b on a.id = b.id where a.payState = 0 and a.pay_querycount < 4 and b.id is null and a.updated_at >= '{0}' ", updated_at);
                DataTable       dataTable    = DBUtils.QueryData(sql);
                List <Recharge> userAccounts = dataTable.GetListByTableName <Recharge>();

                if (userAccounts != null && userAccounts.Count > 0)
                {
                    List <String> ids = userAccounts.Select(A => A.kid).ToList();
                    sql = "update recharge_history set pay_querycount = (pay_querycount + 1) where kid in (" + String.Join(",", ids) + ")";
                    DBUtils.ExecuteNonQuery(sql);
                }

                return(userAccounts);
            }
            catch (Exception)
            {
                return(null);
            }
        }