Ejemplo n.º 1
0
 public static function get_instance()
 {
     if (self::$instance === null) {
         $classname = __CLASS__;
         self::$instance = new $classname();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 /**
  * 通过商品类型ID获取商品类型所关联的商品品牌
  *
  * @param integer $classify_id
  * @return array
  */
 public static function get_clsbrdrs($classify_id = 0)
 {
     $brands = $query_struct = array();
     if ($classify_id > 0) {
         $query_struct_relation = array('where' => array('classify_id' => $classify_id));
         $brand_ids = array();
         $records = Classify_brand_relationService::get_instance()->index($query_struct_relation);
         foreach ($records as $record) {
             if (!in_array($record['brand_id'], $brand_ids)) {
                 $brand_ids[] = $record['brand_id'];
             }
         }
         if (!empty($brand_ids)) {
             $query_struct = array('where' => array('id' => $brand_ids), 'orderby' => array('name' => 'ASC'));
         }
     }
     $brands = BrandService_Core::get_instance()->index($query_struct);
     return $brands;
 }