public static string ViewChanneluserpagelist(int comid, int channelcompanyid, int pageindex, int pagesize, string key = "", string openid = "", string usern = "", string usere = "", int isheadofficekf = 0, int isonlycoachlist = 0, string isviewjiaolian = "0,1") { var totalcount = 0; try { B2bCrmData crmdata = new B2bCrmData(); var prodata = new B2bCompanyManagerUserData(); if (openid != "") { //根据微信号得到用户所在顾问的渠道单位信息 //Member_Channel_company m_channelcompany = new MemberChannelcompanyData().GetGuWenChannelCompanyByCrmWeixin(openid, comid); //if (m_channelcompany != null) //{ // channelcompanyid = m_channelcompany.Id; //} } //得到用户坐标 if (usere == "" || usern == "" || usere == "0" || usern == "0") { if (openid != "") { B2b_crm_location location = new B2bCrmData().GetB2bcrmlocationByopenid(openid); if (location != null) { usern = location.Latitude; usere = location.Longitude; } } } var list = prodata.ViewChanneluserpagelist(comid, channelcompanyid, pageindex, pagesize, out totalcount, key, openid, usern, usere, isheadofficekf, isonlycoachlist, isviewjiaolian); IEnumerable result = ""; if (list != null) { //result = from pro in list // orderby new Model_guwen().IsCanZixun descending,new Model_guwen().Distance // select new Model_guwen result = from pro in list select new { Id = pro.Id, Name = pro.Employeename, Comid = pro.Com_id, CompanyName = new B2bCompanyData().GetCompanyNameById(pro.Com_id), Atype = pro.Atype, Createuserid = pro.Createuserid, Employeestate = pro.Employeestate, Job = pro.Job, Tel = pro.Tel, channelcompanyid = pro.Channelcompanyid, ChannelCompany = new MemberChannelcompanyData().GetCompanyNameById(pro.Channelcompanyid.ToString().ConvertTo <int>(0)), Channelcompanyid = pro.Channelcompanyid, Channelsource = pro.Channelsource, Selfbrief = pro.Selfbrief, Headimg = pro.Headimg, Headimgurl = FileSerivce.GetImgUrl(pro.Headimg), Workingyears = pro.Workingyears, Workdays = pro.Workdays, Workdaystime = pro.Workdaystime, Workendtime = pro.Workendtime, Fixphone = pro.Fixphone, Email = pro.Email, Homepage = pro.Homepage, Weibopage = pro.Weibopage, QQ = pro.QQ, Weixin = pro.Weixin, Selfhomepage_qrcordurl = pro.Selfhomepage_qrcordurl, bindingproid = pro.bindingproid, //根据用户微信号判断 其顾问是不是可以咨询 IsCanZixun = crmdata.IsCanZixun(pro.Weixin, pro.Com_id), //IsCanZixun = pro.IsCanZixun, //距离用户距离 //Distance = crmdata.PeopleCoordinates(openid, Int32.Parse(pro.Channelcompanyid.ToString()), pro.Com_id, usern, usere), Distance = pro.Distance, channelid = new MemberChannelData().GetChannelid(pro.Com_id, pro.Tel) } } ; return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); throw; } }