Browse Source

优化cgi字段类型格式

james 2 years ago
parent
commit
e505e8eb47
1 changed files with 47 additions and 47 deletions
  1. 47 47
      ws/main.c

+ 47 - 47
ws/main.c

@@ -39,37 +39,37 @@ void qry_iot_param(json_object *body,int cid)
     json_object *iotlist;
     iotlist = json_object_new_array();
 	json_object *sp = json_object_new_object();
-	json_object_object_add(sp,"field1",json_object_new_int(ytShm->spStatusList.spStatus[cid][1].REALTIME_VALUE));
-	json_object_object_add(sp,"field2",json_object_new_int(ytShm->spStatusList.spStatus[cid][2].REALTIME_VALUE));
-	json_object_object_add(sp,"field3",json_object_new_int(ytShm->spStatusList.spStatus[cid][3].REALTIME_VALUE));
-	json_object_object_add(sp,"field4",json_object_new_int(ytShm->spStatusList.spStatus[cid][4].REALTIME_VALUE));
-	json_object_object_add(sp,"field5",json_object_new_int(ytShm->spStatusList.spStatus[cid][5].REALTIME_VALUE));
-	json_object_object_add(sp,"field6",json_object_new_int(ytShm->spStatusList.spStatus[cid][6].REALTIME_VALUE));
-	json_object_object_add(sp,"field7",json_object_new_int(ytShm->spStatusList.spStatus[cid][7].REALTIME_VALUE));
-	json_object_object_add(sp,"field8",json_object_new_int(ytShm->spStatusList.spStatus[cid][8].REALTIME_VALUE));
-	json_object_object_add(sp,"field9",json_object_new_int(ytShm->spStatusList.spStatus[cid][9].REALTIME_VALUE));
-	json_object_object_add(sp,"field10",json_object_new_int(ytShm->spStatusList.spStatus[cid][10].REALTIME_VALUE));
-	json_object_object_add(sp,"field11",json_object_new_int(ytShm->spStatusList.spStatus[cid][11].REALTIME_VALUE));
-	json_object_object_add(sp,"field12",json_object_new_int(ytShm->spStatusList.spStatus[cid][12].REALTIME_VALUE));
-	json_object_object_add(sp,"field13",json_object_new_int(ytShm->spStatusList.spStatus[cid][13].REALTIME_VALUE));
-	json_object_object_add(sp,"field14",json_object_new_int(ytShm->spStatusList.spStatus[cid][14].REALTIME_VALUE));
-	json_object_object_add(sp,"field15",json_object_new_int(ytShm->spStatusList.spStatus[cid][15].REALTIME_VALUE));
-	json_object_object_add(sp,"field16",json_object_new_int(ytShm->spStatusList.spStatus[cid][16].REALTIME_VALUE));
-	json_object_object_add(sp,"field17",json_object_new_int(ytShm->spStatusList.spStatus[cid][17].REALTIME_VALUE));
-	json_object_object_add(sp,"field18",json_object_new_int(ytShm->spStatusList.spStatus[cid][18].REALTIME_VALUE));
-	json_object_object_add(sp,"field19",json_object_new_int(ytShm->spStatusList.spStatus[cid][19].REALTIME_VALUE));
-	json_object_object_add(sp,"field20",json_object_new_int(ytShm->spStatusList.spStatus[cid][20].REALTIME_VALUE));
-	json_object_object_add(sp,"field21",json_object_new_int(ytShm->spStatusList.spStatus[cid][21].REALTIME_VALUE));
-	json_object_object_add(sp,"field22",json_object_new_int(ytShm->spStatusList.spStatus[cid][22].REALTIME_VALUE));
-	json_object_object_add(sp,"field23",json_object_new_int(ytShm->spStatusList.spStatus[cid][23].REALTIME_VALUE));
-	json_object_object_add(sp,"field24",json_object_new_int(ytShm->spStatusList.spStatus[cid][24].REALTIME_VALUE));
-	json_object_object_add(sp,"field25",json_object_new_int(ytShm->spStatusList.spStatus[cid][25].REALTIME_VALUE));
-	json_object_object_add(sp,"field26",json_object_new_int(ytShm->spStatusList.spStatus[cid][26].REALTIME_VALUE));
-	json_object_object_add(sp,"field27",json_object_new_int(ytShm->spStatusList.spStatus[cid][27].REALTIME_VALUE));
-	json_object_object_add(sp,"field28",json_object_new_int(ytShm->spStatusList.spStatus[cid][28].REALTIME_VALUE));
-	json_object_object_add(sp,"field29",json_object_new_int(ytShm->spStatusList.spStatus[cid][29].REALTIME_VALUE));
-	json_object_object_add(sp,"field30",json_object_new_int(ytShm->spStatusList.spStatus[cid][30].REALTIME_VALUE));
-	json_object_object_add(sp,"field31",json_object_new_int(ytShm->spStatusList.spStatus[cid][31].REALTIME_VALUE));
+	json_object_object_add(sp,"field1",json_object_new_double(ytShm->spStatusList.spStatus[cid][1].REALTIME_VALUE));
+	json_object_object_add(sp,"field2",json_object_new_double(ytShm->spStatusList.spStatus[cid][2].REALTIME_VALUE));
+	json_object_object_add(sp,"field3",json_object_new_double(ytShm->spStatusList.spStatus[cid][3].REALTIME_VALUE));
+	json_object_object_add(sp,"field4",json_object_new_double(ytShm->spStatusList.spStatus[cid][4].REALTIME_VALUE));
+	json_object_object_add(sp,"field5",json_object_new_double(ytShm->spStatusList.spStatus[cid][5].REALTIME_VALUE));
+	json_object_object_add(sp,"field6",json_object_new_double(ytShm->spStatusList.spStatus[cid][6].REALTIME_VALUE));
+	json_object_object_add(sp,"field7",json_object_new_double(ytShm->spStatusList.spStatus[cid][7].REALTIME_VALUE));
+	json_object_object_add(sp,"field8",json_object_new_double(ytShm->spStatusList.spStatus[cid][8].REALTIME_VALUE));
+	json_object_object_add(sp,"field9",json_object_new_double(ytShm->spStatusList.spStatus[cid][9].REALTIME_VALUE));
+	json_object_object_add(sp,"field10",json_object_new_double(ytShm->spStatusList.spStatus[cid][10].REALTIME_VALUE));
+	json_object_object_add(sp,"field11",json_object_new_double(ytShm->spStatusList.spStatus[cid][11].REALTIME_VALUE));
+	json_object_object_add(sp,"field12",json_object_new_double(ytShm->spStatusList.spStatus[cid][12].REALTIME_VALUE));
+	json_object_object_add(sp,"field13",json_object_new_double(ytShm->spStatusList.spStatus[cid][13].REALTIME_VALUE));
+	json_object_object_add(sp,"field14",json_object_new_double(ytShm->spStatusList.spStatus[cid][14].REALTIME_VALUE));
+	json_object_object_add(sp,"field15",json_object_new_double(ytShm->spStatusList.spStatus[cid][15].REALTIME_VALUE));
+	json_object_object_add(sp,"field16",json_object_new_double(ytShm->spStatusList.spStatus[cid][16].REALTIME_VALUE));
+	json_object_object_add(sp,"field17",json_object_new_double(ytShm->spStatusList.spStatus[cid][17].REALTIME_VALUE));
+	json_object_object_add(sp,"field18",json_object_new_double(ytShm->spStatusList.spStatus[cid][18].REALTIME_VALUE));
+	json_object_object_add(sp,"field19",json_object_new_double(ytShm->spStatusList.spStatus[cid][19].REALTIME_VALUE));
+	json_object_object_add(sp,"field20",json_object_new_double(ytShm->spStatusList.spStatus[cid][20].REALTIME_VALUE));
+	json_object_object_add(sp,"field21",json_object_new_double(ytShm->spStatusList.spStatus[cid][21].REALTIME_VALUE));
+	json_object_object_add(sp,"field22",json_object_new_double(ytShm->spStatusList.spStatus[cid][22].REALTIME_VALUE));
+	json_object_object_add(sp,"field23",json_object_new_double(ytShm->spStatusList.spStatus[cid][23].REALTIME_VALUE));
+	json_object_object_add(sp,"field24",json_object_new_double(ytShm->spStatusList.spStatus[cid][24].REALTIME_VALUE));
+	json_object_object_add(sp,"field25",json_object_new_double(ytShm->spStatusList.spStatus[cid][25].REALTIME_VALUE));
+	json_object_object_add(sp,"field26",json_object_new_double(ytShm->spStatusList.spStatus[cid][26].REALTIME_VALUE));
+	json_object_object_add(sp,"field27",json_object_new_double(ytShm->spStatusList.spStatus[cid][27].REALTIME_VALUE));
+	json_object_object_add(sp,"field28",json_object_new_double(ytShm->spStatusList.spStatus[cid][28].REALTIME_VALUE));
+	json_object_object_add(sp,"field29",json_object_new_double(ytShm->spStatusList.spStatus[cid][29].REALTIME_VALUE));
+	json_object_object_add(sp,"field30",json_object_new_double(ytShm->spStatusList.spStatus[cid][30].REALTIME_VALUE));
+	json_object_object_add(sp,"field31",json_object_new_double(ytShm->spStatusList.spStatus[cid][31].REALTIME_VALUE));
 	json_object_array_add(iotlist,sp);
     json_object_object_add(body,"IOT_LIST",iotlist);
 }
