Exemple #1
0
        public ActionResult Index()
        {
            var data = _iShopOpenApiService.Get(CurShopId);

            if (data == null)
            {
                data = _iShopOpenApiService.MakeOpenApi(CurShopId);
                _iShopOpenApiService.Add(data);
            }
            return(View(data));
        }
        public ShopHelper(string app_key)
        {
            _iShopService        = Himall.ServiceProvider.Instance <IShopService> .Create;
            _iRegionService      = Himall.ServiceProvider.Instance <IRegionService> .Create;
            _iManagerService     = Himall.ServiceProvider.Instance <IManagerService> .Create;
            _iShopOpenApiService = Himall.ServiceProvider.Instance <IShopOpenApiService> .Create;

            _AppKey = app_key;
            if (string.IsNullOrWhiteSpace(_AppKey))
            {
                throw new HimallOpenApiException(Hishop.Open.Api.OpenApiErrorCode.Missing_App_Key, "app_key");
            }
            var shopappinfo = _iShopOpenApiService.Get(_AppKey);

            if (shopappinfo == null)
            {
                throw new HimallOpenApiException(Hishop.Open.Api.OpenApiErrorCode.Invalid_App_Key, "app_key");
            }
            if (shopappinfo.IsEnable != true)
            {
                throw new HimallOpenApiException(Hishop.Open.Api.OpenApiErrorCode.System_Error, "function not open");
            }
            _AppSecreate = shopappinfo.AppSecreat;
            if (string.IsNullOrWhiteSpace(_AppSecreate))
            {
                throw new HimallOpenApiException(Hishop.Open.Api.OpenApiErrorCode.Insufficient_ISV_Permissions, "not set app_secreat");
            }

            var shop = _iShopService.GetShop(shopappinfo.ShopId);

            if (shop == null)
            {
                throw new HimallOpenApiException(Hishop.Open.Api.OpenApiErrorCode.Invalid_App_Key, "app_key");
            }
            ShopId = shop.Id;
            var manage = _iManagerService.GetSellerManagerByShopId(ShopId);

            if (manage == null)
            {
                throw new HimallException("店铺管理信息有误,请管理员修正");
            }
            SellerName = manage.UserName;
        }
Exemple #3
0
 /// <summary>
 /// 获取店铺的OpenApi配置
 /// </summary>
 /// <param name="appkey"></param>
 /// <returns></returns>
 public static ShopOpenApiSettingInfo Get(string appkey)
 {
     return(_iShopOpenApiService.Get(appkey));
 }