private void BindData()
        {
            this.rptAdminUserList.DataSource = VShopHelper.GetAdminUserMsgList(0);
            this.rptAdminUserList.DataBind();
            this.rptList.DataSource = VShopHelper.GetMessageTemplates();
            this.rptList.DataBind();
            int num = 0;

            this.cbPowerListDistributors.Items.Clear();
            foreach (DataRow row in VShopHelper.GetAdminUserMsgDetail(true).Rows)
            {
                ListItem item = new ListItem(row["DetailName"].ToString(), row["DetailType"].ToString());
                this.cbPowerListDistributors.Items.Add(item);
                this.cbPowerListDistributors.Items[num].Selected = row["IsSelected"].ToString() == "1";
                num++;
            }
            num = 0;
            this.cbPowerListMember.Items.Clear();
            foreach (DataRow row2 in VShopHelper.GetAdminUserMsgDetail(false).Rows)
            {
                ListItem item2 = new ListItem(row2["DetailName"].ToString(), row2["DetailType"].ToString());
                this.cbPowerListMember.Items.Add(item2);
                this.cbPowerListMember.Items[num].Selected = row2["IsSelected"].ToString() == "1";
                num++;
            }
            this.WeixinAppId   = this.siteSettings.WeixinAppId;
            this.hfAppID.Value = this.siteSettings.WeixinAppId;
            string str = TokenApi.GetToken_Message(this.siteSettings.WeixinAppId, this.siteSettings.WeixinAppSecret);

            this.hfWeiXinAccessToken.Value = str;
            this.ShowQRImage();
        }
Exemple #2
0
        private static void Send(MessageTemplate template, SiteSettings settings, MemberInfo user, bool sendFirst, MailMessage email, string innerSubject, string innerMessage, string smsMessage, TemplateMessage templateMessage)
        {
            if (template.SendEmail && (email != null))
            {
                if (sendFirst)
                {
                    EmailSender sender = CreateEmailSender(settings);
                    if ((sender == null) || !SendMail(email, sender))
                    {
                        Emails.EnqueuEmail(email, settings);
                    }
                }
                else
                {
                    Emails.EnqueuEmail(email, settings);
                }
            }
            bool sendSMS          = template.SendSMS;
            bool sendInnerMessage = template.SendInnerMessage;

            if ((template.SendWeixin && !string.IsNullOrWhiteSpace(template.WeixinTemplateId)) && (templateMessage != null))
            {
                TemplateApi.SendMessage(TokenApi.GetToken_Message(settings.WeixinAppId, settings.WeixinAppSecret), templateMessage);
            }
        }
        private void DataListBind()
        {
            this.rptAdminUserList.DataSource = VShopHelper.GetAdminUserMsgList(1);
            this.rptAdminUserList.DataBind();
            System.Collections.Generic.IList <MessageTemplate> aliFuWuMessageTemplates = VShopHelper.GetAliFuWuMessageTemplates();
            this.rptAliFuWuMessageTemplateList.DataSource = aliFuWuMessageTemplates;
            this.rptAliFuWuMessageTemplateList.DataBind();
            int num = 0;

            this.cbPowerListDistributors.Items.Clear();
            foreach (System.Data.DataRow dataRow in VShopHelper.GetAdminUserMsgDetail(true).Rows)
            {
                System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem(dataRow["DetailName"].ToString(), dataRow["DetailType"].ToString());
                this.cbPowerListDistributors.Items.Add(item);
                this.cbPowerListDistributors.Items[num].Selected = (dataRow["IsSelected"].ToString() == "1");
                num++;
            }
            num = 0;
            this.cbPowerListMember.Items.Clear();
            foreach (System.Data.DataRow dataRow2 in VShopHelper.GetAdminUserMsgDetail(false).Rows)
            {
                System.Web.UI.WebControls.ListItem item2 = new System.Web.UI.WebControls.ListItem(dataRow2["DetailName"].ToString(), dataRow2["DetailType"].ToString());
                this.cbPowerListMember.Items.Add(item2);
                this.cbPowerListMember.Items[num].Selected = (dataRow2["IsSelected"].ToString() == "1");
                num++;
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            this.WeixinAppId   = masterSettings.WeixinAppId;
            this.hfAppID.Value = masterSettings.WeixinAppId;
            string token_Message = TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);

            this.hfWeiXinAccessToken.Value = token_Message;
            this.ShowQRImage();
        }
Exemple #4
0
        private bool CreatMember(string OpenId, int ReferralUserId, string AceessTokenDefault = "")
        {
            if (string.IsNullOrEmpty(AceessTokenDefault))
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                AceessTokenDefault = TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);
            }
            string urlToDecode = "";
            string userHead    = "";
            string text        = "";

            BarCodeApi.GetHeadImageUrlByOpenID(AceessTokenDefault, OpenId, out text, out urlToDecode, out userHead);
            string     generateId = Globals.GetGenerateId();
            MemberInfo memberInfo = new MemberInfo();

            memberInfo.GradeId        = MemberProcessor.GetDefaultMemberGrade();
            memberInfo.UserName       = Globals.UrlDecode(urlToDecode);
            memberInfo.OpenId         = OpenId;
            memberInfo.CreateDate     = System.DateTime.Now;
            memberInfo.SessionId      = generateId;
            memberInfo.SessionEndTime = System.DateTime.Now.AddYears(10);
            memberInfo.UserHead       = userHead;
            memberInfo.ReferralUserId = ReferralUserId;
            memberInfo.Password       = HiCryptographer.Md5Encrypt("888888");
            Globals.Debuglog(JsonConvert.SerializeObject(memberInfo), "_DebuglogScanRegisterUserInfo.txt");
            return(MemberProcessor.CreateMember(memberInfo));
        }
