Beispiel #1
0
        //初始会员密码
        public static string initialuser(int id, int comid)
        {
            var b2b      = new B2bCrmData();
            var phone    = b2b.Readuser(id, comid).Phone.ToString();
            var pass     = phone.Substring(5, 6).ToString();
            var name     = b2b.Readuser(id, comid).Name.ToString();
            var cardcode = b2b.Readuser(id, comid).Idcard.ToString();

            try
            {
                var prodata = new B2bCrmData();

                B2b_crm b2bcrm = new B2b_crm()
                {
                    Id        = id,
                    Com_id    = comid,
                    Password1 = pass
                };
                var pro = prodata.initialuser(b2bcrm);
                if (int.Parse(pro) == id)
                {
                    SendSmsHelper.GetMember_sms(phone, name, cardcode, pass, 0, "初始化密码", comid);
                }
                return(JsonConvert.SerializeObject(new { type = 100, msg = pro }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Beispiel #2
0
        public static string Upchannl(int id, int comid, decimal channlcard, decimal oldcard, int uptype)
        {
            try
            {
                var pro = "";

                //获得渠道ID
                var Channeinfo = new MemberChannelData().GetSelfChannelDetailByCardNo(channlcard.ToString());

                B2bCrmData crmdate  = new B2bCrmData();
                var        Userinfo = crmdate.Readuser(id, comid);


                if (Channeinfo != null && Userinfo != null)
                {
                    pro = new MemberChannelData().UpchannlT(Userinfo.Cardid, Channeinfo.Id, uptype);
                }

                return(JsonConvert.SerializeObject(new { type = 100, msg = pro }));
            }
            catch (Exception e)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = e.Message }));
            }
        }
Beispiel #3
0
        public string Servermobile = ""; //服务专员手机


        protected void Page_Load(object sender, EventArgs e)
        {
            openid     = Request["openid"];
            weixinpass = Request["weixinpass"];

            //如果SESSION有值,进行赋值
            if (openid != "" && Session["Openid"] != null)
            {
                openid = Session["Openid"].ToString();
            }



            //获得商户ID
            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);

            if (companyinfo != null)
            {
                comid             = companyinfo.Com_id;
                Session["Com_id"] = comid;
            }


            //已登录直接跳转
            if (Session["AccountId"] != null)
            {
                AccountId = Int32.Parse(Session["AccountId"].ToString());
                B2bCrmData dateuser1 = new B2bCrmData();
                B2b_crm    modeluser = dateuser1.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    AccountName   = modeluser.Name;
                    AccountCard   = modeluser.Idcard.ToString();
                    Servercard    = modeluser.Servercard;
                    Integral      = modeluser.Integral;
                    Imprest       = modeluser.Imprest;
                }

                //服务专员信息,服务专员ID
                if (Servercard != 0)
                {
                    MemberChannelData channeldate  = new MemberChannelData();
                    Member_Channel    channelmode2 = channeldate.GetChannelDetail(Int32.Parse(Servercard.ToString()));
                    if (channelmode2 != null)
                    {
                        Servername   = channelmode2.Name;
                        Servermobile = channelmode2.Mobile;
                    }
                }
            }
        }
Beispiel #4
0
        public static string Readuser(int id, int comid)
        {
            try
            {
                var prodata = new B2bCrmData();
                var list    = prodata.Readuser(id, comid);
                var rename  = MemberChannelData.GetChannelinfo(int.Parse(MemberCardData.GetCardNumber(list.Idcard).IssueCard.ToString()));
                var memcard = MemberChannelData.GetChannelinfo(int.Parse(MemberCardData.GetCardNumber(list.Idcard).ServerCard.ToString()));

                return(JsonConvert.SerializeObject(new { type = 100, msg = list, Namechannl = rename, Mem = memcard }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Beispiel #5
0
        public bool issetfinancepaytype = false;//是否设置了微信支付参数
        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            id       = Request["id"].ConvertTo <int>(0);
            nowdate  = DateTime.Now.ToString("yyyy-MM-dd");
            nowtoday = DateTime.Now;

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

            //获取随机用户ID


            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }


            if (id != 0)
            {
                B2b_com_pro pro = new B2bComProData().GetProById(id.ToString());
                if (pro != null)
                {
                    Ispanicbuy       = pro.Ispanicbuy;       //是否抢购或限购
                    Limitbuytotalnum = pro.Limitbuytotalnum; //限购数量

                    //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                    B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(pro.Com_id);
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                    if (model != null)
                    {
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                        //商家微信支付的所有参数都存在
                        if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                        {
                            //appId = model.Wx_appid;
                            //appsecret = model.Wx_appkey;
                            //appkey = model.Wx_paysignkey;
                            //mchid = model.Wx_partnerid;
                            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                            issetfinancepaytype = true;
                        }
                    }



                    //票务产品,判断 是否抢购/限购,是的话 作废超时未支付订单,完成回滚操作
                    if (pro_servertype == 1)
                    {
                        if (pro.Ispanicbuy == 1 || pro.Ispanicbuy == 2)
                        {
                            int rs = new B2bComProData().CancelOvertimeOrder(pro);
                        }
                    }

                    iscanbook      = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                    pro_servertype = pro.Server_type;
                    pickuppoint    = pro.pickuppoint;
                    dropoffpoint   = pro.dropoffpoint;


                    childreduce = pro.Childreduce;
                }
                if (pro.Ispanicbuy == 1)
                {
                    panic_begintime  = pro.Panic_begintime;
                    panicbuy_endtime = pro.Panicbuy_endtime;


                    TimeSpan tss = pro.Panic_begintime - nowtoday;
                    var      day = tss.Days * 24 * 3600;;  //这是相差的天数
                    var      h   = tss.Hours * 3600;       //这是相差的小时数,
                    var      m   = tss.Minutes * 60;
                    var      s   = tss.Seconds;
                    shijiacha = day + h + m + s;
                }
                projectid        = pro.Projectid;
                comid            = pro.Com_id;
                pro_name         = pro.Pro_name;
                price            = pro.Advise_price;
                face_price       = pro.Face_price;
                limitbuytotalnum = pro.Limitbuytotalnum;
                imgurl           = FileSerivce.GetImgUrl(pro.Imgurl);
                if (price == 0)
                {
                    price = 0;
                }
                else
                {
                    CommonFunc.OperTwoDecimal(price.ToString());
                    //price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                }

                if (face_price != 0)
                {
                    CommonFunc.OperTwoDecimal(face_price.ToString());
                }


                nowdate = DateTime.Now.ToString("yyyy-MM-dd");


                if (pro.Service_Contain != "")
                {
                    sumaryend = pro.Service_Contain;
                }

                if (pro.Service_NotContain != "")
                {
                    sumaryend = sumaryend + "</br> " + pro.Service_NotContain;
                }

                if (pro.Precautions != "")
                {
                    sumaryend = sumaryend + "</br> " + pro.Precautions;
                }

                Server_type = pro.Server_type;
                //如果服务类型是 票务;  则备注信息中 显示 电子码使用限制
                //if (pro.Server_type == 1)
                //{
                //    if (pro.Iscanuseonsameday == 0)//电子码当天不可用
                //    {
                //        sumaryend = "此产品当天预订不可用<br>" + sumaryend;
                //    }
                //    if (pro.Iscanuseonsameday == 1)//电子码当天可用
                //    {
                //        sumaryend = "此产品当天预订可用<br>" + sumaryend;
                //    }
                //    if (pro.Iscanuseonsameday == 2)//电子码出票2小时内不可用
                //    {
                //        sumaryend = "此产品出票2小时内不可用<br>" + sumaryend;
                //    }
                //}

                remark  = pro.Pro_Remark;
                pro_num = pro.Pro_number;
                if (pro_num == 0)
                {
                    pro_max = 100;
                    pro_min = 1;
                }
                else
                {
                    pro_min = 1;
                    pro_max = pro_num;
                }
                pro_explain = pro.Pro_explain;



                #region 产品有效期判定(微信模板--门票订单预订成功通知 中也有用到)
                provalidatemethod = pro.ProValidateMethod; //判断 1按产品有效期,2指定有效期
                appointdate       = pro.Appointdata;       //1=一星期,,2=1个月,3=3个月,4=6个月,5=一年
                iscanuseonsameday = pro.Iscanuseonsameday; //1当天可用,0当天不可用

                DateTime pro_end = pro.Pro_end;
                //返回有效期
                pro_youxiaoqi = new B2bComProData().GetPro_Youxiaoqi(pro.Pro_start, pro.Pro_end, provalidatemethod, appointdate, iscanuseonsameday);

                #endregion



                var commodel = B2bCompanyData.GetCompany(comid);
                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                    }
                }


                var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    phone = saleset.Service_Phone;
                }

                //查询项目电话,如果有项目电话调取项目电话
                var projectdata  = new B2b_com_projectData();
                var projectmodel = projectdata.GetProject(projectid, comid);
                if (projectmodel != null)
                {
                    if (projectmodel.Mobile != "")
                    {
                        phone = projectmodel.Mobile;
                    }
                }


                //从cookie中得到微信号
                if (Request.Cookies["openid"] != null)
                {
                    openid = Request.Cookies["openid"].Value;
                }
                B2bCrmData b2b_crm = new B2bCrmData();
                if (openid != "")
                {
                    B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid);
                    if (b2bmodle != null)
                    {
                        Imprest  = b2bmodle.Imprest;
                        Integral = b2bmodle.Integral;
                    }
                }
            }



            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var wxdomain = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl);
                if (wxdomain != null)
                {
                    comid = wxdomain.Comid;
                }
            }
            if (comid != 0)
            {
                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }



            //获取BANNER,及logo
            if (comid != 0)
            {
                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }
            }


            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Beispiel #6
0
        public string userid  = "0";//用户临时 Uid 或 实际Uid



        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

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

            if (key != "")
            {
                biaoti = key;
            }

            proclass = Request["class"].ConvertTo <int>(0);
            price    = Request["price"].ConvertTo <int>(0);

            //获取随机用户ID
            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }



            if (proclass != 0)
            {
                var prodata = new B2bComProData();
                var result  = prodata.Proclassbyid(proclass);
                if (result != null)
                {
                    biaoti = result.Classname;
                }
            }



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


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }


            if (comid != 0)
            {
                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }



            //获取BANNER,及logo
            if (comid != 0)
            {
                var imagedata  = new B2bCompanyImageData();
                int totalcount = 0;
                List <B2b_company_image> list = imagedata.PageGetimageList(comid, 2, out totalcount);

                if (list != null)
                {
                    for (int i = 0; i < totalcount; i++)
                    {
                        bannerimg   = FileSerivce.GetImgUrl(list[i].Imgurl);
                        bannerlink  = list[i].Linkurl;
                        bannertitle = list[i].Title;
                    }
                }

                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }


                //读取首页栏目,只读取前10个栏目,太多影响打开
                var shopmenudata = new B2bCompanyMenuData();
                menulist = shopmenudata.GetMenuList(comid, 1, 10, out menutotalcount, 1);
                if (menulist != null)
                {
                    for (int i = 0; i < menutotalcount; i++)
                    {
                        menulist[i].Imgurl_address = FileSerivce.GetImgUrl(menulist[i].Imgurl);
                    }
                }
            }



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Beispiel #7
0
        public int isrightwxset = 1;  //微信接口设置信息是否正确
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            materialid = Request["materialid"].ConvertTo <int>(0);
            uid        = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            WxMaterial wxmaterial = new WxMaterialData().GetWxMaterial(materialid);

            string weixincode = Request["code"].ConvertTo <string>("");

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


            #region  材信息
            if (wxmaterial != null)
            {
                authorpayurl = wxmaterial.Authorpayurl;
                Author       = wxmaterial.Author;
                datetime     = wxmaterial.Operatime.ToString("yyyy-MM-dd");

                comid = wxmaterial.Comid;

                id         = wxmaterial.MaterialId;
                title      = wxmaterial.Title;
                thisday    = DateTime.Now.ToString("yyyy-MM-dd");
                article    = wxmaterial.Article;
                phone_tel  = wxmaterial.Phone;
                Articleurl = wxmaterial.Articleurl;
                phone      = "客服电话:";
                price      = wxmaterial.Price.ToString();

                if (price == "0.00" || price == "0")
                {
                    price = "";
                }
                else
                {
                    price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                    price = "¥" + price + "元-";
                }



                summary = wxmaterial.Summary;
                var identityFileUpload = new FileUploadData().GetFileById(wxmaterial.Imgpath.ToString().ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    if (identityFileUpload.Relativepath != "")
                    {
                        headPortraitImgSrc = fileUrl + identityFileUpload.Relativepath;
                    }
                    else
                    {
                        headPortraitImgSrc = "";
                    }
                }
            }
            #endregion

            #region 微信转发访问统计
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //查询是否有此cookies,有此cooki则证明已经访问过的用户
                if (Request.Cookies["wxact" + materialid.ToString()] == null)
                {
                    var forward = new MemberForwardingData().Forwardingcount(uid, materialid, uip, comid);
                    if (forward > 0)
                    {
                        HttpCookie cookie = new HttpCookie("wxact" + materialid.ToString());     //实例化HttpCookie类并添加值
                        cookie.Value   = "yes";
                        cookie.Expires = DateTime.Now.AddDays(365);
                        Response.Cookies.Add(cookie);
                    }
                }


                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }


                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);

                        cookie         = new HttpCookie("ZF_WxmaterialId"); //实例化HttpCookie类并添加值
                        cookie.Value   = materialid.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
            #endregion



            if (comid != 0)
            {
                #region  微信语音播放接口会用到
                string url = Request.Url.ToString();

                //根据传入参数openid、comid 得到 access_token、jsapi_ticket、noncestr、timestamp、 url(当前网页的URL,不包含#及其后面部分)
                WeiXinBasic basic = new WeiXinBasicData().GetWxBasicByComId(comid);
                if (basic != null)
                {
                    appId     = basic.AppId;
                    timestamp = new WeixinVoiceUtil().CreatenTimestamp();
                    nonceStr  = new WeixinVoiceUtil().CreatenNonce_str();

                    WXAccessToken maccesstoken = new WeixinVoiceUtil().GetAccessToken(comid, basic.AppId, basic.AppSecret);
                    if (maccesstoken != null)
                    {
                        string jsapi_ticket = new WeixinVoiceUtil().GetTickect(maccesstoken.ACCESS_TOKEN, comid);
                        if (jsapi_ticket == "")
                        {
                            isrightwxset = 0;
                        }
                        else
                        {
                            string beforesha1_signature = "";
                            signature = new WeixinVoiceUtil().GetSignature(jsapi_ticket, nonceStr, timestamp, url, out beforesha1_signature);
                        }
                    }
                    else
                    {
                        isrightwxset = 0;
                    }
                }
                else
                {
                    isrightwxset = 0;
                }
                #endregion



                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }
                    Com_name = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }



                if (weixincode != "")
                {
                    int questtype = 2;//1=微信授权验证
                    DealUserinfo1("", weixincode, comid, questtype);
                }
                else if (openid != "")
                {
                    string weixinpass = Request["weixinpass"].ConvertTo <string>("");
                    int    questtype  = 1;                               //1=一次性密码验证
                    DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
                }
            }
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Request.ValidateInput();
            string u = Request.ServerVariables["HTTP_USER_AGENT"];

            //bool bo = detectmobilebrowser.HttpUserAgent(u);
            proclass = Request["proclass"].ConvertTo <int>(0);

            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            buyuid    = Request["buyuid"].ConvertTo <int>(0);
            tocomid   = Request["tocomid"].ConvertTo <int>(0);
            projectid = Request["id"].ConvertTo <int>(0);

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

            string pno1 = EncryptionHelper.EticketPnoDES(pno, 1);//解密

            var B2bEticketdata = new B2bEticketData();
            var eticketinfo    = B2bEticketdata.GetEticketDetail(pno1);

            if (eticketinfo != null)
            {
                comid     = eticketinfo.Com_id;
                usepnonum = eticketinfo.Use_pnum;
            }


            if (comid == 0)
            {
                if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
                {
                    comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                }
                else
                {
                    B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                    if (companyinfo != null)
                    {
                        comid = companyinfo.Com_id;
                    }
                }
            }

            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }


            //根据项目id得到项目信息
            if (projectid != 0)
            {
                B2b_com_project mod = new B2b_com_projectData().GetProject(projectid, comid);
                if (mod != null)
                {
                    projectname   = mod.Projectname;
                    projectimgurl = FileSerivce.GetImgUrl(mod.Projectimg);
                    projectbrief  = mod.Briefintroduce;
                }


                B2bComProData prodata1 = new B2bComProData();
                var           prohotel = prodata1.Selectpro_hotel(comid, projectid);
                if (prohotel == 1)
                {
                    // Response.Redirect("hotel/hotelshow.aspx?projectid=" + projectid + "&id=" + comid + "&uid =" + uid + "&buyuid=" + buyuid + "&tocomid=" + tocomid + " ");
                }
            }


            if (comid != 0)
            {
                B2b_company companyinfo = B2bCompanyData.GetCompany(comid);

                B2bCompanyInfoData info = new B2bCompanyInfoData();
                if (companyinfo != null)
                {
                    comName = companyinfo.Com_name;
                    if (comName.Length >= 9)
                    {
                        comName = comName.Substring(0, 9) + "..";
                    }

                    remark = info.GetCompanyInfo(comid).Scenic_intro + "&nbsp;&nbsp;<a style=\"color:#1a9ed9\" href=\"OrderinfoTitle.aspx?id=" + comid + "\">(查看全部)</a>";
                    if (remark.Length > 42)
                    {
                        remark = remark.Substring(0, 42) + "&nbsp;&nbsp;<a style=\"color:#1a9ed9\" href=\"OrderinfoTitle.aspx?id=" + comid + "\">(查看全部)</a>";
                    }


                    if (companyinfo.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = companyinfo.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = companyinfo.B2bcompanyinfo.Wxfocus_author;;
                    }
                }

                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    if (saleset.Smalllogo != null && saleset.Smalllogo != "")
                    {
                        headPortraitImgSrc = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                    }
                }
            }


            //------------------------------新添加代码(主要目的就是获取微信号使用户处于登录状态以及判断用户转发时引发的微信号混乱问题)===========================

            string weixincode = Request["code"].ConvertTo <string>("");

            if (weixincode == "")//未认证微信
            {
                openid     = Request["openid"].ConvertTo <string>("");
                weixinpass = Request["weixinpass"].ConvertTo <string>("");
                int questtype = 1;                                   //1=一次性密码验证
                DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
            }
            else//已认证微信

            {
                int questtype = 2;                               //1=微信授权验证
                DealUserinfo1("", weixincode, comid, questtype); //获取微信号;使用户处于登录状态
            }
        }
