ColdFusion多个查询混淆返回错误的值

时间:2013-10-25 14:02:19

标签: coldfusion cfquery query-cache

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

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

每个页面对我创建的表格(lowestBuyNowPrice)执行查询,该表格每10分钟更新一次,市场上现有的最低买入价格,我将此值与当前结果的值进行比较。

然而,我购买卡的次数比最低的BuyNowPrice表中的价值要高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>

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

任何想法?

0 个答案:

没有答案