Esempio n. 1
0
    public void Test()
    {
        try
        {
            List <WXMessageLog_EX> mlist = mss.GetOrderNoPayed();
            foreach (var m in mlist)
            {
                if (!string.IsNullOrEmpty(m.FromUserName))
                {
                    mss.SaveWXMessageLog(new ORG_WXMessage_Log {
                        CreateTime = DateTime.Now, EventID = m.ID, EventType = 1
                    });
                    string token = Token(mjuserid);
                    var    temp  = new
                    {
                        first      = new { value = "未支付提醒通知", color = "#173177" },
                        type       = new { value = "项目", color = "#173177" },
                        e_title    = new { value = "小时光SPA预约", color = "#173177" },
                        o_id       = new { value = m.ORDER_NO, color = "#173177" },
                        order_date = new { value = m.CREATE_DATE.ToString("yyyy.MM.dd HH:mm"), color = "#173177" },
                        o_money    = new { value = m.PAY_AMT, color = "#173177" },
                        remark     = new { value = "\n" + "Hi,您预约的小时光SPA还未支付,超过10分钟订单自动取消哦~", color = "#CD0000" }
                    };
                    string message = SendTemplateMessage(token, m.FromUserName, "Or5LLJHk2GFu_9uLkeEKmCgvFU8p1BlokArSeAe6jaQ", "#FF0000", temp, WebUrl + "/wechat/spa/dingdan.aspx");
                }
            }

            List <WXMessageLog_EX> llist = mss.GetOrderClosed();
            foreach (var m in llist)
            {
                if (!string.IsNullOrEmpty(m.FromUserName))
                {
                    mss.SaveWXMessageLog(new ORG_WXMessage_Log {
                        CreateTime = DateTime.Now, EventID = m.ID, EventType = 3
                    });
                    string token = Token(mjuserid);
                    var    temp  = new
                    {
                        first    = new { value = "您好,您有一笔交易已关闭。", color = "#173177" },
                        keyword1 = new { value = m.ORDER_NO, color = "#173177" },
                        keyword2 = new { value = m.CREATE_DATE.ToString("yyyy.MM.dd HH:mm"), color = "#173177" },
                        keyword3 = new { value = "订单支付超时", color = "#173177" },
                        keyword4 = new { value = m.OverdueDate.ToString("yyyy.MM.dd HH:mm"), color = "#173177" },
                        remark   = new { value = "\n" + "感谢您的选择,请及时查看确认。如有疑问,请咨询客服:176-2116-0808", color = "#CD0000" }
                    };
                    string message = SendTemplateMessage(token, m.FromUserName, "vxtsFe76nhOMAEXz_8GvgxsQbpAxBsR5iD0_uRXBuww", "#FF0000", temp, WebUrl + "/wechat/spa/dingdan.aspx");
                }
            }
        }
        catch (Exception ex)
        {
            mss.SaveLog(new WXLOG {
                CON = ex.Message + "," + ex.StackTrace, TIME = DateTime.Now
            });
        }
    }