colly_wyx
2018-04-18 f716003ce965eddf14c9cf0470708ec9bf4a9a45
Yfs/Domain/Data.php
@@ -7,6 +7,8 @@
    public function __construct(){
        //DI()->redis = new Redis_Lite(DI()->config->get('app.redis.servers'));
       $this->model = new Model_Data();
       $this->hourly_model = new Model_DataHourly();
       $this->warn_model = new Model_DataWarn();
    }
    /**
@@ -19,10 +21,19 @@
        $arr['lon'] = $data['lon'];
        $arr['lat'] = $data['lat'];
        $arr['address'] = $data['address'];
        foreach ($data['data'] as $value) {
        foreach ($data['data'] as $value) {
            $arr['value'] = $value['value'];
            $arr['create_time'] = $value['time'];
            $this->model->add($arr);
            $arr['date'] = date('Y-m-d', strtotime($value['time']));
            if($value['type'] == 0){
                $this->model->add($arr);
                if($arr['is_warn'] == 1){
                    $this->warn_model->add($arr);
                }
            }
            elseif($value['type'] == 1){
                $this->hourly_model->add($arr);
            }
            if(isset($arr['_id']))
                unset($arr['_id']);
        }
@@ -32,6 +43,18 @@
    }
    public function getList(){
        return $this->model->getList();
    }
    //public function updateTime($data){
    //    $id = $data['_id'];
   //     unset($data['_id']);
   //     return $this->model->update($data, array('_id' => $id));
    //}
    
}