Beispiel #9
0
        public int viewtop   = 1;   //头部及左侧相关显示控制
        protected void Page_Load(object sender, EventArgs e)
        {
            //如果判断手机浏览器 跳转手机版
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            if (bo)
            {
                Response.Redirect("/h5/order/");
            }


            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToString();
            comid      = Request["comid"].ConvertTo <int>(0);
            menuindex  = Request["menuindex"].ConvertTo <int>(0);


            B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);

            if (companyinfo != null)
            {
                comid = companyinfo.Com_id;
            }
            else
            { //判定是否为自助域名规则安 shop1.etown.cn
                if (Domain_def.Domain_yanzheng(RequestUrl))
                {
                    comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                }
            }


            //绿野 不显示头部
            if (comid == 2553)
            {
                viewtop = 0;
            }

            //判断商户ID(域名未绑定)
            if (comid != 0)
            {
                B2b_company modlecom = B2bCompanyData.GetAllComMsg(comid);
                if (modlecom != null)
                {
                    Com_name       = modlecom.Com_name;
                    txtServiceInfo = modlecom.B2bcompanyinfo.Serviceinfo;
                    Scenic_name    = modlecom.Scenic_name;
                    scenic_address = modlecom.B2bcompanyinfo.Scenic_address;
                    coordinate     = modlecom.B2bcompanyinfo.Coordinate;
                    coordinatesize = modlecom.B2bcompanyinfo.Coordinatesize;
                    weixinimg      = modlecom.B2bcompanyinfo.Weixinimg;
                    weixinname     = modlecom.B2bcompanyinfo.Weixinname;
                    Qq             = modlecom.B2bcompanyinfo.Qq;
                }

                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                    Copyright = pro.Copyright;
                    Tel       = pro.Service_Phone;
                }



                //读取首页栏目,只读取前10个栏目,太多影响打开
                var shopmenudata = new B2bCompanyMenuData();
                menulist = shopmenudata.GetMenuList(comid, 1, 10, out menutotalcount, 1, menuindex);
                if (menulist != null)
                {
                    for (int i = 0; i < menulist.Count; i++)
                    {
                        menulist[i].Imgurl_address = FileSerivce.GetImgUrl(menulist[i].Imgurl);
                    }
                }

                //如果没有栏目读取项目
                if (menutotalcount == 0)
                {
                    var prodata = new B2b_com_projectData();
                    projectlist = prodata.Projectpagelist(comid.ToString(), 1, 10, "1", out porjectcount, "");
                }
            }


            int totalcount = 0;

            if (Session["AccountId"] != null)
            {
                //账户信息
                AccountId   = Int32.Parse(Session["AccountId"].ToString());
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                RequestUrl  = Request.ServerVariables["SERVER_NAME"].ToLower();

                //会员信息
                B2bCrmData dateuser  = new B2bCrmData();
                B2b_crm    modeluser = dateuser.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    Imprest       = modeluser.Imprest;
                    Integral      = modeluser.Integral;
                    //密码
                    AccountPass = modeluser.Password1;
                    //微信关注
                    weixin = modeluser.Weixin == "" ? "未关注" : "已关注";
                }

                //用户订单
                //List<B2b_order> orderlist = new B2bOrderData().ComOrderPageList(comid,1, 100, AccountId, out totalcount);
                //Rporder.DataSource = orderlist;
                //Rporder.DataBind();
            }
        }
Beispiel #10
0
        public decimal childreduce = 0;//儿童减免费用
        protected void Page_Load(object sender, EventArgs e)
        {
            lineid = Request["lineid"].ConvertTo <int>(0);
            uid    = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip     = CommonFunc.GetRealIP();
            nowdate = DateTime.Now;


            if (lineid != 0)
            {
                var prodata = new B2bComProData();
                var pro     = prodata.GetProById(lineid.ToString());

                if (pro != null)
                {
                    //作废超时未支付订单,完成回滚操作
                    int rs = new B2bComProData().CancelOvertimeOrder(pro);

                    childreduce = pro.Childreduce;

                    pro_name           = pro.Pro_name;
                    com_id             = pro.Com_id;
                    comid              = pro.Com_id;
                    pro_state          = pro.Pro_state;
                    server_type        = pro.Server_type;
                    pro_type           = pro.Pro_type;
                    source_type        = pro.Source_type;
                    pro_Remark         = pro.Pro_Remark;
                    pro_start          = pro.Pro_start;
                    pro_end            = pro.Pro_end;
                    face_price         = pro.Face_price;
                    advise_price       = pro.Advise_price;
                    agent1_price       = pro.Agent1_price;
                    agent2_price       = pro.Agent2_price;
                    agent3_price       = pro.Agent3_price;
                    agentsettle_price  = pro.Agentsettle_price;
                    thatDay_can        = pro.ThatDay_can;
                    thatday_can_day    = pro.Thatday_can_day;
                    service_Contain    = pro.Service_Contain;
                    service_NotContain = pro.Service_NotContain;
                    precautions        = pro.Precautions;
                    tuan_pro           = pro.Tuan_pro;
                    zhixiao            = pro.Zhixiao;
                    agentsale          = pro.Agentsale;
                    createtime         = pro.Createtime;
                    sms              = pro.Sms;
                    createuserid     = pro.Createuserid;
                    imgurl           = pro.Imgurl;
                    pro_number       = pro.Pro_number;
                    pro_explain      = pro.Pro_explain;
                    tuipiao          = pro.Tuipiao;
                    tuipiao_guoqi    = pro.Tuipiao_guoqi;
                    tuipiao_endday   = pro.Tuipiao_endday;
                    imgaddress       = FileSerivce.GetImgUrl(pro.Imgurl);
                    projectid        = pro.Projectid;
                    travelproductid  = pro.Travelproductid;
                    travelstarting   = pro.Travelstarting;
                    travelending     = pro.Travelending;
                    ispanicbuy       = pro.Ispanicbuy;
                    panic_begintime  = pro.Panic_begintime;
                    panicbuy_endtime = pro.Panicbuy_endtime;
                    limitbuytotalnum = pro.Limitbuytotalnum;

                    if (ispanicbuy == 1)
                    {
                        TimeSpan tss = panic_begintime - nowdate;
                        var      day = tss.Days * 24 * 3600;;          //这是相差的天数
                        var      h   = tss.Hours * 3600;               //这是相差的小时数,
                        var      m   = tss.Minutes * 60;
                        var      s   = tss.Seconds;
                        shijiacha = day + h + m + s;
                    }
                }
            }

            if (com_id != 0)
            {
                B2b_company company = B2bCompanyData.GetCompany(com_id);
                if (company != null)
                {
                    companyname = company.Com_name;
                    tel         = company.B2bcompanyinfo.Tel;
                }
                //获取渠道门市电话,当用户为门市会员则调取门市电话 tel
            }



            if (comid != 0)
            {
                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");

                if (weixincode != "")
                {
                    int questtype = 2;//1=微信授权验证
                    DealUserinfo1("", weixincode, comid, questtype);
                }
                else
                {
                    string openid     = Request["openid"].ConvertTo <string>("");
                    string weixinpass = Request["weixinpass"].ConvertTo <string>("");
                    int    questtype  = 1;                               //1=一次性密码验证
                    DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
                }
            }



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, com_id);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                   //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, com_id); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// 获取会员信息分两种方式:a.根据客户端保存的cookie值获取 b.根据传递过来的参数获取
        /// </summary>
        /// <param name="weixincode"></param>
        /// <param name="openid"></param>
        /// <param name="weixinpass"></param>
        private void GetCrmInfo(string weixincode, string openid, string weixinpass)
        {
            //如果SESSION有值,进行赋值
            if (openid == "" && Session["Openid"] != null)
            {
                openid = Session["Openid"].ToString();
            }

            //判断商家是否微信认证
            if (weixincode != "")//进行过微信认证,微信认证登陆
            {
                //如果微信ID,递实现自动登陆
                GetOpenId(weixincode, comid);
            }
            else if (openid != "" && weixinpass != "")
            {
                //最后判断传递过来的微信一次性密码
                VerifyOneOffPass(openid, weixinpass);
            }


            //判断登陆状态
            if (Session["AccountId"] != null)
            {
                //先判断Session
                int        AccountId = int.Parse(Request.Cookies["AccountId"].Value);
                B2bCrmData dateuser  = new B2bCrmData();
                B2b_crm    userinfo  = dateuser.Readuser(AccountId, comid);
                if (userinfo != null)
                {
                    Readuser(userinfo.Idcard, comid);
                }
            }
            else
            {//再判断COOKIES
                if (Request.Cookies["AccountId"] != null)
                {
                    string accountmd5 = "";
                    int    AccountId  = int.Parse(Request.Cookies["AccountId"].Value);
                    if (Request.Cookies["AccountKey"] != null)
                    {
                        accountmd5 = Request.Cookies["AccountKey"].Value;
                    }

                    var data1 = CrmMemberJsonData.WeixinCookieLogin(AccountId.ToString(), accountmd5, comid, out userinfo);
                    if (data1 == "OK")
                    {
                        //从cookie中得到微信号
                        if (Request.Cookies["openid"] != null)
                        {
                            openid = Request.Cookies["openid"].Value;
                        }
                        if (userinfo != null)
                        {
                            Readuser(userinfo.Idcard, comid);//读取用户信息
                        }
                    }
                    else
                    {
                        //当cookie错误无法登陆则清除所有COOKIE;
                        HttpCookie aCookie;
                        string     cookieName;
                        int        limit = Request.Cookies.Count;
                        for (int i = 0; i < limit; i++)
                        {
                            cookieName      = Request.Cookies[i].Name;
                            aCookie         = new HttpCookie(cookieName);
                            aCookie.Expires = DateTime.Now.AddDays(-1);
                            Response.Cookies.Add(aCookie);
                        }
                        //根据传递过来的参数获取会员信息
                        GetCrmByParam(weixincode, openid, weixinpass);
                    }
                }
                else
                {
                    //根据传递过来的参数获取会员信息
                    GetCrmByParam(weixincode, openid, weixinpass);
                }
            }
        }
