<!--#include file="conn.asp" -->
<!-- #include file="inc/info.asp" -->
<!-- #include file="inc/const.asp" -->
<%response.Expires=0
admheader
action=rst("action")
response.Write("<table width=""95%"" border=""0"" cellspacing=""1"" cellpadding=""3"" class=""tableBorder"" align=center>")
response.Write("<tr><td height=""0"" width=23%\><nobr></nobr></td><td height=""0"" width=23%\><nobr></nobr></td><td height=""0"" width=23%\><nobr></nobr></td><td height=""0"" width=15%\><nobr></nobr></td><td height=""0"" width=16%\><nobr></nobr></td></tr>")
response.Write("<tr><th height=""25"" colspan=5>")
select case action
case "refresh"
str="到达底价的商品"
case "showrefresh"
str="成交到达底价的商品"
case "dorefresh"
str="成交到达底价的商品"
case "refresh_no"
str="没有人竞标的商品"
case "dorefresh_no"
str="结束没有人竞标的商品"
case "refresh_nogetdi"
str="未到达底价的商品"
case "showrefresh_nogetdi"
str="结束未到达底价的商品"
case "dorefresh_nogetdi"
str="结束未到达底价的商品"
case "delauc"
str="删除错误的商品"
case "dodelauc"
str="删除错误的商品"
case else
err_msg="错误"
call aspease_err
end select
response.write str
response.write "</th></tr>"
select case action
case "refresh"
call refresh
case "showrefresh"
call showrefresh
case "dorefresh"
call dorefresh
case "refresh_no"
call refresh_no
case "dorefresh_no"
call dorefresh_no
case "refresh_nogetdi"
call refresh_nogetdi
case "showrefresh_nogetdi"
call showrefresh_nogetdi
case "dorefresh_nogetdi"
call dorefresh_nogetdi
case "delauc"
call delauc
case "dodelauc"
call dodelauc
case else
err_msg="错误"
call aspease_err
end select
admfooter
response.write "</table></body></html>"
'#########有人竞标达到低价,可以成交结束的商品
sub refresh
sql = "select * from auctions where auc_CurrentBid>auc_ReservePrice and auc_ended ='N' and datediff('s',now(),auc_CloseDate)<=0 order by auc_CloseDate desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write " <tr><td class=row colspan=5>现在没有结束的商品</td></tr>"
else
response.write "<tr><td class=row colspan=5>现在已经有" & rs.recordcount & " 个结束的商品,请点击商品连接进行交易</td></tr>"
response.write "<tr><td class=row colspan=3>商品名称</td><td class=row colspan=2>查看详细</td></tr>"
do while not rs.eof
response.write "<tr><td class=row colspan=3><a href=?action=showrefresh&aucid="&fval(rs("auc_id"))&">"&rs("auc_itemtitle")&"</a> </td><td colspan=2 class=row><a href=?action=showrefresh&aucid="&fval(rs("auc_id"))&">查看详细</a></td></tr>"
rs.movenext
loop
end if
end sub
sub showrefresh
aucid=fval(rst("aucid"))
sql = "select * from bids,auctions where auc_id =biditemid and biditemid="&sqlval(aucid)&" and auc_ended='N' order by bidAmount desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
response.Write("<tr><td class=row colspan=5>直接点击“成交”即可完成交易</td></tr>")
response.Write(" <tr>")
response.Write(" <th height=""25"">商品名称</th>")
response.Write(" <th height=""25"">所出价格</th>")
response.Write(" <th height=""25"">买家</th>")
response.Write(" <th height=""25"">卖家</th>")
response.Write(" <th height=""25"">执行操作</th>")
response.Write(" </tr>")
response.Write("<form action=""?action=dorefresh"" name=""form"" method=post>")
response.Write("<input type=hidden name=h1 value=" & aucid & ">")
response.Write("<input type=hidden name=owner value=" & fval(rs("auc_ItemOwner")) & ">")
i=0
while not rs.eof
response.Write("<tr><td><a href=""viewitem.asp?aucid=" & aucid & """ target=_blank>" & rs("auc_itemtitle") & "</a></td>")
response.Write("<td>" & rs("bidAmount") & "</td>")
response.Write("<td><a href=contact.asp?userid=" & fval(rs("bidBidderID")) & " target=_blank>" & aspeaseusername(sqlval(rs("bidBidderID"))) & "</a></td>")
response.Write("<td><a href=contact.asp?userid=" & fval(rs("auc_ItemOwner")) & " target=_blank>" & aspeaseusername(sqlval(rs("auc_ItemOwner"))) & "</a></td>")
response.Write("<td>" & rs("bidID") & "<input type=checkbox name=""c1"" value=" & fval(rs("bidID")))
if i < fval(rs("auc_Numleft")) then
response.write("checked")
else
response.write("disabled")
end if
response.Write("></td></tr>")
rs.movenext
i=i+1
wend
response.Write("<tr><td colspan=5><input type=submit name=submit value=""成交""></td></tr></form>")
end sub
sub dorefresh
dim biditemid
bidid=rst("c1")
bidid=replace(bidid,"'","")
bidid=replace(bidid,";","")
bidid=replace(bidid,"--","")
bidid=replace(bidid,")","")
biditemid=rst("h1")
incept=split(bidid,",")
for i=0 to ubound(incept)
conn.execute("update bids set bidstat='Y' where bidid in ("&incept(i)&")")
sql3="select * from bids,auctions where biditemid=auc_id and bidid ="&incept(i)&" and bidstat='Y' order by bidAmount desc"
set rs3=server.createobject("adodb.recordset")
rs3.Open sql3,conn,1,3
if rs3.recordcount=0 then
response.write "<tr><td class=row colspan=5>没有记录</td></tr>"
response.End()
else
rs3.movefirst
do while not rs3.eof
conn.execute "insert into gets(get_itemid,get_date,get_buyerid,get_num,get_amount,get_bidid,get_sellerid,get_type) values("&sqlval(rs3("biditemid"))&",'"&sqldate(now())&"',"&sqlval(rs3("bidBidderID"))&","&sqlval(rs3("bidnum"))&","&sqlval(rs3("bidAmount"))&","&sqlval(rs3("bidid"))&","&sqlval(rs3("auc_ItemOwner"))&",0)"
rs3.movenext
loop
conn.execute("update auctions set auc_ended='Y',auc_numleft=auc_numleft-"&rs3.recordcount&" where auc_id ="&sqlval(biditemid))
end if
next
response.Write("<tr><td class=row colspan=5>交易成功 ,请返回</td></tr>")
end sub
'#################无人竞标的商品已经到期##############
sub refresh_no
sql = "select * from auctions where auc_ended='N' and auc_Bidtimes=0 and datediff('s',now(),auc_CloseDate)<=0 order by auc_CloseDate desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
response.write "<tr><td class=row colspan=5>现在没有结束的商品</td></tr>"
response.end
end if
response.Write(" <tr> ")
response.Write(" <th width=""23%"" height=""25"">商品名称</th>")
response.Write(" <th width=""23%"" height=""25"">开始时间</th>")
response.Write(" <th width=""23%"" height=""25"">结束时间</th>")
response.Write(" <th width=""15%"" height=""25"">卖家</th>")
response.Write(" <th width=""16%"" height=""25"">执行操作</th>")
response.Write(" </tr> ")
response.Write(" <form action=""?action=dorefresh_no"" name=""form"" method=post>")
i=1
while not rs.eof
response.Write(" <tr> ")
response.Write(" <td width=""23%""> <a href=""viewitem.asp?aucid=")
response.Write(fval(rs("auc_id")))
response.Write(""" target=""_blank"">")
response.Write(rs("auc_itemtitle"))
response.Write("</a></td>")
response.Write(" <td width=""23%""> ")
response.Write(sqldate(rs("auc_AvailDate")))
response.Write("</td>")
response.Write(" <td width=""23%""> ")
response.Write(sqldate(rs("auc_CloseDate")))
response.Write("</td>")
response.Write(" <td width=""15%""> ")
response.Write(aspeaseusername(sqlval(rs("auc_ItemOwner"))))
response.Write("</td>")
response.Write(" <td width=""16%""><input type=""checkbox"" name=""c1"" value=""")
response.Write(fval(rs("auc_id")))
response.Write(""" checked></td>")
response.Write(" </tr>")
rs.movenext
i=i+1
wend
response.Write(" <tr>")
response.Write(" <td colspan=""5""><input type=submit name=submit value=""结束""></td>")
response.Write(" </tr>")
response.Write(" </form>")
end sub
sub dorefresh_no
aucid=request("c1")
conn.execute("update auctions set auc_ended='Y' where auc_id in ("&aucid&")")
response.Write("<script language=javascript>{alert( '商品结束操作成功');location.href='admin_ProcessClosings.asp?action=refresh_no';}</script>")
end sub
'##########################有人竞标,但是没有达到底价,
'这时都不成交,使商品结束,卖家可以重新挂出再卖
sub refresh_nogetdi
sql = "select * from auctions where auc_currentbid>auc_StartingBid and auc_CurrentBid<auc_ReservePrice and auc_ended ='N'and datediff('s',now(),auc_CloseDate)<=0 order by auc_CloseDate desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<tr><td class=row colspan=5>现在没有未达到底价结束的商品</td></tr>"
else
response.write "<tr><td class=row colspan=5>现在已经有"&rs.recordcount&"个结束的商品,请点击商品连接进行结束吧</td></tr>"
do while not rs.eof
response.write "<tr><td class=row colspan=5><a href=?action=showrefresh_nogetdi&aucid="&fval(rs("auc_id"))&">"&rs("auc_itemtitle")&"</a> </td></tr>"
rs.movenext
loop
end if
end sub
sub showrefresh_nogetdi
aucid=fval(rst("aucid"))
sql = "select * from bids,auctions where auc_id =biditemid and biditemid="&sqlval(aucid)&" and auc_ended='N' order by bidAmount desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
response.Write("<tr>")
response.Write(" <td class=row colspan=5>直接点击“结束”即可完成商品结束</td>")
response.Write(" </tr>")
response.Write("<tr> ")
response.Write(" <th height=""25"">商品名称</th>")
response.Write(" <th height=""25"">所出价格</th>")
response.Write(" <th height=""25"">买家</th>")
response.Write(" <th height=""25"">卖家</th>")
response.Write(" <th height=""25"">执行操作</th>")
response.Write(" </tr>")
response.Write(" <form action=""?action=dorefresh_nogetdi"" name=""form"" method=post>")
response.Write(" <input type=hidden name=""h1"" value=""")
response.Write(aucid)
response.Write(""">")
response.Write(" <input type=hidden name=""owner"" value=""")
response.Write(fval(rs("auc_ItemOwner")))
response.Write(""">")
i=0
while not rs.eof
response.Write(" <tr>")
response.Write(" <td><a href=""viewitem.asp?aucid=" & aucid & """ target=_blank>" & rs("auc_itemtitle") & "</a></td>")
response.Write(" <td>" & rs("bidAmount") & "</td>")
response.Write(" <td>")
response.Write(" <a href=contact.asp?userid=" & fval(rs("bidBidderID")) & " target=_blank>")
response.Write(aspeaseusername(sqlval(rs("bidBidderID"))) & "</a></td> ")
response.Write(" <td><a href=contact.asp?userid=" & fval(rs("auc_ItemOwner")) & " target=_blank>")
response.Write(aspeaseusername(sqlval(rs("auc_ItemOwner"))) & "</a></td>")
response.Write(" <td>" & rs("bidID") & "<input type=checkbox name=""c1"" value=" & fval(rs("bidID")))
if i < fval(rs("auc_Numleft")) then
response.write("checked")
else
response.write("disabled")
end if
response.Write("></td></tr>")
rs.movenext
i=i+1
wend
response.Write(" <tr>")
response.Write(" <td colspan=6>")
response.Write(" <input type=submit name=submit value=""结束"">")
response.Write(" </td>")
response.Write(" </tr>")
response.Write(" </form>")
end sub
sub dorefresh_nogetdi
bidid=rst("c1")
bidid=replace(bidid,"'","")
bidid=replace(bidid,";","")
bidid=replace(bidid,"--","")
bidid=replace(bidid,")","")
biditemid=fval(rst("h1"))
incept=split(bidid,",")
for i=0 to ubound(incept)
conn.execute("delete from bids where bidid in("&incept(i)&")")
next
conn.execute("delete from msg where msg_aucid ="&rst("h1")&"")
conn.execute("update auctions set auc_ended='Y' where auc_id ="&sqlval(biditemid))
response.Write("<script language=javascript>")
response.Write(chr(10))
response.Write("{alert( '该商品已经结束成功');")
response.Write(chr(10))
response.Write("location.href='admin_ProcessClosings.asp?action=refresh_nogetdi';}")
response.Write(chr(10))
response.Write("</script>")
end sub
'#############################删除错误的商品################
sub delauc
response.Write("<form name=""form1"" method=""post"" action=""?action=dodelauc"">")
response.Write(" <tr>")
response.Write(" <td class=row> 请输入要删除的商品编号 </td>")
response.Write(" <td class=row colspan=4> <input type=""text"" name=""auc_id""> <input type=""submit"" name=""Submit"" value=""删除""></td> ")
response.Write("</tr>")
response.Write("</form>")
end sub
sub dodelauc
auc_id=rst("auc_id")
if auc_id="" or isnumeric(auc_id)=false then
response.write "<tr><td class=row>请输入正确的编号</td></tr>"
response.end
else
conn.execute("delete from auctions where auc_id="&sqlval(auc_id))
conn.execute("delete from bids where bidItemID="&sqlval(auc_id))
conn.execute("delete from careauc where careItemID="&sqlval(auc_id))
conn.execute("delete from pingjia where pj_aucid="&sqlval(auc_id))
conn.execute("delete from msg where msg_aucid="&sqlval(auc_id))
conn.execute("delete from tuijian where tj_aucid="&sqlval(auc_id))
conn.execute("delete from upshelf where up_aucid="&sqlval(auc_id))
response.write "<tr><td class=row colspan=5>数据删除成功!!</td></tr>"
response.end
end if
end sub
%>
[此贴子已经被作者于2004-11-01 22:18:06编辑过]