Hidistro.UI.Web/Admin/Shop/Hi_Ajax_GetItems.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace Hidistro.UI.Web.Admin.Shop
{
using Hidistro.ControlPanel.Commodities;
using Hidistro.Core;
using Hidistro.Core.Entities;
using Hidistro.Core.Enums;
using Hidistro.Entities.Commodities;
using System;
using System.Data;
using System.Text;
using System.Web;
public class Hi_Ajax_GetItems : IHttpHandler
{
public string GetGoodsListJson(DbQueryResult GoodsTable)
{
StringBuilder builder = new StringBuilder();
builder.Append("\"list\":[");
DataTable data = (DataTable) GoodsTable.Data;
for (int i = 0; i < data.Rows.Count; i++)
{
builder.Append("{");
builder.Append("\"item_id\":\"" + data.Rows[i]["ProductId"] + "\",");
builder.Append("\"title\":\"" + data.Rows[i]["ProductName"].ToString().Replace(@"\", "") + "\",");
builder.Append("\"price\":\"" + data.Rows[i]["SalePrice"] + "\",");
builder.Append("\"original_price\":\"" + data.Rows[i]["MarketPrice"] + "\",");
builder.Append("\"create_time\":\"" + Convert.ToDateTime(data.Rows[i]["AddedDate"]).ToString("yyyy-MM-dd HH:mm:ss") + "\",");
builder.Append("\"link\":\"/ProductDetails.aspx?productId=" + data.Rows[i]["ProductId"] + "\",");
builder.Append("\"pic\":\"" + data.Rows[i]["ThumbnailUrl310"] + "\",");
builder.Append("\"is_compress\":0");
builder.Append("},");
}
return (builder.ToString().TrimEnd(new char[] { ',' }) + "]");
}
public DbQueryResult GetGoodsTable(HttpContext context)
{
return ProductHelper.GetProducts(this.GetProductQuery(context));
}
public string GetModelJson(HttpContext context)
{
DbQueryResult goodsTable = this.GetGoodsTable(context);
int pageCount = TemplatePageControl.GetPageCount(goodsTable.TotalRecords, 10);
if (goodsTable != null)
{
string str = "{\"status\":1,";
return (((str + this.GetGoodsListJson(goodsTable) + ",") + "\"page\":\"" + this.GetPageHtml(pageCount, context) + "\"") + "}");
}
return "{\"status\":1,\"list\":[],\"page\":\"\"}";
}
public string GetPageHtml(int pageCount, HttpContext context)
{
int pageIndex = (context.Request.Form["p"] == null) ? 1 : Convert.ToInt32(context.Request.Form["p"]);
return TemplatePageControl.GetPageHtml(pageCount, pageIndex);
}
public ProductQuery GetProductQuery(HttpContext context)
{
后面还有 20 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