Beispiel #12
0
        //给顾问,客户,绑定人发送通知, sentype=1 给绑定顾问,=2给客户 =3给教练
        public static void SendWxkefumsg(int orderid, int sentype, string msg, int comid)
        {
            WeiXinBasic basic  = new WeiXinBasicData().GetWxBasicByComId(comid);
            string      openid = "";


            WxMessageLogData messagelogdata = new WxMessageLogData();

            B2bOrderData orderdate = new B2bOrderData();
            var          orderinfo = orderdate.GetOrderById(orderid);

            if (orderinfo == null)
            {
                return;
            }


            //会员

            MemberCardData carddata = new MemberCardData();
            var            userdata = new B2bCrmData();

            if (sentype == 2)
            {
                var userinfo = userdata.Readuser(orderinfo.U_id, orderinfo.Comid);
                if (userinfo == null)
                {
                    return;
                }

                openid = userinfo.Weixin;

                if (openid != "")
                {
                    //微信客服 文本消息
                    string data = SendWxMsg(comid, openid, 1, "", msg, "", basic.Weixinno);
                }
            }

            if (sentype == 1)
            {
                var b2bprodata = new B2bComProData();
                var proinfo    = b2bprodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid);
                if (proinfo == null)
                {
                    return;
                }

                if (proinfo.bookpro_bindphone != "")
                {
                    //var channeldata = new MemberChannelData();
                    //var channelinfo = channeldata.GetPhoneComIdChannelDetail(proinfo.bookpro_bindphone,comid);


                    //直接通过 手机查询用户
                    var userinfo_binding = userdata.GetSjKeHu(proinfo.bookpro_bindphone, orderinfo.Comid);
                    if (userinfo_binding == null)
                    {
                        return;
                    }
                    openid = userinfo_binding.Weixin;
                    if (openid != "")
                    {
                        //微信 文本消息
                        string data_binding = SendWxMsg(comid, openid, 1, "", msg, "", basic.Weixinno);
                    }
                }
            }

            //给教练
            if (sentype == 3)
            {
                var b2bprodata = new B2bComProData();
                var proinfo    = b2bprodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid);
                if (proinfo == null)
                {
                    return;
                }

                if (orderinfo.channelcoachid != 0)
                {
                    var channeldata = new MemberChannelData();
                    var channelinfo = MemberChannelData.GetChannelinfo(orderinfo.channelcoachid);

                    if (channelinfo != null)
                    {
                        //直接通过 手机查询用户
                        var userinfo_binding = userdata.GetSjKeHu(channelinfo.Mobile, orderinfo.Comid);
                        if (userinfo_binding == null)
                        {
                            return;
                        }
                        openid = userinfo_binding.Weixin;
                        if (openid != "")
                        {
                            //微信 文本消息
                            string data_binding = SendWxMsg(comid, openid, 1, "", msg, "", basic.Weixinno);
                        }
                    }
                }
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            //根据域名读取商户ID,如果没有绑定域名直接跳转后台
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }

            //if (bo == false)
            //{
            //    if (comid == 101)
            //    {
            //        Response.Redirect("http://vctrip.etown.cn/");
            //    }
            //    Response.Redirect("http://shop" + comid + ".etown.cn");
            //}

            if (openid != null && openid != "")
            {
                //只要传递过来微信ID 直接SESSION
                Session["Openid"] = openid;
            }



            //判断登陆状态
            if (Session["AccountId"] != null)
            {//先判断Session
                AccountId   = Int32.Parse(Session["AccountId"].ToString());
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                Today       = DateTime.Now.ToString("yyyy-MM-dd");
                //comid = int.Parse(Session["Com_id"].ToString());


                //AccountId = Int32.Parse(Session["AccountId"].ToString());
                B2bCrmData dateuser1 = new B2bCrmData();
                B2b_crm    modeluser = dateuser1.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    openid          = modeluser.Weixin;
                    Accountphone    = modeluser.Phone;
                    AccountName     = modeluser.Name;
                    AccountCard     = modeluser.Idcard.ToString();
                    AccountBirthday = modeluser.Birthday;
                    Accountsex      = modeluser.Sex;
                    year            = AccountBirthday.Year.ToString();
                    month           = AccountBirthday.Month.ToString();
                    day             = AccountBirthday.Day.ToString();

                    comid = int.Parse(modeluser.Com_id.ToString());
                }



                B2bCrmData dateuser = new B2bCrmData();
                dateuser.WeixinConPass(openid, comid);//只要包含SESSION登陆成功,清空微信密码
            }
            else
            {//再判断COOKIES
                //comid = Request["comid"].ConvertTo<int>(0);
                if (Request.Cookies["AccountId"] != null && Request.Cookies["AccountKey"] != null)
                {
                    AccountId = Int32.Parse(Request.Cookies["AccountId"].Value);
                    string  accountmd5 = Request.Cookies["AccountKey"].Value;
                    B2b_crm userinfo;

                    var data = CrmMemberJsonData.WeixinCookieLogin(AccountId.ToString(), accountmd5, comid, out userinfo);
                    if (data == "OK")
                    {
                        Session["AccountId"]   = userinfo.Id;
                        Session["AccountName"] = userinfo.Name;
                        Session["AccountCard"] = userinfo.Idcard;
                        Session["Com_id"]      = comid;
                        //Accountsex = userinfo.Sex;
                        openid = userinfo.Weixin;


                        HttpCookie cookie = new HttpCookie("AccountId", userinfo.Id.ToString());     //实例化HttpCookie类并添加值
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                        cookie         = new HttpCookie("AccountName", userinfo.Name.ToString()); //实例化HttpCookie类并添加值
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                        var returnmd5 = EncryptionHelper.ToMD5(userinfo.Idcard.ToString() + userinfo.Id.ToString(), "UTF-8");
                        cookie         = new HttpCookie("AccountKey", returnmd5); //实例化HttpCookie类并添加值
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Beispiel #14
0
        public static string WriteMoney(int id, int comid, string acttype, string money, decimal orderid, string ordername, string remark = "")
        {
            try
            {
                //获得操作用户
                B2b_company_manageuser user    = UserHelper.CurrentUser();
                B2b_company            company = UserHelper.CurrentCompany;
                string username = user.Accounts;
                //获得IP
                string addressIP = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName()).GetValue(0).ToString();
                int    pro       = 0;

                //判断金额有效性
                bool isNum = Domain_def.RegexValidate("^[0-9]*$", money);
                if (!isNum)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "操作错误,金额只能包含数字" }));
                }

                //充等积分
                if (acttype == "add_dengjifen")
                {
                    B2bcrm_dengjifenlog djflog = new B2bcrm_dengjifenlog
                    {
                        id        = 0,
                        crmid     = id,
                        dengjifen = decimal.Parse(money),
                        ptype     = 1,
                        opertor   = user.Id.ToString(),
                        opertime  = DateTime.Now,
                        orderid   = int.Parse(orderid.ToString()),
                        ordername = ordername,
                        remark    = remark
                    };


                    pro = new B2bCrmData().Adjust_dengjifen(djflog, id, comid, decimal.Parse(money));
                    if (pro == 0)
                    {
                        return(JsonConvert.SerializeObject(new { type = 1, msg = "调整用户等积分失败" }));
                    }
                }
                //减等积分
                else if (acttype == "reduce_dengjifen")
                {
                    B2bcrm_dengjifenlog djflog = new B2bcrm_dengjifenlog
                    {
                        id        = 0,
                        crmid     = id,
                        dengjifen = 0 - decimal.Parse(money),
                        ptype     = 2,
                        opertor   = user.Id.ToString(),
                        opertime  = DateTime.Now,
                        orderid   = int.Parse(orderid.ToString()),
                        ordername = ordername,
                        remark    = remark
                    };


                    pro = new B2bCrmData().Adjust_dengjifen(djflog, id, comid, 0 - decimal.Parse(money));
                    if (pro == 0)
                    {
                        return(JsonConvert.SerializeObject(new { type = 1, msg = "调整用户等积分失败" }));
                    }
                }
                //充积分
                else if (acttype == "add_integral")
                {
                    MemberIntegralData intdate = new MemberIntegralData();
                    Member_Integral    Intinfo = new Member_Integral()
                    {
                        Id        = id,
                        Comid     = comid,
                        Acttype   = acttype,               //操作类型
                        Money     = decimal.Parse(money),  //交易金额
                        Admin     = username,
                        Ip        = addressIP,
                        Ptype     = 1,
                        Oid       = 0,
                        Remark    = "",
                        OrderId   = orderid,
                        OrderName = ordername
                    };
                    pro = intdate.InsertOrUpdate(Intinfo);
                    if (pro != 0)
                    {
                        //积分变动 触发等积分变动
                        B2bcrm_dengjifenlog djflog = new B2bcrm_dengjifenlog
                        {
                            id        = 0,
                            crmid     = id,
                            dengjifen = decimal.Parse(money),
                            ptype     = 1,
                            opertor   = user.Id.ToString(),
                            opertime  = DateTime.Now,
                            orderid   = int.Parse(orderid.ToString()),
                            ordername = ordername,
                            remark    = "后台调整积分引起等积分变动:" + remark
                        };
                        new B2bCrmData().Adjust_dengjifen(djflog, id, comid, decimal.Parse(money));



                        B2bCrmData prodata = new B2bCrmData();
                        var        list    = prodata.Readuser(Intinfo.Id, Intinfo.Comid);

                        //微信消息模板
                        if (list.Weixin != "")
                        {
                            new Weixin_tmplmsgManage().WxTmplMsg_CrmIntegralReward(list.Com_id, list.Weixin, "您好,积分已经打入您的账户", list.Idcard.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "活动赠送", Intinfo.Money.ToString(), list.Integral.ToString(), "如有疑问,请致电客服。");
                        }

                        SendSmsHelper.GetMember_sms(list.Phone, list.Name, list.Idcard.ToString(), list.Password1, Intinfo.Money, "充积分", comid);//发送短信
                    }
                }//减积分
                else if (acttype == "reduce_integral")
                {
                    MemberIntegralData intdate = new MemberIntegralData();
                    Member_Integral    Intinfo = new Member_Integral()
                    {
                        Id        = id,
                        Comid     = comid,
                        Acttype   = acttype,                  //操作类型
                        Money     = 0 - decimal.Parse(money), //交易金额
                        Admin     = username,
                        Ip        = addressIP,
                        Ptype     = 2,
                        Oid       = 0,
                        Remark    = "",
                        OrderId   = orderid,
                        OrderName = ordername
                    };
                    pro = intdate.InsertOrUpdate(Intinfo);
                    if (pro != 0)
                    {
                        ////积分变动 触发等积分变动
                        //B2bcrm_dengjifenlog djflog = new B2bcrm_dengjifenlog
                        //{
                        //    id = 0,
                        //    crmid = id,
                        //    dengjifen = 0-decimal.Parse(money),
                        //    ptype = 2,
                        //    opertor = user.Id.ToString(),
                        //    opertime = DateTime.Now,
                        //    orderid = int.Parse(orderid.ToString()),
                        //    ordername = ordername,
                        //    remark = "后台调整积分引起等积分变动:" + remark
                        //};
                        //new B2bCrmData().Adjust_dengjifen(djflog, id, comid, 0-decimal.Parse(money));



                        B2bCrmData prodata = new B2bCrmData();
                        var        list    = prodata.Readuser(Intinfo.Id, Intinfo.Comid);
                        //SendSmsHelper.GetMember_sms(list.Phone, list.Name, list.Idcard.ToString(), list.Password1, Intinfo.Money, "减积分", comid);//发送短信

                        if (list.Weixin != "")
                        {
                            new Weixin_tmplmsgManage().WxTmplMsg_CrmConsume(list.Com_id, list.Weixin, "名称", "使用积分", "会员卡号", list.Idcard.ToString(), DateTime.Now.ToString(), " 使用" + Intinfo.Money + " 积分,如有疑问,请致电客服。");
                        }
                    }
                }//充预付款
                else if (acttype == "add_imprest")
                {
                    MemberImprestData impdate = new MemberImprestData();
                    Member_Imprest    Impinfo = new Member_Imprest()
                    {
                        Id        = id,
                        Comid     = comid,
                        Acttype   = acttype,              //操作类型
                        Money     = decimal.Parse(money), //交易金额
                        Admin     = username,
                        Ip        = addressIP,
                        Ptype     = 1,
                        Oid       = 0,
                        Remark    = "",
                        OrderId   = orderid,
                        OrderName = ordername
                    };
                    pro = impdate.InsertOrUpdate(Impinfo);
                    if (pro != 0)
                    {
                        B2bCrmData prodata = new B2bCrmData();
                        var        list    = prodata.Readuser(Impinfo.Id, Impinfo.Comid);
                        //微信消息模板
                        if (list.Weixin != "")
                        {
                            new Weixin_tmplmsgManage().WxTmplMsg_CrmRecharge(list.Com_id, list.Weixin, "您好,已成功进行会员卡充值", "会员卡号", list.Idcard.ToString(), Impinfo.Money.ToString() + "元", "充值成功", "如有疑问,请致电客服。");
                        }
                        SendSmsHelper.GetMember_sms(list.Phone, list.Name, list.Idcard.ToString(), list.Password1, Impinfo.Money, "充预付款", comid);//发送短信
                    }
                }//减预付款
                else if (acttype == "reduce_imprest")
                {
                    MemberImprestData impdate = new MemberImprestData();
                    Member_Imprest    Impinfo = new Member_Imprest()
                    {
                        Id        = id,
                        Comid     = comid,
                        Acttype   = acttype,                  //操作类型
                        Money     = 0 - decimal.Parse(money), //交易金额
                        Admin     = username,
                        Ip        = addressIP,
                        Ptype     = 2,
                        Oid       = 0,
                        Remark    = "",
                        OrderId   = orderid,
                        OrderName = ordername
                    };
                    pro = impdate.InsertOrUpdate(Impinfo);
                    if (pro != 0)
                    {
                        B2bCrmData prodata = new B2bCrmData();
                        var        list    = prodata.Readuser(Impinfo.Id, Impinfo.Comid);
                        //SendSmsHelper.GetMember_sms(list.Phone, list.Name, list.Idcard.ToString(), list.Password1, Impinfo.Money, "减预付款", comid);//发送短信
                        if (list.Weixin != "")
                        {
                            new Weixin_tmplmsgManage().WxTmplMsg_CrmConsume(list.Com_id, list.Weixin, "名称", "使用预付款", "会员卡号", list.Idcard.ToString(), DateTime.Now.ToString(), " 使用" + Impinfo.Money + " 元预付款,如有疑问,请致电客服。");
                        }
                    }
                }
                else
                {
                    pro = 0;//正常操作返回0错误
                }

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

                throw;
            }
        }
