浏览代码

fix:submitTest

Xu·LinPeng 1 月之前
父节点
当前提交
8e5267e4c3
共有 2 个文件被更改,包括 45 次插入2 次删除
  1. 44 1
      Modules/Admin/Http/Controllers/Api/ApiController.php
  2. 1 1
      Modules/Admin/Routes/api.php

+ 44 - 1
Modules/Admin/Http/Controllers/Api/ApiController.php

@@ -1208,7 +1208,7 @@ class ApiController extends BaseController
         $zt = $request->query('zt');
 
         $res = DB::connection('mysql_fwe10')->table('uf_xx_dtk')
-            ->select('id','tmlx','tm','xxa','xxb','xxc','xxd')
+            ->select('id','tmlx','tm','xxa','xxb','xxc','xxd','da')
             ->where('is_delete',0)
             ->where('sjzt',$params['zt'])
             ->orderBy('tmlx')
@@ -1221,6 +1221,49 @@ class ApiController extends BaseController
     }
 
 
+    public function submitTest(Request $request)
+    {
+        $params = $request->all();
+        $result['status'] = true;
+        $result['msg']    = ApiEnum::RETURN_SUCCESS;
+
+        $list = $params['answer'];
+
+        if(count($list) > 0){
+            for($i=0;$i<count($list);$i++){
+                $id = mt_rand(pow(10, 18), pow(10, 18) + 999999999);
+
+                if (is_array($list[$i]['value'])) {
+                    $value = implode(',', $list[$i]['value']);
+                } else {
+                    $value = $list[$i]['value'];
+                }
+
+                $insert = [
+                    'ID' => $id,
+                    'FORM_DATA_ID' => $id,
+                    'DATA_INDEX' => 0.0,
+                    'CREATE_TIME' => date('Y-m-d H:i:s'),
+                    'TENANT_KEY' => 't1zz9w8165',
+                    'IS_DELETE' => 0,
+                    'DELETE_TYPE' => 0,
+                    'FT_STATUS' => 0,
+
+                    'jid' => $params['jid'],
+                    'da'  => $value,
+                    'tid' => $list[$i]['id'],
+                    'xm'  => $params['xm'],
+                    'gh'  => $params['gh']
+                ];
+
+                DB::connection('mysql_fwe10')->table('uf_zhxx_wjdc_dtqk')->insert($insert);
+            }
+        }
+
+        return self::successResponse($result);
+    }
+
+
     //腾讯地图逆地址解析
     public function positionGeocoder(){
         $lat = Input::get('lat', '');//纬度

+ 1 - 1
Modules/Admin/Routes/api.php

@@ -89,7 +89,7 @@ Route::namespace('Api')->group(function () {
     //问卷调查提交
     Route::post('fanwei/submit_test', 'ApiController@submitTest');
     //问卷调查统计
-    Route::post('fanwei/get_test_static', 'ApiController@getTestStatic');
+//    Route::post('fanwei/get_test_static', 'ApiController@getTestStatic');
     //问卷调查单题列表
 //    Route::post('fanwei/get_topic_test_list', 'ApiController@getTopicTestList');