eBay,当时间到期时,他们如何结束拍卖?

发布于 2024-09-28 13:11:06 字数 1436 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

倾城°AllureLove 2024-10-05 13:11:06

显然他们需要将其标记为
拍卖结束后立即关闭。

是的,但不一定是实时的。

sql 2005 中如何处理这样的事情?

一点也不。数据库就是数据库。对于实时定价/拍卖计算,您将使用一个程序。基本上,更新数据库,但不要从数据库运行逻辑。

他们是否每秒查询数据库以查找过期的拍卖?

单程。另一种方法是在内存中保存一个按过期时间排序的拍卖列表,然后检查哪些过期。

他们不可能为每一次拍卖创建 SQL 作业,不是吗?

可能不会。

我要做的就是在内存中保存一个拍卖列表。通过每台服务器进行 X 次拍卖来实现可扩展性。

Obviously they need to mark it as
closed as soon as the auction ends.

Yes, but not necessarily real time.

How is something like this handled in sql 2005?

Not at all. A DB is a DB. For real time pricing / auction calculation youwould use a program. Basically, update the database, but dont run the logic from the database.

Do they query the db every second to find the expired auctions?

One way. Another is to have a list ofauctions sorted by expiration in memory and just check there which expire.

No way they are creating sql jobs for every single auction, or are they?

Likely not.

What I would do is keep a list of auctions in memory. Scalability by having X auctions per server.

意犹 2024-10-05 13:11:06

我认为拍卖的状态是拍卖结束日期和当前时间的结果。您不必更改数据库即可更改拍卖状态,通过拍卖结束日期的当前时间将为您完成此操作。

查看拍卖的用户只会根据请求查看状态,因此可以在请求时确定状态。任何物理行为(向获胜者发送电子邮件)不必是真正实时的。投标必须结束;并且可以根据每个投标确定状态

I would consider the state of the auction a result of the end-date of the auction and the current time. You don't have to make a change to the database in order for the state of the auction to change, the current time passing the auction end-date will do that for you.

A user viewing the auction will only view the state on a request basis, so the state can be determined at request-time. Any physical actions (sending email to winner) do not have to be true real-time. Just the closing of the bidding has to be; and the status can be determined on a per-bid basis

淡看悲欢离合 2024-10-05 13:11:06

我曾想象拍卖记录有一个类似 EndDate 的属性。超过该点后,将不再接受任何投标。出价时,客户端应用程序会将 NowEndDate 进行比较。此外,在尝试记录该出价时,数据库会根据 Now() 检查 Auction.EndDate

我不确定客户是否应该更新 auction.status="Closed"。这是对客户端的依赖,也许数据库不应该依赖客户端来“结束”拍卖。建议应该预先确定,并且不需要干预。

I had imagined that an Auction record has an attribute like EndDate. No bids would be accepted beyond that point. When bidding, the client application would compare Now to EndDate. As well, the DB would check Auction.EndDate against Now() when attempting to log that bid.

I'm not sure that clients should be updating the auction.status="Closed" at all. That's a dependency on a client, where perhaps the DB shouldn't have to rely on a client to 'close' an auction. Suggest that should be predetermined, and not require intervention.

人心善变 2024-10-05 13:11:06

我的猜测是一个调度程序和一个作业/任务队列,其中每个任务的执行时间都与拍卖的到期时间一致。调度程序定期检查队列,并在拍卖时间过去后执行任务。该任务将拍卖状态更改为“已结束”,因此此后无法进行出价。这还可能引发一些其他行动,例如向获胜者发送电子邮件。

My guess is a scheduler and a job/task queue where each the execution of each task is timed to coincide with the auction's exipiration. The scheduler periodically checks the queue, and when the auction's time has passed the task is executed. The task changes the auction's state to "closed," so bidding cannot occur after that poiint. That could also trigger some other actions like emailing the winner.

吻风 2024-10-05 13:11:06

根据项目的规模,您可能会使用单个 SQL 作业来执行大规模拍卖结束。每分钟运行一次。

Update [Auctions] SET AuctionStatus = 'CLOSED' WHERE CloseDate <= CURRENT_TIMESTAMP;

让您的应用程序逻辑仅在满足相同 where 子句的情况下向拍卖发布出价。

然后,您可以使用另一个计划作业处理拍卖获胜者,并针对尚未处理的封闭式拍卖进行运行。

Depending on the scale of your project you may get away with a single SQL job that performs mass closing of the auctions. Run this every minute.

Update [Auctions] SET AuctionStatus = 'CLOSED' WHERE CloseDate <= CURRENT_TIMESTAMP;

Have your application logic only post bids to auctions where this same where clause is met.

You can then process auction winners with another scheduled job and runs against closed auctions that are not yet processed.

鹤舞 2024-10-05 13:11:06

我脑海中浮现的第一件事是一个 javascript 函数,当拍卖倒计时计时器达到一定数字时调用该函数,在本例中我想象为 0。让该函数对脚本进行 ajax 调用,这将验证拍卖是否已完成确实过期了,那就更新数据库。

First thing that pops into my head is a javascript function that is called when the auction countdown timer reaches a certain number, in this case I would imagine 0. Have the function make a ajax call to a script, which would verify that the auction has indeed expired, then update the database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文