Exemple #1
0
        private string GetAccountList(HttpContext context)
        {
            int pageSize = 10; //默认每页返回记录数
            int _pageindex;
            int _type;

            string userid    = context.Request["userid"] ?? "";
            string pageindex = context.Request["pageindex"] ?? ""; //页索引
            string findkey   = context.Request["findkey"] ?? "";   //搜索关键字
            string type      = context.Request["type"] ?? "";      //类型

            if (string.IsNullOrEmpty(userid))
            {
                return(ResultJson(ResultType.error, "请输入用户ID", ""));
            }
            if (string.IsNullOrEmpty(pageindex))
            {
                return(ResultJson(ResultType.error, "页索引不能为空", ""));
            }
            if (string.IsNullOrEmpty(type))
            {
                return(ResultJson(ResultType.error, "类型不能为空", ""));
            }
            int.TryParse(pageindex, out _pageindex);

            if (_pageindex <= 0)
            {
                _pageindex = 1;
            }

            long _userid = 0;

            long.TryParse(userid, out _userid);
            int.TryParse(type, out _type);

            if (!string.IsNullOrEmpty(findkey))
            {
                findkey = SafeHelper.GetSafeSql(findkey);
            }

            AccountService svc = new AccountService();
            object         result;

            if ("1".Equals(type))
            {
                result = svc.AccountList(_userid, _pageindex, pageSize, findkey, _type);
            }
            else
            {
                result = svc.AccountYTList(_userid, _pageindex, pageSize, findkey, _type);
            }
            return(ResultJson(ResultType.success, "获取成功", result));
        }