public static string FindPass(string account, string phone, string findway)
        {
            string message;
            string content = "您账户密码重置成功,新密码:$pass$,请登陆后更改密码!";
            int    userid  = 0;

            if (findway == "")
            {
                findway = "sms";
            }

            //判断登录账户是否存在
            B2b_company_manageuser model2 = B2bCompanyManagerUserData.GetManageUserByAccount(account);

            if (model2 == null)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "账户与手机匹配错误!" }));
            }
            if (phone.Trim() == "")
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "手机信息错误!" }));
            }
            if (phone.Trim() != model2.Tel.Trim())
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "账户与手机匹配错误!" }));
            }

            if (findway == "sms")
            {
                //短信重置密码
                Random ra      = new Random();
                string newPass = ra.Next(26844521, 98946546).ToString();

                var uppass = B2bCompanyManagerUserData.ChangePwd(model2.Id, model2.Passwords, newPass, out message);

                if (uppass == 0)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "重置密码错误!" }));
                }

                content = content.Replace("$pass$", newPass);
                var backContent = SendSmsHelper.SendSms(phone, content, model2.Com_id, out message);
                if (backContent < 0)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "重置短信发送失败,请重新重置密码!" }));
                }
            }

            if (findway == "email")
            {
                //邮件重置密码连接
                //尚未做
            }



            return(JsonConvert.SerializeObject(new { type = 100, msg = "密码重置成功" }));
        }
