public static async Task <UserShops> GetShopLock(Session session) { var userShops = new UserShops(); List <Models.Shop> shops = null; shops = await ShopCache.Instance.GetEntities(session.member_no, session.user_no, true); if (await Refresh(session, shops, true)) { await using (var mylock = await RedLock.CreateLockAsync($"lock:session:{session.session_id}")) { shops = await ShopCache.Instance.GetEntities(session.member_no, session.user_no, true); await Refresh(session, shops, false); } } if (shops.Count > 0) { foreach (var shop in shops) { var shopInfo = userShops.Shops.Where(x => x.ShopId == shop.shop_id).FirstOrDefault(); if (shopInfo == null || shopInfo == default(ShopInfo)) { shopInfo = new ShopInfo(); shopInfo.ShopId = shop.shop_id; userShops.Shops.Add(shopInfo); } shopInfo.Items.Add(new ShopItemInfo() { ShopItemId = shop.shop_item_id, Quantity = shop.quantity, PurchaseCount = shop.purchase_count }); } } return(userShops); }
public IEnumerable <string> GenerateUserShops() => UserShops.Select(shop => $"shop 1 {shop.Value.OwnerId} 1 3 0 {shop.Value.Name}").ToList();
public IEnumerable <string> GeneratePlayerShopOnMap() => UserShops.Select(shop => $"pflag 1 {shop.Value.OwnerId} {shop.Key + 1}").ToList();
public IEnumerable <string> GenerateUserShops() { return(UserShops.Select(shop => $"shop 1 {shop.Key + 1} 1 3 0 {shop.Value.Name}").ToList()); }
private IEnumerable <string> GenerateUserShops() { return(UserShops.Select(shop => $"shop 1 {shop.Value.OwnerId} 1 3 0 {shop.Value.Name}").ToList()); }
private IEnumerable <string> GeneratePlayerShopOnMap() { return(UserShops.Select(shop => $"pflag 1 {shop.Value.OwnerId} {shop.Key + 1}").ToList()); }