public void GetCarFriendsGroupList()
 {
     using (var client = new CarFriendsGroupClient())
     {
         var request = new GetCarFriendsGroupListRequest();
         //var vehicleList = new List<string>();
         //vehicleList.Add("奥迪A3");
         //request.VehicleList = vehicleList;
         //request.SearchVehicleKey = "A8L";
         //request.IsRecommend = true;
         var result = client.GetCarFriendsGroupListAsync(request);
         Assert.IsNotNull(result.Result);
     }
 }
예제 #2
0
 /// <summary>
 /// 获取车友群列表
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public async Task <OperationResult <CarFriendsGroupInfoResponse> > GetCarFriendsGroupListAsync(GetCarFriendsGroupListRequest request)
 {
     return(OperationResult.FromResult(await CarFriendsGroupManager.GetCarFriendsGroupListAsync(request)));
 }
예제 #3
0
        /// <summary>
        /// 获取车友群列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <CarFriendsGroupInfoResponse> GetCarFriendsGroupListAsync(GetCarFriendsGroupListRequest request)
        {
            using (var client = CacheHelper.CreateCacheClient(GlobalConstant.CarFriendsGroupName))
            {
                var result = new CarFriendsGroupInfoResponse();
                //筛选车型得到的车型群
                if (request.VehicleList != null && request.VehicleList.Count > 0)
                {
                    string key          = string.Format(GlobalConstant.CarFriendsGroupKey, string.Join(":", request.VehicleList));
                    var    clientResult = await client.GetOrSetAsync(SecurityHelper.Hash(key), async() => (await DalCarFriendsGroup.GetFilterCarFriendsGroupListAsync(request.VehicleList)), TimeSpan.FromMinutes(10));

                    if (clientResult.Success && clientResult.Value != null)
                    {
                        result = clientResult.Value;
                    }
                }
                else
                {
                    //热门车友群/热门推荐群/搜索车型得到的车型群/全部车友群
                    string key          = string.Format(GlobalConstant.CarFriendsGroupKey, ":" + request.IsRecommend + ":" + request.SearchVehicleKey);
                    var    clientResult = await client.GetOrSetAsync(SecurityHelper.Hash(key), async() => (await GetSearchCarFriendsGroupResponseAsync(request.IsRecommend, request.SearchVehicleKey)), TimeSpan.FromMinutes(10));

                    if (clientResult.Success && clientResult.Value != null && clientResult.Value.groupCount > 0)
                    {
                        result = clientResult.Value;
                    }
                }
                return(result);
            }
        }