⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paytopic.asp

📁 教师评估系统
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!-- #include file="Cls.asp" -->
<%
top "悬赏帖子",True
ChkUser
openweiwang=0
prestige_set=1 '每个报酬帖自动包含的威望值
CacheAdd "User_"&CookieUserName,""

id=ChkNumeric(Request("id"))

Set Rs=Conn.Execute("select ForumID,Username,PostsTableName,PayTopicMoney,Replies,Topic from [WxThreads] where ID="&id)
ForumID=Rs(0)
PostsTableName=Rs(2)
picuser=Rs(1)
allpaymoney=Rs(3)
Topic=ReplaceText(Rs(5),"<[^>]*>","")
if Rs(4)=0 then Error 6,"<li>该悬赏帖不存在回复</li>"
Rs.close

ForumData=GetForumData(ForumID)
ForumName=ForumData(2)
Moderated=ForumData(3)
ParentID=ForumData(0)

if LCase(picuser)=LCase(CookieUserName) then pass=1
if BestRole=1 then pass=1

if pass<>1 then Error 0,""
realtoplou=0

if allpaymoney<=0 then Error "系统错误","<li>该悬赏帖已结帖</li>"
%><div class="nav dt"><img alt="" src="Images/Forum_nav.gif" />&nbsp; <%=ClubTree%> → <%ForumTree(ParentID)%><%=ForumTreeList%> <a href="Forums.asp?Fid=<%=ForumID%>"><%=ForumName%></a> → <a href="Threads.asp?Tid=<%=ThreadID%>"><%=Topic%></a> → 悬赏结帖 [<a href="?menu=redo&id=<%=id%>" title="点这里删除临时数据,重新分配">刷新临时数据重新分配</a>]</div>
<%
Set Rs=Conn.Execute("select Adminname from [WxPayTopic] where ThreadID="&id&" order by id desc")
if Rs.Eof Then
 Adminname=CookieUserName
Else
 AdminName=Rs(0)
end if
Rs.close

if LCase(Adminname)<>LCase(CookieUserName) then noadmin="yes"

if Request("menu")="redo" and noadmin="yes" then
Conn.execute("delete from [WxPayTopic] where ThreadID="&id&"")
%>
<script type="text/javascript">
alert("您好 <%=CookieUserName%>,您当前所管理的悬赏帖,正被另一位管理员“<%=adminname%>”管理(发帖人和版主及其以上管理员有权进行结帖)");
</script> 
<%
end if

if Request("menu")="givemoney" Then
Conn.execute("delete from [WxPayTopic] where DateCreated<"&SqlDateChar&Date()-2&SqlDateChar&"")

'处理数据

oklouid=ChkNumeric(Request("oklouid"))
AllRename=Request("AllRename")
AllRenamelou=Request("AllRenamelou")
allgetsame=Request("allgetsame")
if isnumeric(""&Request("toplou")&"") then
toplou=int(Request("toplou"))
else
toplou=0
end if

Dim GiveMoney(9),GetMoneyUser(9),havegive
For j=0 To 9
GiveMoney(j)=ChkNumeric(Request.Form("GiveMoney"&(j+1)))
GetMoneyUser(j)=HTMLEncode(Request.Form("GetMoneyUser"&(j+1)))
havegive=havegive+GiveMoney(j)
Next

if havegive>0 and allgetsame<>1 and LCase(adminname)=LCase(CookieUserName) then
For j=0 To 9
if GiveMoney(j)>0 Then
Conn.Execute("insert into [WxPayTopic] (Adminname,Username,ThreadID,GetMoney) values ('"&CookieUserName&"','"&GetMoneyUser(j)&"',"&id&",'"&GiveMoney(j)&"')")
end if
Next

end if

if noadmin="yes" then
%>
<script type="text/javascript">
alert("您好 <%=CookieUserName%>,您当前所管理的悬赏帖,正被另一位管理员“<%=adminname%>”管理(发帖人和版主及其以上管理员有权进行结帖)");
</script>
<%
end if
end if