Exemple #5
0
        private bool CreatMember(string OpenId, int ReferralUserId)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       tOKEN          = TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);
            string       nickName       = "";
            string       headImageUrl   = "";
            string       retInfo        = "";

            BarCodeApi.GetHeadImageUrlByOpenID(tOKEN, OpenId, out retInfo, out nickName, out headImageUrl);
            string     generateId = Globals.GetGenerateId();
            MemberInfo info       = new MemberInfo
            {
                GradeId        = MemberProcessor.GetDefaultMemberGrade(),
                UserName       = Globals.UrlDecode(nickName),
                OpenId         = OpenId,
                CreateDate     = DateTime.Now,
                SessionId      = generateId,
                SessionEndTime = DateTime.Now.AddYears(10),
                UserHead       = headImageUrl,
                ReferralUserId = ReferralUserId,
                Password       = HiCryptographer.Md5Encrypt("888888")
            };

            Globals.Debuglog(JsonConvert.SerializeObject(info), "_Debuglog.txt");
            return(MemberProcessor.CreateMember(info));
        }
        private void ShowQRImage()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            string       tICKET         = BarCodeApi.CreateTicket(TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret), "1", "QR_SCENE", "604800");

            this.CodeTicket         = tICKET;
            this.imgQRCode.ImageUrl = BarCodeApi.GetQRImageUrlByTicket(tICKET);
        }
Exemple #7
0
        /// <summary>
        /// 支付成功微信提醒
        /// </summary>
        /// <param name="context"></param>
        private void sendPaySuccessMsg(System.Web.HttpContext context)
        {
            try
            {
                context.Response.ContentType = "application/json";
                string orderId = context.Request["orderid"];
                string uid     = context.Request["uid"];
                WriteLog("进入");
                string result = string.Empty;
                WriteLog("参数:" + orderId + " " + uid);
                MemberInfo member    = MemberProcessor.GetMember(int.Parse(uid));
                OrderInfo  orderInfo = OrderHelper.GetOrderInfo(orderId);

                SiteSettings    masterSettings  = SettingsManager.GetMasterSettings(false);
                TemplateMessage templateMessage = new TemplateMessage();
                templateMessage.Url        = "";                                            //单击URL
                templateMessage.TemplateId = "Rx4a6JWjSRlIwctN0SuwGa82cjpzBnpZQWdwHz9CWQE"; //Globals.GetMasterSettings(true).WX_Template_01;// "b1_ARggaBzbc5owqmwrZ15QPj9Ksfs0p5i64C6MzXKw";//消息模板ID
                templateMessage.Touser     = member.OpenId;                                 //用户OPENID


                TemplateMessage.MessagePart[] messateParts = new TemplateMessage.MessagePart[] {
                    new TemplateMessage.MessagePart {
                        Name = "first", Value = "您好,微信支付已成功!"
                    },
                    new TemplateMessage.MessagePart {
                        Name = "keyword1", Value = orderInfo.OrderId
                    },
                    new TemplateMessage.MessagePart {
                        Name = "keyword2", Value = orderInfo.GetTotal().ToString("F2") + "元"
                    },
                    new TemplateMessage.MessagePart {
                        Name = "keyword3", Value = orderInfo.ModeName
                    },
                    new TemplateMessage.MessagePart {
                        Name = "keyword4", Value = orderInfo.PayDate.ToString()
                    },
                    new TemplateMessage.MessagePart {
                        Name = "remark", /*Color = "#FF0000"*/ Value = "多谢您的惠顾!下单成功,正在等待接单,请留意接单通知!"
                    }
                };
                templateMessage.Data = messateParts;
                TemplateApi.SendMessage(TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret), templateMessage);
                result = "ok";
                context.Response.Write("{\"result\":\"" + result + "\"}");
            }
            catch (Exception ex)
            {
                WriteLog(ex.Message);
            }
        }
Exemple #8
0
        protected string GetImgUrl()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       pattern        = "ReferralId=(?<url>d+)";
            string       input          = base.Request.UrlReferrer.ToString();

            System.Text.RegularExpressions.Match match = System.Text.RegularExpressions.Regex.Match(input, pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            if (match.Success)
            {
                this.ReferralId = match.Value;
            }
            int       num               = Globals.ToNum(this.ReferralId);
            string    result            = this.webStart + "/Follow.aspx?ReferralId=" + this.ReferralId;
            ScanInfos scanInfosByUserId = ScanHelp.GetScanInfosByUserId(num, 0, "WX");

            if (scanInfosByUserId == null)
            {
                ScanHelp.CreatNewScan(num, "WX", 0);
                scanInfosByUserId = ScanHelp.GetScanInfosByUserId(num, 0, "WX");
            }
            if (scanInfosByUserId != null && !string.IsNullOrEmpty(scanInfosByUserId.CodeUrl))
            {
                result = BarCodeApi.GetQRImageUrlByTicket(scanInfosByUserId.CodeUrl);
            }
            else
            {
                if (string.IsNullOrEmpty(masterSettings.WeixinAppId) || string.IsNullOrEmpty(masterSettings.WeixinAppSecret))
                {
                    return("");
                }
                string token_Message = TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);
                if (TokenApi.CheckIsRightToken(token_Message))
                {
                    string text = BarCodeApi.CreateTicket(token_Message, scanInfosByUserId.Sceneid, "QR_LIMIT_SCENE", "2592000");
                    if (!string.IsNullOrEmpty(text))
                    {
                        result = BarCodeApi.GetQRImageUrlByTicket(text);
                        scanInfosByUserId.CodeUrl        = text;
                        scanInfosByUserId.CreateTime     = System.DateTime.Now;
                        scanInfosByUserId.LastActiveTime = System.DateTime.Now;
                        ScanHelp.updateScanInfosCodeUrl(scanInfosByUserId);
                    }
                }
            }
            return(result);
        }
