122 lines
3.5 KiB
C#
122 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Store.Client.Commons
|
|
{
|
|
///// <summary>
|
|
///// 商铺列表信息管理
|
|
///// </summary>
|
|
//public abstract class ShopManage<T> : ISingletonDependency, ILoginSuccessed where T : ShopBase
|
|
//{
|
|
// /// <summary>
|
|
// /// 日志
|
|
// /// </summary>
|
|
// [Autowired]
|
|
// protected ILog _log { get; set; }
|
|
// [Autowired]
|
|
// internal ShopService _shopService { get; set; }
|
|
// /// <summary>
|
|
// /// 私有商铺集合
|
|
// /// </summary>
|
|
// private List<T> _shopsData = new List<T>();
|
|
// /// <summary>
|
|
// /// 私有商铺分组
|
|
// /// </summary>
|
|
// /// <returns></returns>
|
|
// private List<string> _shopGroups = new List<string>();
|
|
|
|
// /// <summary>
|
|
// /// 所有商铺
|
|
// /// </summary>
|
|
// public List<T> Shops
|
|
// {
|
|
// get
|
|
// {
|
|
// return _shopsData;
|
|
// }
|
|
// }
|
|
// /// <summary>
|
|
// /// 商铺分组
|
|
// /// </summary>
|
|
// public List<string> ShopGroups
|
|
// {
|
|
// get => _shopGroups;
|
|
// }
|
|
// /// <summary>
|
|
// /// 获取随机Cookie
|
|
// /// </summary>
|
|
// /// <returns></returns>
|
|
// public Cookies GetRandomCookies()
|
|
// {
|
|
// return Shops[RandomHelper.GetRandomNumber(Shops.Count - 1)].Cookie;
|
|
// }
|
|
|
|
|
|
// /// <summary>
|
|
// /// 刷新
|
|
// /// </summary>
|
|
// public void Refresh()
|
|
// {
|
|
// LoadServerShops();
|
|
// }
|
|
|
|
// void ILoginSuccessed.LoginSuccess(UserInfo user)
|
|
// {
|
|
// try
|
|
// {
|
|
// LoadServerShops();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// _log.Error(ex, "加载商铺列表");
|
|
// }
|
|
// }
|
|
|
|
// /// <summary>
|
|
// /// 加载服务器商铺
|
|
// /// </summary>
|
|
// private void LoadServerShops()
|
|
// {
|
|
// _shopsData = _shopService.GetShops<T>();
|
|
// _getshopGroup();
|
|
// RefreshShopsCookie();
|
|
// }
|
|
|
|
// private void RefreshShopsCookie()
|
|
// {
|
|
// var shops = Shops.Select(a => a as ShopBase).ToList();
|
|
// _shopService.GetShopCookie(shops);
|
|
// }
|
|
// /// <summary>
|
|
// /// 检测商铺登录状态
|
|
// /// </summary>
|
|
// 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);
|
|
// //}
|
|
|
|
|
|
// /// <summary>
|
|
// /// 商铺分组
|
|
// /// </summary>
|
|
// private void _getshopGroup()
|
|
// {
|
|
// _shopGroups.Clear();
|
|
// List<string> list = (from a in _shopsData group a by a.GroupName into b select b.Key).ToList();
|
|
// foreach (var item in list)
|
|
// {
|
|
// _shopGroups.Add(item);
|
|
// }
|
|
// }
|
|
|
|
|
|
//}
|
|
}
|