<?php
/**
 *
 *User:Administrator
 *Date:2021/10/11
 */

namespace app\api\business;

use app\api\model\ProductClass;
use app\api\model\TestProduct;
use app\common\lib\Arr;

class ProductBus
{

    public function selectProductList($type_id)
    {

        //todo cache缓存优化数据
        $field='id,parent_id,product_code,name,alias';
        $tmp_result = (new ProductClass())->selectProductListByTypeID($type_id,$field)->toArray();//字段调用的field过滤

        //todo 树状化需要看一下，回调可以优化
        $result = (new Arr())->Arr_tree($tmp_result,'0'.$type_id);
        return $result;
    }


}