$app->sfunc->badRequest400($app, "targetMissing"); } $targets = $app->sfunc->convertStringToIntArray($inputs["targets"]); try { // Check that an access token is present and is valid $app->oauth->resource->isValidRequest(); //get and check the user id by AccessToken $app->sfunc->isValidUUID($app, $uuid); $thisTime = "'" . $app->sfunc->getGMT() . "'"; // use ' to quote the time string $outputString = ""; $outputString2 = ""; $thsUser = NiuUsrInfo::findFirst("id = " . $uuid); foreach ($targets as $val) { //GiftBox::findFirst("id = " . $val . " AND targetid = " . $uuid. " AND expired_at > " . $thisTime); $gBoxEntry = GiftBox::findFirst(array("conditions" => "id = {$val} AND targetid = {$uuid} AND expired_at > {$thisTime}")); if (!$gBoxEntry) { $outputString2 = $outputString2 . "," . $val; continue; } $giftContent = $app->sfunc->convertStringToIntArray($gBoxEntry->json); //now we get int[,] //if giftContent[0] is not array //$giftContent[0] is the type based on public enum NiuPurchaseType, //$giftContent[1] is the index of the item, used in cashcard/ eq //$giftContent[2] is the amount in general, used in diamond/ cash //if giftContent[0] is array //$giftContent[0][$i] is the type based on public enum NiuPurchaseType, //$giftContent[1][$i] is the index of the item, used in cashcard/ eq //$giftContent[2][$i] is the amount in general, used in diamond/ cash if (is_array($giftContent[0])) {