|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
当然了,现在国内CRM厂商的产品与其说是CRM,但从至少从我的角度分析上来看,充其量只是一个大型的进销存而已了,了解尚浅,不够胆详评,这里只提技术问题ResolvingBids-Page6
ChrisPayne
September11,2000
FunctionResolveBids(ItemID)
Setvariablesandcreateobjects
dimmonIncrement,monHighPrice,intAvailable,intTotItems,flgQuit
dimblnResolved
Assumebidsareresolved
blnResolved=True
strConnectionString="DSN=MyAuction;UID=username;PWD=password;Database=MyAuctionDB"
setrst=Server.CreateObject("ADODB.Recordset")
Getinformationfromitemstable
strSQL="SELECTIncrement,AvailableFROMtblAuctionItemsWHERE"&_
"IID="&ItemID
rst.openstrSQL,strConnectionString
monIncrement=rst(0)
intAvailable=rst(1)
rst.close
Findthehighestbidandtotalnumberitemsbidfor
strSQL="SELECTmax(WinPrice)ASWinPrice,sum(WinItems)as"&_
"WinItemsFROMtblAuctionBidsWHERE"&_
"ItemID="&ItemID
rst.openstrSQL,strConnectionString
monHighPrice=rst(0)
intTotItems=rst(1)
rst.close
Ifauserwithahighermaxbidexists,then
updatetheirbidifandonlyifavailableitemsisexceeded
strSQL="SELECTMaxBid,UID,BidItems,WinPriceFROM"&_
"tblAuctionBidsWHEREItemID="&ItemID
rst.openstrSQL,strConnectionString
ifnotrst.eofthen
dountilrst.eof
if(rst(0)>monHighPrice+monIncrement)AND(intTotItems>intAvailable)&_
AND(rst(3)monHighPrice)then
monHighPrice=monHighPrice+monIncrement
callDoBids(ItemID,rst(1),monHighPrice)
blnResolved=False
endif
rst.MoveNext
Ifwereattheendoftherecordset
andthebidsarenotyetresolved,gobacktothebeginning
ifnotblnResolvedANDrst.eofthen
rst.MoveFirst
blnResolved=True
endif
loop
endif
rst.close
EndFunction
Themainpartoftheabovecodeisthelastdo...loopsection.Theprocessisasfollows:
Enterausersbid(usingtheDoBids()function)
Findthehighestbidfortheitem,andtotalnumberofitemsbidfor
Loopthroughdatabaseand:
IFthecurrentbiddersmaximumbidishigherthanthehighestwinningbid,
ANDthetotalnumberofitemsbidforisgreaterthanthenumberofitemsavailable,
ANDthecurrentbiddersbidisnotthehighestbid,
THENincrementthecurrentbiddersbidbytheincrementvalue.
Ifwereachtheendoftherecordset,andthebidsarestillnotresolved,thestartover.
Thisprocesswillautomaticallyupdateallbidsappropriately,andweedoutthosewhosemaxbidsarenot
highenough.Thereasonwechecktomakesurethetotalnumberofitemsbidforisgreaterthanthenumber
oftotalitemsavailableinstep4isbecauseifallbidsareplacedanditemsclaimed,andthereare
stilllotsavailable,theneveryonewinsandbidsdonotneedtobeincremented.
Forexample,imaginethereare10lotsavailable,andthereare3bidders.IfbidderAwants3lotsat$3,
bidderBwants3lotsat$2,andbidderCwants3lotsat$1,everyonewillwinbecausethereisenough
lotstogoaround,andthensome.Thedoloopabovewillonlyhavetogothroughonce.
However,supposebidderCnowwants5items.Sincetherearenotenoughitemstogoaround,someonewill
havetoloseout.Theloopinthecodeaboveweedsthispersonoutbycheckingmaxbidsandupdatingthe
winningbids.Ifeveryonesmaxbidsinthisscenariowas$20,andtheincrementwas$2,thenbidderCand
whicheverofbidderAandBplacedthefirstbidwouldwin(rememberthatbidpriorityisplacedonmost
lotsbidfor,followedbybidtime).
缺点:正版成本价格贵(盗版就不说了)、不够安全,大多数服务器用windows系统,没有linux安全 |
|