Beispiel #15
0
        public void Page_Load(object sender, EventArgs e)
        {
            string u = Request.ServerVariables["HTTP_USER_AGENT"];

            bo = detectmobilebrowser.HttpUserAgent(u);


            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "Request.Url:" + Request.Url.ToString());

            id = Request["id"].ConvertTo <string>("");
            string temp_id = Request["id"].ConvertTo <string>("");


            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }


            //取消超时订单
            B2b_com_pro pro_cannelorder = new B2b_com_pro();

            pro_cannelorder.Server_type = 0;
            int rs_cannelorder = new B2bComProData().CancelOvertimeOrder(pro_cannelorder);



            num = Request["num"].ConvertTo <int>(1);

            string aRequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();

            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "aRequestUrl:" + aRequestUrl);
            if (Domain_def.Domain_yanzheng(aRequestUrl))//如果符合shop101.etown.cn的格式
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(aRequestUrl).ToString());
            }

            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }



            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "comid:" + comid);
            #region 判断是否含有微信端传递过来的code值,不含有自刷新
            code = Request.QueryString["code"].ConvertTo <string>("");
            if (code == "")
            {
                selfrefreshurl = WeiXinJsonData.GetFollowOpenLinkUrlAboutPay(comid, "http://shop" + comid + ".etown.cn/wxpay/micromart_pay_" + num + "_" + id + ".aspx");
                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "selfrefreshurl:" + selfrefreshurl);
                //Response.Redirect(refreshurl);
            }
            #endregion


            //buyuid = Request["buyuid"].ConvertTo<int>(0);
            //tocomid = Request["tocomid"].ConvertTo<int>(0);
            //uid = Request["uid"].ConvertTo<int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();


            nowdate  = DateTime.Now.ToString("yyyy-MM-dd");
            nowtoday = DateTime.Now;

            if (temp_id != "")
            {
                B2bOrderData orderdata = new B2bOrderData();
                var          pro       = orderdata.GetOrderById(int.Parse(temp_id));
                if (pro != null)
                {
                    orderstatus = EnumUtils.GetName((OrderStatus)pro.Order_state);
                    order_state = pro.Order_state;
                    subtime     = pro.U_subdate.ToString("yyyy/MM/dd hh:mm:ss");
                    paystate    = pro.Pay_state;

                    #region 微信端 共享收货地址接口 参数获取

                    //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                    B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(pro.Comid);
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                    if (model != null)
                    {
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                        //商家微信支付的所有参数都存在
                        if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                        {
                            appId     = model.Wx_appid;
                            appsecret = model.Wx_appkey;
                            //appkey = model.Wx_paysignkey;
                            //mchid = model.Wx_partnerid;
                            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                            issetfinancepaytype = true;
                            if (code != "")
                            {
                                string url =
                                    string.Format(
                                        "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code",
                                        appId, appsecret, code);
                                string returnStr = HttpUtil.Send("", url);
                                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "returnStr:" + returnStr);

                                var obj = JsonConvert.DeserializeObject <ModelOpenID>(returnStr);
                                if (obj.openid == null)
                                {
                                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "微信转发页面打开的,returnStr:" + returnStr);

                                    selfrefreshurl = WeiXinJsonData.GetFollowOpenLinkUrlAboutPay(comid, "http://shop" + comid + ".etown.cn/wxpay/micromart_pay_" + num + "_" + id + ".aspx");
                                    Response.Redirect(selfrefreshurl);
                                }

                                if (obj != null)
                                {
                                    timeStamp          = TenpayUtil.getTimestamp();
                                    nonceStr           = TenpayUtil.getNoncestr();
                                    access_tokenstring = obj.access_token;
                                    openid             = obj.openid;

                                    HttpCookie newCookie = new HttpCookie("openid");
                                    //往Cookie里面添加值,均为键/值对。Cookie可以根据关键字寻找到相应的值
                                    newCookie.Values.Add("openid", openid);
                                    newCookie.Expires = DateTime.Now.AddDays(365);
                                    //Cookie的设置页面要用Response
                                    Response.AppendCookie(newCookie);

                                    //签名字段:appId、url(当前网页url)、timestamp、noncestr、accessToken
                                    var paySignReqHandler = new RequestHandler(Context);
                                    paySignReqHandler.setParameter("appid", appId);
                                    paySignReqHandler.setParameter("timestamp", timeStamp);
                                    paySignReqHandler.setParameter("noncestr", nonceStr);
                                    paySignReqHandler.setParameter("url", Request.Url.ToString());
                                    paySignReqHandler.setParameter("accesstoken", obj.access_token);
                                    //addrSign = paySignReqHandler.CreateAddrSign();
                                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", appId + ";" + timeStamp + ";" + nonceStr + ";" + Request.Url.ToString() + ";" + obj.access_token + ";" + addrSign);
                                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "Request.Url:" + Request.Url.ToString());
                                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "addrSign:" + addrSign);
                                }
                            }
                        }
                    }

                    #endregion



                    address = pro.U_name + " " + pro.U_phone + "<br>" + pro.Province + " " + pro.City + " " + pro.Address;



                    if (pro.Shopcartid == 0)
                    {
                        B2b_com_pro proinfo = new B2bComProData().GetProById(pro.Pro_id.ToString(), pro.Speciid, pro.channelcoachid);
                        if (proinfo != null)
                        {
                            pro_name    = proinfo.Pro_name;
                            imgurl      = FileSerivce.GetImgUrl(proinfo.Imgurl);
                            Ispanicbuy  = proinfo.Ispanicbuy;
                            Server_type = proinfo.Server_type;
                        }
                        else
                        {
                            pro_name = "对订单进行支付";
                        }
                        pay_price = Math.Round(pro.Pay_price, 2);
                        pro_price = Math.Round(pro.Pay_price * pro.U_num, 2);
                        price     = Math.Round(pro.Pay_price * pro.U_num - pro.Integral1 - pro.Imprest1 + pro.Express, 2);
                        num       = pro.U_num;
                        Express   = Math.Round(pro.Express, 2);
                    }
                    else
                    { //如果是购物车订单,必须一起支付
                        cart_id  = pro.Shopcartid;
                        cart     = 1;
                        price    = Math.Round(orderdata.GetCartOrderMoneyById(pro.Id), 2);
                        pro_name = orderdata.GetCartOrderProById(pro.Id);
                        Express  = Math.Round(orderdata.GetCartOrderExpressMoneyById(pro.Id), 2);
                        num      = 1;
                        var shopcart = orderdata.shopcartorder(pro.Shopcartid);
                        if (shopcart != null)
                        {
                            for (int i = 0; i < shopcart.Count; i++)
                            {
                                pro_price += shopcart[i].Pay_price * shopcart[i].U_num;
                                proid     += shopcart[i].Pro_id + ",";
                            }
                        }

                        pro_price = Math.Round(pro_price, 2);
                    }
                }



                if (price == 0)
                {
                    price = 0;
                }
                else
                {
                    CommonFunc.OperTwoDecimal(price.ToString());
                    //price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                }

                nowdate = DateTime.Now.ToString("yyyy-MM-dd");

                if (summary.Length > 30)
                {
                    summary = summary.Substring(0, 30);
                }
                if (summary.Length > 150)
                {
                    summary = summary.Substring(0, 150) + "...";
                }
                var commodel = B2bCompanyData.GetCompany(comid);
                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                    }
                }


                var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    phone = saleset.Service_Phone;
                }

                //查询项目电话,如果有项目电话调取项目电话
                var projectdata  = new B2b_com_projectData();
                var projectmodel = projectdata.GetProject(projectid, comid);
                if (projectmodel != null)
                {
                    if (projectmodel.Mobile != "")
                    {
                        phone = projectmodel.Mobile;
                    }
                }


                //从cookie中得到微信号
                if (Request.Cookies["openid"] != null)
                {
                    openid = Request.Cookies["openid"].Value;
                }
                B2bCrmData b2b_crm = new B2bCrmData();
                if (openid != "")
                {
                    B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid);
                    if (b2bmodle != null)
                    {
                        Imprest  = b2bmodle.Imprest;
                        Integral = b2bmodle.Integral;
                    }
                }
            }


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
                if (comid != 0)
                {
                    var commodel = B2bCompanyData.GetCompany(comid);

                    if (commodel != null)
                    {
                        if (commodel.B2bcompanyinfo != null)
                        {
                            Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                            Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                            weixinname     = commodel.B2bcompanyinfo.Weixinname;
                            Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                        }

                        title = commodel.Com_name;
                    }


                    B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                    if (pro != null)
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }

                    ////获取微信平台端code
                    //string weixincode = Request["code"].ConvertTo<string>("");
                    ////获取微信号和一次性密码
                    //openid = Request["openid"].ConvertTo<string>("");
                    //string weixinpass = Request["weixinpass"].ConvertTo<string>("");

                    ////获得会员信息
                    //GetCrmInfo(weixincode, openid, weixinpass);
                }
            }


            //获取BANNER,及logo
            if (comid != 0)
            {
                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }
            }



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Beispiel #16
0
        public int isSetVisitDate = 0;           //是否指定日期使用

        public void Page_Load(object sender, EventArgs e)
        {
            string u = Request.ServerVariables["HTTP_USER_AGENT"];

            bo = detectmobilebrowser.HttpUserAgent(u);



            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "Request.Url:" + Request.Url.ToString());

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

            string temp_id         = Request["id"].ConvertTo <string>("");
            string temp_id_speciid = "0";

            if (id.Contains("_"))//检验是否为购物车订单
            {
                cart = 1;
                var id_arr = id.Replace('_', ',');

                //如果包含规格产品
                var prospeciid = new B2bOrderData().SearchCartListBycartid(id_arr);
                if (prospeciid != null)
                {
                    if (prospeciid.Count == 0)
                    {
                        //没有此购物车,跳转购物车重新选择产品
                        Response.Redirect("/h5/order/cart.aspx");
                    }

                    id = "";
                    for (int i = 0; i < prospeciid.Count; i++)
                    {
                        id         += prospeciid[i].Id + ",";
                        id_speciid += prospeciid[i].Speciid + ",";

                        temp_id         = prospeciid[i].Id.ToString();
                        pro_id          = temp_id;
                        temp_id_speciid = prospeciid[i].Speciid.ToString();
                    }
                }
                else
                {
                    //没有此购物车,跳转购物车重新选择产品
                    Response.Redirect("/h5/order/cart.aspx");
                }
            }
            else
            {
                if (id.Contains("g"))//检验是否带规格
                {
                    var id_arr = id.Split('g');
                    id = id_arr[0];
                    //只针对直销单产品顶哦故
                    if (id_arr[1].Contains("s"))
                    {
                        var ids_arr = id_arr[1].Split('s');
                        id_speciid      = ids_arr[0];
                        temp_id_speciid = ids_arr[0];
                        serverid        = ids_arr[1];
                        serverid        = serverid.Replace("A", ",");
                    }
                    else
                    {
                        id_speciid      = id_arr[1];
                        temp_id_speciid = id_arr[1];
                    }

                    temp_id = id_arr[0];
                    pro_id  = id_arr[0];
                }
            }

            //对规格默认赋值为0
            if (temp_id_speciid == "")
            {
                temp_id_speciid = "0";
            }



            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }



            num = Request["num"].ConvertTo <int>(1);

            string aRequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();

            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "aRequestUrl:" + aRequestUrl);
            if (Domain_def.Domain_yanzheng(aRequestUrl))//如果符合shop101.etown.cn的格式
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(aRequestUrl).ToString());
            }

            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }



            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "comid:" + comid);
            #region 判断是否含有微信端传递过来的code值,不含有自刷新
            code = Request.QueryString["code"].ConvertTo <string>("");
            if (code == "")
            {
                selfrefreshurl = WeiXinJsonData.GetFollowOpenLinkUrlAboutPay(comid, "http://shop" + comid + ".etown.cn/wxpay/micromart_pay_" + num + "_" + id + ".aspx");
                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "selfrefreshurl:" + selfrefreshurl);
                //Response.Redirect(refreshurl);
            }
            #endregion


            //buyuid = Request["buyuid"].ConvertTo<int>(0);
            //tocomid = Request["tocomid"].ConvertTo<int>(0);
            //uid = Request["uid"].ConvertTo<int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();


            nowdate  = DateTime.Now.ToString("yyyy-MM-dd");
            nowtoday = DateTime.Now;

            if (temp_id != "")
            {
                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "a");
                B2b_com_pro pro = new B2bComProData().GetProById(temp_id);

                if (pro == null)
                {
                    //没有查询到产品,跳转购物车重新选择产品
                    Response.Redirect("/h5/order/cart.aspx");
                }


                if (pro != null)
                {
                    //判断微信 是否是认证服务号
                    WeiXinBasic mbasic = new WeiXinBasicData().GetWxBasicByComId(pro.Com_id);
                    if (mbasic == null)
                    {
                        iswxsubscribenum = false;
                    }
                    else
                    {
                        if (mbasic.Weixintype == 1 || mbasic.Weixintype == 2)
                        {
                            iswxsubscribenum = true;
                        }
                        else
                        {
                            iswxsubscribenum = false;
                        }
                    }

                    #region 微信端 共享收货地址接口 参数获取

                    //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                    B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(pro.Com_id);
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                    if (model != null)
                    {
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                        //商家微信支付的所有参数都存在
                        if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                        {
                            appId     = model.Wx_appid;
                            appsecret = model.Wx_appkey;
                            //appkey = model.Wx_paysignkey;
                            //mchid = model.Wx_partnerid;
                            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                            issetfinancepaytype = true;
                            if (code != "")
                            {
                                string url =
                                    string.Format(
                                        "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code",
                                        appId, appsecret, code);
                                string returnStr = HttpUtil.Send("", url);
                                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "returnStr:" + returnStr);

                                var obj = JsonConvert.DeserializeObject <ModelOpenID>(returnStr);
                                if (obj.openid == null)
                                {
                                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "微信转发页面打开的,returnStr:" + returnStr);

                                    selfrefreshurl = WeiXinJsonData.GetFollowOpenLinkUrlAboutPay(comid, "http://shop" + comid + ".etown.cn/wxpay/micromart_pay_" + num + "_" + id + ".aspx");
                                    Response.Redirect(selfrefreshurl);
                                }

                                if (obj != null)
                                {
                                    timeStamp          = TenpayUtil.getTimestamp();
                                    nonceStr           = TenpayUtil.getNoncestr();
                                    access_tokenstring = obj.access_token;
                                    openid             = obj.openid;

                                    HttpCookie newCookie = new HttpCookie("openid");
                                    //往Cookie里面添加值,均为键/值对。Cookie可以根据关键字寻找到相应的值
                                    newCookie.Values.Add("openid", openid);
                                    newCookie.Expires = DateTime.Now.AddDays(365);
                                    //Cookie的设置页面要用Response
                                    Response.AppendCookie(newCookie);

                                    //签名字段:appId、url(当前网页url)、timestamp、noncestr、accessToken
                                    var paySignReqHandler = new RequestHandler(Context);
                                    paySignReqHandler.setParameter("appid", appId);
                                    paySignReqHandler.setParameter("timestamp", timeStamp);
                                    paySignReqHandler.setParameter("noncestr", nonceStr);
                                    paySignReqHandler.setParameter("url", Request.Url.ToString());
                                    paySignReqHandler.setParameter("accesstoken", obj.access_token);
                                    //addrSign = paySignReqHandler.CreateAddrSign();
                                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", appId + ";" + timeStamp + ";" + nonceStr + ";" + Request.Url.ToString() + ";" + obj.access_token + ";" + addrSign);
                                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "Request.Url:" + Request.Url.ToString());
                                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "addrSign:" + addrSign);
                                }
                            }
                        }
                    }

                    #endregion


                    //票务产品,判断 是否抢购/限购,是的话 作废超时未支付订单,完成回滚操作
                    if (pro_servertype == 1)
                    {
                        if (pro.Ispanicbuy == 1 || pro.Ispanicbuy == 2)
                        {
                            int rs = new B2bComProData().CancelOvertimeOrder(pro);
                        }
                    }

                    iscanbook      = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                    pro_servertype = pro.Server_type;
                    pickuppoint    = pro.pickuppoint;
                    dropoffpoint   = pro.dropoffpoint;
                    issetidcard    = pro.issetidcard;
                    isSetVisitDate = pro.isSetVisitDate;
                    childreduce    = pro.Childreduce;
                    pro_start      = pro.Pro_start;
                    pro_end        = pro.Pro_end;
                }
                if (pro.Ispanicbuy == 1)
                {
                    panic_begintime  = pro.Panic_begintime;
                    panicbuy_endtime = pro.Panicbuy_endtime;


                    TimeSpan tss = pro.Panic_begintime - nowtoday;
                    var      day = tss.Days * 24 * 3600;;  //这是相差的天数
                    var      h   = tss.Hours * 3600;       //这是相差的小时数,
                    var      m   = tss.Minutes * 60;
                    var      s   = tss.Seconds;
                    shijiacha = day + h + m + s;
                }
                projectid = pro.Projectid;
                comid     = pro.Com_id;

                if (temp_id_speciid != "0") //如果规格非默认值,有规格传递,查询规格的价格 及名称
                {                           //如果含有规格
                    B2b_com_pro prospeciid = new B2bComProData().GetProspeciidById(temp_id, int.Parse(temp_id_speciid));
                    if (prospeciid != null)
                    {
                        pro_name = pro.Pro_name + prospeciid.Pro_name;
                        price    = prospeciid.Advise_price;
                    }
                }
                else
                {
                    pro_name = pro.Pro_name;
                    price    = pro.Advise_price;
                }

                //如果有服务,增加服务价格
                if (serverid != "")
                {
                    var server_arr = serverid.Split(',');
                    for (int i = 0; i < server_arr.Length; i++)
                    {
                        if (server_arr[i] != "")
                        {
                            var rentsrever = new RentserverData().Rentserverbyidandproid(int.Parse(server_arr[i]), int.Parse(temp_id));
                            if (rentsrever != null)
                            {
                                price += rentsrever.saleprice + rentsrever.serverDepositprice;
                            }
                        }
                    }
                }


                imgurl = FileSerivce.GetImgUrl(pro.Imgurl);
                if (price == 0)
                {
                    price = 0;
                }
                else
                {
                    CommonFunc.OperTwoDecimal(price.ToString());
                    //price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                }

                nowdate = DateTime.Now.ToString("yyyy-MM-dd");
                if (pro.Service_Contain != "")
                {
                    summary = "包含服务:" + pro.Service_Contain;
                }

                if (pro.Service_NotContain != "")
                {
                    sumaryend = summary + "</br> 不包含服务:" + pro.Service_NotContain + "</br> 注意事项:" + pro.Precautions;
                }

                if (pro.Precautions != "")
                {
                    sumaryend = summary + "</br> 注意事项:" + pro.Precautions;
                }
                //如果服务类型是 票务;  则备注信息中 显示 电子码使用限制
                if (pro.Server_type == 1)
                {
                    if (pro.Iscanuseonsameday == 0)//电子码当天不可用
                    {
                        sumaryend = "此产品当天预订不可用<br>" + sumaryend;
                    }
                    if (pro.Iscanuseonsameday == 1)//电子码当天可用
                    {
                        sumaryend = "此产品当天预订可用<br>" + sumaryend;
                    }
                    if (pro.Iscanuseonsameday == 2)//电子码出票2小时内不可用
                    {
                        sumaryend = "此产品出票2小时内不可用<br>" + sumaryend;
                    }
                }
                if (summary.Length > 30)
                {
                    summary = summary.Substring(0, 30);
                }
                if (summary.Length > 150)
                {
                    summary = summary.Substring(0, 150) + "...";
                }
                remark  = pro.Pro_Remark;
                pro_num = pro.Pro_number;
                if (pro_num == 0)
                {
                    pro_max = 100;
                    pro_min = 1;
                }
                else
                {
                    pro_min = 1;
                    pro_max = pro_num;
                }
                pro_explain = pro.Pro_explain;



                #region 产品有效期判定(微信模板--门票订单预订成功通知 中也有用到)
                provalidatemethod = pro.ProValidateMethod; //判断 1按产品有效期,2指定有效期
                appointdate       = pro.Appointdata;       //1=一星期,,2=1个月,3=3个月,4=6个月,5=一年
                iscanuseonsameday = pro.Iscanuseonsameday; //1当天可用,0当天不可用

                pro_end = pro.Pro_end;
                //返回有效期
                pro_youxiaoqi = new B2bComProData().GetPro_Youxiaoqi(pro.Pro_start, pro.Pro_end, provalidatemethod, appointdate, iscanuseonsameday);

                #endregion



                var commodel = B2bCompanyData.GetCompany(comid);
                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                    }
                }


                var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    phone = saleset.Service_Phone;
                }

                //查询项目电话,如果有项目电话调取项目电话
                var projectdata  = new B2b_com_projectData();
                var projectmodel = projectdata.GetProject(projectid, comid);
                if (projectmodel != null)
                {
                    if (projectmodel.Mobile != "")
                    {
                        phone = projectmodel.Mobile;
                    }
                }


                //从cookie中得到微信号
                if (Request.Cookies["openid"] != null)
                {
                    openid = Request.Cookies["openid"].Value;
                }
                B2bCrmData b2b_crm = new B2bCrmData();
                if (openid != "")
                {
                    B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid);
                    if (b2bmodle != null)
                    {
                        Imprest  = b2bmodle.Imprest;
                        Integral = b2bmodle.Integral;
                    }
                }
            }

            //如果是购物车产品,整体更换计算方式,以上至是读一个产品信息,并且读取用户的分销信息等
            if (cart == 1)
            {
                cart_num = ""; //数量
                price    = 0;  //单价


                //获取购物车 的用户ID

                if (Request.Cookies["temp_userid"] != null)
                {
                    userid = Request.Cookies["temp_userid"].Value;
                }


                cart_id = id; //赋值方便区分



                if (userid != "")
                {
                    var list = new B2bOrderData().SearchUserCartList(comid, userid, cart_id, id_speciid);
                    if (list != null)
                    {
                        cart_id = "";
                        for (int i = 0; i < list.Count; i++)
                        {
                            cart_num += list[i].U_num + ",";
                            cart_id  += list[i].Id + ",";

                            if (list[i].Speciid == 0)
                            {
                                price += list[i].U_num * list[i].Advise_price; //重新计算价格
                            }
                            else
                            {
                                B2b_com_pro prospeciid = new B2bComProData().GetProspeciidById(list[i].Id.ToString(), list[i].Speciid);//如果含有规格参数 读取规格
                                if (prospeciid != null)
                                {
                                    price += list[i].U_num * prospeciid.Advise_price; //重新计算价格
                                }
                            }
                        }

                        if (cart_num != "")
                        {
                            if (cart_num.Substring(cart_num.Length - 1, 1) == ",")
                            {
                                cart_num = cart_num.Substring(0, cart_num.Length - 1);
                            }
                        }
                        if (cart_id != "")
                        {
                            if (cart_id.Substring(cart_id.Length - 1, 1) == ",")
                            {
                                cart_id = cart_id.Substring(0, cart_id.Length - 1);
                            }
                        }
                    }
                }
            }


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
                if (comid != 0)
                {
                    var commodel = B2bCompanyData.GetCompany(comid);

                    if (commodel != null)
                    {
                        if (commodel.B2bcompanyinfo != null)
                        {
                            Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                            Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                            weixinname     = commodel.B2bcompanyinfo.Weixinname;
                            Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                        }

                        title = commodel.Com_name;
                    }


                    B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                    if (pro != null)
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                        logoimg = comlogo;
                    }

                    ////获取微信平台端code
                    //string weixincode = Request["code"].ConvertTo<string>("");
                    ////获取微信号和一次性密码
                    //openid = Request["openid"].ConvertTo<string>("");
                    //string weixinpass = Request["weixinpass"].ConvertTo<string>("");

                    ////获得会员信息
                    //GetCrmInfo(weixincode, openid, weixinpass);
                }
            }


            //获取BANNER,及logo
            //if (comid != 0)
            //{


            //    //根据公司id得到 直销设置
            //    B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
            //    if (saleset != null)
            //    {
            //        logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo<int>(0));
            //    }

            //}



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AccountId"] != null)
            {
                WxMaterialData Wx     = new WxMaterialData();
                WxMaterial     wmater = Wx.logGetidinfo(" SalePromoteTypeid !=4 order by operatime  desc ");

                int totalcount = 0;


                if (wmater != null)
                {
                    Listtime = wmater.Operatime.ToString("yyyy-MM-dd");
                }

                //账户信息
                AccountId   = Int32.Parse(Session["AccountId"].ToString());
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                RequestUrl  = Request.ServerVariables["SERVER_NAME"].ToLower();

                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }

                //会员信息
                B2bCrmData dateuser  = new B2bCrmData();
                B2b_crm    modeluser = dateuser.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    Servercard    = modeluser.Servercard;
                    Imprest       = modeluser.Imprest;
                    Integral      = modeluser.Integral;
                    //密码
                    AccountPass = modeluser.Password1;
                    //微信关注
                    weixin = modeluser.Weixin == "" ? "未关注" : "已关注";
                }

                //渠道
                MemberChannelData channeldate = new MemberChannelData();

                //渠道信息
                Member_Channel channelmodel = channeldate.GetSelfChannelDetailByCardNo(AccountCard);
                if (channelmodel != null)
                {
                    channeltype = 1;
                    channelid   = channelmodel.Id;

                    RebateConsume = channelmodel.RebateConsume;
                    RebateOpen    = channelmodel.RebateOpen;
                    Opencardnum   = channelmodel.Opencardnum;
                    Firstdealnum  = channelmodel.Firstdealnum;
                    Summoney      = channelmodel.Summoney;
                }


                //服务专员信息,服务专员ID
                if (Servercard != 0)
                {
                    Member_Channel channelmode2 = channeldate.GetChannelDetail(Int32.Parse(Servercard.ToString()));
                    if (channelmode2 != null)
                    {
                        Servername   = channelmode2.Name;
                        Servermobile = channelmode2.Mobile;
                    }
                }

                ////菜单项new WxSalePromoteTypeData()
                //List<WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetAllWxMaterialType(comid, out totalcount);

                //菜单项new WxSalePromoteTypeData()
                List <WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetRecommendWxMaterialType(comid, out totalcount);

                if (comid == 101)
                {
                    List <WxSalePromoteType> list = new List <WxSalePromoteType>();
                    int[] i = { 0, 1, 2, 5, 12 };
                    foreach (int s in i)
                    {
                        WxSalePromoteType wxmaterial = new WxSalePromoteType();

                        wxmaterial.Id       = menulist[s].Id;
                        wxmaterial.Typename = menulist[s].Typename;
                        list.Add(wxmaterial);
                    }

                    menu.DataSource = list;
                    menu.DataBind();
                }
                else
                {
                    menu.DataSource = menulist;
                    menu.DataBind();
                }

                //得到微信会员卡说明和使用门店说明
                int ttcount = 0;
                mcMaterilList = new MemberShipCardMaterialData().GetMCMateralListByComId(comid, out ttcount);
            }
            else
            {
                Response.Redirect("/byts/login.aspx");
            }
        }
