コード例 #1
0
        private void Email(string info)
        {
            var           data = info.Split(';')?.ToList();
            StringBuilder sbr  = new StringBuilder();

            sbr.Append($@"<label> {data.Count}个异常拼团订单处理 </label> ");
            sbr.Append(@"<table border=1" + " align=center" + " width =1000 " + "><tr bgcolor='#4da6ff'><td align=center><b>OrderId</b></td><td align=center><b>PID</b></td> </tr>");
            foreach (var item in data)
            {
                var dat       = new List <int>();
                var childItem = item.Split(':').ToList();
                if (childItem.Any())
                {
                    if (childItem.Count == 1)
                    {
                        childItem.Add("");
                    }
                    sbr.Append("<tr>\n");
                    sbr.Append($"<td style='text-align:center'>{childItem[0]}</td>");
                    sbr.Append($"<td style='text-align:center'>{childItem[1]}</td>");
                    sbr.Append("</tr>");
                }
            }
            sbr.Append("</table>");
            sbr.Append(info);
            var data2 = sbr.ToString();

            TuhuMessage.SendEmail($"拼团异常订单补偿--{DateTime.Now.ToString("s")}", "*****@*****.**", sbr.ToString());
        }
コード例 #2
0
 public static void SendEmail(List <string> pids, ILog logger)
 {
     if (pids.Any())
     {
         var baseInfo     = DalTireStockoutStatusWhile.GetBaseProductInfo(pids);
         var stockoutInfo = DalTireStockoutStatusWhile.GetStockoutStatus(pids);
         var data         = baseInfo.Union(stockoutInfo).GroupBy(g => g.PID).Select(g => new TireStockProductModel
         {
             PID               = g.Key,
             DisplayName       = g.FirstOrDefault(t => !string.IsNullOrEmpty(t.DisplayName))?.DisplayName ?? "",
             Brand             = g.FirstOrDefault(t => !string.IsNullOrEmpty(t.Brand))?.Brand ?? "",
             OnSale            = g.Any(t => t.OnSale),
             StockoutStatus    = g.Max(t => t.StockoutStatus),
             CurrentStockCount = g.Max(t => t.CurrentStockCount),
             MonthSales        = g.Max(t => t.MonthSales)
         }).ToList();
         var body      = new StringBuilder(51200);
         var emailhead =
             $@"<div style='font-size:20px;font-weight:bold;'><p>白名单变更记录:</p><p>{
                     DateTime.Now.ToString(CultureInfo.CurrentCulture)
                 }</p></div>";
         body.Append(emailhead);
         body.Append(TableMessage("以下PID被加入白名单", data));
         var dat     = data.Where(g => (g.SystemStockout == 1 || g.StockoutStatus == 1) && g.OnSale).ToList();
         var message = body.Append(TableMessage("以下PID的展示状态由缺货变为有货", dat)).ToString();
         TuhuMessage.SendEmail("【Info】白名单状态变更记录",
                               "*****@*****.**",
                               message);
     }
     else
     {
         logger.Warn("无新增缺货白名单");
     }
 }
