Exemplo n.º 1
0
        /// <summary>
        /// 获取俱乐部的战绩列表
        /// </summary>
        /// <param name="pagination"></param>
        /// <param name="sdate"></param>
        /// <param name="edate"></param>
        /// <param name="clubid"></param>
        /// <returns></returns>
        public ActionResult GetClubGamePlayer(string pagination, string sdate, string edate, string clubid, string roomNum)
        {
            Pagination        paginationobj = pagination.ToObject <Pagination>();
            T_game_player_log model         = new T_game_player_log();

            model.pageIndex  = paginationobj.page;
            model.pageSize   = paginationobj.rows;
            model.totalCount = paginationobj.total;
            //model.startDate = sdate;
            //model.endDate = edate;
            model.clubId  = Convert.ToInt32(clubid);
            model.roomNum = Convert.ToInt32(roomNum);

            List <T_game_player_log> list = this._clubgame.GetClubGamePlayer(model);

            var jsonData = new
            {
                rows    = list,
                total   = list.Count > 0 ? list[0].total : 0,
                page    = paginationobj.page,
                records = list.Count > 0 ? list[0].totalCount : 0
            };

            return(Success(jsonData));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查询房间玩家输赢记录
        /// </summary>
        /// <returns></returns>
        public List <T_game_player_log> GetClubGamePlayer(T_game_player_log model)
        {
            using (IDbConnection conn = DapperAdapter.MySQLOpenConnection(ConfigurationHelper.MySQLConnectionStr))
            {
                DynamicParameters param = new DynamicParameters();
                StringBuilder     sb    = new StringBuilder();

                sb.Append("SELECT * from t_game_player_log where  clubId = @clubId and roomNum = @roomNum");

                param.Add("@clubId", model.clubId);

                param.Add("@roomNum", model.roomNum);
                if (!string.IsNullOrEmpty(model.startDate))
                {
                    sb.Append(" and updateTime>=@startDate ");
                    param.Add("@startDate", model.startDate);
                }
                if (!string.IsNullOrEmpty(model.endDate))
                {
                    sb.Append(" and updateTime<=@endDate ");
                    param.Add("@endDate", model.endDate);
                }
                //获取总记录数
                string sqlCount = sb.ToString().Replace("SELECT *", "select count(1) totalCount ");
                //分页记录列表
                var list = conn.Query <T_game_player_log>(sb.ToString(), param).ToList();
                if (list != null && list.Count() > 0)
                {
                    //总记录数列表
                    dynamic identity = conn.Query(sqlCount, param).Single();
                    list[0].totalCount = Convert.ToInt64(identity.totalCount);
                    list[0].pageIndex  = model.pageIndex;
                    list[0].pageSize   = model.pageSize;
                }

                return(list);
            }
        }