Beispiel #18
0
        public static string AccountClaimActPageList(int aid, int cardid, int AccountId, int comid)
        {
            int totalcount = 0;
            var aaid       = 0;
            var ret        = "";

            try
            {
                if (cardid != 0)
                {
                    //查询优惠券
                    MemberActivityData Activitydata  = new MemberActivityData();
                    Member_Activity    Activitymodel = Activitydata.GetMemberActivityById(aid);

                    if (Activitymodel != null)
                    {
                        if (Activitymodel.Runstate == false)
                        {
                            return(JsonConvert.SerializeObject(new { type = 1, msg = "活动已结束" }));
                        }
                        var today = DateTime.Now;

                        if (Activitymodel.Actstar < today && Activitymodel.Actend.AddDays(1) > today)
                        {
                        }
                        else
                        {
                            return(JsonConvert.SerializeObject(new { type = 1, msg = "活动已结束" }));
                        }
                    }


                    //每个活动只能领取一次,防止重复领取,
                    var listact = Activitydata.AccountActInfo(aid, AccountId, comid, out totalcount);
                    if (listact == null)
                    {
                        //领取活动
                        aaid = Activitydata.AccountClaimActPageList(aid, cardid, comid);
                        if (aaid != 0)
                        {
                            if (Activitymodel != null)
                            {
                                if (Activitymodel.Acttype == 4)//只有积分优惠券才会领取时充入积分
                                {
                                    MemberIntegralData intdate = new MemberIntegralData();
                                    Member_Integral    Intinfo = new Member_Integral()
                                    {
                                        Id        = AccountId,
                                        Comid     = comid,
                                        Acttype   = "add_integral",      //操作类型,增加积分
                                        Money     = Activitymodel.Money, //交易金额
                                        Admin     = "领取积分优惠券",
                                        Ip        = "",
                                        Ptype     = 1,
                                        Oid       = 0,
                                        Remark    = "",
                                        OrderId   = 0,
                                        OrderName = Activitymodel.Atitle
                                    };
                                    var InsertIntegral = intdate.InsertOrUpdate(Intinfo);

                                    //优惠券确认使用
                                    Member_Activity actinfo     = null;
                                    string          phone       = "";
                                    string          name        = "";
                                    decimal         idcard      = 0;
                                    decimal         aggcardcode = 0;

                                    MemberCardData carddata = new MemberCardData();
                                    var            confirm  = carddata.EconfirmCard(aaid, aid, cardid, comid, out actinfo, out phone, out name, out idcard, out aggcardcode);



                                    B2bCrmData prodata = new B2bCrmData();
                                    var        list    = prodata.Readuser(AccountId, comid);
                                    //微信消息模板
                                    if (list.Weixin != "")
                                    {
                                        new Weixin_tmplmsgManage().WxTmplMsg_CrmIntegralReward(list.Com_id, list.Weixin, "您好," + AccountId + " 积分已经打入您的账户", list.Idcard.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "活动赠送", Intinfo.Money.ToString(), list.Integral.ToString(), "如有疑问,请致电客服。");
                                    }
                                }
                            }
                        }
                        ret = "OK";
                    }
                    else
                    {
                        ret = "已领取活动";
                    }

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

                throw;
            }
        }
Beispiel #19
0
        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

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

            if (key != "")
            {
                biaoti = key;
            }

            proclass = Request["class"].ConvertTo <int>(0);
            price    = Request["price"].ConvertTo <int>(0);



            if (proclass != 0)
            {
                var prodata = new B2bComProData();
                var result  = prodata.Proclassbyid(proclass);
                if (result != null)
                {
                    biaoti = result.Classname;
                }
            }



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


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
                if (comid != 0)
                {
                    var commodel = B2bCompanyData.GetCompany(comid);

                    if (commodel != null)
                    {
                        if (commodel.B2bcompanyinfo != null)
                        {
                            Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                            Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                        }

                        title = commodel.Com_name;
                    }


                    B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                    if (pro != null)
                    {
                        if (pro.Smalllogo != null && pro.Smalllogo != "")
                        {
                            comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                        }
                    }

                    //获取微信平台端code
                    string weixincode = Request["code"].ConvertTo <string>("");
                    //获取微信号和一次性密码
                    openid = Request["openid"].ConvertTo <string>("");
                    string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                    //获得会员信息
                    GetCrmInfo(weixincode, openid, weixinpass);


                    //如果是一个项目进行跳转
                    int totalcount = 0;
                    var list       = new B2b_com_projectData().ProjectSelectpagelist(1, 1, 10, "", out totalcount, 0, comid.ToString(), 0);
                    if (totalcount == 1 && list != null)
                    {
                        Response.Redirect("Orderlist.aspx?id=" + list[0].Id);
                    }
                }
            }


            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Beispiel #20
0
        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            uid      = Request["uid"].ConvertTo <int>(0);
            MasterId = Request["MasterId"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            id       = Request["id"].ConvertTo <int>(0);
            nowdate  = DateTime.Now.ToString("yyyy-MM-dd");
            nowtoday = DateTime.Now;

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



            //获取随机用户ID


            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }


            if (id != 0)
            {
                B2b_com_pro pro = new B2bComProData().GetProById(id.ToString());
                if (pro != null)
                {
                    channelcoachid = new MemberChannelData().GetChannelidbymanageuserid(MasterId, pro.Com_id);
                    if (pro.Server_type == 13)
                    {
                        //如果 产品为教练产品
                        if (channelcoachid == 0)
                        {
                            //当未选择教练 则 跳转到教练页面
                            Response.Redirect("/h5/coachList.aspx?come=" + id);
                        }
                    }

                    Ispanicbuy       = pro.Ispanicbuy;       //是否抢购或限购
                    Limitbuytotalnum = pro.Limitbuytotalnum; //限购数量
                    bindname         = pro.bookpro_bindname;
                    bindphone        = pro.bookpro_bindphone;
                    manyspeci        = pro.Manyspeci;
                    Wrentserver      = pro.Wrentserver;
                    //如果多规格读取规格
                    if (manyspeci == 1)
                    {
                        gglist = new B2b_com_pro_SpeciData().Getgglist(pro.Id);
                    }


                    //对默认只显示预约电话进行
                    if (pro.Server_type == 12 || pro.Server_type == 13)
                    {
                        //当时预约产品就先设定显示预约电话
                        view_phone = 1;

                        //先判断渠道来路,如果没有渠道则安默认,如果有来路渠道,则显示来路渠道
                        if (MasterId != 0)
                        {
                            B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId);
                            if (manageruser != null)
                            {
                                bindname  = manageruser.Employeename;
                                bindphone = manageruser.Tel;
                            }
                        }


                        //判断 绑定渠道电话 与 访问来的渠道电话相同 则 显示电话,并显示预订
                        if (bindphone == pro.bookpro_bindphone)
                        {
                            view_phone = 2;
                        }

                        //如果为教练产品,显示订购和 和图像 不显示电话
                        if (pro.Server_type == 13)
                        {
                            view_phone = 3;
                        }
                    }


                    //通过 显示渠道的电话 来查找头像


                    B2b_company_manageuser manageruser_temp = new B2bCompanyManagerUserData().GetCompanyUserByPhone(bindphone, pro.Com_id);
                    if (manageruser_temp != null)
                    {
                        channleimg = FileSerivce.GetImgUrl(manageruser_temp.Headimg);
                        if (channleimg == "/Images/defaultThumb.png")
                        {
                            channleimg = "";
                        }
                    }



                    //查询相关项目名称
                    var proprojectdata = new B2b_com_projectData();

                    var proprejectinfo = proprojectdata.GetProject(pro.Projectid, pro.Com_id);
                    if (proprejectinfo != null)
                    {
                        projectname = proprejectinfo.Projectname;
                        Coordinate  = proprejectinfo.Coordinate;
                        Address     = proprejectinfo.Address;
                    }

                    projectname = proprojectdata.GetProjectNameByid(pro.Projectid);



                    //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                    B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(pro.Com_id);
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                    if (model != null)
                    {
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                        //商家微信支付的所有参数都存在
                        if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                        {
                            //appId = model.Wx_appid;
                            //appsecret = model.Wx_appkey;
                            //appkey = model.Wx_paysignkey;
                            //mchid = model.Wx_partnerid;
                            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                            issetfinancepaytype = true;
                        }
                    }



                    //票务产品,判断 是否抢购/限购,是的话 作废超时未支付订单,完成回滚操作
                    if (pro_servertype == 1)
                    {
                        if (pro.Ispanicbuy == 1 || pro.Ispanicbuy == 2)
                        {
                            int rs = new B2bComProData().CancelOvertimeOrder(pro);
                        }
                    }

                    iscanbook      = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                    pro_servertype = pro.Server_type;
                    pickuppoint    = pro.pickuppoint;
                    dropoffpoint   = pro.dropoffpoint;


                    childreduce = pro.Childreduce;

                    if (pro.Ispanicbuy == 1)
                    {
                        panic_begintime  = pro.Panic_begintime;
                        panicbuy_endtime = pro.Panicbuy_endtime;


                        TimeSpan tss = pro.Panic_begintime - nowtoday;
                        var      day = tss.Days * 24 * 3600;; //这是相差的天数
                        var      h   = tss.Hours * 3600;      //这是相差的小时数,
                        var      m   = tss.Minutes * 60;
                        var      s   = tss.Seconds;
                        shijiacha = day + h + m + s;
                    }
                    projectid        = pro.Projectid;
                    comid            = pro.Com_id;
                    pro_name         = pro.Pro_name;
                    price            = pro.Advise_price;
                    face_price       = pro.Face_price;
                    limitbuytotalnum = pro.Limitbuytotalnum;
                    imgurl           = FileSerivce.GetImgUrl(pro.Imgurl);

                    //如果含有规格读取规格价格中最低价
                    if (manyspeci == 1)
                    {
                        if (gglist != null)
                        {
                            price      = 0;
                            face_price = 0;
                            for (int i = 0; i < gglist.Count(); i++)
                            {
                                if (gglist[i].speci_advise_price != 0)
                                {
                                    if (price == 0 || price > gglist[i].speci_advise_price)
                                    {
                                        price      = gglist[i].speci_advise_price;
                                        face_price = gglist[i].speci_face_price;
                                    }
                                }
                            }
                        }
                    }



                    if (price == 0)
                    {
                        price = 0;
                    }
                    else
                    {
                        CommonFunc.OperTwoDecimal(price.ToString());
                        //price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                    }

                    if (face_price != 0)
                    {
                        CommonFunc.OperTwoDecimal(face_price.ToString());
                    }


                    nowdate = DateTime.Now.ToString("yyyy-MM-dd");


                    if (pro.Service_Contain != "")
                    {
                        sumaryend = pro.Service_Contain;
                    }

                    if (pro.Service_NotContain != "")
                    {
                        sumaryend = sumaryend + "</br> " + pro.Service_NotContain;
                    }

                    if (pro.Precautions != "")
                    {
                        sumaryend = sumaryend + "</br> " + pro.Precautions;
                    }

                    Server_type = pro.Server_type;

                    bookpro_ispay = pro.bookpro_ispay;

                    //如果服务类型是 票务;  则备注信息中 显示 电子码使用限制
                    if (pro.Server_type == 1)
                    {
                        if (pro.Iscanuseonsameday == 0)//电子码当天不可用
                        {
                            youxianshiduan = "此产品当天预订不可用";
                        }
                        if (pro.Iscanuseonsameday == 1)//电子码当天可用
                        {
                            youxianshiduan = "此产品当天预订可用";
                        }
                        if (pro.Iscanuseonsameday == 2)//电子码出票2小时内不可用
                        {
                            youxianshiduan = "此产品出票2小时内不可用";
                        }
                    }

                    remark  = pro.Pro_Remark;
                    pro_num = pro.Pro_number;
                    if (pro_num == 0)
                    {
                        pro_max = 100;
                        pro_min = 1;
                    }
                    else
                    {
                        pro_min = 1;
                        pro_max = pro_num;
                    }
                    pro_explain = pro.Pro_explain;



                    #region 产品有效期判定(微信模板--门票订单预订成功通知 中也有用到)
                    provalidatemethod = pro.ProValidateMethod; //判断 1按产品有效期,2指定有效期
                    appointdate       = pro.Appointdata;       //1=一星期,,2=1个月,3=3个月,4=6个月,5=一年
                    iscanuseonsameday = pro.Iscanuseonsameday; //1当天可用,0当天不可用

                    pro_end     = pro.Pro_end;
                    pro_end_str = pro.Pro_end.AddMonths(-1).ToString("yyyy,MM,dd");
                    //返回有效期
                    pro_youxiaoqi = new B2bComProData().GetPro_Youxiaoqi(pro.Pro_start, pro.Pro_end, provalidatemethod, appointdate, iscanuseonsameday);

                    #endregion


                    //如果是 教练产品 根据教练信息 获取教练 上班时间

                    if (pro.Server_type == 13 || pro.Server_type == 12)
                    {                      //必须是教练产品
                        if (MasterId != 0) //必须有教练参数
                        {
                            B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId);
                            if (manageruser != null)
                            {
                                if (manageruser.Workdays != "")
                                {
                                    if (manageruser.worktimestar != 0)
                                    {
                                        if (manageruser.worktimestar < manageruser.worktimeend)
                                        {
                                            for (var i = manageruser.worktimestar; i < manageruser.worktimeend; i++)
                                            {
                                                workh += "<option value=\"" + i + "\">" + i + "点</option>";
                                            }
                                        }
                                        else
                                        {
                                            var day1 = 24 - manageruser.worktimestar;
                                            var day2 = manageruser.worktimeend;
                                            var day3 = day1 + day2;

                                            for (var i = 0; i > day3; i++)
                                            {
                                                if (i > day1)
                                                {
                                                    workh += "<option value=\"" + (manageruser.worktimestar + i) + "\">" + (manageruser.worktimestar + i) + "点</option>";
                                                }
                                                else
                                                {
                                                    workh += "<option value=\"" + (manageruser.worktimestar - i) + "\">" + (manageruser.worktimestar - i) + "点</option>";
                                                }
                                            }
                                        }
                                    }



                                    if (!manageruser.Workdays.Contains("2"))                                              //检验不含周一
                                    {
                                        DateTime dt        = DateTime.Now;                                                //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))); //本周周一

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }

                                    if (!manageruser.Workdays.Contains("3"))                                                         //检验不含周二
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(1); //本周周二

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("4"))                                                         //检验不含周3
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(2); //本周周3

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("5"))                                                         //检验不含周4
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(3); //本周周4

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("6"))                                                         //检验不含周5
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(4); //本周周5


                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("7"))                                                         //检验不含周6
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(5); //本周周6

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("1"))                                                         //检验不含周日
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(6); //本周周日


                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }



                var commodel = B2bCompanyData.GetCompany(comid);
                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                    }
                }


                var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    phone = saleset.Service_Phone;
                }

                //查询项目电话,如果有项目电话调取项目电话
                var projectdata  = new B2b_com_projectData();
                var projectmodel = projectdata.GetProject(projectid, comid);
                if (projectmodel != null)
                {
                    if (projectmodel.Mobile != "")
                    {
                        phone = projectmodel.Mobile;
                    }
                }


                //从cookie中得到微信号
                if (Request.Cookies["openid"] != null)
                {
                    openid = Request.Cookies["openid"].Value;
                }
                B2bCrmData b2b_crm = new B2bCrmData();
                if (openid != "")
                {
                    B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid);
                    if (b2bmodle != null)
                    {
                        Imprest  = b2bmodle.Imprest;
                        Integral = b2bmodle.Integral;
                    }
                }
            }



            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var wxdomain = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl);
                if (wxdomain != null)
                {
                    comid = wxdomain.Comid;
                }
            }
            if (comid != 0)
            {
                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }



            //获取BANNER,及logo
            if (comid != 0)
            {
                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }
            }


            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WxMaterialData Wx     = new WxMaterialData();
            WxMaterial     wmater = Wx.logGetidinfo(" SalePromoteTypeid !=4 order by operatime  desc ");

            int totalcount = 0;


            if (wmater != null)
            {
                Listtime = wmater.Operatime.ToString("yyyy-MM-dd");
            }


            ////判断如果是否为手机访问
            //if (detectmobilebrowser.HttpUserAgent(Request.ServerVariables["HTTP_USER_AGENT"]))
            //{
            //    if (Request["brow"]=="PC")//如果接收到传递PC访问则只PC版
            //    {
            //         Cookie.WriteCookie("Mobile_Brow_Set", "PC");
            //    }
            //
            //    //查看COOKIE 是否设定是否设定为PC
            //    if (Cookie.GetCookie("Mobile_Brow_Set") == "PC")
            //    {
            //    }
            //    else
            //    {
            //          Response.Redirect("/M/Default.aspx?brow=MO");
            //    }
            //}

            if (Session["AccountId"] != null)
            {
                //账户信息
                AccountId   = Int32.Parse(Session["AccountId"].ToString());
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                RequestUrl  = Request.ServerVariables["SERVER_NAME"].ToLower();

                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }

                if (comid != 101)
                {
                    Response.Redirect("/ui/shangjiaui/ProductList.aspx");
                }


                //会员信息
                B2bCrmData dateuser  = new B2bCrmData();
                B2b_crm    modeluser = dateuser.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    Servercard    = modeluser.Servercard;
                    Imprest       = modeluser.Imprest;
                    Integral      = modeluser.Integral;
                    //密码
                    AccountPass = modeluser.Password1;
                    //微信关注
                    weixin = modeluser.Weixin == "" ? "未关注" : "已关注";
                }

                //渠道
                MemberChannelData channeldate = new MemberChannelData();

                //渠道信息
                Member_Channel channelmodel = channeldate.GetSelfChannelDetailByCardNo(AccountCard);
                if (channelmodel != null)
                {
                    channeltype = 1;
                    channelid   = channelmodel.Id;

                    RebateConsume = channelmodel.RebateConsume;
                    RebateOpen    = channelmodel.RebateOpen;
                    Opencardnum   = channelmodel.Opencardnum;
                    Firstdealnum  = channelmodel.Firstdealnum;
                    Summoney      = channelmodel.Summoney;
                }


                //服务专员信息,服务专员ID
                if (Servercard != 0)
                {
                    Member_Channel channelmode2 = channeldate.GetChannelDetail(Int32.Parse(Servercard.ToString()));
                    if (channelmode2 != null)
                    {
                        Servername   = channelmode2.Name;
                        Servermobile = channelmode2.Mobile;
                    }
                }

                //菜单项new WxSalePromoteTypeData()
                List <WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetAllWxMaterialType(comid, out totalcount);

                if (comid == 101)
                {
                    List <WxSalePromoteType> list = new List <WxSalePromoteType>();
                    int[] i = { 0, 1, 2, 5, 12 };
                    foreach (int s in i)
                    {
                        WxSalePromoteType wxmaterial = new WxSalePromoteType();

                        wxmaterial.Id       = menulist[s].Id;
                        wxmaterial.Typename = menulist[s].Typename;
                        list.Add(wxmaterial);
                    }

                    menu.DataSource = list;
                    menu.DataBind();
                }
                else
                {
                    menu.DataSource = menulist;
                    menu.DataBind();
                }
            }
            else
            {
                Response.Redirect("/V/card.aspx");
            }
        }
Beispiel #22
0
        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            id = Request["id"].ConvertTo <int>(0);
            string md5 = Request["md5"].ConvertTo <string>("");

            string Returnmd5 = EncryptionHelper.ToMD5(id.ToString() + "lixh1210", "UTF-8");


            var orderdata = new B2bOrderData();
            var orderinfo = orderdata.GetOrderById(id);

            if (orderinfo != null)
            {
                u_name = orderinfo.U_name;

                //判断登陆状态
                //if (Session["AccountId"] != null)
                //{
                //先判断Session
                //int AccountId = int.Parse(Session["AccountId"].ToString());

                if (Returnmd5 == md5)       //必须符合加密的才能打开
                {
                    yuyuetime = orderinfo.U_traveldate.ToString("yyyy-MM-dd hh:mm:ss");
                    var prodata = new B2bComProData();
                    var proinfo = prodata.GetProById(orderinfo.Pro_id.ToString());
                    if (proinfo != null)
                    {
                        Pro_name  = proinfo.Pro_name;
                        bindiname = proinfo.bookpro_bindname;
                        bindphone = proinfo.bookpro_bindphone;

                        var managedata = new B2bCompanyManagerUserData();
                        var manageinfo = managedata.GetCompanyUserByPhone(bindphone, proinfo.Com_id);
                        if (manageinfo != null)
                        {
                            bindimg = FileSerivce.GetImgUrl(manageinfo.Headimg);
                        }
                    }
                }
                //}
            }



            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

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

            if (key != "")
            {
                biaoti = key;
            }

            proclass = Request["class"].ConvertTo <int>(0);
            price    = Request["price"].ConvertTo <int>(0);



            if (proclass != 0)
            {
                var prodata = new B2bComProData();
                var result  = prodata.Proclassbyid(proclass);
                if (result != null)
                {
                    biaoti = result.Classname;
                }
            }

            //获取随机用户ID
            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }

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


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }



            if (comid != 0)
            {
                //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(comid);
                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                if (model != null)
                {
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                    //商家微信支付的所有参数都存在
                    if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                    {
                        //appId = model.Wx_appid;
                        //appsecret = model.Wx_appkey;
                        //appkey = model.Wx_paysignkey;
                        //mchid = model.Wx_partnerid;
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                        issetfinancepaytype = true;
                    }
                }


                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }


            //获取BANNER,及logo
            if (comid != 0)
            {
                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }
            }



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
Beispiel #23
0
        public string comlogo = ""; //公司logo地址

        protected void Page_Load(object sender, EventArgs e)
        {
            openid = Request["openid"];
            act    = Request["act"];
            aid    = Request["aid"].ToString();

            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();


            //如果SESSION有值,进行赋值
            if (openid == "" && Session["Openid"] != null)
            {
                openid = Session["Openid"].ToString();
            }

            //根据域名读取商户ID,如果没有绑定域名直接跳转后台
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }

            if (comid != 0)
            {
                //根据公司id得到公司logo地址和公司名称
                comname = B2bCompanyData.GetCompany(comid).Com_name;
                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

                if (pro != null)
                {
                    comlogo = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0));
                }
            }
            //如果账户登陆状态则读取用户信息
            if (Session["AccountId"] != null)
            {
                //获取用户卡号
                B2bCrmData crmdate  = new B2bCrmData();
                B2b_crm    crmmodle = crmdate.Readuser(Int32.Parse(Session["AccountId"].ToString()), comid);

                if (crmmodle != null)
                {
                    cardcode = crmmodle.Idcard;
                }

                //获取优惠劵信息 对已领的优惠劵和未领的优惠劵
                if (aid != "")
                {
                    MemberActivityData actdata = new MemberActivityData();
                    if (act == "A")//已领的优惠劵
                    {
                        Member_Activity actmodel = actdata.AccountActInfo(Int32.Parse(aid), Int32.Parse(Session["AccountId"].ToString()), comid, out totalcount);
                        if (actmodel != null)
                        {
                            Actend   = actmodel.Actend.ToString("yyyy-MM-dd");
                            Title    = actmodel.Title;
                            usestate = actmodel.Usestate;
                            Atitle   = actmodel.Atitle;
                            Remark   = actmodel.Remark.Replace(((char)10).ToString(), "<br />");
                            //Useremark = actmodel.Useremark;
                            Usetitle = actmodel.Usetitle.Replace(((char)10).ToString(), "<br />");
                        }
                    }
                    else
                    {//未领取的
                        Member_Activity actmodel = actdata.UnAccountActInfo(Int32.Parse(aid), 0, comid, out totalcount);
                        if (actmodel != null)
                        {
                            Actend = actmodel.Actend.ToString("yyyy-MM-dd");
                            Title  = actmodel.Title;
                            Atitle = actmodel.Atitle;
                            Remark = actmodel.Remark.Replace(((char)10).ToString(), "<br />");
                            //Useremark = actmodel.Useremark.Replace(((char)10).ToString(), "<br />");
                            Usetitle = actmodel.Usetitle;
                            usestate = 6;
                        }
                    }


                    //活动使用门市
                    MemberChannelcompanyData chandata = new MemberChannelcompanyData();
                    var list = chandata.GetUnitListselected(int.Parse(aid));
                    if (list != null)
                    {
                        for (int i = 0; i < list.Count(); i++)
                        {
                            Useremark += list[i].Companyname + " <br>";
                        }
                    }
                }
                else
                {
                    Response.Redirect("/M/Default.aspx");
                }
            }
            else
            {//非会员看未领取的
                if (aid != "")
                {
                    MemberActivityData actdata  = new MemberActivityData();
                    Member_Activity    actmodel = actdata.UnAccountActInfo(Int32.Parse(aid), 0, comid, out totalcount);
                    if (actmodel != null)
                    {
                        Actend    = actmodel.Actend.ToString("yyyy-MM-dd");
                        Title     = actmodel.Title;
                        Atitle    = actmodel.Atitle;
                        Remark    = actmodel.Remark.Replace(((char)10).ToString(), "<br />");
                        Useremark = actmodel.Useremark.Replace(((char)10).ToString(), "<br />");
                        Usetitle  = actmodel.Usetitle.Length > 14 ? actmodel.Usetitle.Substring(0, 13) + "." : actmodel.Useremark;
                        usestate  = 5;
                    }
                }
            }
        }
        private void GetMemberCard(string openid, string weixincode, string weixinpass, int comid)
        {
            //如果SESSION有值,进行赋值
            if (openid == "" && Session["Openid"] != null)
            {
                openid = Session["Openid"].ToString();
            }

            //判断商家是否微信认证
            if (weixincode != "")//进行过微信认证,微信认证登陆
            {
                //如果微信ID,递实现自动登陆
                GetOpenId(weixincode, comid);
            }
            else if (openid != "" && weixinpass != "")
            {
                //最后判断传递过来的微信一次性密码
                VerifyOneOffPass(openid, weixinpass);
            }



            //判断登陆状态
            if (Session["AccountId"] != null)
            {
                //先判断Session
                AccountId = int.Parse(Session["AccountId"].ToString());
                B2bCrmData dateuser = new B2bCrmData();
                B2b_crm    userinfo = dateuser.Readuser(AccountId, comid);
                if (userinfo != null)
                {
                    Readuser(userinfo.Idcard, comid);
                }
            }
            else
            {//再判断COOKIES
                if (Request.Cookies["AccountId"] != null)
                {
                    string accountmd5 = "";
                    AccountId = int.Parse(Request.Cookies["AccountId"].Value);
                    if (Request.Cookies["AccountKey"] != null)
                    {
                        accountmd5 = Request.Cookies["AccountKey"].Value;
                    }
                    B2b_crm userinfo;
                    var     data = CrmMemberJsonData.WeixinCookieLogin(AccountId.ToString(), accountmd5, comid, out userinfo);
                    if (data == "OK")
                    {
                        Session["AccountId"]   = userinfo.Id;
                        Session["AccountName"] = userinfo.Name;
                        Session["AccountCard"] = userinfo.Idcard;
                        Session["Com_id"]      = comid;
                        HttpCookie cookie = new HttpCookie("AccountId");     //实例化HttpCookie类并添加值
                        cookie.Value   = userinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                        var returnmd5 = EncryptionHelper.ToMD5(userinfo.Idcard.ToString() + userinfo.Id.ToString(), "UTF-8");
                        cookie         = new HttpCookie("AccountKey"); //实例化HttpCookie类并添加值
                        cookie.Value   = returnmd5;
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);

                        cookie         = new HttpCookie("openid"); //实例化HttpCookie类并添加值
                        cookie.Value   = userinfo.Weixin;
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);

                        if (userinfo != null)
                        {
                            Readuser(userinfo.Idcard, comid);//读取用户信息
                        }

                        Response.Redirect(Request.Url.ToString()); //登陆成功,刷新页面
                    }
                    else
                    {
                        //当cookie错误无法登陆则清除所有COOKIE
                        HttpCookie aCookie; string cookieName;
                        int        limit = Request.Cookies.Count;
                        for (int i = 0; i < limit; i++)
                        {
                            cookieName      = Request.Cookies[i].Name;
                            aCookie         = new HttpCookie(cookieName);
                            aCookie.Expires = DateTime.Now.AddDays(-1);
                            Response.Cookies.Add(aCookie);
                        }

                        if (Request.Cookies["AccountId"] != null)
                        {
                            HttpCookie mycookie;
                            mycookie = Request.Cookies["AccountId"];
                            TimeSpan ts = new TimeSpan(0, 0, 0, 0);  //时间跨度
                            mycookie.Expires = DateTime.Now.Add(ts); //立即过期
                            Response.Cookies.Remove("AccountId");    //清除
                            Response.Cookies.Add(mycookie);          //写入立即过期的*/
                            Response.Cookies["AccountId"].Expires = DateTime.Now.AddDays(-1);
                        }
                        if (Request.Cookies["AccountName"] != null)
                        {
                            HttpCookie mycookie = Request.Cookies["AccountName"];
                            TimeSpan   ts       = new TimeSpan(0, 0, 0, 0); //时间跨度
                            mycookie.Expires = DateTime.Now.Add(ts);        //立即过期
                            Response.Cookies.Remove("AccountName");         //清除
                            Response.Cookies.Add(mycookie);                 //写入立即过期的*/
                            Response.Cookies["AccountName"].Expires = DateTime.Now.AddDays(-1);
                        }
                        if (Request.Cookies["AccountKey"] != null)
                        {
                            HttpCookie mycookie = Request.Cookies["AccountKey"];
                            TimeSpan   ts       = new TimeSpan(0, 0, 0, 0); //时间跨度
                            mycookie.Expires = DateTime.Now.Add(ts);        //立即过期
                            Response.Cookies.Remove("AccountKey");          //清除
                            Response.Cookies.Add(mycookie);                 //写入立即过期的*/
                            Response.Cookies["AccountKey"].Expires = DateTime.Now.AddDays(-1);
                        }


                        if (weixincode != "")
                        {//如果微信认证代码,微信认证登陆
                            GetOpenId(weixincode, comid);
                        }
                        else if (openid != "" && weixinpass != "")
                        {
                            VerifyOneOffPass(openid, weixinpass);
                        }
                    }
                }
            }
        }
Beispiel #25
0
        public string authorpayurl = ""; //作者关注链接
        protected void Page_Load(object sender, EventArgs e)
        {
            uid        = Request["uid"].ConvertTo <int>(0);
            materialid = Request["materialid"].ConvertTo <int>(0);

            //获取IP地址
            uip = CommonFunc.GetRealIP();

            WxMaterial wxmaterial = new WxMaterialData().GetWxMaterial(materialid);

            nowdate = DateTime.Now.ToString("yyyy-MM-dd");

            string weixincode = Request["code"].ConvertTo <string>("");
            string openid     = Request["openid"].ConvertTo <string>("");



            if (wxmaterial != null)
            {
                authorpayurl = wxmaterial.Authorpayurl;
                comid        = wxmaterial.Comid;
                Author       = wxmaterial.Author;

                id         = wxmaterial.MaterialId;
                title      = wxmaterial.Title;
                thisday    = DateTime.Now.ToString("yyyy-MM-dd");
                article    = wxmaterial.Article;
                Articleurl = wxmaterial.Articleurl;
                phone_tel  = wxmaterial.Phone;
                phone      = "客服电话:";
                price      = wxmaterial.Price.ToString();
                datetime   = wxmaterial.Operatime.ToString("yyyy-MM-dd");

                if (price == "0.00" || price == "0")
                {
                    price = "";
                }
                else
                {
                    price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                    price = "¥" + price;
                }



                //期
                wxtype   = wxmaterial.SalePromoteTypeid;
                percalid = wxmaterial.Periodicalid;
                periodical period = new WxMaterialData().selectperiodical(percalid);
                if (period != null)
                {
                    percal  = period.Percal;
                    peryear = period.Peryear;
                }

                summary = wxmaterial.Summary;
                var identityFileUpload = new FileUploadData().GetFileById(wxmaterial.Imgpath.ToString().ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    if (identityFileUpload.Relativepath != "")
                    {
                        headPortraitImgSrc = fileUrl + identityFileUpload.Relativepath;
                    }
                }
                else
                {
                    headPortraitImgSrc = "";
                }


                //微信转发访问统计
                if (uid != 0)//必须记录转发用户信息才能继续统计
                {
                    //查询是否有此cookies,有此cooki则证明已经访问过的用户
                    if (Request.Cookies["wxact" + materialid.ToString()] == null)
                    {
                        forward = new MemberForwardingData().Forwardingcount(uid, materialid, uip, comid);

                        if (forward > 0)
                        {
                            HttpCookie cookie = new HttpCookie("wxact" + materialid.ToString());     //实例化HttpCookie类并添加值
                            cookie.Value   = "yes";
                            cookie.Expires = DateTime.Now.AddDays(365);
                            Response.Cookies.Add(cookie);
                        }
                    }


                    //判断有转发人的渠道
                    var    crmdata       = new B2bCrmData();
                    var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                    string zhuanfa_phone = "";
                    if (pro != null)
                    {
                        zhuanfa_phone = pro.Phone;
                    }


                    if (zhuanfa_phone != "")
                    {                                                                                  //转发人手机存在
                        MemberChannelData channeldata = new MemberChannelData();
                        var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                        if (channeinfo != null)
                        {
                            //转发人渠道记录COOKI
                            HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                            cookie.Value   = channeinfo.Id.ToString();
                            cookie.Expires = DateTime.Now.AddDays(120);
                            Response.Cookies.Add(cookie);

                            cookie         = new HttpCookie("ZF_WxmaterialId"); //实例化HttpCookie类并添加值
                            cookie.Value   = materialid.ToString();
                            cookie.Expires = DateTime.Now.AddDays(120);
                            Response.Cookies.Add(cookie);
                        }
                    }
                }
            }


            if (comid != 0)
            {
                if (weixincode != "")
                {
                    int questtype = 2;//1=微信授权验证
                    DealUserinfo1("", weixincode, comid, questtype);
                }
                else if (openid != "")
                {
                    string weixinpass = Request["weixinpass"].ConvertTo <string>("");
                    int    questtype  = 1;                               //1=一次性密码验证
                    DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
                }
            }
        }
Beispiel #26
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string oper = context.Request["oper"].ConvertTo <string>("");

            if (oper != "")
            {
                if (oper == "getunitlist")
                {
                    int    unittype = context.Request["unittype"].ConvertTo <int>(0);//默认显示内部渠道
                    string data     = ChannelJsonData.GetUnitList(unittype);
                    context.Response.Write(data);
                }
                if (oper == "getunitlistneww")
                {
                    int unittype = context.Request["unittype"].ConvertTo <int>(0);//默认显示内部渠道,加公司限制
                    int comid    = context.Request["comid"].ConvertTo <int>(0);
                    int actid    = context.Request["actid"].ConvertTo <int>(0);
                    int userid   = context.Request["userid"].ConvertTo <int>(0);

                    string data = ChannelJsonData.GetUnitList(comid, unittype, userid, actid);
                    context.Response.Write(data);
                }
                if (oper == "getunitlist2")                                                //只是用于员工管理页面
                {
                    string ischosen = context.Request["ischosen"].ConvertTo <string>("0"); //渠道来源中“所属门市”是否选中
                    int    userid   = context.Request["userid"].ConvertTo <int>(0);
                    string unittype = context.Request["unittype"].ConvertTo <string>("0"); //默认显示内部渠道,加公司限制
                    int    comid    = context.Request["comid"].ConvertTo <int>(0);

                    string data = ChannelJsonData.GetUnitList(comid, unittype, ischosen, userid);
                    context.Response.Write(data);
                }
                if (oper == "GetChannelCompanyList")
                {
                    string channeltype = context.Request["channeltype"].ConvertTo <string>("");
                    int    comid       = context.Request["comid"].ConvertTo <int>();
                    int    pageindex   = context.Request["pageindex"].ConvertTo <int>(1);
                    int    pagesize    = context.Request["pagesize"].ConvertTo <int>(10);

                    string data = ChannelJsonData.GetChannelCompanyList(comid, channeltype, pageindex, pagesize);
                    context.Response.Write(data);
                }
                if (oper == "GetChannelCompany")
                {
                    string channelcompanyid = context.Request["channelcompanyid"].ConvertTo <string>("");
                    string data             = ChannelJsonData.GetChannelCompany(channelcompanyid);
                    context.Response.Write(data);
                }
                if (oper == "getchanneldetail")
                {
                    int channelid = context.Request["channelid"].ConvertTo <int>(0);

                    string date = ChannelJsonData.GetChannelDetail(channelid);
                    context.Response.Write(date);
                }
                if (oper == "getchanneldetailnew")
                {
                    int    channelid = context.Request["channelid"].ConvertTo <int>(0);
                    int    comid     = context.Request["comid"].ConvertTo <int>(0);
                    string date      = ChannelJsonData.GetChannelDetail(channelid, comid);
                    context.Response.Write(date);
                }
                if (oper == "getchannelcompanyname")
                {
                    int comid            = context.Request["comid"].ConvertTo <int>(0);
                    int channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0);

                    string date = ChannelJsonData.Getchannelcompanyname(channelcompanyid, comid);
                    context.Response.Write(date);
                }
                if (oper == "editchannel")
                {
                    var id            = context.Request["id"];
                    var comid         = context.Request["comid"];
                    var Issuetype     = context.Request["Issuetype"];
                    var companyid     = context.Request["companyid"];
                    var name          = context.Request["name"];
                    var mobile        = context.Request["mobile"];
                    var cardcode      = context.Request["cardcode"].ConvertTo <decimal>(0);
                    var chadress      = context.Request["chadress"];
                    var chobjects     = context.Request["chobjects"];
                    var rebateopen    = context.Request["rebateopen"];
                    var rebateconsume = context.Request["rebateconsume"];
                    var rebateleval   = context.Request["rebateleval"];

                    var opencardnum  = context.Request["opencardnum"];
                    var firstdealnum = context.Request["firstdealnum"];
                    var summoney     = context.Request["summoney"];

                    int whetherdefaultchannel = context.Request["whetherdefaultchannel"].ConvertTo <int>(0);
                    int runstate = context.Request["runstate"].ConvertTo <int>(1);

                    Member_Channel channel = new Member_Channel()
                    {
                        Id                    = id.ConvertTo <int>(0),
                        Com_id                = comid.ConvertTo <int>(0),
                        Issuetype             = Issuetype.ConvertTo <int>(1),
                        Companyid             = companyid.ConvertTo <int>(0),
                        Name                  = name,
                        Mobile                = mobile,
                        Cardcode              = cardcode,
                        Chaddress             = chadress,
                        ChObjects             = chobjects,
                        RebateOpen            = rebateopen.ConvertTo <decimal>(0),
                        RebateConsume         = rebateconsume.ConvertTo <decimal>(0),
                        RebateConsume2        = 0,
                        RebateLevel           = rebateleval.ConvertTo <int>(0),
                        Opencardnum           = opencardnum.ConvertTo <int>(0),
                        Firstdealnum          = firstdealnum.ConvertTo <int>(0),
                        Summoney              = summoney.ConvertTo <decimal>(0),
                        Whetherdefaultchannel = whetherdefaultchannel,
                        Runstate              = runstate
                    };

                    string data = ChannelJsonData.EditChannel(channel);
                    context.Response.Write(data);
                }
                if (oper == "pagelist")
                {
                    var comid     = context.Request["comid"];
                    var pageindex = context.Request["pageindex"].ConvertTo <int>(0);
                    var pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    var issuetype = context.Request["issuetype"].ConvertTo <string>("all");

                    var userid = context.Request["userid"].ConvertTo <int>(0);

                    string data = ChannelJsonData.PageList(comid, pageindex, pagesize, issuetype, userid);

                    context.Response.Write(data);
                }
                if (oper == "channellistbycomid")
                {
                    var comid     = context.Request["comid"];
                    var pageindex = context.Request["pageindex"].ConvertTo <int>(0);
                    var pagesize  = context.Request["pagesize"].ConvertTo <int>(10);


                    string data = ChannelJsonData.Channellistbycomid(comid, pageindex, pagesize);

                    context.Response.Write(data);
                }

                //渠道查询
                if (oper == "searchpagelist")
                {
                    var comid     = context.Request["comid"];
                    var pageindex = context.Request["pageindex"].ConvertTo <int>(0);
                    var pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    var key       = context.Request["key"].ConvertTo <string>("");
                    var select    = context.Request["select"].ConvertTo <int>(0);

                    var    userid = context.Request["userid"].ConvertTo <int>(0);
                    string data   = ChannelJsonData.SeachList(comid, pageindex, pagesize, key, select, userid);

                    context.Response.Write(data);
                }
                if (oper == "editchannelcompany")
                {
                    var channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0);
                    var comid            = context.Request["comid"].ConvertTo <int>(0);
                    var Issuetype        = context.Request["Issuetype"].ConvertTo <int>(1);
                    var companyname      = context.Request["companyname"].ConvertTo <string>("");

                    string  companyaddress    = context.Request["companyaddress"].ConvertTo <string>("");
                    string  companyphone      = context.Request["companyphone"].ConvertTo <string>("");
                    decimal companyCoordinate = context.Request["companycoordinate"].ConvertTo <decimal>(0);
                    string  companyLocate     = context.Request["companyLocate"].ConvertTo <string>("");

                    int    companyimg     = context.Request["companyimg"].ConvertTo <int>(0);
                    string companyintro   = context.Request["companyintro"].ConvertTo <string>("");
                    string companyproject = context.Request["companyproject"].ConvertTo <string>("");

                    int companystate      = context.Request["companystate"].ConvertTo <int>(1);
                    int whetherdepartment = context.Request["whetherdepartment"].ConvertTo <int>(0);

                    string bookurl  = context.Request["bookurl"].ConvertTo <string>("");
                    string city     = context.Request["city"].ConvertTo <string>("");
                    string province = context.Request["Province"].ConvertTo <string>("");

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

                    Member_Channel_company company = new Member_Channel_company()
                    {
                        Id                = channelcompanyid,
                        Companyname       = companyname,
                        Com_id            = comid,
                        Issuetype         = Issuetype,
                        Companyaddress    = companyaddress,
                        Companyphone      = companyphone,
                        CompanyCoordinate = companyCoordinate,
                        CompanyLocate     = companyLocate,
                        Companyimg        = companyimg,
                        Companyintro      = companyintro,
                        Companyproject    = companyproject,
                        Companystate      = companystate,
                        Whetherdepartment = whetherdepartment,
                        Bookurl           = bookurl,
                        City              = city,
                        Province          = province,
                        Outshop           = outshop
                    };
                    string data = ChannelJsonData.EditChannelCompany(company);
                    context.Response.Write(data);
                }
                if (oper == "GetChannelByCompanyid")
                {
                    var    companyid = context.Request["companyid"];
                    string data      = ChannelJsonData.GetChannelByCompanyid(companyid);
                    context.Response.Write(data);
                }

                //修改渠道和推荐人
                if (oper == "upchannl")
                {
                    var comid      = context.Request["comid"].ConvertTo <int>(0);
                    var id         = context.Request["id"].ConvertTo <int>(0);
                    var channlcard = context.Request["channlcard"].ConvertTo <decimal>();
                    var oldcard    = context.Request["oldcard"].ConvertTo <decimal>();
                    var uptype     = context.Request["Uptype"].ConvertTo <int>();

                    string data = ChannelJsonData.Upchannl(id, comid, channlcard, oldcard, uptype);

                    context.Response.Write(data);
                }

                //修改门市店长推荐
                if (oper == "upchannelcompanproject")
                {
                    var comid          = context.Request["comid"].ConvertTo <int>(0);
                    var id             = context.Request["channelcompanyid"].ConvertTo <int>(0);
                    var companyproject = context.Request["companyproject"].ConvertTo <string>("");

                    string data = ChannelJsonData.Upchannelcompanproject(id, companyproject);

                    context.Response.Write(data);
                }

                //渠道统计
                if (oper == "Channelstatistics")
                {
                    var comid     = context.Request["comid"];
                    var pageindex = context.Request["pageindex"].ConvertTo <int>(0);
                    var pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    //var issuetype = context.Request["issuetype"].ConvertTo<string>("all") == "all" ? "all" : context.Request["issuetype"];
                    string channelcompanytype = context.Request["channelcompanytype"].ConvertTo <string>("out");

                    string data = ChannelJsonData.Channelstatistics(comid, pageindex, pagesize, channelcompanytype);

                    context.Response.Write(data);
                }
                //渠道统计
                if (oper == "Channelstatistics2")
                {
                    var comid     = context.Request["comid"];
                    var pageindex = context.Request["pageindex"].ConvertTo <int>(0);
                    var pagesize  = context.Request["pagesize"].ConvertTo <int>(10);

                    string channelcompanytype = context.Request["channelcompanytype"].ConvertTo <string>("out");
                    string companystate       = context.Request["companystate"].ConvertTo <string>("1");

                    string data = ChannelJsonData.Channelstatistics2(comid, pageindex, pagesize, channelcompanytype, companystate);

                    context.Response.Write(data);
                }

                if (oper == "Channelstatistics3")
                {
                    int channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0);
                    var comid            = context.Request["comid"];
                    var pageindex        = context.Request["pageindex"].ConvertTo <int>(0);
                    var pagesize         = context.Request["pagesize"].ConvertTo <int>(10);

                    string channelcompanytype = context.Request["channelcompanytype"].ConvertTo <string>("out");
                    string companystate       = context.Request["companystate"].ConvertTo <string>("1");

                    string data = ChannelJsonData.Channelstatistics2(comid, pageindex, pagesize, channelcompanytype, companystate, channelcompanyid);

                    context.Response.Write(data);
                }
                //渠道统计_验卡
                if (oper == "ChannelYk")
                {
                    var    comid     = context.Request["comid"];
                    var    pageindex = context.Request["pageindex"].ConvertTo <int>(0);
                    var    pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    var    issuetype = context.Request["issuetype"].ConvertTo <string>("all") == "all" ? "all" : context.Request["issuetype"];
                    string data      = ChannelJsonData.ChannelYk(comid, pageindex, pagesize, issuetype);

                    context.Response.Write(data);
                }
                if (oper == "GetAllInnerChannels")//得到所有的内部渠道
                {
                    string data = ChannelJsonData.GetAllInnerChannels();
                    context.Response.Write(data);
                }

                if (oper == "GetAllInnerChannelCompanys")//得到所有的内部渠道门市
                {
                    string data = ChannelJsonData.GetUnitList(0);
                    context.Response.Write(data);
                }
                if (oper == "GetUnitListNew")//得到内部/外部渠道门市
                {
                    int sourceid = context.Request["sourceid"].ConvertTo <int>(0);

                    string data = ChannelJsonData.GetUnitList(sourceid);
                    context.Response.Write(data);
                }

                if (oper == "GetUnitListselected")//得到渠道及被选中效果
                {
                    int actid = context.Request["actid"].ConvertTo <int>(0);

                    string data = ChannelJsonData.GetUnitListselected(actid);
                    context.Response.Write(data);
                }
                if (oper == "SearchChannelByChannelUnit")//得到渠道公司下的渠道列表
                {
                    var comid            = context.Request["comid"];
                    var pageindex        = context.Request["pageindex"].ConvertTo <int>(0);
                    var pagesize         = context.Request["pagesize"].ConvertTo <int>(10);
                    var channelcompanyid = context.Request["channelcompanyid"].ConvertTo <int>(0);


                    string data = ChannelJsonData.SearchChannelByChannelUnit(comid, pageindex, pagesize, channelcompanyid);

                    context.Response.Write(data);
                }
                if (oper == "Channelcompanypagelist")
                {
                    var comid     = context.Request["comid"];
                    var pageindex = context.Request["pageindex"].ConvertTo <int>(0);
                    var pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    var key       = context.Request["key"].ConvertTo <string>("");

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

                    string channelcompanytype = context.Request["channelcompanytype"].ConvertTo <string>("0,1,3,4");
                    var    accountid          = 0;
                    if (context.Request.Cookies["AccountId"] != null)
                    {
                        accountid = context.Request.Cookies["AccountId"].Value.ConvertTo <int>(0);
                    }
                    var openid  = "";
                    var n1      = ""; //用户的精度
                    var e1      = ""; //用户的维度
                    var b2bdate = new B2bCrmData();

                    if (accountid != 0)
                    {
                        var b2bmodel = b2bdate.Readuser(accountid, int.Parse(comid));
                        if (b2bmodel != null)
                        {
                            openid = b2bmodel.Weixin;
                        }
                        var crmlocation = b2bdate.GetB2bCrmDistanceByid(openid);
                        if (crmlocation != "")
                        {
                            var locatarr = crmlocation.Split(',');
                            if (locatarr.Count() >= 2)
                            {
                                n1 = locatarr[1];
                                e1 = locatarr[0];
                            }
                        }
                    }



                    string data = ChannelJsonData.Channelcompanypagelist(comid, pageindex, pagesize, key, channelcompanyid, channelcompanytype, openid);

                    context.Response.Write(data);
                }

                if (oper == "ChannelcompanyOrderlocation")
                {
                    var comid     = context.Request["comid"];
                    var pageindex = context.Request["pageindex"].ConvertTo <int>(0);
                    var pagesize  = context.Request["pagesize"].ConvertTo <int>(10);
                    var key       = context.Request["key"].ConvertTo <string>("");

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

                    string channelcompanytype = context.Request["channelcompanytype"].ConvertTo <string>("0,1,3,4");
                    var    accountid          = 0;
                    if (context.Request.Cookies["AccountId"] != null)
                    {
                        accountid = context.Request.Cookies["AccountId"].Value.ConvertTo <int>(0);
                    }
                    var openid  = "";
                    var n1      = ""; //用户的精度
                    var e1      = ""; //用户的维度
                    var b2bdate = new B2bCrmData();

                    if (accountid != 0)
                    {
                        var b2bmodel = b2bdate.Readuser(accountid, int.Parse(comid));
                        if (b2bmodel != null)
                        {
                            openid = b2bmodel.Weixin;
                        }
                        var crmlocation = b2bdate.GetB2bCrmDistanceByid(openid);
                        if (crmlocation != "")
                        {
                            var locatarr = crmlocation.Split(',');
                            if (locatarr.Count() >= 2)
                            {
                                n1 = locatarr[1];
                                e1 = locatarr[0];
                            }
                        }
                    }

                    string data = ChannelJsonData.ChannelcompanyOrderlocation(comid, pageindex, pagesize, key, channelcompanyid, channelcompanytype, openid, n1, e1);

                    context.Response.Write(data);
                }


                if (oper == "adjustchannelcompanystatus")
                {
                    int    companyid = context.Request["companyid"].ConvertTo <int>(0);
                    int    status    = context.Request["status"].ConvertTo <int>(0);
                    string data      = ChannelJsonData.Adjustchannelcompanystatus(companyid, status);

                    context.Response.Write(data);
                }
            }
        }
