<?php

namespace Hura8\Components\Product\AdminController;

use Hura8\Components\Product\Model\ProductHotModel;
use Hura8\Traits\ClassCacheTrait;

class AProductHotController
{
    use ClassCacheTrait;

    /* @var  ProductHotModel $objProductHotModel */
    protected  $objProductHotModel;


    public function __construct()
    {
        $this->objProductHotModel = new ProductHotModel();
    }


    public function getProductHot(array $product_id_array) {
        $hot_script = $this->objProductHotModel->getProductHot($product_id_array);

        //add empty for other products
        foreach ($product_id_array as $pro_id) {
            if(!isset($hot_script[$pro_id])) $hot_script[$pro_id] = [];
        }

        return $hot_script;
    }


    public function updateProductHot($pro_id, array $new_types) {
        return $this->objProductHotModel->updateProductHot($pro_id, $new_types);
    }



}
