コード例 #1
0
        /// <summary>
        /// 保存城购云配置信息
        /// </summary>
        /// <param name="key">客户KEY</param>
        /// <param name="secret">客户密钥</param>
        /// <returns></returns>
        public static void SaveConfig(string key, string secret)
        {
            //先更新内存中数据
            _appInfo = new AppModel { AppKey = key, AppSecret = secret};
            _yunClient = null;

            //将数据写入缓存中
            var init = new Yun.ClientCache.CacheFunc();
            init.DropTable(_appTableName);
            init.Insert(_appTableName, "id", _appInfo, null);
        }
コード例 #2
0
        /// <summary>
        /// 获取系统信息
        /// </summary>
        private static void GetWebSettingRequest()
        {
            if (_webInfo != null) return;

            var init = new Yun.ClientCache.CacheFunc();
            var setting = init.Fetch<Settoins>("app", "id = 1");

            if (setting != null)
            {
                _webInfo = setting.Settoin.ConvertAll(x => new StringKeyValuePair { Key = x.Key, Value = x.Value });
               return;
                
            }
            var r = YunClient.Instance.Execute(new GetWebSettingRequest(), Extension.Member.Token).Settings;

            if (r == null || r.Count <= 0) return;
            init.Insert("app", "id", new Settoins {id = 1, Settoin = r}, null);
            _webInfo = r.ConvertAll(x => new StringKeyValuePair {Key = x.Key, Value = x.Value});
        }
コード例 #3
0
        /// <summary>
        /// 添加系统信息
        /// </summary>
        public static bool SetWebSettings(string isneedcates, string webName, string beian, string seoKey, string seoValue, string seoDescription, string stock, string qqKey, string qqValue, string sinaWeiBoKey, string sinaWeiBoValue, string alipayKey, string alipayValue, string qqUrl, string sinaWeiBoUrl, string alipayUrl, string logn = "", string alipayReturnUrl="")
        {
            var lognImg = Extension.Commodity.UpdateImages();
            var setting = new List<YunKeyValuePair<string, string>>
            {
                new YunKeyValuePair<string, string>("isneedcates", isneedcates),
                new YunKeyValuePair<string, string>("webname", webName),
                new YunKeyValuePair<string, string>("beian", beian),
                new YunKeyValuePair<string, string>("logo", lognImg != "" ? lognImg : logn),
                new YunKeyValuePair<string, string>("seokey", seoKey),
                new YunKeyValuePair<string, string>("seovalue", seoValue),
                new YunKeyValuePair<string, string>("seodescription", seoDescription),
                new YunKeyValuePair<string, string>("stock", stock),
                new YunKeyValuePair<string, string>("qqkey", qqKey),
                new YunKeyValuePair<string, string>("qqvalue", qqValue),
                new YunKeyValuePair<string, string>("qqurl", qqUrl),
                new YunKeyValuePair<string, string>("sinaweibokey", sinaWeiBoKey),
                new YunKeyValuePair<string, string>("sinaweibovalue", sinaWeiBoValue),
                new YunKeyValuePair<string, string>("sinaweibourl", sinaWeiBoUrl),
                new YunKeyValuePair<string, string>("alipaykey", alipayKey),
                new YunKeyValuePair<string, string>("alipayvalue", alipayValue),
                new YunKeyValuePair<string, string>("alipayurl", alipayUrl),
                new YunKeyValuePair<string, string>("alipayreturnurl", alipayReturnUrl),
            };

            var r = YunClient.Instance.Execute(new SetWebSettingRequest
            {
                Setting = setting,
            }, Extension.Member.Token);

            //将数据写入缓存中
            var init = new Yun.ClientCache.CacheFunc();
            init.Delete("app", "id", 1);
            _webInfo = null;

            init.Insert("app", "id", new Settoins { id = 1, Settoin = setting }, null);
            return r.Result;
        }