制作我们自己的Ebay(拍卖系统)(7)

2016-01-29 17:20 3 1 收藏

制作我们自己的Ebay(拍卖系统)(7),制作我们自己的Ebay(拍卖系统)(7)

【 tulaoshi.com - ASP 】

  Chris Payne

September 11, 2000

Well, now your auction can run for an indefinite time. People can keep placing bids until you decide to
stop them (good for the seller, but makes bidders kind of unhappy, to say the least). Let's discuss the
mechanisms for stopping an auction.

There are two easy ways to do it. The first, and easiest to perform, though requiring more manual
intervention in the long run, is to simply build in an "Active" bit field into your tblAuctions table.
When you decide to stop the auction, flip the bit, and the auction is over. (You'll also have to add some
code to make sure that the DoBids and ResolveBids functions don't operate on closed auctions.) Then simply
query the database, find out the winner(s), and let them and the seller know. Easy as pie.

The second method is to go by the end date the seller specifies (better business, believe me). To do this,
you can manually stop the auction (via the process above) when the appropriate date comes, or you can
schedule a task to turn an auction off at the appropriate times. There are a few ways to do this, via your
database program and the Windows NT Task Scheduler, so I won't go through each one. You could simply set
the script to run every midnight or so to stop the auction and determine the winners.

If you let the seller specify an exact time for the auction to end, then you're introducing a whole new
set of complications. One way to handle this is to programmatically set a scheduled task as soon as the
seller submits the auction, for the end date of the auction. This requires minimum intervention, but
requires you to know how to do that (for documentation on the Task Scheduler, read this MSDN article).
Another method is to create your own specific version of task scheduler; create a small program that will
run in the background and watch the times on auctions. When an auction end date passes, flip the bit.

Okay, so the auction is over. Now what?

Assuming that you would like minimal manual intervention, and you don't really care who wins (like the
head guys at Ebay care who wins every single auction), then you could create a function to send alerts to
the winner(s) and seller that will kick off when the auction is over. This function could also in turn
kick off some type of payment system, but that is beyond the scope of this article. Let's look at the
function:



Function SelectWinners(AuctionID, itemID)


'Set variables and create objects
dim totItems, intAvailable
totItems = 0
strConnectionString = "DSN=MyAuction;UID=username;PWD=password;Database=MyAuctionDB"
set rst = Server.CreateObject("ADODB.Recordset")


'Find the number of items available
strSQL = "SELECT Available FROM tblAuctionItems WHERE " & _
"IID = " & ItemID
rst.open strSQL, strConnectionString
intAvailable = rst(1)
rst.close


'find the winners
'If two customers bid the same amount, the customer requesting
more items will win. If still tied, the customer placing the
earliest bid will win
strSQL = "SELECT UID, WinPrice, WinItems FROM tblAuctionBids " & _
"WHERE IID = " & itemID & " ORDER BY WinItems DESC, Time"


rst.open strSQL, strConnectionString
if not rst.eof then
do until rst.eof OR totItems = intAvailable
'Keep a running tally of items distributed
totItems = totItems + rst(2)
If totItems <= intAvailable then 'This buyer won
'Send an email alerting this buyer
call SendWinningEmail(rst(0))
End if
rst.movenext
loop
end if


End Function


This is a pretty simple function. Simply loop through the bids in the correct order (by number of items
won first, and then by date), and alert the buyers that they've won. Once the num

来源:http://www.tulaoshi.com/n/20160129/1501011.html

延伸阅读
深度了解自己的win7系统详情   1.使用组合快捷键win+r,打开运行,输入slmgr.vbs -dlv,回车确定,如下图所示 2.如下图所示,我们可以清楚滴看到系统的版本信息,包括激活ID等 修复Win7系统开机时出现0xc0000098错误代码的方法 Win7系统启动故障有很多种,通常都有一定的故障代码,我们可以依照故障代码来寻找针对的...
标签: 脱毛
问答 图钉提问: 夏天最好的脱毛方法是什么??哪位达人帮忙解决一下 图老师解答: 病情分析:       您好,最好是采用激光脱毛,激光脱毛方式具有一定的高科技含量和强大的物理学基础,主要原理是应用了一个物理学的概念,即某一颜色的物质,一定对某一特殊波长的光吸收率最强。     &nbs...
标签: 美容 美容方法
你是否有过这些苦恼,是否遭遇过这些尴尬,是否无奈?是否无助? 别急,图老师图老师小编虽然不能带你拯救地球,但可以教你如何去拯救自己的肌肤。 在一次匆忙的上眉毛油之后,你突然发现眼睫毛卷在一起了 解决:在化妆清洁器上滴一滴挥发清洁剂,在快干的时候,将睫毛上的粘质擦拭掉(在下睫毛下面放置折叠的纸接掉下的残渣)...
婴儿期心理发育 1、2个月婴儿心理发育     这个时期的孩子与外界接触很少,是以自我为中心地生活着,只关心自己的满足。当他们的生活需求得到满足时,就非常平静,而当饥饿、消化不良或疲劳的刺激时,就会不停地啼哭。孩子的注意力有了一定的发展,发亮的或彩色鲜艳的物体出现在视野内时,他会发出愉...
标签: windows系统
Win8怎样自己制作系统主题?   Windows 8主题是一组由图片和声音定制而成的桌面元素集合,可以给人们以视听享受。我们可以通过自定义主题的方式来实现你的要求。 右击桌面空白处,选择快捷菜单中的个(图老师整理)性化命令。 在弹出的个性化窗口中,任意选择一组主题。选择之后,下面的桌面背景相应就变成了该主题所使用...

经验教程

120

收藏

99
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部