Exemple #9
0
        protected void ShowQRCodeImage()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            string       text           = base.Request.QueryString["id"];

            if (string.IsNullOrEmpty(text))
            {
                base.Response.Redirect("WifiSetList.aspx");
            }
            string wifiInfo = "wifi_" + text;

            wifiInfo = text;
            string token_Message      = TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);
            string tICKET             = BarCodeApi.CreateTicketWifi(token_Message, wifiInfo);
            string qRImageUrlByTicket = BarCodeApi.GetQRImageUrlByTicket(tICKET);

            this.imgQRCode.ImageUrl = qRImageUrlByTicket;
        }
        protected string GetImgUrl()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       pattern        = "ReferralId=(?<url>d+)";
            Match        match          = Regex.Match(base.Request.UrlReferrer.ToString(), pattern, RegexOptions.IgnoreCase);

            if (match.Success)
            {
                this.ReferralId = match.Value;
            }
            int       userid             = Globals.ToNum(this.ReferralId);
            string    qRImageUrlByTicket = this.webStart + "/Follow.aspx?ReferralId=" + this.ReferralId;
            ScanInfos info = ScanHelp.GetScanInfosByUserId(userid, 0, "WX");

            if (info == null)
            {
                ScanHelp.CreatNewScan(userid, "WX", 0);
                info = ScanHelp.GetScanInfosByUserId(userid, 0, "WX");
            }
            if ((info != null) && !string.IsNullOrEmpty(info.CodeUrl))
            {
                return(BarCodeApi.GetQRImageUrlByTicket(info.CodeUrl));
            }
            if (string.IsNullOrEmpty(masterSettings.WeixinAppId) || string.IsNullOrEmpty(masterSettings.WeixinAppSecret))
            {
                return("");
            }
            string token = TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);

            if (TokenApi.CheckIsRightToken(token))
            {
                string str5 = BarCodeApi.CreateTicket(token, info.Sceneid, "QR_LIMIT_SCENE", "2592000");
                if (!string.IsNullOrEmpty(str5))
                {
                    qRImageUrlByTicket  = BarCodeApi.GetQRImageUrlByTicket(str5);
                    info.CodeUrl        = str5;
                    info.CreateTime     = DateTime.Now;
                    info.LastActiveTime = DateTime.Now;
                    ScanHelp.updateScanInfosCodeUrl(info);
                }
            }
            return(qRImageUrlByTicket);
        }
Exemple #11
0
        private string GetCacheToken(string appid, string secret)
        {
            string str = TokenApi.GetToken_Message(appid, secret);

            if ((!string.IsNullOrEmpty(str) && str.Contains("errmsg")) && str.Contains("errcode"))
            {
                Dictionary <string, string> dictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(str);
                if (((dictionary != null) && dictionary.ContainsKey("errcode")) && dictionary.ContainsKey("errmsg"))
                {
                    this._GetTokenError = dictionary["errcode"] + "|" + dictionary["errmsg"];
                    return(str);
                }
                this._GetTokenError = "";
                return(str);
            }
            if (string.IsNullOrEmpty(str))
            {
                str = "";
                this._GetTokenError = "获取令牌失败";
            }
            return(str);
        }
Exemple #12
0
        private string GetCacheToken(string appid, string secret)
        {
            string text = TokenApi.GetToken_Message(appid, secret);

            if (!string.IsNullOrEmpty(text) && text.Contains("errmsg") && text.Contains("errcode"))
            {
                Dictionary <string, string> dictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(text);
                if (dictionary != null && dictionary.ContainsKey("errcode") && dictionary.ContainsKey("errmsg"))
                {
                    this._GetTokenError = dictionary["errcode"] + "|" + dictionary["errmsg"];
                }
                else
                {
                    this._GetTokenError = "";
                }
            }
            else if (string.IsNullOrEmpty(text))
            {
                text = "";
                this._GetTokenError = "获取令牌失败";
            }
            return(text);
        }
Exemple #13
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["ReferralId"], out this.userId))
     {
         this.Context.Response.Redirect("/");
     }
     else
     {
         DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(this.userId);
         if (userIdDistributors == null)
         {
             this.Context.Response.Redirect("/");
         }
         else
         {
             this.imglogo = (HtmlImage)this.FindControl("QrcodeImg");
             int currentMemberUserId = Globals.GetCurrentMemberUserId(false);
             this.editPanel         = (HtmlControl)this.FindControl("editPanel");
             this.editPanel.Visible = false;
             if (currentMemberUserId == this.userId)
             {
                 this.imglogo.Attributes.Add("Admin", "true");
                 MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                 DateTime   cardCreatTime = userIdDistributors.CardCreatTime;
                 string     str           = File.ReadAllText(HttpRuntime.AppDomainAppPath.ToString() + "Storage/Utility/StoreCardSet.js");
                 JObject    obj2          = JsonConvert.DeserializeObject(str) as JObject;
                 DateTime   time2         = new DateTime();
                 if ((obj2 != null) && (obj2["writeDate"] != null))
                 {
                     time2 = DateTime.Parse(obj2["writeDate"].ToString());
                 }
                 ScanInfos info = ScanHelp.GetScanInfosByUserId(currentMember.UserId, 0, "WX");
                 if (info == null)
                 {
                     ScanHelp.CreatNewScan(currentMember.UserId, "WX", 0);
                     info = ScanHelp.GetScanInfosByUserId(currentMember.UserId, 0, "WX");
                 }
                 string codeUrl = "";
                 if (info == null)
                 {
                     codeUrl = Globals.HostPath(HttpContext.Current.Request.Url) + "/Follow.aspx?ReferralId=" + currentMember.UserId.ToString();
                 }
                 else
                 {
                     codeUrl = info.CodeUrl;
                     if (string.IsNullOrEmpty(codeUrl))
                     {
                         string token = TokenApi.GetToken_Message(this.siteSettings.WeixinAppId, this.siteSettings.WeixinAppSecret);
                         if (TokenApi.CheckIsRightToken(token))
                         {
                             string str4 = BarCodeApi.CreateTicket(token, info.Sceneid, "QR_LIMIT_SCENE", "2592000");
                             if (!string.IsNullOrEmpty(str4))
                             {
                                 codeUrl             = str4;
                                 info.CodeUrl        = str4;
                                 info.CreateTime     = DateTime.Now;
                                 info.LastActiveTime = DateTime.Now;
                                 ScanHelp.updateScanInfosCodeUrl(info);
                             }
                         }
                     }
                     if (string.IsNullOrEmpty(codeUrl))
                     {
                         codeUrl = Globals.HostPath(HttpContext.Current.Request.Url) + "/Follow.aspx?ReferralId=" + currentMember.UserId.ToString();
                     }
                     else
                     {
                         codeUrl = BarCodeApi.GetQRImageUrlByTicket(codeUrl);
                     }
                 }
                 if (string.IsNullOrEmpty(userIdDistributors.StoreCard) || (cardCreatTime < time2))
                 {
                     string storeName = userIdDistributors.StoreName;
                     if (!this.siteSettings.IsShowDistributorSelfStoreName)
                     {
                         storeName = this.siteSettings.SiteName;
                     }
                     StoreCardCreater creater = new StoreCardCreater(str, currentMember.UserHead, userIdDistributors.Logo, codeUrl, currentMember.UserName, storeName, this.userId, this.userId);
                     string           imgUrl  = "";
                     if (creater.ReadJson() && creater.CreadCard(out imgUrl))
                     {
                         DistributorsBrower.UpdateStoreCard(this.userId, imgUrl);
                     }
                 }
             }
             if (string.IsNullOrEmpty(userIdDistributors.StoreCard))
             {
                 userIdDistributors.StoreCard = "/Storage/master/DistributorCards/StoreCard" + this.userId.ToString() + ".jpg";
             }
             this.ShareInfo   = (HtmlInputHidden)this.FindControl("ShareInfo");
             this.imglogo.Src = userIdDistributors.StoreCard;
             PageTitle.AddSiteNameTitle("掌柜名片");
         }
     }
 }
