Hidistro.UI.Web/Admin/promotion/SelectProductToActivityHandler.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Web;
using ControlPanel.Promotions;
using Hidistro.ControlPanel.Commodities;

namespace Hidistro.UI.Web.Admin.promotion
{
    public class SelectProductToActivityHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            try
            {
                int couponId = int.Parse(context.Request["id"].ToString());
                string s = context.Request["products"].ToString();
                bool flag = bool.Parse(context.Request["bsingle"].ToString());
                bool flag2 = bool.Parse(context.Request["setSale"].ToString());
                bool flag3 = false;
                if (!flag)
                {
                    bool isAllProduct = bool.Parse(context.Request["all"].ToString());
                    IList<string> productIDs = s.Split(new char[] { '|' });
                    flag3 = ActivityHelper.AddProducts(couponId, isAllProduct, productIDs);
                    if (flag2)
                    {
                        ProductHelper.UpShelf(s.Replace('|', ','));
                    }
                }
                else
                {
                    int productID = int.Parse(s);
                    flag3 = ActivityHelper.AddProducts(couponId, productID);
                    if (flag2)
                    {
                        ProductHelper.UpShelf(productID.ToString());
                    }
                }
                if (flag3)
                {
                    context.Response.Write("{\"type\":\"success\",\"data\":\"添加商品成功\"}");
                }
                else
                {
                    context.Response.Write("{\"type\":\"success\",\"data\":\"写数据库失败\"}");
                }
            }
            catch (Exception exception)
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"" + exception.Message + "\"}");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
后面还有 4 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。