@@ -83,52 +83,52 @@ void set_real_value(json_object *param,int cid)
 			t=json_object_get_int(val);
                         timestamp=json_object_get_int(val);
         }else if(strcmp(key,"field16")==0){
-            ytShm->spStatusList.spStatus[cid][16].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][16].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][16].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field17")==0){
-            ytShm->spStatusList.spStatus[cid][17].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][17].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][17].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field18")==0){
-            ytShm->spStatusList.spStatus[cid][18].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][18].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][18].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field19")==0){
-            ytShm->spStatusList.spStatus[cid][19].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][19].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][19].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field20")==0){
-            ytShm->spStatusList.spStatus[cid][20].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][20].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][20].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field21")==0){
-            ytShm->spStatusList.spStatus[cid][21].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][21].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][21].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field22")==0){
-            ytShm->spStatusList.spStatus[cid][22].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][22].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][22].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field23")==0){
-            ytShm->spStatusList.spStatus[cid][23].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][23].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][23].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field24")==0){
-            ytShm->spStatusList.spStatus[cid][24].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][24].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][24].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field25")==0){
-            ytShm->spStatusList.spStatus[cid][25].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][25].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][25].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field26")==0){
-            ytShm->spStatusList.spStatus[cid][26].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][26].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][26].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field27")==0){
-            ytShm->spStatusList.spStatus[cid][27].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][27].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][27].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field28")==0){
-            ytShm->spStatusList.spStatus[cid][28].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][28].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][28].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field29")==0){
-            ytShm->spStatusList.spStatus[cid][29].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][29].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][29].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field30")==0){
-            ytShm->spStatusList.spStatus[cid][30].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][30].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][30].REALTIME_TIMESTAMP=t;
         }else if(strcmp(key,"field31")==0){
-            ytShm->spStatusList.spStatus[cid][31].REALTIME_VALUE=json_object_get_int(val);
+            ytShm->spStatusList.spStatus[cid][31].REALTIME_VALUE=json_object_get_double(val);
 			ytShm->spStatusList.spStatus[cid][31].REALTIME_TIMESTAMP=t;
         }
     }