增加教师电话

This commit is contained in:
巴掌 committed 2020-08-23 17:00:29 +08:00
1 parent c9e9d29ba6
commit a67bb00b3b
6 files changed
+63 -8

No files matched your search

+20 -2
View File
@@ -158,6 +158,7 @@ class Index extends AdminBase
,'quanpin'
,'shoupin'
,'shengri'
,'phone'
,'zhiwu_id'
,'zhicheng_id'
,'xueli_id'
@@ -173,7 +174,14 @@ class Index extends AdminBase
$result = $validate->scene('create')->check($list);
$msg = $validate->getError();
if(!$result){
return json(['msg' => $msg, 'val' => 0]);;
return json(['msg' => $msg, 'val' => 0]);
}
$tc = new TC();
$temp = $tc->phoneSrc($list['phone']);
if($temp)
{
return json(['msg' => '手机号已经存在', 'val' => 0]);
}
$list['quanpin'] = trim(strtolower(str_replace(' ', '', $list['quanpin'])));
@@ -232,7 +240,7 @@ class Index extends AdminBase
public function edit($id)
{
// 获取教师信息
$list['data'] = TC::field('id, xingming, sex, quanpin, shoupin, shengri, zhiwu_id, zhicheng_id, xueli_id, biye, worktime, zhuanye, danwei_id, tuixiu')
$list['data'] = TC::field('id, xingming, sex, quanpin, shoupin, shengri, phone, zhiwu_id, zhicheng_id, xueli_id, biye, worktime, zhuanye, danwei_id, tuixiu')
->find($id);
// 设置页面标题
@@ -260,6 +268,7 @@ class Index extends AdminBase
,'quanpin'
,'shoupin'
,'shengri'
,'phone'
,'zhiwu_id'
,'zhicheng_id'
,'xueli_id'
@@ -278,17 +287,26 @@ class Index extends AdminBase
if(!$result){
return json(['msg' => $msg, 'val' => 0]);;
}
$tc = new TC();
$temp = $tc->phoneSrc($list['phone']);
if($temp)
{
return json(['msg' => '手机号已经存在', 'val' => 0]);
}
$list['quanpin'] = trim(strtolower(str_replace(' ', '', $list['quanpin'])));
$list['shoupin'] = trim(strtolower($list['shoupin']));
// 更新数据
$teacher = new TC();
$teacherlist = $teacher->find($id);
$teacherlist->xingming = $list['xingming'];
$teacherlist->sex = $list['sex'];
$teacherlist->quanpin = $list['quanpin'];
$teacherlist->shoupin = $list['shoupin'];
$teacherlist->shengri = $list['shengri'];
$teacherlist->phone = $list['phone'];
$teacherlist->zhiwu_id = $list['zhiwu_id'];
$teacherlist->zhicheng_id = $list['zhicheng_id'];
$teacherlist->xueli_id = $list['xueli_id'];
+29 -6
View File
@@ -138,17 +138,28 @@ class Teacher extends BaseModel
$i = 0;
$teacherlist = array();
foreach ($arr as $key => $value) {
$phone = str_replace(' ', '', $value[4]);
$temp = $this->phoneSrc($phone);
if($temp)
{
if($temp->delete_time > 0)
{
$temp->restore();
}
$teacherlist[$i]['id'] = $temp->id;
}
$teacherlist[$i]['xingming'] = $value[1];
$teacherlist[$i]['sex'] = $this->cutStr($value[2]);
$teacherlist[$i]['shengri'] = $value[3];
$teacherlist[$i]['worktime'] = $value[4];
$teacherlist[$i]['zhiwu_id'] = $this->cutStr($value[5]);
$teacherlist[$i]['zhicheng_id'] = $this->cutStr($value[6]);
$teacherlist[$i]['phone'] = $phone;
$teacherlist[$i]['worktime'] = $value[5];
$teacherlist[$i]['zhiwu_id'] = $this->cutStr($value[6]);
$teacherlist[$i]['zhicheng_id'] = $this->cutStr($value[7]);
$teacherlist[$i]['danwei_id'] = $School_id;
$teacherlist[$i]['biye'] = $value[8];
$teacherlist[$i]['subject_id'] = $this->cutStr($value[7]);
$teacherlist[$i]['biye'] = $value[9];
$teacherlist[$i]['subject_id'] = $this->cutStr($value[8]);
$teacherlist[$i]['zhuanye'] = $value[9];
$teacherlist[$i]['xueli_id'] = $this->cutStr($value[10]);
$teacherlist[$i]['xueli_id'] = $this->cutStr($value[11]);
$quanpin = $pinyin->sentence($value[1]);
$jianpin = $pinyin->abbr($value[1]);
$teacherlist[$i]['quanpin'] = trim(strtolower(str_replace(' ', '', $quanpin)));
@@ -196,6 +207,18 @@ class Teacher extends BaseModel
}
// 根据手机号查询教师
public function phoneSrc($phone)
{
$data = self::withTrashed()
->where('phone', $phone)
->field('id, delete_time')
->find();
return $data;
}
// 查询教师荣誉
public function srcRongyu($teacher_id)
{
+3
View File
@@ -20,6 +20,7 @@ class Teacher extends Validate
'sex|性别' => 'require|number|max:2',
'danwei_id|单位' => 'require|number',
'shengri|出生日期' => 'date',
'phone|手机号' => 'require|mobile',
'zhiwu_id|职务' => 'number',
'zhicheng_id|职称' => 'number',
'xueli_id|学历' => 'number',
@@ -45,6 +46,7 @@ class Teacher extends Validate
,'sex'
,'danwei_id'
,'shengri'
,'phone'
,'zhiwu_id'
,'zhicheng_id'
,'xueli_id'
@@ -61,6 +63,7 @@ class Teacher extends Validate
,'sex'
,'danwei_id'
,'shengri'
,'phone'
,'zhiwu_id'
,'zhicheng_id'
,'xueli_id'
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff. Show more