sql="select * from [WxPosts"&PostsTableName&"] where ThreadID="&id&" and IsTopic=0 order by id"
rs.Open sql,Conn,1
i=0'楼层
ii=0'有效项参数
do while Not rs.Eof
i=i+1
if picuser=rs("username") then showgiveroom="-"
if allrename_1="" then
if picuser<>rs("username") then
ii=ii+1
allrename_1=""&rs("username")&""
allrenamelou_1=""&i&""
end if
else
if instr("|"&allrename_1&"|","|"&rs("username")&"|")>0 then thesame="yes"
if thesame<>"yes" and picuser<>rs("username") then
ii=ii+1
allrename_1=""&allrename_1&"|"&rs("username")&""
allrenamelou_1=""&allrenamelou_1&"|"&i&""
end if
end if
thesame="no"
showgiveroom=""
rs.MoveNext
loop
rs.close
if i=0 then Error "系统错误","<li>该悬赏帖不存在回复</li>"
'if i=0 then on Error resume next
if ii=0 then Error "系统错误","<li>该悬赏帖不存在回复</li>"
'if ii=0 then on Error resume next
realtoplou=i '最高真正楼层
if noadmin="yes" then allrename=allrename_1

if Request("allgetsame")=1 then '自动平分所有钱

verymoneybox=int(allpaymoney/ii)'每份钱多少

'开始直接给会员转账

if openweiwang=1 then'威望值启动的情况下
'on Error resume next
weiwang_verybox=int(prestige_set/ii)'每份威望是多少点
end if

allrename_2=split(allrename_1,"|")
for i = 0 to UBound(allrename_2)
sql="select * from [WxUsers] where username='"&allrename_2(i)&"'"
rs.Open sql,Conn,1,3
if Not rs.Eof then
if i=0 then

'添加威望值
if openweiwang=1 then'威望值启动的情况下
rs("prestige")=rs("prestige")+weiwang_verybox+(prestige_set-(weiwang_verybox*ii))
showinreforum="&nbsp;获得威望值:"&weiwang_verybox+(prestige_set-(weiwang_verybox*ii))&""
end if

rs("usermoney")=rs("usermoney")+verymoneybox+(allpaymoney-(int(allpaymoney/ii)*ii))'分完还剩余的,要分给第一个回复者
else
rs("usermoney")=rs("usermoney")+verymoneybox

'添加威望值
if openweiwang=1 then'威望值启动的情况下
rs("prestige")=rs("prestige")+weiwang_verybox
showinreforum="&nbsp;获得威望值:"&weiwang_verybox&""
end if

end if
if showmoneyhowtogive="" then
showmoneyhowtogive="&nbsp;&nbsp;(总报酬金:"&allpaymoney&")&nbsp;<br />&nbsp;"&allrename_2(i)&"&nbsp;获得报酬:&nbsp;"&verymoneybox+(allpaymoney-(int(allpaymoney/ii)*ii))&"&nbsp;元"&showinreforum&""
else
showmoneyhowtogive=""&showmoneyhowtogive&"<br />&nbsp;"&allrename_2(i)&"&nbsp;获得报酬:&nbsp;"&verymoneybox&"&nbsp;元"&showinreforum&""
end if
rs.update
end if
rs.close
next

'自动回复一个带有报酬分配表的帖子
sql="select * from [WxPosts"&PostsTableName&"]"
rs.Open sql,Conn,1,3
rs.addnew
rs("ThreadID")=id
rs("IsTopic")=0
rs("username")=CookieUserName
rs("Subject")="Re:"&Conn.Execute("select topic from [WxThreads] where id="&id&"")(0)
rs("content")="<span class=red><b>本帖悬赏分配情况公布</b></span><br />"&showmoneyhowtogive&"<br />"&showinreforum&""
rs("posttime")=now
rs("postip")=Request.ServerVariables("REMOTE_ADDR")
rs.update
rs.close
showmoneyhowtogive=""

'把该报酬帖设置为已结帖
sql="select * from [WxThreads] where id="&ID&""
rs.Open sql,Conn,1,3
if Not rs.Eof then
rs("PayTopicMoney")=-rs("PayTopicMoney")
rs("icon")=12
rs("replies")=rs("replies")+1
rs.update
end if
rs.close

Response.redirect "Threads.asp?Tid="&id&""'跳回帖子

end if

if LCase(adminname)=LCase(CookieUserName) and realtoplou<=toplou then '如果已到处理到顶楼就执行下面的设置

if Request("doallnow")="yes" or Request("allgetsame")=1 then'开始处理临时数据

if Request("allgetsame")=1 then '自动平分所有钱

