| | |
| | | |
| | | use think\facade\Cache; |
| | | use app\common\model\product\Category as CategoryModel; |
| | | |
| | | use app\supplier\model\supplier\Supplier as SupplierModel; |
| | | /** |
| | | * 商品分类模型 |
| | | */ |
| | |
| | | { |
| | | $model = new static; |
| | | if (!Cache::get('category_supplier_' . $shop_supplier_id)) { |
| | | $supplier=(new SupplierModel)->detail($shop_supplier_id); |
| | | $where=[$shop_supplier_id] |
| | | if($supplier['is_newcomer']||$supplier['is_repurchase']||$supplier['is_vip']){ |
| | | $where=[0,$shop_supplier_id] |
| | | } |
| | | $data = $model->with(['images']) |
| | | ->where('shop_supplier_id','in',[0,$shop_supplier_id]) |
| | | ->where('shop_supplier_id','in',$where) |
| | | ->order(['sort' => 'asc', 'create_time' => 'asc'])->select(); |
| | | $all = !empty($data) ? $data->toArray() : []; |
| | | $tree = []; |