using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Store.Client.Commons { ///// ///// 商铺列表信息管理 ///// //public abstract class ShopManage : ISingletonDependency, ILoginSuccessed where T : ShopBase //{ // /// // /// 日志 // /// // [Autowired] // protected ILog _log { get; set; } // [Autowired] // internal ShopService _shopService { get; set; } // /// // /// 私有商铺集合 // /// // private List _shopsData = new List(); // /// // /// 私有商铺分组 // /// // /// // private List _shopGroups = new List(); // /// // /// 所有商铺 // /// // public List Shops // { // get // { // return _shopsData; // } // } // /// // /// 商铺分组 // /// // public List ShopGroups // { // get => _shopGroups; // } // /// // /// 获取随机Cookie // /// // /// // public Cookies GetRandomCookies() // { // return Shops[RandomHelper.GetRandomNumber(Shops.Count - 1)].Cookie; // } // /// // /// 刷新 // /// // public void Refresh() // { // LoadServerShops(); // } // void ILoginSuccessed.LoginSuccess(UserInfo user) // { // try // { // LoadServerShops(); // } // catch (Exception ex) // { // _log.Error(ex, "加载商铺列表"); // } // } // /// // /// 加载服务器商铺 // /// // private void LoadServerShops() // { // _shopsData = _shopService.GetShops(); // _getshopGroup(); // RefreshShopsCookie(); // } // private void RefreshShopsCookie() // { // var shops = Shops.Select(a => a as ShopBase).ToList(); // _shopService.GetShopCookie(shops); // } // /// // /// 检测商铺登录状态 // /// // public abstract void CheckShopStatus(T shop); // //{ // // //string urlx = "https://myseller.taobao.com/ajaxProxy.do?_ksTS=1548152154745_13&callback=seller_layout_head&action=FrameworkLayoutAction&event_submit_do_layout_data=true"; // // //string refere = "https://myseller.taobao.com"; // // //string htmlx = GetPostTaobaoHtml.GetUrl(urlx, refere, true, "", Shop.Cookies); // // //Shop.MsgForCookiesLogin = htmlx.Contains("\"shopName\":\"") ? "登录成功" : "会话已过期"; // // //GetTaobaoShops.ShopsTemp.Add(Shop); // //} // /// // /// 商铺分组 // /// // private void _getshopGroup() // { // _shopGroups.Clear(); // List list = (from a in _shopsData group a by a.GroupName into b select b.Key).ToList(); // foreach (var item in list) // { // _shopGroups.Add(item); // } // } //} }