|
@@ -822,9 +822,114 @@ class ApiController extends BaseController
|
|
{
|
|
{
|
|
$result['status'] = true;
|
|
$result['status'] = true;
|
|
$result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
$result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
- $result['data'] = [];
|
|
|
|
|
|
|
|
- $res = DB::connection('mysql_fwe10')->table('uf_zhxx_wjdc_tgl')->select('id','tmlx','xztm','tktm','jdtm','xxa','xxb','xxc','xxd','xxe')->where('is_delete',0)->orderBy('tmlx')->orderBy('create_time')->get();
|
|
|
|
|
|
+ $result['data']['title'] = '洗选中心'.date("Y").'年员工思想状况调查问卷';
|
|
|
|
+
|
|
|
|
+ $jid = DB::connection('mysql_fwe10')->table('uf_zhxx_wjdc_jgl')->where('is_delete',0)->orderBy('create_time','desc')->limit(1)->pluck('ID')[0];
|
|
|
|
+
|
|
|
|
+ $tgl_list = DB::connection('mysql_fwe10')->table('uf_zhxx_wjdc_tgl')->where('is_delete',0)->orderBy('tmlx')->orderBy('create_time')->get();
|
|
|
|
+
|
|
|
|
+ $statis_list = [];
|
|
|
|
+ if(count($tgl_list) > 0){
|
|
|
|
+ for($i=0;$i<count($tgl_list);$i++){
|
|
|
|
+ $statis_list[$i]['id'] = $tgl_list[$i]->ID;
|
|
|
|
+ $statis_list[$i]['tmlx'] = $tgl_list[$i]->tmlx;
|
|
|
|
+ if($tgl_list[$i]->tmlx == 0){//单选题
|
|
|
|
+ $statis_list[$i]['title'] = $tgl_list[$i]->xztm;
|
|
|
|
+ $statis_list[$i]['type'] = '单选题';
|
|
|
|
+ $statis_list[$i]['a'] = $tgl_list[$i]->xxa;
|
|
|
|
+ $statis_list[$i]['b'] = $tgl_list[$i]->xxb;
|
|
|
|
+ $statis_list[$i]['c'] = $tgl_list[$i]->xxc;
|
|
|
|
+ $statis_list[$i]['d'] = $tgl_list[$i]->xxd;
|
|
|
|
+ $statis_list[$i]['e'] = $tgl_list[$i]->xxe;
|
|
|
|
+ $statis_list[$i]['a_num'] = 0;
|
|
|
|
+ $statis_list[$i]['b_num'] = 0;
|
|
|
|
+ $statis_list[$i]['c_num'] = 0;
|
|
|
|
+ $statis_list[$i]['d_num'] = 0;
|
|
|
|
+ $statis_list[$i]['e_num'] = 0;
|
|
|
|
+ $statis_list[$i]['num'] = 0;
|
|
|
|
+ }
|
|
|
|
+ if($tgl_list[$i]->tmlx == 1){//多选题
|
|
|
|
+ $statis_list[$i]['title'] = $tgl_list[$i]->xztm;
|
|
|
|
+ $statis_list[$i]['type'] = '多选题';
|
|
|
|
+ $statis_list[$i]['a'] = $tgl_list[$i]->xxa;
|
|
|
|
+ $statis_list[$i]['b'] = $tgl_list[$i]->xxb;
|
|
|
|
+ $statis_list[$i]['c'] = $tgl_list[$i]->xxc;
|
|
|
|
+ $statis_list[$i]['d'] = $tgl_list[$i]->xxd;
|
|
|
|
+ $statis_list[$i]['e'] = $tgl_list[$i]->xxe;
|
|
|
|
+ $statis_list[$i]['a_num'] = 0;
|
|
|
|
+ $statis_list[$i]['b_num'] = 0;
|
|
|
|
+ $statis_list[$i]['c_num'] = 0;
|
|
|
|
+ $statis_list[$i]['d_num'] = 0;
|
|
|
|
+ $statis_list[$i]['e_num'] = 0;
|
|
|
|
+ $statis_list[$i]['num'] = 0;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if($tgl_list[$i]->tmlx == 2){//填空题
|
|
|
|
+ $statis_list[$i]['title'] = $tgl_list[$i]->tktm;
|
|
|
|
+ }
|
|
|
|
+ if($tgl_list[$i]->tmlx == 3){//简答题
|
|
|
|
+ $statis_list[$i]['title'] = $tgl_list[$i]->jdtm;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $dtqk_list = DB::connection('mysql_fwe10')->table('uf_zhxx_wjdc_dtqk')->select('da','tid')->where('jid',$jid)->where('is_delete',0)->get();
|
|
|
|
+
|
|
|
|
+ $id_list = array_column($statis_list, 'id');
|
|
|
|
+ if(count($dtqk_list) > 0){
|
|
|
|
+ for($i=0;$i<count($dtqk_list);$i++){
|
|
|
|
+ $key = array_search($dtqk_list[$i]->tid, $id_list);
|
|
|
|
+ if($statis_list[$key]['tmlx'] == 0){//单选
|
|
|
|
+ if($dtqk_list[$i]->da == 'A'){
|
|
|
|
+ $statis_list[$key]['a_num']++;
|
|
|
|
+ }
|
|
|
|
+ if($dtqk_list[$i]->da == 'B'){
|
|
|
|
+ $statis_list[$key]['b_num']++;
|
|
|
|
+ }
|
|
|
|
+ if($dtqk_list[$i]->da == 'C'){
|
|
|
|
+ $statis_list[$key]['c_num']++;
|
|
|
|
+ }
|
|
|
|
+ if($dtqk_list[$i]->da == 'D'){
|
|
|
|
+ $statis_list[$key]['d_num']++;
|
|
|
|
+ }
|
|
|
|
+ if($dtqk_list[$i]->da == 'E'){
|
|
|
|
+ $statis_list[$key]['e_num']++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if($statis_list[$key]['tmlx'] == 1){//多选
|
|
|
|
+ $da = explode(',',$dtqk_list[$i]->da);
|
|
|
|
+ for($j=0;$j<count($da);$j++){
|
|
|
|
+ if($da[$j] == 'A'){
|
|
|
|
+ $statis_list[$key]['a_num']++;
|
|
|
|
+ }
|
|
|
|
+ if($da[$j] == 'B'){
|
|
|
|
+ $statis_list[$key]['a_num']++;
|
|
|
|
+ }
|
|
|
|
+ if($da[$j] == 'C'){
|
|
|
|
+ $statis_list[$key]['a_num']++;
|
|
|
|
+ }
|
|
|
|
+ if($da[$j] == 'D'){
|
|
|
|
+ $statis_list[$key]['a_num']++;
|
|
|
|
+ }
|
|
|
|
+ if($da[$j] == 'E'){
|
|
|
|
+ $statis_list[$key]['a_num']++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(count($statis_list) > 0){
|
|
|
|
+ $num = $statis_list[0]['a_num'] + $statis_list[0]['b_num'] + $statis_list[0]['c_num'] + $statis_list[0]['d_num'] + $statis_list[0]['e_num'];
|
|
|
|
+ for($i=0;$i<count($statis_list);$i++){
|
|
|
|
+ if($statis_list[$i]['tmlx'] == 0 || $statis_list[$i]['tmlx'] == 1){
|
|
|
|
+ $statis_list[$i]['num'] = $num;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $result['data']['list'] = $statis_list;
|
|
|
|
|
|
return self::successResponse($result);
|
|
return self::successResponse($result);
|
|
}
|
|
}
|
|
@@ -836,7 +941,32 @@ class ApiController extends BaseController
|
|
$result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
$result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
$result['data'] = [];
|
|
$result['data'] = [];
|
|
|
|
|
|
- $res = DB::connection('mysql_fwe10')->table('uf_zhxx_wjdc_tgl')->select('id','tmlx','xztm','tktm','jdtm','xxa','xxb','xxc','xxd','xxe')->where('is_delete',0)->orderBy('tmlx')->orderBy('create_time')->get();
|
|
|
|
|
|
+ $id = Input::get('id', '');
|
|
|
|
+
|
|
|
|
+ if (!$id) {
|
|
|
|
+ return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $t = DB::connection('mysql_fwe10')->table('uf_zhxx_wjdc_tgl')->where('ID',$id)->get();
|
|
|
|
+
|
|
|
|
+ $list = DB::connection('mysql_fwe10')->table('uf_zhxx_wjdc_dtqk')->where('tid',$id)->where('is_delete',0)->orderBy('create_time')->pluck('da');
|
|
|
|
+
|
|
|
|
+ if($t[0]->tmlx == 2){//填空
|
|
|
|
+ $result['data']['title'] = $t[0]->tktm;
|
|
|
|
+ }
|
|
|
|
+ if($t[0]->tmlx == 3){//简答
|
|
|
|
+ $result['data']['title'] = $t[0]->jdtm;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $result['data']['list'] = [];
|
|
|
|
+
|
|
|
|
+ if(count($list) > 0){
|
|
|
|
+ for($i=0;$i<count($list);$i++){
|
|
|
|
+ if($list[$i] != '无' && $list[$i] != '没有'){
|
|
|
|
+ array_push($result['data']['list'],$list[$i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
return self::successResponse($result);
|
|
return self::successResponse($result);
|
|
}
|
|
}
|