Beispiel #1
0
        /// <summary>
        /// 获取作品列表(小程序,必须是审核过的)
        /// </summary>
        /// <param name="uid">赛区id</param>
        /// <param name="zone_id">赛区id</param>
        /// <param name="keyword">作品编号/标题/作者</param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public ApiPageResult GetArticleList(int uid, int zone_id = 0, string keyword = null, int pageIndex = GloabManager.PAGEINDEX, int pageSize = GloabManager.PAGESIZE)
        {
            ApiPageResult apiResult   = new ApiPageResult();
            var           checkResult = Util.CheckParameters(
                new Parameter {
                Value = uid.ToString(), Msg = "uid 不能为空值"
            },
                new Parameter {
                Value = uid.ToString(), Msg = "uid 必须是数字类型", Regex = @"^[1-9]\d*$"
            },
                new Parameter {
                Value = zone_id.ToString(), Msg = "zone_id 不能为空值"
            },
                new Parameter {
                Value = zone_id.ToString(), Msg = "zone_id 必须是数字类型", Regex = @"^[0-9]\d*$"
            }
                );

            if (!checkResult.OK)
            {
                apiResult.success = false;
                apiResult.status  = ApiStatusCode.InvalidParam;
                apiResult.message = checkResult.Msg;
                return(apiResult);
            }
            //查到当前默认开启的赛季
            BaseBLL <competition_notice> notice_bll = new BaseBLL <competition_notice>();
            var competion_season        = notice_bll.Find(o => o.is_delete == 0 && o.is_open == 1);
            int competiontion_season_id = competion_season?.competition_season_id ?? 0;

            if (competiontion_season_id == 0)
            {
                return(new ApiPageResult()
                {
                    success = false,
                    message = "当前没有开启任何赛季"
                });
            }
            ArticleBLL bll = new ArticleBLL();

            return(bll.GetArticleList(uid, zone_id, competiontion_season_id, keyword, pageIndex, pageSize));
        }