Exemplo n.º 1
0
        public ResponseMessageNews GetResponseMessage(RequestMessageLocation requestMessage)
        {
            MpUser fromUser = MpUserService.GetByOpenID(requestMessage.FromUserName);

            if (fromUser != null)
            {
                fromUser.LocationX     = requestMessage.Location_X;
                fromUser.LocationY     = requestMessage.Location_Y;
                fromUser.LocationLabel = requestMessage.Label;
                fromUser.LastVisitDate = DateTime.Now;
                MpUserService.Update(fromUser);
            }

            double longitude = requestMessage.Location_Y;
            double latitude  = requestMessage.Location_X;

            //修正坐标
            DistanceHelper.ConvertCoordinate(ref longitude, ref latitude);
            IList <BranchDTO> listBranch = BranchService.GetBranch(longitude, latitude);
            var responseMessage          = ResponseMessageBase.CreateFromRequestMessage <ResponseMessageNews>(requestMessage);

            responseMessage.Articles.Add(new Article()
            {
                Title       = "石狮农商银行周边网点",
                Description = "",
                PicUrl      = GlobalConfig.GetConfig()["ResourceDomain"] + "/funongbaotop.jpg",
                Url         = "http://wx.ssrcb.com/Branch/BranchListMap?point=" + longitude + "," + latitude,
            });
            //responseMessage.Articles.Add(new Article()
            //{
            //    Title = "石狮农商银行周边网点",
            //    Description = "",
            //    PicUrl = GlobalConfig.GetConfig()["ResourceDomain"] + "/funongbaotop.jpg",
            //    Url = "http://wx.ssrcb.com/Branch/BranchList?point=" + longitude + "," + latitude,
            //});
            //foreach (var item in listBranch)
            //{
            //    responseMessage.Articles.Add(new Article()
            //    {
            //        Title = item.Name+"("+item.Distance+"千米)"+"\n"+item.Address,
            //        Description = item.Address,
            //        PicUrl = "",
            //        Url = "http://wx.ssrcb.com/Branch/BranchInfo?id=" + item.Id.ToString() + "&longitude=" + longitude + "&latitude=" + latitude
            //    });
            //}
            return(responseMessage);
        }