Beispiel #2
0
        public static string Contentsend(int comid, string mobile, string name, string company, string address)
        {
            string Smstext   = "";
            string msg       = "";
            int    sendstate = 0;

            try
            {
                Smstext = "商户咨询:" + name + "(" + mobile + ")" + "公司名称:" + company + " 地址:" + address;

                if (mobile != "" || name != "")
                {
                    sendstate = SendSmsHelper.SendSms("13511097178", Smstext, 101, out msg);
                }

                return(JsonConvert.SerializeObject(new { type = 100, msg = sendstate }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Beispiel #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string oper       = context.Request["oper"].ConvertTo <string>("");
            string phone      = context.Request["phone"].ConvertTo <string>("");
            string smscontent = context.Request["smscontent"].ConvertTo <string>("");

            string dxstr = context.Request["dxstr"].ConvertTo <string>("");
            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\BaoxianLog.txt", dxstr);
            string msg = "";

            if (oper == "234908uasdlkfjasdfou234kldfuasfk234u809dsfjasdfu90")
            {
                var snsback = SendSmsHelper.SendSms(phone, smscontent, 106, out msg);

                context.Response.Write(snsback);
            }

            //接收短信上行数据 http://ip:port/MO?dxstr=2,13800138000,0,F165245140224152846,20140428172543;2,15193792747,0,F165246140224152846,20140428172543;
            if (dxstr != "")
            {
                //var OrderData1 = new B2bOrderData();
                //var insertstepm = OrderData1.InsertSmsback(0, "", "", dxstr, "");


                var dxstr_arr = dxstr.Split(';');
                for (int i = 0; i < dxstr_arr.Length; i++) //分解每条消息
                {
                    if (dxstr_arr[i] != "")                //判断消息是否为空
                    {
                        var duanxin_arr = dxstr_arr[i].Split(',');
                        if (duanxin_arr.Length == 5)    //必须含有5个参数,下面读取对应的值,如果不匹配,暂时 不操作
                        {
                            var duanxin_type   = int.Parse(duanxin_arr[0]);
                            var duanxin_mobile = duanxin_arr[1];
                            var duanxin_state  = duanxin_arr[2];
                            var duanxin_con    = duanxin_arr[3];
                            var duanxin_time   = duanxin_arr[4];


                            if (duanxin_type == 0)    //上行消息

                            //上行消息写入记录
                            {
                                var OrderData = new B2bOrderData();
                                var insertsms = OrderData.InsertSmsback(duanxin_type, duanxin_mobile, duanxin_state, duanxin_con, duanxin_time);


                                //对上行消息判定
                                if (duanxin_con != "")
                                {
                                    if (duanxin_con.ToLower().Substring(0, 2) == "qr" || duanxin_con.ToLower().Substring(0, 2) == "qx" || duanxin_con.ToLower().Substring(0, 2) == "tj")
                                    {
                                        //截取前两个字qr,进入确认流程
                                        int orderid = int.Parse(duanxin_con.ToLower().Substring(2, duanxin_con.Length - 2));

                                        var snsback = OrderJsonData.UporderPaystate(orderid, duanxin_con.ToLower().Substring(0, 2), duanxin_mobile);

                                        context.Response.Write(snsback);
                                    }
                                }
                            }

                            if (duanxin_type == 2) //状态报告,未做
                            {
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string phone = Request["etmobile"].ConvertTo <string>("");

            string duanxintext = Request["duanxintext1"].ConvertTo <string>("");



            int comid = Request["comid"].ConvertTo <int>(0);

            int    userid  = Request["userid"].ConvertTo <int>(0);
            string isqunfa = Request["isqunfa"].ConvertTo <string>("no");

            if (isqunfa == "yes")
            {
                isqunfa = "1";
            }
            else
            {
                isqunfa = "0";
            }
            string msg       = "";
            int    sendstate = 0;   //发送结果默认为0

            string Invitecode = ""; //验证码

            //获取公司微信号
            B2b_company com = B2bCompanyData.GetAllComMsg(comid);

            if (com.B2bcompanyinfo.Weixinname == "")
            {
                msg = phone + "公司微信号为空";
            }
            else
            {
                duanxintext = duanxintext.Replace("$comweixin$", com.B2bcompanyinfo.Weixinname);

                //判断手机格式是否正确
                bool isphone = Regex.IsMatch(phone, @"^1[358]\d{9}$", RegexOptions.IgnoreCase);
                if (isphone)
                {
                    //获得随机码
                    Invitecode = MemberCardData.GetRandomCode().ToString();
                    //使用随机码时,标记为已使用 防止重复码
                    ExcelSqlHelper.ExecuteNonQuery("update RandomCode set state = 1 where code = " + Invitecode);

                    duanxintext = duanxintext.Replace("$invitecode$", Invitecode);
                    sendstate   = SendSmsHelper.SendSms(phone, duanxintext, comid, out msg);
                }
                else
                {
                    msg = phone + "手机格式不正确";
                }
            }



            //录入发送邀请码日志
            B2b_invitecodesendlog log = new B2b_invitecodesendlog
            {
                Id         = 0,
                Phone      = phone,
                Smscontent = duanxintext,
                Invitecode = Invitecode,
                Senduserid = userid,
                Sendtime   = DateTime.Now,
                Issendsuc  = 0,
                Isqunfa    = int.Parse(isqunfa),
                Remark     = msg,
                Comid      = comid
            };

            if (sendstate > 0)
            {
                log.Issendsuc = 1;
            }
            else
            {
                log.Issendsuc = 0;
            }

            int result = new B2b_invitecodesendlogData().Inslog(log);
        }
Beispiel #5
0
        public static void AsyncSendSms(B2b_smsmobilesend msmslog)
        {
            //根据订单号得到产品信息
            B2b_com_pro mpro = new B2bComProData().GetProByOrderID(msmslog.Oid);

            if (mpro == null)
            {
                return;
            }

            string phone               = msmslog.Mobile;
            string smscontent          = msmslog.Content;
            int    comid               = mpro.Com_id;
            int    orderid             = msmslog.Oid;
            string pno                 = msmslog.Pno;
            int    insertsendEticketid = msmslog.Sendeticketid;
            int    pro_sourcetype      = mpro.Source_type;

            string msg = "";

            int sendback = SendSmsHelper.SendSms(phone, smscontent, comid, out msg);

            int sendstate = 1;       //1未发码;2已发码;3发送中

            if (pro_sourcetype == 1) //系统自动生成
            {
                if (sendback > 0)
                {
                    //修改电子票发送日志表的发码状态为"发送成功"
                    B2b_eticket_send_log eticketlogup = new B2b_eticket_send_log()
                    {
                        Id        = insertsendEticketid,
                        Sendstate = (int)SendCodeStatus.HasSend,
                        Senddate  = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                    };

                    int upsendEticket = new B2bEticketSendLogData().InsertOrUpdate(eticketlogup);
                    //修改订单中发码状态为“已发码”
                    int upsendstate = new B2bOrderData().Upsendstate(orderid, (int)SendCodeStatus.HasSend);
                }
                else
                {
                    //修改电子票发送日志表的发码状态为"未发码"
                    B2b_eticket_send_log eticketlogup = new B2b_eticket_send_log()
                    {
                        Id        = insertsendEticketid,
                        Sendstate = (int)SendCodeStatus.NotSend,
                        Senddate  = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                    };

                    int upsendEticket = new B2bEticketSendLogData().InsertOrUpdate(eticketlogup);
                    //修改订单中发码状态为“未发码”
                    int upsendstate = new B2bOrderData().Upsendstate(orderid, (int)SendCodeStatus.NotSend);
                }
            }
            if (pro_sourcetype == 2)//倒码产品
            {
                if (sendback > 0)
                {
                    //修改订单中发码状态为“已发码”
                    int upsendstate = new B2bOrderData().Upsendstate(orderid, (int)SendCodeStatus.HasSend);
                }
                else
                {
                    //修改订单中发码状态为“未发码”
                    int upsendstate = new B2bOrderData().Upsendstate(orderid, (int)SendCodeStatus.NotSend);
                }
            }


            //记录短信日志表
            B2bSmsMobileSendDate smsmobilelog = new B2bSmsMobileSendDate();
            B2b_smsmobilesend    smslog       = new B2b_smsmobilesend()
            {
                Mobile        = phone,
                Content       = smscontent,
                Flag          = sendstate,
                Text          = msg,
                Delaysendtime = "",
                Oid           = orderid,
                Pno           = pno,
                Realsendtime  = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                Smsid         = sendback,
                Sendeticketid = insertsendEticketid
            };
            int insertsendmobileid = smsmobilelog.InsertOrUpdate(smslog);
        }
Beispiel #6
0
        public static string SmsSend(int comid, string Smsphone, string Smstext)
        {
            string[] pohone_arr;
            string[] phone_name_arr;
            string   phonestr  = "";
            string   namestr   = "";
            string   smsstr    = "";
            int      sendtype  = 0;//默认是没有姓名群发,1为有姓名一个一个发
            string   msg       = "";
            int      sendstate = 0;

            try
            {
                //当包含姓名通配符则一条一条发送
                if (Smstext.IndexOf("%name%") > 0)
                {
                    sendtype = 1;
                }

                //分割
                //Regex reg = new Regex(@"\r\n");
                //pohone_arr = reg.Split(Smsphone.Trim());

                pohone_arr = Smsphone.Split('\n');

                if (sendtype == 1)//安一条一条发送
                {
                    for (int i = 0; i < pohone_arr.Length; i++)
                    {
                        if (pohone_arr[i] != "")
                        {
                            phone_name_arr = pohone_arr[i].Split(' ');//空格区分
                            phonestr       = phone_name_arr[0].Substring(0, 11);
                            if (phone_name_arr.Length >= 2)
                            {
                                namestr = phone_name_arr[1];
                            }
                            smsstr    = Smstext.Replace("%name%", namestr);
                            sendstate = SendSmsHelper.SendSms(phonestr, smsstr, comid, out msg);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < pohone_arr.Length; i++)
                    {
                        if (pohone_arr[i] != "")
                        {
                            if (phonestr == "")
                            {
                                phonestr = pohone_arr[i].Substring(0, 11);
                            }
                            else
                            {
                                phonestr = phonestr + "," + pohone_arr[i].Substring(0, 11);
                            }

                            smsstr    = Smstext;
                            sendstate = SendSmsHelper.SendSms(phonestr, smsstr, comid, out msg);
                        }
                    }
                }

                return(JsonConvert.SerializeObject(new { type = 100, msg = sendstate }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }