Exemple #1
0
        /// <summary>
        ///根据用户微信号判断 其顾问是不是可以咨询
        /// </summary>
        /// <param name="openid"></param>
        /// <param name="p"></param>
        /// <param name="comid"></param>
        /// <returns></returns>
        public int IsCanZixun(string openid, int comid)
        {
            B2b_company_manageuser manageruser = new B2bCompanyManagerUserData().GetGuwenByVipweixin(openid, comid);

            if (manageruser == null)
            {
                return(0);
            }
            else
            {
                string Workdays = manageruser.Workdays;
                //判断是否在工作日内,1为在,0为不在
                int WorkdaysView = new B2bCrmData().WorkDay(Workdays);

                //判断顾问是否绑定了微信 0未绑定;1已绑定
                int isbindweixin = 0;
                var crmmodel     = new B2bCrmData().GetB2bCrmByPhone(manageruser.Com_id, manageruser.Tel);
                if (crmmodel != null)
                {
                    if (crmmodel.Weixin != "")
                    {
                        isbindweixin = 1;
                    }
                    else
                    {
                        isbindweixin = 0;
                    }
                }

                //顾问已经绑定微信并且在工作日内,则可以咨询
                if (WorkdaysView == 1 && isbindweixin == 1)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }
Exemple #2
0
        //计算渠道人/渠道人单位/渠道人公司  距离会员的距离
        public double PeopleCoordinates(string openid, int channelcompanyid, int comid = 0, string usern = "", string usere = "")
        {
            var projdistance = "";


            //根据会员微信获取顾问坐标;没有计算渠道单位/渠道公司的坐标
            B2b_crm_location crmlocation = new B2bCrmData().GetGuwenLocationByVipweixin(openid, comid);

            if (crmlocation != null)
            {
                //纬度+经度
                projdistance = crmlocation.Longitude + "," + crmlocation.Latitude;
            }
            else
            {
                if (channelcompanyid != 0)
                {
                    projdistance = GetChannelDistanceByid(channelcompanyid);
                }
                else
                {
                    if (comid != 0)
                    {
                        B2bCompanyData comdata  = new B2bCompanyData();
                        var            datainfo = B2bCompanyData.GetAllComMsg(comid);
                        if (datainfo != null)
                        {
                            projdistance = datainfo.B2bcompanyinfo.Coordinate;
                        }
                    }
                }
            }

            if (projdistance == "")
            {
                return(0);
            }



            var crmdistance = GetB2bCrmDistanceByid(openid);
            var n1          = "";
            var e1          = "";
            var n2          = "";
            var e2          = "";

            if (projdistance != "")
            {
                var locatearr = projdistance.Split(',');
                if (locatearr.Length >= 2)
                {
                    n1 = locatearr[1];
                    e1 = locatearr[0];
                }

                if (usern != "" && usere != "" && usern != "0" && usere != "0")
                {
                    n2 = usern;
                    e2 = usere;
                }
                else
                {
                    var crmlocatearr = crmdistance.Split(',');
                    if (crmlocatearr.Length >= 2)
                    {
                        n2 = crmlocatearr[1];
                        e2 = crmlocatearr[0];
                    }
                }


                if (n1 == "" || n2 == "" || e1 == "" || e2 == "")
                {
                    return(0);
                }

                using (var helper = new SqlHelper())
                {
                    var crm = new InternalB2bCrm(helper).CalculateTheCoordinates(n1, e1, n2, e2);
                    return(crm);
                }
            }

            return(0);
        }