else

'先把相同的项目按ID号的来删除,ID号大的留下,得到钱为0的也删除
sql="select * from [WxPayTopic] where ThreadID="&id&" order by id desc"
rs.Open sql,Conn,1,3
allreadygivemoney=0 '要给出的钱的总数
realgetmoneyman=0 '最后能得到钱的总人数
username_checksame=""
do while Not rs.Eof
if Int(Rs("GetMoney"))<=0 then
Rs.delete
Rs.update
else
if InStr("|"&username_checksame&"|","|"&Rs("Username")&"|")>0 Then
Rs.delete
Rs.update
Else
realgetmoneyman=Int(realgetmoneyman)+1
Response.write "RE"&realgetmoneyman
allreadygivemoney=Int(allreadygivemoney)+Rs("GetMoney")
username_checksame=username_checksame&"|"&Rs("username")
end if
end if

Rs.MoveNext
loop
Rs.close

'检查总分配的钱和提供的报酬总数是否相等,准备下步运行一定的代码段
if allpaymoney>allreadygivemoney then dolaw="1"
if allpaymoney=allreadygivemoney then dolaw="2"
if allpaymoney<allreadygivemoney then dolaw="3"

'###如果给出钱后还有余就执行本代码段###
if dolaw="1" then
allpaymoney_duode=allpaymoney-allreadygivemoney

if realgetmoneyman=0 then Error "操作错误","<li>最后能得到钱的总人数不能为零</li>"

allpaymoney_duode_1=allpaymoney_duode/realgetmoneyman

sql="select * from [WxPayTopic] where ThreadID="&id&" order by id"
rs.Open sql,Conn,1,3
checkrich_1=0'看谁的钱最多,如果这样分后还有余额,都分给他(checkrich)
givetomoneycheck=0 '实际已分出的钱
do while Not rs.Eof
if rs("getmoney")>checkrich_1 then
checkrich_1=rs("getmoney")
checkrich=rs("username")
end if
if allpaymoney_duode_1>1 then '余下的钱还够分每人一份
rs("getmoney")=rs("getmoney")+int(allpaymoney_duode_1)
else'不够分,按各自得钱占总钱数的百分比分配余额
rs("getmoney")=int((rs("getmoney")/allreadygivemoney)*allpaymoney_duode)
end if
rs.update
givetomoneycheck=givetomoneycheck+rs("getmoney")
rs.MoveNext
loop
rs.close

if givetomoneycheck<allpaymoney then'还有钱余下就都分给得到最多钱的人
sql="select * from [WxPayTopic] where ThreadID="&id&" and username='"&checkrich&"'"
rs.Open sql,Conn,1,3
if Not rs.Eof then
rs("getmoney")=rs("getmoney")+(allpaymoney-givetomoneycheck)
rs.update
end if
rs.close
end if

'把该报酬帖设置为已结帖并在最后以当前管理员身份回复出分配表
sql="select * from [WxThreads] where id="&ID&""
rs.Open sql,Conn,1,3
if Not rs.Eof then
rs("PayTopicMoney")=-rs("PayTopicMoney")
rs("icon")=12
rs("replies")=rs("replies")+1
rs.update
end if
rs.close

'生成分配表下步回复到帖子里
sql="select * from [WxPayTopic] where ThreadID="&id&" order by id"
rs.Open sql,Conn,1
do while Not rs.Eof
if givemoneyorder=empty then
givemoneyorder=""&rs("username")&","&rs("getmoney")&""
else
givemoneyorder=""&givemoneyorder&"|"&rs("username")&","&rs("getmoney")&""
end if
if showmoneyhowtogive="" then
showmoneyhowtogive="&nbsp;&nbsp;(总报酬金:"&allpaymoney&")&nbsp;<br />&nbsp;"&rs("username")&"&nbsp;获得报酬:&nbsp;"&rs("getmoney")&"&nbsp;元"
else
showmoneyhowtogive=""&showmoneyhowtogive&"<br />&nbsp;"&rs("username")&"&nbsp;获得报酬:&nbsp;"&rs("getmoney")&"&nbsp;元"
end if
rs.MoveNext
loop
rs.close

if openweiwang=1 then'威望值启动的情况下
weiwang_pay=0 '累加已送的威望值
'on Error resume next
end if

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -