colly_wyx
2018-04-17 bf600de624ac26b99cecdec37c1f1aef63b09634
Yfs/Api/Data.php
@@ -57,15 +57,28 @@
    public function getUserDataList(){
        $rs = array('code' => 0, 'msg' => '', 'info' => array());
        $data_daily_service = new Domain_DataDaily();
        if($data_daily_service->checkTime($this->start_time, $this->end_time)){
        if($this->start_time == $this->end_time || $data_daily_service->checkTime($this->start_time, $this->end_time)){
            $result = $data_daily_service->getUserDataList($this->user_id, $this->start_time, $this->end_time);
            if($result){
                $res_avg = $data_daily_service->getUserDataAvg($this->user_id, $this->start_time, $this->end_time);
                if($res_avg < 0.25){
                    $res_status = '安全';
                }
                elseif($res_avg >= 0.25 && $res_avg < 0.8){
                    $res_status = '轻微';
                }
                elseif($res_avg >= 0.8 && $res_avg < 2){
                    $res_status = '中度';
                }
                else{
                    $res_status = '严重';
                }
                $rs['msg'] = '数据获取成功';
                $rs['info'] = $data_list;
                $rs['info'] = array('data' => $result, 'avg' => $res_avg, 'status' => $res_status);
            }
            else{
                $rs['code'] = 1;
                $rs['msg'] = '数据获取失败';
                $rs['msg'] = '没有数据';
                $rs['info'] = array('data' => array(), 'avg' => 0, 'status' => '安全');
            }
        }
        else{