コード例 #1
0
ファイル: SmsSend.cs プロジェクト: wengzhilai/OldWebApi
        public bool SmsSendOrder(string mobile, string time, string content, int userId, int orderId, string type)
        {
            if (userId != 0)
            {
                var msg = "【云乐享车】您的工单[{0}]已经[{1}],详细情况请进入系统查询";
                msg = string.Format(msg, time, content);
                ErrorInfo err = new ErrorInfo();

                var url = "http://www.27580sc.com/staffcar/index.html{0}#/followHelpOrder/" + orderId;
                switch (type)
                {
                case "1":
                    url = "http://www.27580sc.com/staffcar/index.html{0}#/followInsure/" + orderId;
                    break;
                }

                using (DBEntities db = new DBEntities())
                {
                    var user = db.YL_USER.SingleOrDefault(x => x.ID == userId);
                    if (user != null)
                    {
                        mobile = user.LOGIN_NAME;
                        if (string.Join(",", user.YL_ROLE.Select(x => x.ID).ToList()) == "2")
                        {
                            url = url.Replace("staffcar", "userCar");
                        }
                    }
                    if (WeixinSendMsg(userId, msg, url, ref err))
                    {
                        return(true);
                    }
                }
            }

            if (!mobile.IsInt64() || mobile.Length != 11)
            {
                return(false);
            }

            string tpl_value = "#time#={0}&#content#={1}";

            tpl_value = string.Format(tpl_value, time, content);
            tpl_value = HttpUtility.UrlEncode(tpl_value);

            string data_tpl_sms = "apikey=51f88df9eedd2e9565f5f3a9417c45df&mobile=" + mobile + "&tpl_id=1540992&tpl_value=" + tpl_value;
            string questStr     = "";

            if (Fun.HttpPostEncoded("https://sms.yunpian.com/v2/sms/tpl_single_send.json", data_tpl_sms, ref questStr))
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
ファイル: SmsSend.cs プロジェクト: wengzhilai/OldWebApi
        public bool SmsSendCode(string mobile, string code)
        {
            string tpl_value = HttpUtility.UrlEncode(
                HttpUtility.UrlEncode("#code#", Encoding.UTF8) + "=" +
                HttpUtility.UrlEncode(code, Encoding.UTF8), Encoding.UTF8);
            string data_tpl_sms = "apikey=51f88df9eedd2e9565f5f3a9417c45df&mobile=" + mobile + "&tpl_id=1323633&tpl_value=" + tpl_value;
            string questStr     = "";

            if (Fun.HttpPostEncoded("https://sms.yunpian.com/v2/sms/tpl_single_send.json", data_tpl_sms, ref questStr))
            {
                return(true);
            }
            return(false);
        }