Пример #1
0
        /// <summary>
        /// 获取商户列表
        /// </summary>
        public void GetMerchantList()
        {
            var mid         = GetInt("mid");
            var orderby     = GetInt("orderby");
            var orderbytype = GetInt("orderbytype");
            var start       = GetInt("start");
            var limit       = GetInt("limit");

            var merresult     = MerchantHelper.GetMerchantList(mid, orderby, orderbytype, start * limit, limit);
            var mertyperesult = MerchantTypeHelper.GetList();

            var data   = new List <MerchantItem>();
            var idlist = merresult.Results.Select(o => o.Id).ToList();
            var users  = AccountHelper.GetUserList(Utility.GetWhereSql(idlist));

            foreach (var merchant in merresult.Results)
            {
                var merchantitem = new MerchantItem();
                merchantitem.Id        = merchant.Id;
                merchantitem.UserCount = merchant.UserCount;
                var user = users.Results.FirstOrDefault(o => o.Id == merchant.Id);
                if (user == null)
                {
                    ReturnErrorMsg("数据出错");
                    return;
                }
                merchantitem.Money = user.Money;
                var mertype = mertyperesult.FirstOrDefault(o => o.Id == merchant.Mid);
                if (mertype == null)
                {
                    ReturnErrorMsg("数据出错");
                    return;
                }
                merchantitem.Cname      = mertype.Name;
                merchantitem.CreateTime = merchant.CreateTime;
                merchantitem.DevName    = merchant.DevName;
                merchantitem.Name       = merchant.Name;
                merchantitem.LogoUrl    = merchant.LogoUrl;

                data.Add(merchantitem);
            }
            var jt = new JsonTransfer();

            jt.Add("list", data);
            jt.Add("totalcount", merresult.TotalCount);

            Response.Write(jt.ToJson());
            Response.End();
        }