Exemple #14
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("店铺推广");
            int        num           = Globals.RequestQueryNum("ReferralId");
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (num > 0 && currentMember == null)
            {
                this.Page.Response.Redirect("/default.aspx?ReferralId=" + num);
                this.Page.Response.End();
            }
            if (!int.TryParse(this.Page.Request.QueryString["UserId"], out this.userId))
            {
                base.GotoResourceNotFound("");
            }
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(this.userId);

            if (userIdDistributors == null)
            {
                base.GotoResourceNotFound("");
            }
            this.litStroeDesc = (System.Web.UI.WebControls.Literal) this.FindControl("litStroeDesc");
            this.litLinkurl   = (System.Web.UI.WebControls.Literal) this.FindControl("litLinkurl");
            this.litStoreurl  = (System.Web.UI.WebControls.Literal) this.FindControl("litStoreurl");
            string text = Globals.FullPath("/Default.aspx?ReferralId=" + this.userId);

            this.litLinkurl.Text  = text;
            this.litStoreurl.Text = text;
            this.Logoimage        = (System.Web.UI.WebControls.Image) this.FindControl("Logoimage");
            this.storeCode        = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("storeCode");
            this.storeFollowCode  = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("storeFollowCode");
            if (!string.IsNullOrEmpty(userIdDistributors.Logo))
            {
                this.Logoimage.ImageUrl = Globals.HostPath(this.Page.Request.Url) + userIdDistributors.Logo;
            }
            else
            {
                userIdDistributors.Logo = "/Utility/pics/headLogo.jpg";
            }
            this.storeCode.Src       = "/Api/CreatQRCode.ashx?code=" + Globals.UrlEncode(text) + "&Logo=" + userIdDistributors.Logo;
            this.storeFollowCode.Src = "";
            ScanInfos scanInfosByUserId = ScanHelp.GetScanInfosByUserId(this.userId, 0, "WX");

            if (scanInfosByUserId == null)
            {
                ScanHelp.CreatNewScan(this.userId, "WX", 0);
                scanInfosByUserId = ScanHelp.GetScanInfosByUserId(this.userId, 0, "WX");
            }
            string text2 = "";

            if (scanInfosByUserId != null && !string.IsNullOrEmpty(scanInfosByUserId.CodeUrl))
            {
                text2 = BarCodeApi.GetQRImageUrlByTicket(scanInfosByUserId.CodeUrl);
            }
            else
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                string       token_Message  = TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);
                if (TokenApi.CheckIsRightToken(token_Message))
                {
                    string text3 = BarCodeApi.CreateTicket(token_Message, scanInfosByUserId.Sceneid, "QR_LIMIT_SCENE", "2592000");
                    if (!string.IsNullOrEmpty(text3))
                    {
                        text2 = BarCodeApi.GetQRImageUrlByTicket(text3);
                        scanInfosByUserId.CodeUrl        = text3;
                        scanInfosByUserId.CreateTime     = System.DateTime.Now;
                        scanInfosByUserId.LastActiveTime = System.DateTime.Now;
                        ScanHelp.updateScanInfosCodeUrl(scanInfosByUserId);
                    }
                }
            }
            if (!string.IsNullOrEmpty(text2))
            {
                this.storeFollowCode.Src = "/Api/CreatQRCode.ashx?Combin=" + Globals.UrlEncode(text2) + "&Logo=" + userIdDistributors.Logo;
            }
            else
            {
                this.storeFollowCode.Src = "";
            }
            this.litStroeName      = (System.Web.UI.WebControls.Literal) this.FindControl("litStroeName");
            this.litStroeName.Text = userIdDistributors.StoreName;
            this.litStroeDesc.Text = userIdDistributors.StoreDescription;
        }