Beispiel #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToString();
            comid      = Request["comid"].ConvertTo <int>(0);
            id         = Request["id"].ConvertTo <int>(0);

            B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);

            if (companyinfo != null)
            {
                comid = companyinfo.Com_id;
            }
            else
            { //判定是否为自助域名规则安 shop1.etown.cn
                if (Domain_def.Domain_yanzheng(RequestUrl))
                {
                    comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                }
            }

            if (id != 0)
            {
                B2b_com_pro pro = new B2bComProData().GetProById(id.ToString());
                if (pro == null)
                {
                    return;
                }
                //绿野 不显示头部
                if (comid == 2553)
                {
                    viewtop_pro = 0;
                }


                if (pro != null)
                {
                    if (pro.Com_id != comid)
                    {
                        return;
                    }

                    Ispanicbuy       = pro.Ispanicbuy;       //是否抢购或限购
                    Limitbuytotalnum = pro.Limitbuytotalnum; //限购数量

                    manyspeci = pro.Manyspeci;               //
                    //票务产品,判断 是否抢购/限购,是的话 作废超时未支付订单,完成回滚操作
                    if (pro_servertype == 1)
                    {
                        if (pro.Ispanicbuy == 1 || pro.Ispanicbuy == 2)
                        {
                            int rs = new B2bComProData().CancelOvertimeOrder(pro);
                        }
                    }

                    iscanbook      = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                    pro_servertype = pro.Server_type;
                    pickuppoint    = pro.pickuppoint;
                    dropoffpoint   = pro.dropoffpoint;


                    childreduce = pro.Childreduce;
                }
                if (pro.Ispanicbuy == 1)
                {
                    panic_begintime  = pro.Panic_begintime;
                    panicbuy_endtime = pro.Panicbuy_endtime;

                    nowtoday = DateTime.Now;
                    TimeSpan tss = pro.Panic_begintime - nowtoday;
                    var      day = tss.Days * 24 * 3600;;  //这是相差的天数
                    var      h   = tss.Hours * 3600;       //这是相差的小时数,
                    var      m   = tss.Minutes * 60;
                    var      s   = tss.Seconds;
                    shijiacha = day + h + m + s;
                }
                projectid  = pro.Projectid;
                comid      = pro.Com_id;
                pro_name   = pro.Pro_name;
                price      = pro.Advise_price;
                Face_price = pro.Face_price;

                //如果含有规格读取规格价格中最低价
                if (manyspeci == 1)
                {
                    gglist = new B2b_com_pro_SpeciData().Getgglist(pro.Id);

                    if (gglist != null)
                    {
                        price      = 0;
                        Face_price = 0;
                        for (int i = 0; i < gglist.Count(); i++)
                        {
                            if (price == 0 || price > gglist[i].speci_advise_price)
                            {
                                price      = gglist[i].speci_advise_price;
                                Face_price = gglist[i].speci_face_price;
                            }
                        }
                    }
                }


                imgurl = FileSerivce.GetImgUrl(pro.Imgurl);
                if (price == 0)
                {
                    price = 0;
                }
                else
                {
                    CommonFunc.OperTwoDecimal(price.ToString());
                    //price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                }

                nowdate = DateTime.Now.ToString("yyyy-MM-dd");


                if (pro.Service_Contain != "")
                {
                    sumaryend = pro.Service_Contain;
                }

                if (pro.Service_NotContain != "")
                {
                    sumaryend = sumaryend + "</br> " + pro.Service_NotContain;
                }

                if (pro.Precautions != "")
                {
                    sumaryend = sumaryend + "</br> " + pro.Precautions;
                }


                //如果服务类型是 票务;  则备注信息中 显示 电子码使用限制
                if (pro.Server_type == 1)
                {
                    if (pro.Iscanuseonsameday == 0)//电子码当天不可用
                    {
                        sumaryend = "此产品当天预订不可用<br>" + sumaryend;
                    }
                    if (pro.Iscanuseonsameday == 1)//电子码当天可用
                    {
                        sumaryend = "此产品当天预订可用<br>" + sumaryend;
                    }
                    if (pro.Iscanuseonsameday == 2)//电子码出票2小时内不可用
                    {
                        sumaryend = "此产品出票2小时内不可用<br>" + sumaryend;
                    }
                }

                remark  = pro.Pro_Remark;
                pro_num = pro.Pro_number;
                if (pro_num == 0)
                {
                    pro_max = 100;
                    pro_min = 1;
                }
                else
                {
                    pro_min = 1;
                    pro_max = pro_num;
                }
                pro_explain = pro.Pro_explain;



                #region 产品有效期判定(微信模板--门票订单预订成功通知 中也有用到)
                provalidatemethod = pro.ProValidateMethod; //判断 1按产品有效期,2指定有效期
                appointdate       = pro.Appointdata;       //1=一星期,,2=1个月,3=3个月,4=6个月,5=一年
                iscanuseonsameday = pro.Iscanuseonsameday; //1当天可用,0当天不可用

                DateTime pro_end = pro.Pro_end;
                //返回有效期
                pro_youxiaoqi = new B2bComProData().GetPro_Youxiaoqi(pro.Pro_start, pro.Pro_end, provalidatemethod, appointdate, iscanuseonsameday);

                #endregion



                var commodel = B2bCompanyData.GetCompany(comid);
                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                    }
                }



                //查询项目电话,如果有项目电话调取项目电话
                var projectdata  = new B2b_com_projectData();
                var projectmodel = projectdata.GetProject(projectid, comid);
                if (projectmodel != null)
                {
                    if (projectmodel.Mobile != "")
                    {
                        phone = projectmodel.Mobile;
                    }
                }


                //从cookie中得到微信号
                if (Request.Cookies["openid"] != null)
                {
                    openid = Request.Cookies["openid"].Value;
                }
                B2bCrmData b2b_crm = new B2bCrmData();
                if (openid != "")
                {
                    B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid);
                    if (b2bmodle != null)
                    {
                        Imprest  = b2bmodle.Imprest;
                        Integral = b2bmodle.Integral;
                    }
                }
            }



            //判断商户ID(域名未绑定)
            if (comid != 0)
            {
                B2b_company modlecom = B2bCompanyData.GetAllComMsg(comid);
                if (modlecom != null)
                {
                    Com_name = modlecom.Com_name;
                    title    = modlecom.Com_name;

                    txtServiceInfo = modlecom.B2bcompanyinfo.Serviceinfo;
                    Scenic_name    = modlecom.Scenic_name;
                    scenic_address = modlecom.B2bcompanyinfo.Scenic_address;
                    coordinate     = modlecom.B2bcompanyinfo.Coordinate;
                    coordinatesize = modlecom.B2bcompanyinfo.Coordinatesize;
                    weixinimg      = modlecom.B2bcompanyinfo.Weixinimg;
                    weixinname     = modlecom.B2bcompanyinfo.Weixinname;
                    Qq             = modlecom.B2bcompanyinfo.Qq;
                }

                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                    phone     = pro.Service_Phone;
                    Copyright = pro.Copyright;
                    Tel       = pro.Service_Phone;
                }



                //读取首页栏目,只读取前10个栏目,太多影响打开
                var shopmenudata = new B2bCompanyMenuData();
                menulist = shopmenudata.GetMenuList(comid, 1, 10, out menutotalcount, 1);
                if (menulist != null)
                {
                    for (int i = 0; i < menutotalcount; i++)
                    {
                        menulist[i].Imgurl_address = FileSerivce.GetImgUrl(menulist[i].Imgurl);
                    }
                }

                //如果没有栏目读取项目
                if (menutotalcount == 0)
                {
                    var prodata = new B2b_com_projectData();
                    projectlist = prodata.Projectpagelist(comid.ToString(), 1, 10, "1", out porjectcount, "");
                }
            }


            int totalcount = 0;
            if (Session["AccountId"] != null)
            {
                //账户信息
                AccountId   = Int32.Parse(Session["AccountId"].ToString());
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                RequestUrl  = Request.ServerVariables["SERVER_NAME"].ToLower();

                //会员信息
                B2bCrmData dateuser  = new B2bCrmData();
                B2b_crm    modeluser = dateuser.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    Imprest       = modeluser.Imprest;
                    Integral      = modeluser.Integral;
                    //密码
                    AccountPass = modeluser.Password1;
                    //微信关注
                    weixin = modeluser.Weixin == "" ? "未关注" : "已关注";
                }
            }
        }