<?php
class ExcelSetModel extends Orm_Base{
    public $table = 'excel_set';
    public $field = array(
        'id' => array('type' => "int(11)",'comment' => 'excel设置id'),
        'now_squirrel' => array('type' => "varchar(45)",'comment' => '现存鼠导出设置'),
        'handle_squirrel' => array('type' => "varchar(45)",'comment' => '处理鼠导出设置'),
        'user_id' => array('type' => "int(11)",'comment' => '是否删除'),
    );
    public $pk = 'id';
    public function getsetinfo($params){
        $data = $this->field('*')->where('user_id='.$params['user_id'])->fRow();
        if(empty($data)){
            //现存鼠
            $data['now_squirrel']['number'] = true;
            $data['now_squirrel']['sex'] = true;
            $data['now_squirrel']['birthday'] = true;
            $data['now_squirrel']['strains_id'] = true;
            $data['now_squirrel']['gene'] = true;
            $data['now_squirrel']['cage_num'] = true;
            $data['now_squirrel']['content'] = true;
            $data['now_squirrel']['hair_color'] = true;
            $data['now_squirrel']['fenlong'] = true;
            $data['now_squirrel']['fanzhi'] = true;
            $data['now_squirrel']['breeding_tag'] = true;
            $data['now_squirrel']['see_bole_tag'] = true;
            $data['now_squirrel']['give_medicine'] = true;
            $data['now_squirrel']['father'] = true;
            $data['now_squirrel']['mother'] = true;
            $data['now_squirrel']['remark'] = true;
            //处理鼠
            $data['handle_squirrel']['number'] = true;
            $data['handle_squirrel']['sex'] = true;
            $data['handle_squirrel']['birthday'] = true;
            $data['handle_squirrel']['strains_id'] = true;
            $data['handle_squirrel']['gene'] = true;
            $data['handle_squirrel']['cage_num'] = true;
            $data['handle_squirrel']['content'] = true;
            $data['handle_squirrel']['hair_color'] = true;
            $data['handle_squirrel']['fenlong'] = true;
            $data['handle_squirrel']['fanzhi'] = true;
            $data['handle_squirrel']['breeding_tag'] = true;
            $data['handle_squirrel']['see_bole_tag'] = true;
            $data['handle_squirrel']['give_medicine'] = true;
            $data['handle_squirrel']['father'] = true;
            $data['handle_squirrel']['mother'] = true;
            $data['handle_squirrel']['remark'] = true;
        }else{
            $data['now_squirrel'] = json_decode($data['now_squirrel'],true);
            $data['handle_squirrel'] = json_decode($data['handle_squirrel'],true);
        }
        return $data;
    }
}

