Esempio n. 1
0
        /// <summary>
        /// 获取门店授权平台Url
        /// </summary>
        /// <returns></returns>
        public string GetShopPlatformMapUrl(long shopId, int platformId, int isKaMerchant, string kaMerchantAuthUrl)
        {
            var requestApi = "#";

            switch (platformId)
            {
            case (int)PlatformType.Meituan:
            {
                requestApi = string.Format(MeituanConsts.SHOP_PLATFORM_MAP_API,
                                           ConfigUtil.MeiDeveloperId,
                                           AuthBussinessType.Waimai.GetHashCode(),
                                           shopId,
                                           ConfigUtil.MeiSignKey,
                                           WebUtil.UrlDecode(ConfigUtil.MeiMapCallBack, Encoding.UTF8)
                                           );
                break;
            }

            case (int)PlatformType.Eleme:
            {
                requestApi = string.Format(ElemeConsts.SHOP_AUTH_API,
                                           ConfigUtil.EleAppKey,
                                           WebUtil.UrlDecode(ConfigUtil.EleAuthCallBack, Encoding.UTF8),
                                           DESEncryptUtil.Encrypt(shopId.ToString())
                                           );
                break;
            }

            case (int)PlatformType.Baidu:
            {
                if (isKaMerchant == 1 && !string.IsNullOrWhiteSpace(kaMerchantAuthUrl))
                {
                    requestApi = kaMerchantAuthUrl;
                }
                else
                {
                    requestApi = string.Format(BaiduwmConsts.SHOP_AUTH_URL + "&otherShopId={1}",
                                               ConfigUtil.BaiduAuthSourceKey,
                                               shopId.ToString());
                }
                break;
            }

            default:
                break;
            }
            return(requestApi);
        }
 /// <summary>
 /// 写入登录信息
 /// </summary>
 /// <param name="user">成员信息</param>
 public virtual void AddCurrent(Operator user)
 {
     try
     {
         if (LoginProvider == "Cookie")
         {
             WebUtil.WriteCookie(LoginUserKey, DESEncryptUtil.Encrypt(user.ToJson()));
         }
         else
         {
             WebUtil.WriteSession(LoginUserKey, DESEncryptUtil.Encrypt(user.ToJson()));
         }
         CacheFactory.Cache().WriteCache(user.Token, user.UserId, user.LogTime.AddHours(12));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }