websocket,nodejs做竞拍,求问大神

JavaScript010

websocket,nodejs做竞拍,求问大神,第1张

思路很简单,就像做公共聊天室一样。

所有用户进入到一个“房间”,公用一个socket链接。

有任何一个用户点击按钮后,node端会向所有WEB端emit一个事件。

web端只需要监听这个事件,即可。

伪代码就是这样

// web:

button.on('click', function (){

    socket.emit('done')

})

socket.on('disabled', function (){

    this.attr('disabled', true)

})

// node:

socket.on('done', function (){

    socket.emit('disabled')

})

大概思路就是这样。

AH取消拍卖的宏(分别对应取消不同时间,不取消已经被竞价的商品)

/run local o,j,h,t="owner",GetNumAuctionItems("owner")for i=j,1,-1 do h,t=select(11,GetAuctionItemInfo(o,i)),GetAuctionItemTimeLeft(o,i)if not h and t and t==1 then CancelAuction(i)end end 短

/run local o,j,h,t="owner",GetNumAuctionItems("owner")for i=j,1,-1 do h,t=select(11,GetAuctionItemInfo(o,i)),GetAuctionItemTimeLeft(o,i)if not h and t and t==2 then CancelAuction(i)end end 中

/run local o,j,h,t="owner",GetNumAuctionItems("owner")for i=j,1,-1 do h,t=select(11,GetAuctionItemInfo(o,i)),GetAuctionItemTimeLeft(o,i)if not h and t and t==3 then CancelAuction(i)end end 长

/run local o,j,h,t="owner",GetNumAuctionItems("owner")for i=j,1,-1 do h,t=select(11,GetAuctionItemInfo(o,i)),GetAuctionItemTimeLeft(o,i)if not h and t and t==4 then CancelAuction(i)end end 非常长

这个是简易的/run local o,j,h,t="owner",GetNumAuctionItems("owner")for i=j,1,-1 do h,t=select(11,GetAuctionItemInfo(o,i)),GetAuctionItemTimeLeft(o,i)if not h and t and t<=2 then CancelAuction(i)end end

修改1 234 分别对应短 中 长很长 来取消 不会取消被竞拍的物品

回头我帮你试试专门的插件拍卖助手Auctioneer,说是JS专用的

看看效果如何顺便尝试做做?