private void Save_Click(object sender, EventArgs e) { #region 保存积分设置信息 if (this.CheckCookie()) { if ((Convert.ToDouble(creditstax.Text.Trim()) > 1) || (Convert.ToDouble(creditstax.Text.Trim()) < 0)) { base.RegisterStartupScript("", "<script>alert('积分交易税必须是0--1之间的小数');window.location.href='global_scoreset.aspx';</script>"); return; } if (Convert.ToDouble(transfermincredits.Text.Trim()) < 0) { base.RegisterStartupScript("", "<script>alert('转账最低余额必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>"); return; } if (Convert.ToDouble(exchangemincredits.Text.Trim()) < 0) { base.RegisterStartupScript("", "<script>alert('兑换最低余额必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>"); return; } if (Convert.ToDouble(maxincperthread.Text.Trim()) < 0) { base.RegisterStartupScript("", "<script>alert('单主题最高收入必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>"); return; } if (Convert.ToDouble(maxchargespan.Text.Trim()) < 0) { base.RegisterStartupScript("", "<script>alert('单主题最高出售时限必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>"); return; } if (formula.Text.Trim() == "" || !AdminForums.CreateUpdateUserCreditsProcedure(formula.Text.Trim())) { base.RegisterStartupScript("", "<script>alert('总积分计算公式为空或不正确');window.location.href='global_scoreset.aspx';</script>"); return; } if (Convert.ToInt32(losslessdel.Text) > 9999 || Convert.ToInt32(losslessdel.Text) < 0) { base.RegisterStartupScript("", "<script>alert('删帖不减积分时间期限只能在0-9999之间');window.location.href='forum_option.aspx';</script>"); return; } dsSrc.ReadXml(Server.MapPath("../../config/scoreset.config")); dsSrc.Tables["formula"].Rows[0]["formulacontext"] = formula.Text.Trim(); dsSrc.Tables["formula"].Rows[0]["creditstrans"] = creditstrans.SelectedValue; if (creditstrans.SelectedValue == "0") { dsSrc.Tables["formula"].Rows[0]["topicattachcreditstrans"] = creditstrans.SelectedValue; dsSrc.Tables["formula"].Rows[0]["bonuscreditstrans"] = creditstrans.SelectedValue; } else { dsSrc.Tables["formula"].Rows[0]["topicattachcreditstrans"] = topicattachcreditstrans.SelectedValue; dsSrc.Tables["formula"].Rows[0]["bonuscreditstrans"] = bonuscreditstrans.SelectedValue; } dsSrc.Tables["formula"].Rows[0]["creditstax"] = Convert.ToDouble(creditstax.Text); dsSrc.Tables["formula"].Rows[0]["transfermincredits"] = Convert.ToDouble(transfermincredits.Text); dsSrc.Tables["formula"].Rows[0]["exchangemincredits"] = Convert.ToDouble(exchangemincredits.Text); dsSrc.Tables["formula"].Rows[0]["maxincperthread"] = Convert.ToDouble(maxincperthread.Text); dsSrc.Tables["formula"].Rows[0]["maxchargespan"] = Convert.ToDouble(maxchargespan.Text); dsSrc.WriteXml(Server.MapPath("../../config/scoreset.config")); Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService(); cache.RemoveObject("/Forum/Scoreset"); cache.RemoveObject("/Forum/Scoreset/CreditsTrans"); cache.RemoveObject("/Forum/Scoreset//Forum/Scoreset/TopicAttachCreditsTrans"); cache.RemoveObject("/Forum/Scoreset/BonusCreditsTrans"); cache.RemoveObject("/Forum/Scoreset/CreditsTax"); cache.RemoveObject("/Forum/Scoreset/TransferMinCredits"); cache.RemoveObject("/Forum/Scoreset/ExchangeMinCredits"); cache.RemoveObject("/Forum/Scoreset/MaxIncPerThread"); cache.RemoveObject("/Forum/Scoreset/MaxChargeSpan"); cache.RemoveObject("/Forum/IsSetDownLoadAttachScore"); cache.RemoveObject("/Forum/ValidScoreUnit"); cache.RemoveObject("/Forum/RateScoreSet"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "修改积分设置", "修改积分设置"); configInfo.Alipayaccout = DNTRequest.GetFormString("alipayaccount"); configInfo.Cashtocreditrate = DNTRequest.GetFormInt("cashtocreditsrate", 0); int mincreditstobuy = DNTRequest.GetFormInt("mincreditstobuy", 0); //如果现金/积分兑换比率为0,则表示不开启积分充值功能 if (configInfo.Cashtocreditrate > 0) { //为了保证生成的订单价格最低价格为0.1元,则需要根据现金和积分兑换比率来动态调整积分最少购买数量的值 while ((decimal)mincreditstobuy / (decimal)configInfo.Cashtocreditrate < 0.10M) { mincreditstobuy++; } } configInfo.Mincreditstobuy = mincreditstobuy; configInfo.Maxcreditstobuy = DNTRequest.GetFormInt("maxcreditstobuy", 0); configInfo.Userbuycreditscountperday = DNTRequest.GetFormInt("userbuycreditscountperday", 0); configInfo.Alipaypartnercheckkey = DNTRequest.GetFormString("alipaypartnercheckkey"); configInfo.Alipaypartnerid = DNTRequest.GetFormString("alipaypartnerid"); configInfo.Usealipaycustompartnerid = DNTRequest.GetFormInt("usealipaycustompartnerid", 1); configInfo.Usealipayinstantpay = DNTRequest.GetFormInt("usealipayinstantpay", 0); configInfo.Losslessdel = Convert.ToInt16(losslessdel.Text); GeneralConfigs.SaveConfig(configInfo); GeneralConfigs.ResetConfig(); if (RefreshUserScore.SelectedValue.IndexOf("1") == 0) { //运行ajax批量更新用户积分功能 ClientScript.RegisterStartupScript(this.GetType(), "Page", "<script>submit_Click();</script>"); return; //Users.UpdateUserCredits(formula.Text, 0); } base.RegisterStartupScript("PAGE", "window.location.href='global_scoreset.aspx';"); } #endregion }