Exemple #15
0
        public override AbstractResponse OnEvent_ClickRequest(ClickEventRequest clickEventRequest)
        {
            string userOpenId = clickEventRequest.FromUserName;

            WeiXinHelper.UpdateRencentOpenID(userOpenId);
            AbstractResponse result;

            try
            {
                int menuId = System.Convert.ToInt32(clickEventRequest.EventKey);
                Hidistro.Entities.VShop.MenuInfo menu = VShopHelper.GetMenu(menuId);
                if (menu == null)
                {
                    result = null;
                }
                else
                {
                    if (menu.BindType == BindType.StoreCard)
                    {
                        try
                        {
                            SiteSettings siteSettings = SettingsManager.GetMasterSettings(false);
                            string       access_token = TokenApi.GetToken(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret);
                            access_token = JsonConvert.DeserializeObject <Token>(access_token).access_token;
                            MemberInfo member = MemberProcessor.GetOpenIdMember(userOpenId, "wx");
                            if (member == null)
                            {
                                this.CreatMember(userOpenId, 0, access_token);
                                member = MemberProcessor.GetOpenIdMember(userOpenId, "wx");
                            }
                            string           userHead        = member.UserHead;
                            string           storeLogo       = siteSettings.DistributorLogoPic;
                            string           webStart        = Globals.GetWebUrlStart();
                            string           imageUrl        = "/Storage/master/DistributorCards/MemberCard" + member.UserId + ".jpg";
                            string           mediaid         = string.Empty;
                            int              ReferralId      = 0;
                            string           storeName       = siteSettings.SiteName;
                            string           NotSuccessMsg   = string.Empty;
                            DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(member.UserId);
                            if (distributorInfo != null)
                            {
                                ReferralId = member.UserId;
                                if (siteSettings.IsShowDistributorSelfStoreName)
                                {
                                    storeName = distributorInfo.StoreName;
                                    storeLogo = distributorInfo.Logo;
                                }
                                imageUrl = "/Storage/master/DistributorCards/StoreCard" + ReferralId + ".jpg";
                            }
                            else if (!siteSettings.IsShowSiteStoreCard)
                            {
                                string content = "您还不是分销商,不能为您生成推广图片,立即<a href='" + webStart + "/Vshop/DistributorCenter.aspx'>申请分销商</a>";
                                if (!string.IsNullOrEmpty(siteSettings.ToRegistDistributorTips))
                                {
                                    content = System.Text.RegularExpressions.Regex.Replace(siteSettings.ToRegistDistributorTips, "{{申请分销商}}", "<a href='" + webStart + "/Vshop/DistributorCenter.aspx'>申请分销商</a>");
                                }
                                result = new TextResponse
                                {
                                    CreateTime   = System.DateTime.Now,
                                    ToUserName   = userOpenId,
                                    FromUserName = clickEventRequest.ToUserName,
                                    Content      = content
                                };
                                return(result);
                            }
                            string postData = string.Empty;
                            string creatingStoreCardTips = siteSettings.CreatingStoreCardTips;
                            if (!string.IsNullOrEmpty(creatingStoreCardTips))
                            {
                                postData = string.Concat(new string[]
                                {
                                    "{\"touser\":\"",
                                    userOpenId,
                                    "\",\"msgtype\":\"text\",\"text\":{\"content\":\"",
                                    Globals.String2Json(creatingStoreCardTips),
                                    "\"}}"
                                });
                                NewsApi.KFSend(access_token, postData);
                            }
                            string filePath = System.Web.HttpContext.Current.Request.MapPath(imageUrl);
                            Task.Factory.StartNew(delegate
                            {
                                try
                                {
                                    System.IO.File.Exists(filePath);
                                    string setJson = System.IO.File.ReadAllText(System.Web.HttpRuntime.AppDomainAppPath + "/Storage/Utility/StoreCardSet.js");
                                    string codeUrl = webStart + "/Follow.aspx?ReferralId=" + ReferralId.ToString();
                                    ScanInfos scanInfosByUserId = ScanHelp.GetScanInfosByUserId(ReferralId, 0, "WX");
                                    if (scanInfosByUserId == null)
                                    {
                                        ScanHelp.CreatNewScan(ReferralId, "WX", 0);
                                        scanInfosByUserId = ScanHelp.GetScanInfosByUserId(ReferralId, 0, "WX");
                                    }
                                    if (scanInfosByUserId != null && !string.IsNullOrEmpty(scanInfosByUserId.CodeUrl))
                                    {
                                        codeUrl = BarCodeApi.GetQRImageUrlByTicket(scanInfosByUserId.CodeUrl);
                                    }
                                    else
                                    {
                                        string token_Message = TokenApi.GetToken_Message(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret);
                                        if (TokenApi.CheckIsRightToken(token_Message))
                                        {
                                            string text = BarCodeApi.CreateTicket(token_Message, scanInfosByUserId.Sceneid, "QR_LIMIT_SCENE", "2592000");
                                            if (!string.IsNullOrEmpty(text))
                                            {
                                                codeUrl = BarCodeApi.GetQRImageUrlByTicket(text);
                                                scanInfosByUserId.CodeUrl        = text;
                                                scanInfosByUserId.CreateTime     = System.DateTime.Now;
                                                scanInfosByUserId.LastActiveTime = System.DateTime.Now;
                                                ScanHelp.updateScanInfosCodeUrl(scanInfosByUserId);
                                            }
                                        }
                                    }
                                    StoreCardCreater storeCardCreater = new StoreCardCreater(setJson, userHead, storeLogo, codeUrl, member.UserName, storeName, ReferralId, member.UserId);
                                    if (storeCardCreater.ReadJson() && storeCardCreater.CreadCard(out NotSuccessMsg))
                                    {
                                        if (ReferralId > 0)
                                        {
                                            DistributorsBrower.UpdateStoreCard(ReferralId, NotSuccessMsg);
                                        }
                                        string media_IDByPath = NewsApi.GetMedia_IDByPath(access_token, webStart + imageUrl);
                                        mediaid = NewsApi.GetJsonValue(media_IDByPath, "media_id");
                                    }
                                    else
                                    {
                                        Globals.Debuglog(NotSuccessMsg, "_DebugCreateStoreCardlog.txt");
                                    }
                                    postData = string.Concat(new string[]
                                    {
                                        "{\"touser\":\"",
                                        userOpenId,
                                        "\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"",
                                        mediaid,
                                        "\"}}"
                                    });
                                    NewsApi.KFSend(access_token, postData);
                                }
                                catch (System.Exception ex3)
                                {
                                    postData = string.Concat(new string[]
                                    {
                                        "{\"touser\":\"",
                                        userOpenId,
                                        "\",\"msgtype\":\"text\",\"text\":{\"content\":\"生成图片失败,",
                                        Globals.String2Json(ex3.ToString()),
                                        "\"}}"
                                    });
                                    NewsApi.KFSend(access_token, postData);
                                }
                            });
                            result = null;
                            return(result);
                        }
                        catch (System.Exception ex)
                        {
                            result = new TextResponse
                            {
                                CreateTime   = System.DateTime.Now,
                                ToUserName   = userOpenId,
                                FromUserName = clickEventRequest.ToUserName,
                                Content      = "问题:" + ex.ToString()
                            };
                            return(result);
                        }
                    }
                    Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(menu.ReplyId);
                    if (reply == null)
                    {
                        result = null;
                    }
                    else
                    {
                        if (reply.MessageType != MessageType.Image)
                        {
                            AbstractResponse keyResponse = this.GetKeyResponse(reply.Keys, clickEventRequest);
                            if (keyResponse != null)
                            {
                                result = keyResponse;
                                return(result);
                            }
                        }
                        AbstractResponse response = this.GetResponse(reply, clickEventRequest.FromUserName);
                        if (response == null)
                        {
                            this.GotoManyCustomerService(clickEventRequest);
                        }
                        response.ToUserName   = clickEventRequest.FromUserName;
                        response.FromUserName = clickEventRequest.ToUserName;
                        result = response;
                    }
                }
            }
            catch (System.Exception ex2)
            {
                result = new TextResponse
                {
                    CreateTime   = System.DateTime.Now,
                    ToUserName   = clickEventRequest.FromUserName,
                    FromUserName = clickEventRequest.ToUserName,
                    Content      = "问题:" + ex2.ToString()
                };
            }
            return(result);
        }
