微服务与前端应用开发全解析
1. 拍卖信息查询
在开发过程中,我们需要获取拍卖相关信息。以下是获取所有拍卖信息的代码:
client.trackTrace("Loading all auctions");
pool.query('SELECT idAuction, Name, Description, StartingPrice, AuctionDate, Status, Image, userName, DATEDIFF(date_add(auctiondate, interval activeinhours hour), curdate()) * 24 as ActiveInHours, BidPrice from auctionservicedb.auction where DATEDIFF(date_add(auctiondate, interval activeinhours hour), curdate()) >=0 and IsActive=1', (error, result) => {
if (error) throw error;
response.send(result);
});
若要根据投标人 ID 获取拍卖列表,可创建如下方法:
router.get('/auctionsbyBidderId/:userId', (request, response) => {
client.trackTrace("Loading all auc