コード例 #3
0
        /// <summary>
        /// 发送邮件提醒
        /// </summary>
        /// <param name="expiredInfo">要提醒的活动信息</param>
        private static void SendEmail(IReadOnlyCollection <ExpiredGroupBuyingInfo> expiredInfo)
        {
            if (expiredInfo == null || expiredInfo.Count <= 0)
            {
                Logger.Info("没有数据,无需发送提醒邮件");
                return;
            }
            var htmlBuilder = new StringBuilder();

            htmlBuilder.AppendLine(@"
<table style=""font-size:14px;border:1px solid rgb(0, 92, 182);border-collapse:collapse;"">
    <thead  style=""background-color:rgb(102, 171, 239);"">
        <tr>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">GroupId</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">PID</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">商品名称</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">商品售价</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">商品活动价</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">商品团长价</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">标签</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">创建人</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">活动开始时间</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">活动结束时间</td>
            <td style=""border:1px solid rgb(0, 92, 182);padding: 8px;"">触发条件</td>
        </tr>
    </thead>
    <tbody>");
            foreach (var info in expiredInfo)
            {
                htmlBuilder.AppendLine("\t\t<tr>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.ProductGroupId}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.PID}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.ProductName}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.OriginalPrice:0.00}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.FinalPrice:0.00}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.SpecialPrice:0.00}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{string.Join(", ", info.Label?.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries) ?? Enumerable.Empty<string>())}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.Creator}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.BeginTime:yyyy-MM-dd HH:mm:ss}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.EndTime:yyyy-MM-dd HH:mm:ss}</td>");
                htmlBuilder.AppendLine($"\t\t\t<td  style=\"border:1px solid rgb(0, 92, 182);padding: 8px;\">{info.TriggerType}</td>");
                htmlBuilder.AppendLine("\t\t</tr>");
            }
            htmlBuilder.AppendLine("\t</tbody>");
            htmlBuilder.AppendLine("</table>");
#if DEBUG
            TuhuMessage.SendEmail($"{DateTime.Today:yyyy-MM-dd}拼团活动结束提醒", "李卫涵<*****@*****.**>;", htmlBuilder.ToString());
#else
            TuhuMessage.SendEmail($"{DateTime.Today:yyyy-MM-dd}拼团活动结束提醒",
                                  System.Configuration.ConfigurationManager.AppSettings["PintuanActivityEndRemindJob:To"],
                                  htmlBuilder.ToString());
#endif
            Logger.Info("邮件提醒已发送");
        }
コード例 #4
0
        public async Task <ActionResult> GotoExam(int pkid, string pid, decimal price, int type, decimal?cost, decimal?PurchasePrice, int?totalstock, int?num_week, int?num_month, decimal?guidePrice, decimal nowPrice, string maoliLv, string chaochu, decimal?jdself, decimal?maolie)
        {
            var resultExam = BaoYangPriceGuideManager.GotoAudit(type > 0, ThreadIdentity.Operator.Name, pid, cost, PurchasePrice, totalstock, num_week, num_month, guidePrice, nowPrice, maoliLv, chaochu, jdself, maolie);
            var model      = BaoYangPriceGuideManager.FetchPriceAudit(pkid);

            if (type <= 0)
            {
                TuhuMessage.SendEmail("[被驳回]保养品价格修改申请", model.ApplyPerson, $"您于{DateTime.Now}申请将{model.PID}保养品价格修改为{model.ApplyPrice}元,已被{model.AuditPerson}驳回。");
                return(Json(resultExam));
            }
            int result = -99;

            if (resultExam > 0 && type > 0)
            {
                result = await UpdatePriceAsync(pid, price, $"通过保养价格指导系统审核通过后修改({model.ApplyReason})");
            }
            return(Json(result));
        }
コード例 #5
0
        public ActionResult ApplyUpdatePrice(PriceUpdateAuditModel model)
        {
            if (model == null)
            {
                return(Json(-99));
            }
            model.ApplyPerson = ThreadIdentity.Operator.Name;
            var result = BaoYangPriceGuideManager.ApplyUpdatePrice(model);

            if (!Request.Url.Host.Contains(".tuhu.cn"))
            {
                TuhuMessage.SendEmail("[待审批]保养品价格修改申请", "[email protected],[email protected]", $"{ThreadIdentity.Operator.Name}于{DateTime.Now}申请将{model.PID}保养品价格修改为{model.ApplyPrice}元,超过系统预警线,请您审批!<br/><a href='http://setting.tuhu.cn/BaoYang/AuditPrice' target='_blank'>点此审核</a>");
            }
            else
            {
                TuhuMessage.SendEmail("[待审批]保养品价格修改申请", "[email protected],[email protected]", $"{ThreadIdentity.Operator.Name}于{DateTime.Now}申请将{model.PID}保养品价格修改为{model.ApplyPrice}元,超过系统预警线,请您审批!<br/><a href='http://setting.tuhu.cn/BaoYang/AuditPrice' target='_blank'>点此审核</a>");
            }
            return(Json(result));
        }
コード例 #6
0
        public async Task <ActionResult> GotoExam(int pkid, string pid, decimal price, int type, decimal?cost, decimal?PurchasePrice, int?totalstock, int?num_week, int?num_month, decimal?guidePrice, decimal nowPrice, string maoliLv, string chaochu, decimal?jdself, decimal?maolie)
        {
            var resultExam = BaoYangPriceGuideManager.GotoAudit(type > 0, ThreadIdentity.Operator.Name, pid, cost, PurchasePrice, totalstock, num_week, num_month, guidePrice, nowPrice, maoliLv, chaochu, jdself, maolie);
            var model      = BaoYangPriceGuideManager.FetchPriceAudit(pkid);

            if (type <= 0)
            {
                TuhuMessage.SendEmail("[被驳回]保养品价格修改申请", model.ApplyPerson, $"您于{DateTime.Now}申请将{model.PID}保养品价格修改为{model.ApplyPrice}元,已被{model.AuditPerson}驳回。");
                return(Json(resultExam));
            }
            int result = -99;

            if (resultExam > 0 && type > 0)
            {
                if (!string.Equals(model.Type, "QPLPrice", StringComparison.CurrentCultureIgnoreCase))
                {
                    result = await UpdatePriceAsync(pid, price, $"通过保养价格指导系统审核通过后修改({model.ApplyReason})");
                }
                else
                {
                    var manager = new BaoYangPriceGuideManager();
                    var dic     = new Dictionary <string, decimal>();
                    dic.Add(pid, price);
                    var qplprice = manager.GetQPLPriceBypid(pid);
                    var msg      = await manager.UpdateQPLProductPriceByPidAsync(dic, User.Identity.Name);

                    if (!string.IsNullOrWhiteSpace(msg))
                    {
                        PriceManager.InsrtCouponPriceHistory(new CouponPriceHistory()
                        {
                            PID = pid, OldPrice = qplprice, NewPrice = price, ChangeUser = User.Identity.Name, ChangeDateTime = DateTime.Now, ChangeReason = $"通过GLXT审核通过后修改(申请原因:{ model.ApplyReason})"
                        });
                        result = 1;
                    }
                    else
                    {
                        result = -4;
                    }
                }
            }
            return(Json(result));
        }
コード例 #7
0
        public async Task <string> SendBatchSms(string userEmail, IEnumerable <string> mobiles, int temmplateId, string[] templateArguments, DateTime?sendTime)
        {
            var result        = string.Empty;
            var successResult = new List <int>();
            var failedResult  = new List <int>();
            var batchSize     = 999;

            for (var index = 0; index < (mobiles.Count() + batchSize - 1) / batchSize; index++)
            {
                var batchItem  = mobiles.Skip(index * batchSize).Take(batchSize);
                var sentResult = await SmsManager.SendBatchSmsAsync(batchItem, temmplateId, templateArguments, null, null, null, sendTime);

                if (sentResult.Item1 <= 0)
                {
                    failedResult.Add(sentResult.Item1);
                    var mobilesStr = string.Empty;
                    foreach (var m in batchItem)
                    {
                        mobilesStr += $" {m},";
                    }
                    var emailUser = $"[email protected];{userEmail}";
                    if (!string.Equals(_environment, "dev"))
                    {
                        emailUser = _companyMrRelatedUsers.Contains(userEmail) ? _companyMrRelatedUsers : $"{_companyMrRelatedUsers};{userEmail}";
                    }
                    TuhuMessage.SendEmail($"用户服务码通知短信发送失败", emailUser, $"{sentResult.Item2},发短信接口返回Code:{sentResult.Item1},失败手机号:{mobilesStr}");
                    ///短信发送失败
                }
                else
                {
                    successResult.Add(sentResult.Item1);
                }
            }

            return(successResult.Any() && !failedResult.Any() ? nameof(SmsStatus.Success)
                : successResult.Any() && failedResult.Any() ? nameof(SmsStatus.PartialSuccess)
                : nameof(SmsStatus.Failed));
        }
コード例 #8
0
 public static void SendEmail(string subject, string msg)
 {
     TuhuMessage.SendEmail(subject, _gFBankCardJobUsers, msg);
 }