From 6e986f878ae7b82b1291a2d368485c30a2e02e86 Mon Sep 17 00:00:00 2001 From: colly_wyx <wangyixiong_007@163.com> Date: Thu, 26 Apr 2018 14:57:07 +0800 Subject: [PATCH] 新增原始数据上传接口 --- Yfs/Api/Data.php | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 45 insertions(+), 7 deletions(-) diff --git a/Yfs/Api/Data.php b/Yfs/Api/Data.php index 95f4856..97cce4e 100644 --- a/Yfs/Api/Data.php +++ b/Yfs/Api/Data.php @@ -8,7 +8,12 @@ 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' => '������������'), ), 'getUserDataList' => array( 'user_id' => array( @@ -34,20 +39,53 @@ public function upload(){ $rs = array('code' => 0, 'msg' => ''); $data_service = new Domain_Data(); - $data = json_decode($this->data, true); + + if(!empty($this->data)){ + $data = $this->data; + } + 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(json_last_error() == JSON_ERROR_NONE){ + + if(count($data) > 0){ + $data_service->upload($data); $rs['msg'] = "������������������"; } - else{ - $rs['code'] = 1; - $rs['msg'] = "json������������"; - } + // } + // else{ + // $rs['code'] = 1; + // $rs['msg'] = "json������������"; + // } return $rs; } /** + * ������������������ + * @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 -- Gitblit v1.8.0