示例#1
0
 /**
  * 解析产品列表页推荐产品数据
  *
  * @param string $data 产品数据
  *  - DataFormat: JSON-String
  * @return array
  */
 protected function _parseProductListProducts($data, $options)
 {
     $result = [];
     $data = json_decode($data, true);
     $mProduct = new IProductBase();
     $startNum = ($options['page'] - 1) * IProductBase::PAGE_SIZE;
     if ($startNum > count($data)) {
         $page = intval(count($data) / IProductBase::PAGE_SIZE) + 1;
     } else {
         $page = $options['page'];
     }
     if ($data) {
         $result = $mProduct->getByIds($data, $page);
     }
     return $result;
 }