| | |
| | | public function getRules() { |
| | | return array( |
| | | 'upload' => array( |
| | | 'data' => array('name' => 'data', 'type' => 'array' ,'require' => true, 'desc' => '上传数据'), |
| | | 'data' => array('name' => 'data', 'type' => 'string' ,'require' => false, 'source' => 'post', 'desc' => '上传数据'), |
| | | 'data_1' => array('name' => 'data_1', 'type' => 'array' ,'require' => false, 'source' => 'post', 'desc' => '上传数据'), |
| | | ), |
| | | 'originalUpload' => array( |
| | | 'data' => array('name' => 'data', 'type' => 'string' ,'require' => false, 'source' => 'post', 'desc' => '上传数据'), |
| | | 'data_1' => array('name' => 'data_1', 'type' => 'array' ,'require' => false, 'source' => 'post', 'desc' => '上传数据'), |
| | | 'user_id' => array( |
| | | 'name' => 'user_id', 'type' => 'string', 'require' => true, 'desc' => '用户id' |
| | | ), |
| | | 'time' => array( |
| | | 'name' => 'time', 'type' => 'string', 'require' => true, 'desc' => '时间' |
| | | ), |
| | | |
| | | ), |
| | | 'getUserDataList' => array( |
| | | 'user_id' => array( |
| | |
| | | public function upload(){ |
| | | $rs = array('code' => 0, 'msg' => ''); |
| | | $data_service = new Domain_Data(); |
| | | |
| | | if(!empty($this->data)){ |
| | | $data = json_decode($this->data,true); |
| | | } |
| | | else{ |
| | | $data = $this->data_1; |
| | | } |
| | | //$data = json_decode($this->data, true); |
| | | //print_r(count($data['data']));die(); |
| | | //if(json_last_error() == JSON_ERROR_NONE){ |
| | | if(count($this->data) > 0){ |
| | | |
| | | if(count($data) > 0){ |
| | | |
| | | $data_service->upload($data); |
| | | $rs['msg'] = "数据上报成功"; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 原始数据上传 |
| | | * @return [type] [description] |
| | | */ |
| | | public function originalUpload(){ |
| | | $rs = array('code' => 0, 'msg' => ''); |
| | | $data_service = new Domain_Data(); |
| | | |
| | | if(!empty($this->data)){ |
| | | $data = $this->data; |
| | | } |
| | | else{ |
| | | $data = $this->data_1; |
| | | } |
| | | |
| | | if(count($data) > 0){ |
| | | |
| | | $data_service->originalUpload($data); |
| | | $rs['msg'] = "原始数据上报成功"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取数据 |
| | | * @desc 获取数据 |
| | | * @return string user_id 用户id |