批量添加教师
This commit is contained in:
1 parent
c7a9ec1be6
commit
14ba4ed9ec
3 files changed
+62
-9
No files matched your search
@@ -261,16 +261,55 @@ class Index extends Base
|
||||
}
|
||||
|
||||
// 删除标题行
|
||||
array_splice($stuinfo,0,3);
|
||||
array_splice($teacherinfo,0,4 );
|
||||
|
||||
// 整理数据
|
||||
$i = 0;
|
||||
$teacher = array();
|
||||
$teacherlist = array();
|
||||
|
||||
|
||||
foreach ($teacherinfo as $key => $value) {
|
||||
// 如果姓名、性别、出生日期、全拼、首拼为空则跳过
|
||||
if(empty($value[1]) || empty($value[2]) || empty($value[3]) || empty($value[11]) || empty($value[12]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
return json($data);
|
||||
// 整理数据
|
||||
$teacherlist[$i]['xingming'] = $value[1];
|
||||
if($value[2] == '男')
|
||||
{
|
||||
$teacherlist[$i]['sex'] = 1;
|
||||
}else if($value[2] == '女'){
|
||||
$teacherlist[$i]['sex'] = 0;
|
||||
}else{
|
||||
$teacherlist[$i]['sex'] = 2;
|
||||
}
|
||||
$teacherlist[$i]['shengri'] = $value[3];
|
||||
$teacherlist[$i]['worktime'] = $value[4];
|
||||
$teacherlist[$i]['zhiwu'] = $value[5];
|
||||
$teacherlist[$i]['danwei'] = $list['school'];
|
||||
$teacherlist[$i]['biey'] = $value[8];
|
||||
$teacherlist[$i]['zhuanye'] = $value[9];
|
||||
$teacherlist[$i]['xueli'] = $value[10];
|
||||
$teacherlist[$i]['quanpin'] = $value[11];
|
||||
$teacherlist[$i]['shoupin'] = $value[12];
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
// 实例化学生信息数据模型
|
||||
$teacher = new Teacher();
|
||||
|
||||
// dump($teacherlist);
|
||||
|
||||
// 保存或更新信息
|
||||
$data = $teacher->saveAll($teacherlist);
|
||||
|
||||
// 返回添加结果
|
||||
$data ? $data = ['msg'=>'数据上传成功','val'=>true] : ['msg'=>'数据上传失败','val'=>false];
|
||||
|
||||
return json($data1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ class Teacher extends Migrator
|
||||
->addColumn('sex','boolean',['limit'=>1,'default'=>1,'null'=>false,'comment'=>'性别'])
|
||||
->addColumn('shengri','integer',['limit'=>11,'null'=>true,'comment'=>'生日'])
|
||||
->addColumn('worktime','integer',['limit'=>11,'null'=>true,'comment'=>'工作时间'])
|
||||
->addColumn('zhiwu','string',['limit'=>11,'null'=>true,'comment'=>'职务'])
|
||||
->addColumn('zhicheng','string',['limit'=>11,'null'=>true,'comment'=>'职称'])
|
||||
->addColumn('danwei','string',['limit'=>11,'null'=>false,'comment'=>'现工作单位'])
|
||||
->addColumn('zhiwu','integer',['limit'=>11,'null'=>true,'comment'=>'职务'])
|
||||
->addColumn('zhicheng','integer',['limit'=>11,'null'=>true,'comment'=>'职称'])
|
||||
->addColumn('danwei','integer',['limit'=>11,'null'=>false,'comment'=>'现工作单位'])
|
||||
->addColumn('biye','string',['limit'=>50,'null'=>true,'comment'=>'毕业学校'])
|
||||
->addColumn('zhuanye','string',['limit'=>20,'null'=>true,'comment'=>'专业'])
|
||||
->addColumn('xueli','string',['limit'=>20,'null'=>true,'comment'=>'学历'])
|
||||
|
||||
+15
-1
@@ -60,7 +60,7 @@ class Rule extends Seeder
|
||||
['id'=>801,'title'=>'单位荣誉','name'=>'rongyu/DwRongyu/index','paixu'=>1,'ismenu' =>true,'pid' =>8,'url'=>'/dwry',],
|
||||
['id'=>802,'title'=>'教师荣誉册','name'=>'rongyu/JsRongyu/index','paixu'=>2,'ismenu' =>true,'pid' =>8,'url'=>'/jsry',],
|
||||
['id'=>803,'title'=>'教师荣誉信息','name'=>'rongyu/JsRongyuInfo/index','paixu'=>3,'ismenu' =>true,'pid' =>8,'url'=>'/jsryinfo',],
|
||||
['id'=>804,'title'=>'学生荣誉','name'=>'rongyu/StuRongyu/index','paixu'=>7,'ismenu' =>true,'pid' =>8,'url'=>'/xsry',],
|
||||
['id'=>804,'title'=>'学生荣誉','name'=>'rongyu/StuRongyu/index','paixu'=>7,'ismenu' =>true,'pid' =>8,'url'=>'/xsry','status'=>0],
|
||||
|
||||
|
||||
|
||||
@@ -176,6 +176,20 @@ class Rule extends Seeder
|
||||
['title'=>'查看','name'=>'rongyu/DwRongyu/read','paixu'=>4,'pid'=>801,],
|
||||
['title'=>'状态','name'=>'rongyu/DwRongyu/setStatus','paixu'=>5,'pid'=>801],
|
||||
['title'=>'批量上传','name'=>'rongyu/DwRongyu/createAll','paixu'=>6,'pid'=>801],
|
||||
// 教师荣誉册管理
|
||||
['title'=>'添加','name'=>'rongyu/JsRongyu/create','paixu' =>1,'pid'=>801],
|
||||
['title'=>'删除','name'=>'rongyu/JsRongyu/delete','paixu'=>2,'pid'=>801],
|
||||
['title'=>'编辑','name'=>'rongyu/JsRongyu/edit','paixu'=>3,'pid'=>801,],
|
||||
['title'=>'查看','name'=>'rongyu/JsRongyu/read','paixu'=>4,'pid'=>801,],
|
||||
['title'=>'状态','name'=>'rongyu/JsRongyu/setStatus','paixu'=>5,'pid'=>801],
|
||||
// 教师荣誉信息管理
|
||||
['title'=>'添加','name'=>'rongyu/JsRongyuInfo/create','paixu' =>1,'pid'=>801],
|
||||
['title'=>'删除','name'=>'rongyu/JsRongyuInfo/delete','paixu'=>2,'pid'=>801],
|
||||
['title'=>'编辑','name'=>'rongyu/JsRongyuInfo/edit','paixu'=>3,'pid'=>801,],
|
||||
['title'=>'查看','name'=>'rongyu/JsRongyuInfo/read','paixu'=>4,'pid'=>801,],
|
||||
['title'=>'状态','name'=>'rongyu/JsRongyuInfo/setStatus','paixu'=>5,'pid'=>801],
|
||||
['title'=>'批量上传','name'=>'rongyu/JsRongyuInfo/createAll','paixu'=>6,'pid'=>801],
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user