private static void Init() { if (_yunClient == null) { lock (initLock) { if (_yunClient != null ) return; if (new[] { _serverUrl, _serverKey, _serverUrl }.Any(string.IsNullOrWhiteSpace)) { throw new Exception("服务端必要数据未初始化"); } _yunClient = new DefaultYunClient(_serverUrl, _serverKey, _serverSecret); } } }
private static void Init() { if (_yunClient == null) { lock (initLock) { if (_yunClient != null) { return; } if (new[] { _serverUrl, _serverKey, _serverUrl }.Any(string.IsNullOrWhiteSpace)) { throw new Exception("服务端必要数据未初始化"); } _yunClient = new DefaultYunClient(_serverUrl, _serverKey, _serverSecret); } } }
private static void Init() { if (_yunClient == null || _appInfo == null) { lock (initLock) { if (_yunClient != null && _appInfo != null) return; if (_appInfo == null) { var init = new Yun.ClientCache.CacheFunc(); _appInfo = init.Fetch<AppModel>(_appTableName, "id = 0"); if (_appInfo == null) { throw new Exception("授权信息未设置,无法进行网站初始化"); } } if (_yunClient == null) { var apiUrl = WebConfigurationManager.AppSettings["ServerUrl"]; if (new[] { _appInfo.AppKey, _appInfo.AppSecret, apiUrl }.Any(string.IsNullOrWhiteSpace)) { throw new Exception("服务端必要数据未初始化"); } _yunClient = new DefaultYunClient(apiUrl, _appInfo.AppKey, _appInfo.AppSecret); } } } }