/// <summary> /// 发帖成功 /// </summary> /// <param name="values">版块积分设置</param> /// <param name="topicinfo">主题信息</param> /// <param name="topicid">主题ID</param> private void PostTopicSucceed(float[] values, TopicInfo topicinfo, int topicid) { if (values != null) ///使用版块内积分 { UserCredits.UpdateUserExtCredits(userid, values, false); if (userid != -1) UserCredits.WriteUpdateUserExtCreditsCookies(values); } else ///使用默认积分 { UserCredits.UpdateUserCreditsByPostTopic(userid); if (userid != -1) UserCredits.WriteUpdateUserExtCreditsCookies(Scoresets.GetUserExtCredits(CreditsOperationType.PostTopic)); } //当使用伪aspx if (config.Aspxrewrite == 1) SetUrl(topicinfo.Special == 4 ? ShowDebateAspxRewrite(topicid) : ShowTopicAspxRewrite(topicid, 0)); else SetUrl((topicinfo.Special == 4 ? ShowDebateAspxRewrite(topicid) : ShowTopicAspxRewrite(topicid, 0)) + "&forumpage=" + forumpageid); ForumUtils.WriteCookie("postmessage", ""); ForumUtils.WriteCookie("clearUserdata", "forum"); SetLastPostedForumCookie(); SetMetaRefresh(); MsgForward("posttopic_succeed"); AddMsgLine("发表主题成功, 返回该主题<br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, forumpageid) + "\">点击这里返回 " + forum.Name + "</a>)<br />"); //通知应用有新主题 Sync.NewTopic(topicid.ToString(), topicinfo.Title, topicinfo.Poster, topicinfo.Posterid.ToString(), topicinfo.Fid.ToString(), ""); }
/// <summary> /// 更新用户金币 /// </summary> /// <param name="tidlist">通过审核主题的Tid列表</param> private void UpdateUserCredits(string tidlist) { string[] tidarray = tidlist.Split(','); float[] values = null; ForumInfo forum = null; TopicInfo topic = null; int fid = -1; foreach (string tid in tidarray) { topic = Topics.GetTopicInfo(int.Parse(tid)); //获取主题信息 if (fid != topic.Fid) //当上一个和当前主题不在一个版块内时,重新读取版块的金币设置 { fid = topic.Fid; forum = Forums.GetForumInfo(fid); if (!forum.Postcredits.Equals("")) { int index = 0; float tempval = 0; values = new float[8]; foreach (string ext in Utils.SplitString(forum.Postcredits, ",")) { if (index == 0) { if (!ext.Equals("True")) { values = null; break; } index++; continue; } tempval = Utils.StrToFloat(ext, 0); values[index - 1] = tempval; index++; if (index > 8) { break; } } } } if (values != null) { ///使用版块内金币 UserCredits.UpdateUserCreditsByPostTopic(topic.Posterid, values); } else { ///使用默认金币 UserCredits.UpdateUserCreditsByPostTopic(topic.Posterid); } } }