示例#1
0
 /**
  * @param int $userId
  * @param int $offset
  * @param int $limit
  * @return bool
  */
 public function getNewestProduct($userId = 0, $offset = 0, $limit = KACANA_HOMEPAGE_ITEM_PER_TAG)
 {
     $productModel = new productModel();
     $userProductLike = new userProductLikeModel();
     $products = $productModel->getNewestProduct($offset, $limit);
     foreach ($products as &$product) {
         if ($userId) {
             $product->isLiked = $userProductLike->getItem($userId, $product->id) ? true : false;
         }
         $this->formatProductProperties($product);
     }
     return $products;
 }