Exemplo n.º 1
0
        public WeiXinJsApiTicket GetJsApiTicket(int appId)
        {
            var appRepository = new WeiXinAppRepository(_dbContext);
            var appInfo = appRepository.GetWeiXinAppInfo(appId);
            if (appInfo == null)
                throw new Exception(string.Format("系统中不存在ID为 {0} 的微信配置", appId));

            if (string.IsNullOrEmpty(appInfo.AppId) || string.IsNullOrEmpty(appInfo.AppSecret))
                throw new Exception(string.Format("系统中 {0} 的微信配置不完全,AppID或AppSecret为空.", appInfo.wxName));

            return null;
        }
Exemplo n.º 2
0
        public WeiXinJsApiTicket GetJsApiTicket(int appId)
        {
            var appRepository = new WeiXinAppRepository(_dbContext);
            var appInfo       = appRepository.GetWeiXinAppInfo(appId);

            if (appInfo == null)
            {
                throw new Exception(string.Format("系统中不存在ID为 {0} 的微信配置", appId));
            }

            if (string.IsNullOrEmpty(appInfo.AppId) || string.IsNullOrEmpty(appInfo.AppSecret))
            {
                throw new Exception(string.Format("系统中 {0} 的微信配置不完全,AppID或AppSecret为空.", appInfo.wxName));
            }

            return(null);
        }