本文整理汇总了PHP中Inventory::skip方法的典型用法代码示例。如果您正苦于以下问题:PHP Inventory::skip方法的具体用法?PHP Inventory::skip怎么用?PHP Inventory::skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::skip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define
require_once 'models/AmazonInfo.php';
require_once 'functions/amazon_lookup.php';
require_once 'functions/mws_lookup.php';
require_once 'functions/general_functions.php';
/*
*/
define(MAX_CNT_PER_LOOP, 20);
define(MAX_SKUS_PER_REQUESTS, 2);
$start = 0;
$counter = 0;
Inventory::orderby('created_at', 'ASC');
AmazonInfo::orderby('created_at', 'ASC');
if (Inventory::count() != AmazonInfo::count()) {
$start = MIN(Inventory::count(), AmazonInfo::count());
while (true) {
$inventories = Inventory::skip($start)->take(MAX_SKUS_PER_REQUESTS)->get();
if (count($inventories) == 0) {
break;
}
$counter = 0;
$skus = [];
foreach ($inventories as $inventory) {
array_push($skus, $inventory->sku);
}
$details = get_detail_by_skus($skus);
foreach ($inventories as $inventory) {
$detail = $details["GetMatchingProductForIdResponse"]["GetMatchingProductForIdResult"][$counter++];
$aminfo = new AmazonInfo();
$aminfo->dirty = 1;
$aminfo->isbn = $inventory->isbn;
$aminfo->sku = $inventory->sku;