Hidistro.UI.Web/API/TaobaoProductHandler.cs

(开头部分) 11KB

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

namespace Hidistro.UI.Web.API
{
    using Hidistro.ControlPanel.Commodities;
    using Hidistro.Core;
    using Hidistro.Entities.Commodities;
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.IO;
    using System.Net;
    using System.Web;

    public class TaobaoProductHandler : IHttpHandler
    {
        private void DownloadImage(ProductInfo product, string imageUrls, HttpContext context)
        {
            imageUrls = HttpUtility.UrlDecode(imageUrls);
            string[] strArray = imageUrls.Split(new char[] { ';' });
            int num = 1;
            foreach (string str in strArray)
            {
                string str2 = string.Format("/Storage/master/product/images/{0}", Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture) + str.Substring(str.LastIndexOf('.')));
                string str3 = str2.Replace("/images/", "/thumbs40/40_");
                string str4 = str2.Replace("/images/", "/thumbs60/60_");
                string str5 = str2.Replace("/images/", "/thumbs100/100_");
                string str6 = str2.Replace("/images/", "/thumbs160/160_");
                string str7 = str2.Replace("/images/", "/thumbs180/180_");
                string str8 = str2.Replace("/images/", "/thumbs220/220_");
                string str9 = str2.Replace("/images/", "/thumbs310/310_");
                string str10 = str2.Replace("/images/", "/thumbs410/410_");
                string fileName = HttpContext.Current.Request.MapPath(Globals.ApplicationPath + str2);
                WebClient client = new WebClient();
                try
                {
                    client.DownloadFile(str, fileName);
                    ResourcesHelper.CreateThumbnail(fileName, context.Request.MapPath(Globals.ApplicationPath + str3), 40, 40);
                    ResourcesHelper.CreateThumbnail(fileName, context.Request.MapPath(Globals.ApplicationPath + str4), 60, 60);
                    ResourcesHelper.CreateThumbnail(fileName, context.Request.MapPath(Globals.ApplicationPath + str5), 100, 100);
                    ResourcesHelper.CreateThumbnail(fileName, context.Request.MapPath(Globals.ApplicationPath + str6), 160, 160);
                    ResourcesHelper.CreateThumbnail(fileName, context.Request.MapPath(Globals.ApplicationPath + str7), 180, 180);
                    ResourcesHelper.CreateThumbnail(fileName, context.Request.MapPath(Globals.ApplicationPath + str8), 220, 220);
                    ResourcesHelper.CreateThumbnail(fileName, context.Request.MapPath(Globals.ApplicationPath + str9), 310, 310);
                    ResourcesHelper.CreateThumbnail(fileName, context.Request.MapPath(Globals.ApplicationPath + str10), 410, 410);
                    switch (num)
                    {
                        case 1:
                            product.ImageUrl1 = str2;
                            product.ThumbnailUrl40 = str3;
                            product.ThumbnailUrl60 = str4;
                            product.ThumbnailUrl100 = str5;
                            product.ThumbnailUrl160 = str6;
                            product.ThumbnailUrl180 = str7;
                            product.ThumbnailUrl220 = str8;
                            product.ThumbnailUrl310 = str9;
                            product.ThumbnailUrl410 = str10;
                            break;

                        case 2:
                            product.ImageUrl2 = str2;
                            break;
后面还有 189 行代码,购买后查看完整代码

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

AI 解读 AI

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

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