コード例 #1
0
        public ResultJson <GetRestaurantListResponse, GetRecipeListByGPSResponse, GetArticleListResponse, GetOrderListResponse> TitlePage(GetTitlePageRequest request)
        {
            ResultJson <GetRestaurantListResponse, GetRecipeListByGPSResponse, GetArticleListResponse, GetOrderListResponse> result = new ResultJson <GetRestaurantListResponse, GetRecipeListByGPSResponse, GetArticleListResponse, GetOrderListResponse>();
            var user = CacheForModelUser.Instance.GetUserInfo(request.UserId);
            GetRestaurantListRequest Restaurant_List_Request = new GetRestaurantListRequest
            {
                CoordX = request.CoordX,
                CoordY = request.CoordY,
                PageNo = 1,
            };
            var result_Restaurant = GetRestaurantListInfo(Restaurant_List_Request);
            GetRecipeListByGPSRequest Recipe_List_Request = new GetRecipeListByGPSRequest
            {
                CoordX = request.CoordX,
                CoordY = request.CoordY,
                PageNo = 1,
                UserId = request.UserId
            };
            RecipeController recipeContro = new RecipeController();
            var result_Recipe             = recipeContro.RecipeListByGPS(Recipe_List_Request);
            GetInfoByIdPaggingRequest Article_List_Request = new GetInfoByIdPaggingRequest
            {
                PageNo = 1,
                Id     = request.UserId,
                Token  = request.Token
            };
            ArticleController ArticleContro = new ArticleController();
            var result_Article = ArticleContro.GetArticleListInfo(Article_List_Request);
            GetInfoByUserIdPageRequest Order_List_Request = new GetInfoByUserIdPageRequest
            {
                PageNo = 1,
                UserId = request.UserId,
                Token  = request.Token
            };
            var result_Order = OrdersBiz.Instance.OrderList(Order_List_Request);

            if (result_Recipe.HttpCode == 200 && result_Restaurant.HttpCode == 200 && result_Article.HttpCode == 200)
            {
                result.HttpCode  = 200;
                result.ListData  = Paging.Instance.PageData(result_Restaurant.ListData, 9, 1);
                result.ListData2 = Paging.Instance.PageData(result_Recipe.ListData, 5, 1);
                result.ListData3 = Paging.Instance.PageData(result_Article.ListData, 4, 1);
                result.ListData4 = Paging.Instance.PageData(result_Order.ListData, 3, 1);
            }
            else
            {
                result.HttpCode = 500;
                result.Message  = "数据筛选失败";
            }
            return(result);
        }
コード例 #2
0
        public ResultJson <GetRestaurantListResponse, GetArticleListResponse, GetRecipeListByGPSResponse> SearchVagueRestaurant(GetRestaurantListByNameRequest request)
        {
            ResultJson <GetRestaurantListResponse, GetArticleListResponse, GetRecipeListByGPSResponse> result  = new ResultJson <GetRestaurantListResponse, GetArticleListResponse, GetRecipeListByGPSResponse>();
            ResultJson <GetRestaurantListResponse, GetArticleListResponse, GetRecipeListByGPSResponse> result1 = new ResultJson <GetRestaurantListResponse, GetArticleListResponse, GetRecipeListByGPSResponse>();
            ResultJson <GetRestaurantListResponse, GetArticleListResponse, GetRecipeListByGPSResponse> result2 = new ResultJson <GetRestaurantListResponse, GetArticleListResponse, GetRecipeListByGPSResponse>();

            request.Name = Regex.Replace(request.Name.ToString(), @"\p{Cs}", "");
            if (request.SearchType.ToLower() == Enum_SearchType.Restaurant.Enum_GetString() || request.SearchType.ToLower() == Enum_SearchType.All.Enum_GetString())
            {
                List <GetRestaurantListResponse> List_Response_Option = new List <GetRestaurantListResponse>();
                List <GetRestaurantListResponse> List_Response_Result = new List <GetRestaurantListResponse>();
                var list = CacheForModelRestaurant.Instance.GetRestaurantByName(request.Name);
                foreach (var item in list)
                {
                    GetRestaurantListResponse response = new GetRestaurantListResponse(item, request.CoordX, request.CoordY, SeachRange);
                    if (response.distance != null)
                    {
                        List_Response_Option.Add(response);
                    }
                }

                List_Response_Result = Paging.Instance.PageData <GetRestaurantListResponse>(List_Response_Option, PageSize, request.PageNo);

                if (List_Response_Option.Count == 0)
                {
                    result1.HttpCode = 300;
                    result1.Message  = Enum_Message.NoMoreDataMessage.Enum_GetString();
                }

                else if (List_Response_Result.Count == 0)
                {
                    result1.HttpCode = 300;
                    result1.Message  = Enum_Message.NoMoreDataMessage.Enum_GetString();
                }
                else
                {
                    result1.HttpCode = 200;
                    result1.Message  = Enum_Message.SuccessMessage.Enum_GetString();
                    result1.ListData = List_Response_Result;
                }
            }
            if (request.SearchType.ToLower() == Enum_SearchType.Recipe.Enum_GetString() || request.SearchType.ToLower() == Enum_SearchType.All.Enum_GetString())
            {
                RecipeController recipeContr = new RecipeController();
                GetRestaurantListByNameRequest Recipe_List_Request = new GetRestaurantListByNameRequest
                {
                    CoordX = request.CoordX,
                    CoordY = request.CoordY,
                    PageNo = request.PageNo,
                    Token  = request.Token,
                    UserId = request.UserId,
                    Name   = request.Name,
                };
                var recipe_Result = recipeContr.SearchVagueRecipe(Recipe_List_Request);
                if (recipe_Result.HttpCode != 200)
                {
                    result2.HttpCode = recipe_Result.HttpCode;
                    result2.Message  = recipe_Result.Message;
                }
                else
                {
                    result2.HttpCode  = 200;
                    result2.Message   = Enum_Message.SuccessMessage.Enum_GetString();
                    result2.ListData3 = recipe_Result.ListData;
                }
                CacheForModelSearchRecord.Instance.InsertSearchRecord(request.Name);
            }
            var Searchresult = ArticleBiz.Instance.SearchArticleList(request.UserId, request.PageNo, request.Name);

            if (Searchresult.HttpCode != 200 & result1.HttpCode != 200 & result2.HttpCode != 200)
            {
                result.HttpCode = Searchresult.HttpCode;
                result.Message  = Searchresult.Message;
            }
            else
            {
                result.Message   = Enum_Message.SuccessMessage.Enum_GetString();
                result.HttpCode  = 200;
                result.ListData  = result1.ListData;
                result.ListData2 = Searchresult.ListData;
                result.ListData3 = result2.ListData3;
            }
            return(result);
        }