Car/Ajax/CheckOutProduct.ashx.cs
(完整代码) 1KBusing Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Web;
namespace Car.Ajax
{
/// <summary>
/// CheckOutProduct 的摘要说明
/// </summary>
public class CheckOutProduct : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
if (context.Request["ids"] != null)
{
Hashtable ht = new Hashtable();
string[] arr = context.Request["ids"].ToString().Split(new string[] { "@@@" }, StringSplitOptions.None);
for (int i = 0; i < arr.Length; i++)
{
string[] item = arr[i].Split(new string[] { "$$$" }, StringSplitOptions.None);
DataTable dt = new BLL.Models.Car().GetContentInfo(int.Parse(item[0]), "Product");
if (int.Parse(dt.Rows[0]["ProNumber"].ToString()) < int.Parse(item[2]))
{
ht.Add("code", 1);
ht.Add("msg", dt.Rows[0]["Title"].ToString() + "库存不足!");
string str = JsonConvert.SerializeObject(ht);
context.Response.Write(str);
return;
}
}
ht.Add("code",0);
ht.Add("msg", "");
context.Response.Write(JsonConvert.SerializeObject(ht));
}
else
{
Hashtable ht = new Hashtable();
ht.Add("code", 1);
ht.Add("msg", "参数错误!");
string str = JsonConvert.SerializeObject(ht);
context.Response.Write(str);
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。