Exemple #16
0
        public static string GetAccessToken()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            return(TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret));
        }
Exemple #17
0
        public void Execute(XmlNode node)
        {
            ErrorLog.Write("start go WXMsgRecordJob");
            DateTime startTime = DateTime.Now;
            DateTime endTime   = DateTime.Now;
            int      pageSize  = 50;
            bool     update    = false;
            WXLog    log       = WXHelper.GetWXLog("IsSuccess=0 ORDER BY StartTime ASC");

            if (log.Id != 0)
            {
                update    = true;
                startTime = log.StartTime;
            }
            else
            {
                log = WXHelper.GetWXLog("IsSuccess=1 ORDER BY StartTime DESC");
                if (log.Id != 0)
                {
                    if (log.StartTime.Date.AddDays(1) == DateTime.Now.Date)
                    {
                        return;
                    }
                    startTime = log.EndTime.AddSeconds(1);
                }
                else
                {
                    startTime = startTime.AddDays(-1).Date;
                }
            }
            endTime = startTime.Date.AddDays(1).AddSeconds(-1);


            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            WebUtils     webUtils       = new WebUtils();
            string       returnString   = string.Empty;
            DataTable    dtMsg          = CreateEmptyDataTable();
            DataRow      dr             = null;

            for (int i = 0; i < 2147483647; i++)
            {
                StringBuilder strJson = new StringBuilder();
                strJson.Append("{");
                strJson.AppendFormat("\"endtime\":{0},", DataHelper.ConvertUniversalTime(endTime));
                strJson.AppendFormat("\"pageindex\":{0},", i + 1);
                strJson.AppendFormat("\"pagesize\":{0},", pageSize);
                strJson.AppendFormat("\"starttime\":{0}", DataHelper.ConvertUniversalTime(startTime));
                strJson.Append("}");
                ErrorLog.Write("请求微信服务器,获取客服聊天记录" + strJson.ToString());
                returnString = webUtils.DoPost(string.Format(wx_MsgRecord_URL, TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret)), strJson.ToString());
                ErrorLog.Write(returnString);
                WXMsgPackage package = null;
                try
                {
                    package = Newtonsoft.Json.JsonConvert.DeserializeObject <WXMsgPackage>(returnString);
                }
                catch (Exception ex)
                {
                    ErrorLog.Write(ex.ToString());
                }

                if (package == null || package.RecordList == null || package.RecordList.Length == 0)
                {
                    break;
                }

                foreach (WXMsgRecord record in package.RecordList)
                {
                    dr             = dtMsg.NewRow();
                    dr["Id"]       = i;
                    dr["OpenId"]   = record.OpenId;
                    dr["OperCode"] = record.OperCode;
                    dr["Text"]     = record.Text;
                    dr["Worker"]   = record.Worker;
                    if (string.IsNullOrEmpty(record.Worker) || record.Worker.Trim() == "")
                    {
                        dr["WorkerNo"] = "";
                    }
                    else
                    {
                        dr["WorkerNo"] = record.Worker.Substring(0, record.Worker.IndexOf('@'));
                    }
                    DateTime d = DataHelper.ConvertTimeFromUniversal(record.UniversalTime);
                    dr["Time"]        = d;
                    dr["HappenDate"]  = d.Date;
                    dr["HappenMonth"] = d.ToString("yyyy-MM");
                    dtMsg.Rows.Add(dr);
                }
                //break;
            }
            WXLog newLog = new WXLog();

            newLog.AddTime    = DateTime.Now;
            newLog.UpdateTime = DateTime.Now;
            newLog.StartTime  = startTime;
            newLog.EndTime    = endTime;
            newLog.Type       = 1;
            if (dtMsg.Rows.Count <= 0)
            {
                newLog.IsSuccess = true;
                newLog.Remark    = "当前查询时间没有记录";
                WXHelper.InsertLog(newLog);
                return;
            }

            bool b = WXHelper.BathAddWXMsgRecord(dtMsg);

            ErrorLog.Write(Newtonsoft.Json.JsonConvert.SerializeObject(newLog));
            if (b)
            {
                newLog.IsSuccess = true;
                if (update)
                {
                    newLog.Id     = log.Id;
                    newLog.Remark = "修复聊天记录成功";
                    WXHelper.UpdateLog(newLog);
                }
                else
                {
                    newLog.Remark = "更新聊天记录完成";
                    WXHelper.InsertLog(newLog);
                }
            }
            else
            {
                newLog.IsSuccess = false;
                if (update)
                {
                    newLog.Id     = log.Id;
                    newLog.Remark = "修复聊天记录失败";
                    WXHelper.UpdateLog(newLog);
                }
                else
                {
                    newLog.Remark = "更新聊天记录失败";
                    WXHelper.InsertLog(newLog);
                }
            }
        }
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("店铺推广");
            int userid = Globals.RequestQueryNum("ReferralId");

            if (!int.TryParse(this.Page.Request.QueryString["UserId"], out this.userId))
            {
                this.Page.Response.Redirect("/default.aspx?ReferralId=" + userid);
                this.Page.Response.End();
            }
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(this.userId);

            if (userIdDistributors == null)
            {
                this.Page.Response.Redirect("/default.aspx?ReferralId=" + this.userId.ToString());
                this.Page.Response.End();
            }
            else
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                bool         isShowDistributorSelfStoreName = masterSettings.IsShowDistributorSelfStoreName;
                userid            = userIdDistributors.UserId;
                this.litStroeDesc = (Literal)this.FindControl("litStroeDesc");
                this.litLinkurl   = (Literal)this.FindControl("litLinkurl");
                this.litStoreurl  = (Literal)this.FindControl("litStoreurl");
                string urlToEncode = Globals.FullPath("/Default.aspx?ReferralId=" + userid);
                this.litLinkurl.Text  = urlToEncode;
                this.litStoreurl.Text = urlToEncode;
                this.Logoimage        = (Image)this.FindControl("Logoimage");
                this.storeCode        = (HtmlImage)this.FindControl("storeCode");
                this.storeFollowCode  = (HtmlImage)this.FindControl("storeFollowCode");
                if (!string.IsNullOrEmpty(userIdDistributors.Logo))
                {
                    this.Logoimage.ImageUrl = Globals.HostPath(this.Page.Request.Url) + userIdDistributors.Logo;
                }
                else
                {
                    userIdDistributors.Logo = "/Utility/pics/headLogo.jpg";
                }
                this.storeCode.Src = "/Api/CreatQRCode.ashx?code=" + Globals.UrlEncode(urlToEncode) + "&Logo=" + userIdDistributors.Logo;
                if (masterSettings.IsValidationService)
                {
                    this.storeFollowCode.Src = "";
                    ScanInfos info = ScanHelp.GetScanInfosByUserId(userid, 0, "WX");
                    if (info == null)
                    {
                        ScanHelp.CreatNewScan(userid, "WX", 0);
                        info = ScanHelp.GetScanInfosByUserId(userid, 0, "WX");
                    }
                    string qRImageUrlByTicket = "";
                    if ((info != null) && !string.IsNullOrEmpty(info.CodeUrl))
                    {
                        qRImageUrlByTicket = BarCodeApi.GetQRImageUrlByTicket(info.CodeUrl);
                    }
                    else
                    {
                        string token = TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);
                        if (TokenApi.CheckIsRightToken(token))
                        {
                            string str4 = BarCodeApi.CreateTicket(token, info.Sceneid, "QR_LIMIT_SCENE", "2592000");
                            if (!string.IsNullOrEmpty(str4))
                            {
                                qRImageUrlByTicket  = BarCodeApi.GetQRImageUrlByTicket(str4);
                                info.CodeUrl        = str4;
                                info.CreateTime     = DateTime.Now;
                                info.LastActiveTime = DateTime.Now;
                                ScanHelp.updateScanInfosCodeUrl(info);
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(qRImageUrlByTicket))
                    {
                        this.storeFollowCode.Src = "/Api/CreatQRCode.ashx?Combin=" + Globals.UrlEncode(qRImageUrlByTicket) + "&Logo=" + userIdDistributors.Logo;
                    }
                    else
                    {
                        this.storeFollowCode.Src = "";
                    }
                }
                this.litStroeName      = (Literal)this.FindControl("litStroeName");
                this.litStroeName.Text = userIdDistributors.StoreName;
                this.litStroeDesc.Text = userIdDistributors.StoreDescription;
                if (!isShowDistributorSelfStoreName)
                {
                    this.Logoimage.ImageUrl = masterSettings.DistributorLogoPic;
                    this.litStroeName.Text  = masterSettings.SiteName;
                    this.litStroeDesc.Text  = masterSettings.ShopIntroduction;
                    this.storeCode.Src      = "/Api/CreatQRCode.ashx?code=" + Globals.UrlEncode(urlToEncode) + "&Logo=" + masterSettings.DistributorLogoPic;
                }
            }
        }
