From 066fffc3e2d8107df55dd41d4d50dbe5b69886b1 Mon Sep 17 00:00:00 2001 From: colly_wyx <wangyixiong_007@163.com> Date: Sat, 28 Apr 2018 10:22:40 +0800 Subject: [PATCH] 解决上传原始数据接口bug --- Yfs/Api/Data.php | 39 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Yfs/Api/Data.php b/Yfs/Api/Data.php index 65ed71f..cc47faf 100644 --- a/Yfs/Api/Data.php +++ b/Yfs/Api/Data.php @@ -8,7 +8,19 @@ 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( @@ -34,10 +46,19 @@ 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'] = "������������������"; } @@ -50,6 +71,20 @@ } /** + * ������������������ + * @return [type] [description] + */ + public function originalUpload(){ + $rs = array('code' => 0, 'msg' => ''); + $data_service = new Domain_Data(); + if($data_service->originalUpload($this)) + $rs['msg'] = "������������������������"; + else + $rs['msg'] = "������������������������"; + return $rs; + } + + /** * ������������ * @desc ������������ * @return string user_id ������id -- Gitblit v1.8.0