From 95fbf32a2a659c883aa77cd96191fc47538647a1 Mon Sep 17 00:00:00 2001 From: cxdbz Date: Thu, 26 Dec 2019 19:31:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9D=9E=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E8=AF=81=E5=8F=B7=E4=B8=8A=E4=BC=A0=E6=97=B6=E5=87=BA=E7=94=9F?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E5=92=8C=E6=80=A7=E5=88=AB=E7=9A=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/renshi/controller/Student.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/app/renshi/controller/Student.php b/app/renshi/controller/Student.php index 3cd8c2b6..67cd80f9 100644 --- a/app/renshi/controller/Student.php +++ b/app/renshi/controller/Student.php @@ -520,15 +520,27 @@ class Student extends BaseController $data = array(); foreach ($add as $key => $val) { $sfzhval = strtoupper(trim($myStuList[$key-1][2])); - intval(substr($sfzhval,16,1) )% 2 ? $sex = 1 :$sex = 0 ; - $data[] = [ - 'xingming'=>$myStuList[$key-1][1], - 'shenfenzhenghao'=>strtoupper(trim($sfzhval)), - 'banji'=>$bjid, - 'school'=>$list['school'], - 'shengri' => substr($sfzhval,6,4).'-'.substr($sfzhval,10,2).'-'.substr($sfzhval,12,2), - 'sex' =>$sex, - ]; + if(strlen($sfzhval) == 18) + { + intval(substr($sfzhval,16,1) )% 2 ? $sex = 1 :$sex = 0 ; + $data[] = [ + 'xingming'=>$myStuList[$key-1][1], + 'shenfenzhenghao'=>$sfzhval, + 'banji'=>$bjid, + 'school'=>$list['school'], + 'shengri' => substr($sfzhval,6,4).'-'.substr($sfzhval,10,2).'-'.substr($sfzhval,12,2), + 'sex' =>$sex, + ]; + }else{ + $data[] = [ + 'xingming'=>$myStuList[$key-1][1], + 'shenfenzhenghao'=>$sfzhval, + 'banji'=>$bjid, + 'school'=>$list['school'], + 'shengri' => '1970-1-1', + 'sex' =>2, + ]; + } } $stu->saveAll($data);