<?php
// +----------------------------------------------------------------------
// | ThinkOAO （Online And Offline）
// +----------------------------------------------------------------------
// | Copyright (c) 2016 http://www.hanchao9999.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: xiaogg <xiaogg@sina.cn>
// +----------------------------------------------------------------------
namespace Mobile\Model;
use Think\Model;
class IndexModel extends Model{
    protected $tableName = 'Floor';
    public function index(){
        $where['status'] = 1;
        $where['device'] = 1;
        $floor_list=M('Floor')->where($where)->field(true)->order('sort desc,id desc')->select();
        foreach($floor_list as $key=>$val){
            $is_show_children = ($val['is_show_children']>0)?1:0;
            $goods_num = $son_goods_num = 8;//调取商品数量 子分类商品数量
            if($is_show_children==0){$son_goods_num = 0;}//不显示子分类信息
            $index_list[$key]= get_index_categories($val['bind_cateid'],$goods_num,0,$is_show_children,$son_goods_num);
            foreach($index_list[$key]['goods'] as $k=>$v){
                $index_list[$key]['goods'][$k]['img']=thumb($v['img'],100,100,'noimg_500_500.png');
            }
        }
        $root['index_list']=$index_list;
        $root['floorinfo']=$floor_list;
        return $root;
    }
}