0

我正在开发一个 API,用于搜索在 FIFA 14 中购买的球员卡。

我每分钟向分布在 3 个不同页面上的大约 15 个不同玩家发出 600 个单独的请求,每个单独的请求每次最多返回 50 个结果。

每个页面对我创建的表 (lowestBuyNowPrice) 执行一次查询,该表每 10 分钟更新一次,并以市场上可用的最低立即购买价格进行更新,然后我将此值与当前结果的值进行比较。

但是,我购买卡片的价格比最低购买价格表中的值高出 2 到 3 倍,这是永远不会发生的。

我已经设置了几个其他表来尝试找出发生了什么,看起来查询返回的结果与它应该返回的玩家 ID 不同。

<cfscript>

// SEARCH FOR PLAYER
Variables.doSearch = Application.cfcs.Search.doPlayerSearch(Variables.search2PlayerID,0,"",0,0,0,0,0,Variables.searchPhishingKey,Variables.searchSessionKey);
Variables.searchResults = DeserializeJSON(Variables.doSearch.FileContent);
Variables.numResults = ArrayLen(Variables.searchResults.auctionInfo);
</cfscript>

<!--- GET LATEST LOWEST BIN PRICE --->
<cfquery name="qryBINPrice" datasource="sfadb">
SELECT assetID,playerPosition,lowestBIN FROM FUT14PlayerBIN WHERE binID IN (SELECT MAX(binID) AS binID FROM FUT14PlayerBIN WHERE assetID = #Variables.search2PlayerID# GROUP BY assetID,playerPosition)
</cfquery>

<cfscript>

    // LOOP ROUND RESULTS
    for (i=1; i<=Variables.numResults; i++) {

        // IF ASSET ID OF CURRENT CARD IS SAME AS ONE SEARCHING FOR
        if (Variables.searchResults.auctionInfo[i].itemData.assetID EQ Variables.search2PlayerID) {

            // DEFAULT BUY CARD VARIABLE
            Variables.buyCard = 0;

            // GET POSITION AND STYLE BIN
            Variables.getLowestBIN = Application.cfcs.Player.QoQ(qryBINPrice,"lowestBIN","playerPosition = '#Variables.searchResults.auctionInfo[i].itemData.preferredPosition#'");

            // IF LOWEST BIN RECORD EXISTS
            if (Variables.getLowestBin.RecordCount GT 0) {
                // SET LATEST LOWEST BIN PRICE
                Variables.lowestBIN = getLowestBIN.lowestBIN;

                // SET BUYING PRICE
                Variables.buyingPrice = Variables.lowestBIN * 0.9;

                // IF BIN PRICE SET AND IS LESS THAN SET BUYING PRICE
                if (Variables.searchResults.auctionInfo[i].buyNowPrice GT 0 AND Variables.searchResults.auctionInfo[i].buyNowPrice LTE Variables.buyingPrice) {
                    Variables.timeLeft = Variables.searchResults.auctionInfo[i].expires;
                    Variables.auctionEnds = DateAdd("s",timeLeft,Now());
                    Variables.insStuff = Application.cfcs.Bid.insStuff(Variables.searchResults.auctionInfo[i].itemData.assetID,Variables.searchResults.auctionInfo[i].itemData.preferredPosition,Variables.searchResults.auctionInfo[i].itemData.playStyle,Variables.lowestBIN,Variables.binPrice,Variables.startPrice,Variables.basePrice,Variables.buyingPrice,qryBINPrice.assetID,Variables.searchResults.auctionInfo[i].buyNowPrice);
                    Variables.doBuyCard = Application.cfcs.Bid.doBIN(Variables.searchResults.auctionInfo[i].tradeID,Variables.searchResults.auctionInfo[i].buyNowPrice,Variables.startPrice,Variables.binPrice,Variables.searchResults.auctionInfo[i].itemData.ID,Variables.searchResults.auctionInfo[i].itemData.assetID,Variables.searchResults.auctionInfo[i].itemData.resourceID,Variables.searchResults.auctionInfo[i].itemData.cardSubTypeID,Variables.searchResults.auctionInfo[i].itemData.playStyle,Variables.searchResults.auctionInfo[i].itemData.preferredPosition,Variables.searchResults.auctionInfo[i].startingBid,Variables.searchResults.auctionInfo[i].buyNowPrice,Variables.lowestBIN,Variables.searchResults.auctionInfo[i].currentBid,Variables.searchResults.auctionInfo[i].itemData.discardValue,Variables.auctionEnds);
                }
            }
        }
    }
}
</cfscript>

这可能是由于在这么短的时间内发出的请求量很大,但我不知道如何修改它以确保始终返回正确的记录?

有人有什么想法吗?

4

0 回答 0