From 78cff841433fce51ade16e5fba124becebf26512 Mon Sep 17 00:00:00 2001
From: colly_wyx <wangyixiong_007@163.com>
Date: Fri, 27 Apr 2018 09:00:46 +0800
Subject: [PATCH] 修正bug
---
Yfs/Api/Data.php | 62 +++++++++++++++++++++++++++----
1 files changed, 54 insertions(+), 8 deletions(-)
diff --git a/Yfs/Api/Data.php b/Yfs/Api/Data.php
index 8b0a200..a6f7ffd 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' => 'string' ,'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,17 +46,50 @@
public function upload(){
$rs = array('code' => 0, 'msg' => '');
$data_service = new Domain_Data();
- $data = json_decode($this->data, true);
+
+ 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(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'] = "������������������������";
+ }
}
/**
@@ -67,7 +112,7 @@
elseif($res_avg >= 0.25 && $res_avg < 0.8){
$res_status = '������';
}
- elseif($res_avg >= 8 && $res_avg < 2){
+ elseif($res_avg >= 0.8 && $res_avg < 2){
$res_status = '������';
}
else{
@@ -78,6 +123,7 @@
}
else{
$rs['msg'] = '������������';
+ $rs['info'] = array('data' => array(), 'avg' => 0, 'status' => '������');
}
}
else{
--
Gitblit v1.8.0