示例#1
0
         $ret = db_update("Amazon_Item", $arrfields, array("ASIN" => $ASIN));
         if (!$ret->{'Status'}) {
             unset($arrfields['LastUpdateTime']);
             $strupdate = "";
             foreach ($arrfields as $prop => $value) {
                 $strupdate .= $prop . "[" . $info->{$prop} . "=>" . $value . "], ";
             }
             $strupdate = trim($strupdate, ", ");
             //echo "[Info][".date('Y-m-d H:i:s')."] Amazon_Item ".$info->{'LegoID'}." - ".$info->{'Title'}." updated: ".$strupdate." @ www.amazon.com/gp/product/$ASIN\n";
             //send_Message(NOTIFICATION_RECIPIENT, "Amazon_Item ".$info->{'LegoID'}." - ".$info->{'Title'}." updated: ".$strupdate." @ www.amazon.com/gp/product/$ASIN");
         }
     } else {
         array_push($arrNoupdate, $ASIN);
     }
     if (!empty($rate) && $rate < 76 && ($item->{"Availability"} == "Pickup Only" || $item->{"Availability"} == "Available") && !empty($info->{'LegoID'})) {
         $ret = publish_SaleMessage("amazon.com", $ASIN, $price, $info->{'LegoID'});
         if (!$ret->{'Status'}) {
             echo "[Info][" . date('Y-m-d H:i:s') . "] " . $info->{'LegoID'} . " on sale for \$" . $price . " (" . $rate . "% off from reg. \$" . $info->{'MSRP'} . ") on www.amazon.com/gp/product/" . $ASIN . "\n";
         } else {
             echo "[Warning][" . date('Y-m-d H:i:s') . "] Failed to publish tweet due to " . $ret->{'Message'} . ": " . $info->{'LegoID'} . " on sale for \$" . $price . " (" . $rate . "% off from reg. \$" . $info->{'MSRP'} . ")\n";
         }
     }
 } elseif (!empty($item->{'LegoID'})) {
     $legoID = $item->{'LegoID'};
     db_insert("Amazon_Item", array("LegoID" => $legoID, "ASIN" => $ASIN), null, true);
     echo "[Info][" . date('Y-m-d H:i:s') . "] New item added by legoid: " . $legoID . " - " . $item->{'Title'} . " www.amazon.com/gp/product/" . $ASIN . "\n";
     send_Message(NOTIFICATION_RECIPIENT, "New Amazon_Item " . $legoID . " - " . $item->{'Title'} . " listed on www.amazon.com/gp/product/" . $ASIN);
 } else {
     // try to match the legoid by title.
     $ret = search_legoid(array("Title" => $item->{'Title'}));
     if (isset($ret->{'MatchID'})) {
示例#2
0
         $ret = db_update("Toysrus_Item", $arrfields, array("ToysrusID" => $ToysrusID));
         if (!$ret->{'Status'}) {
             unset($arrfields['LastUpdateTime']);
             $strupdate = "";
             foreach ($arrfields as $prop => $value) {
                 $strupdate .= $prop . "[" . $info->{$prop} . "=>" . $value . "], ";
             }
             $strupdate = trim($strupdate, ", ");
             //echo "[Info][".date('Y-m-d H:i:s')."] Toysrus_Item ".$info->{'LegoID'}." - ".$info->{'Title'}." updated: ".$strupdate." www.toysrus.com/product/index.jsp?productId=$ToysrusID\n";
             //send_Message(NOTIFICATION_RECIPIENT, "Toysrus_Item ".$info->{'LegoID'}." - ".$info->{'Title'}." updated: ".$strupdate." www.toysrus.com/product/index.jsp?productId=$ToysrusID");
         }
     } else {
         array_push($arrNoupdate, $ToysrusID);
     }
     if (!empty($rate) && $rate < 76 && $item->{"Availability"} != "Sold Out" && !empty($info->{'LegoID'})) {
         $ret = publish_SaleMessage("toysrus.com", $ToysrusID, $price, $info->{'LegoID'});
         if (!$ret->{'Status'}) {
             echo "[Info][" . date('Y-m-d H:i:s') . "] " . $info->{'LegoID'} . " on sale for \$" . $price . " (" . $rate . "% off from reg. \$" . $info->{'MSRP'} . ") www.toysrus.com/product/index.jsp?productId=" . $ToysrusID . "\n";
         } else {
             echo "[Warning][" . date('Y-m-d H:i:s') . "] Failed to publish tweet due to " . $ret->{'Message'} . ": " . $info->{'LegoID'} . " on sale for \$" . $price . " (" . $rate . "% off from reg. \$" . $info->{'MSRP'} . ")\n";
         }
     }
 } elseif (!empty($item->{'LegoID'})) {
     $legoID = $item->{'LegoID'};
     db_insert("Toysrus_Item", array("LegoID" => $legoID, "ToysrusID" => $ToysrusID), null, true);
     echo "[Info][" . date('Y-m-d H:i:s') . "] New item added by legoid: " . $legoID . " - " . $item->{'Title'} . " www.toysrus.com/product/index.jsp?productId=" . $ToysrusID . "\n";
     send_Message(NOTIFICATION_RECIPIENT, "New Toysrus_Item " . $legoID . " - " . $item->{'Title'} . " listed on www.toysrus.com/product/index.jsp?productId=" . $ToysrusID);
 } else {
     // try to match the legoid by title.
     $ret = search_legoid(array("Title" => $item->{'Title'}));
     if (isset($ret->{'MatchID'})) {
示例#3
0
         $ret = db_update("Walmart_Item", $arrfields, array("WalmartID" => $walmartID));
         if (!$ret->{'Status'}) {
             unset($arrfields['LastUpdateTime']);
             $strupdate = "";
             foreach ($arrfields as $prop => $value) {
                 $strupdate .= $prop . "[" . $info->{$prop} . "=>" . $value . "], ";
             }
             $strupdate = trim($strupdate, ", ");
             //echo "[Info][".date('Y-m-d H:i:s')."] Walmart_Item ".$info->{'LegoID'}." - ".$info->{'Title'}." updated: ".$strupdate." @ http://www.walmart.com/ip/$walmartID\n";
             //send_Message(NOTIFICATION_RECIPIENT, "Walmart_Item ".$info->{'LegoID'}." - ".$info->{'Title'}." updated: ".$strupdate." @ http://www.walmart.com/ip/$walmartID");
         }
     } else {
         array_push($arrNoupdate, $walmartID);
     }
     if (!empty($rate) && $rate < 76 && ($item->{"Availability"} == "Pickup Only" || $item->{"Availability"} == "Available") && !empty($info->{'LegoID'})) {
         $ret = publish_SaleMessage("walmart.com", $walmartID, $price, $info->{'LegoID'});
         var_dump($ret->{'Message'});
         if (!$ret->{'Status'}) {
             echo "[Info][" . date('Y-m-d H:i:s') . "] " . $info->{'LegoID'} . " on sale for \$" . $price . " (" . $rate . "% off from reg. \$" . $info->{'MSRP'} . ") www.walmart.com/ip/" . $walmartID . "\n";
         } else {
             echo "[Warning][" . date('Y-m-d H:i:s') . "] Failed to publish tweet due to " . $ret->{'Message'} . ": " . $info->{'LegoID'} . " on sale for \$" . $price . " (" . $rate . "% off from reg. \$" . $info->{'MSRP'} . ")\n";
         }
     }
 } elseif (!empty($item->{'LegoID'})) {
     $legoID = $item->{'LegoID'};
     db_insert("Walmart_Item", array("LegoID" => $legoID, "WalmartID" => $walmartID), null, true);
     echo "[Info][" . date('Y-m-d H:i:s') . "] New item added by legoid: " . $legoID . " - " . $item->{'Title'} . " www.walmart.com/ip/" . $walmartID . " \n";
     send_Message(NOTIFICATION_RECIPIENT, "New Walmart_Item " . $legoID . " - " . $item->{'Title'} . " listed on www.walmart.com/ip/" . $walmartID);
 } else {
     // try to match the legoid by title.
     $ret = search_legoid(array("Title" => $item->{'Title'}));