Ejemplo n.º 1
0
        protected override void ThreadRun()
        {
            productImage = ProductImage.Get(TaskSchedule.PlayerAccountId);
            if (productImage != null)
            {
                productImage.Status = 1;
                HttpRequest httpRequest = new HttpRequest(productImage.Url);


                try
                {
                    WriteLog($"开始下载图片--{productImage.Url}");
                    Image image     = httpRequest.GetImage();
                    var   imagePath = createImagepath();
                    image.Save($"{imagePath}/{productImage.Asin}_{productImage.Number}.tbi", ImageFormat.Jpeg);
                    ImageHelper.JoinImage($"{imagePath}/{productImage.Asin}_{productImage.Number}.tbi", Environment.CurrentDirectory + "\\Config\\shuiyin.png", "C");
                    WriteLog($"{productImage.Asin}_{productImage.Number}商品图片下载成功", Core.ConsoleLogStatus.Success);
                    Complete?.Invoke(null, productImage, null, this);
                }
                catch
                {
                    TaskSchedule.RunDateTime = DateTime.Now.AddMinutes(1).GetTimestamp();
                }
            }
            else
            {
                Complete(null, null, null, this);
                return;
            }
        }