Exemple #19
0
        private void btnSendGoods_Click(object sender, System.EventArgs e)
        {
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId);

            if (orderInfo != null)
            {
                ManagerInfo currentManager = ManagerHelper.GetCurrentManager();
                if (currentManager != null)
                {
                    if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Success)
                    {
                        this.ShowMsg("当前订单为团购订单,团购活动还未成功结束,所以不能发货", false);
                    }
                    else
                    {
                        if (!orderInfo.CheckAction(OrderActions.SELLER_SEND_GOODS))
                        {
                            this.ShowMsg("当前订单状态没有付款或不是等待发货的订单,所以不能发货", false);
                        }
                        else
                        {
                            if (!this.radioShippingMode.SelectedValue.HasValue)
                            {
                                this.ShowMsg("请选择配送方式", false);
                            }
                            else
                            {
                                //if (CustomConfigHelper.Instance.BrandShow == false)
                                //{
                                //if (string.IsNullOrEmpty(this.txtShipOrderNumber.Text.Trim()) || this.txtShipOrderNumber.Text.Trim().Length > 20)
                                //{
                                //    this.ShowMsg("运单号码不能为空,在1至20个字符之间", false);
                                //}
                                //}
                                //else
                                //{
                                if (string.IsNullOrEmpty(this.expressRadioButtonList.SelectedValue))
                                {
                                    this.ShowMsg("请选择物流公司", false);
                                }
                                else
                                {
                                    ShippingModeInfo shippingMode = SalesHelper.GetShippingMode(this.radioShippingMode.SelectedValue.Value, true);

                                    orderInfo.RealShippingModeId = this.radioShippingMode.SelectedValue.Value;
                                    orderInfo.RealModeName       = shippingMode.Name;
                                    ExpressCompanyInfo info4 = ExpressHelper.FindNode(this.expressRadioButtonList.SelectedValue);
                                    if (info4 != null)
                                    {
                                        orderInfo.ExpressCompanyAbb  = info4.Kuaidi100Code;
                                        orderInfo.ExpressCompanyName = info4.Name;
                                    }
                                    orderInfo.ShipOrderNumber = this.txtShipOrderNumber.Text;
                                    if (OrderHelper.SendGoods(orderInfo))
                                    {
                                        SendNoteInfo info5 = new SendNoteInfo();
                                        info5.NoteId   = Globals.GetGenerateId();
                                        info5.OrderId  = this.orderId;
                                        info5.Operator = currentManager.UserName;
                                        info5.Remark   = "后台" + info5.Operator + "发货成功";
                                        OrderHelper.SaveSendNote(info5);
                                        MemberInfo member = MemberHelper.GetMember(orderInfo.UserId);
                                        Messenger.OrderShipping(orderInfo, member);
                                        if (!string.IsNullOrEmpty(orderInfo.GatewayOrderId) && orderInfo.GatewayOrderId.Trim().Length > 0)
                                        {
                                            if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                                            {
                                                PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                                                if (paymentMode != null)
                                                {
                                                    PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单发货", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[]
                                                    {
                                                        paymentMode.Gateway
                                                    })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[]
                                                    {
                                                        paymentMode.Gateway
                                                    })), "").SendGoods(orderInfo.GatewayOrderId, orderInfo.RealModeName, orderInfo.ShipOrderNumber, "EXPRESS");
                                                }
                                            }
                                            if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest")
                                            {
                                                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                                                PayClient    client         = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey);
                                                DeliverInfo  deliver        = new DeliverInfo
                                                {
                                                    TransId    = orderInfo.GatewayOrderId,
                                                    OutTradeNo = orderInfo.OrderId,
                                                    OpenId     = MemberHelper.GetMember(orderInfo.UserId).OpenId
                                                };
                                                client.DeliverNotify(deliver);
                                            }
                                        }
                                        orderInfo.OnDeliver();
                                        if (CustomConfigHelper.Instance.IsSanzuo)    //三作咖啡特殊需求:发货时,打印小票(配送票)
                                        {
                                            //this.ShowMsgAndReUrl("发货成功", true,"ManageOrders.aspx");
                                            CloseWindowAndRedirect();
                                        }
                                        else if (CustomConfigHelper.Instance.IsProLa)   //pro辣特殊需求,发货时增加消息推送
                                        {
                                            WriteLog("进入");
                                            SiteSettings    masterSettings  = SettingsManager.GetMasterSettings(false);
                                            TemplateMessage templateMessage = new TemplateMessage();
                                            templateMessage.Url        = Request.Url.Host + "/vshop/MemberOrders.aspx?status=3"; //单击URL
                                            templateMessage.TemplateId = "pPCCurFLdpgnI0ZWpr5eFJQ5bxS7xboaEW2ScBoOY4U";          //Globals.GetMasterSettings(true).WX_Template_01;// "b1_ARggaBzbc5owqmwrZ15QPj9Ksfs0p5i64C6MzXKw";//消息模板ID
                                            templateMessage.Touser     = member.OpenId;                                          //用户OPENID
                                            string productsDes = ""; int c = 0;
                                            foreach (LineItemInfo info in orderInfo.LineItems.Values)
                                            {
                                                if (c > 3)
                                                {
                                                    break;
                                                }
                                                productsDes += info.ItemDescription + ",";
                                                c++;
                                            }
                                            productsDes = productsDes.TrimEnd(',') + "等菜品";

                                            TemplateMessage.MessagePart[] messateParts = new TemplateMessage.MessagePart[] {
                                                new TemplateMessage.MessagePart {
                                                    Name = "first", Value = "亲,您的菜品已备好,配送在途!"
                                                },
                                                new TemplateMessage.MessagePart {
                                                    Name = "keyword1", Value = "订单" + orderInfo.OrderId + "开始配送"
                                                },
                                                new TemplateMessage.MessagePart {
                                                    Name = "keyword2", Value = productsDes
                                                },
                                                new TemplateMessage.MessagePart {
                                                    Name = "remark", Color = "#FF0000", Value = "预计到达时间:" + txtArriveTime.Text                        /*orderInfo.ShipToDate*/
                                                }
                                            };
                                            templateMessage.Data = messateParts;
                                            TemplateApi.SendMessage(TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret), templateMessage);
                                            this.ShowMsg("发货成功", true);
                                        }
                                        else
                                        {
                                            this.ShowMsg("发货成功", true);
                                        }
                                    }
                                    else
                                    {
                                        this.ShowMsg("发货失败", false);
                                    }
                                }
                                //}
                            }
                        }
                    }
                }
            }
        }