This commit is contained in:
巴掌 committed 2021-02-22 17:05:09 +08:00
1 parent 3c95c4ff7a
commit 5e1a0b7b2a
4 files changed
+47 -39

No files matched your search

+32 -31
View File
@@ -88,56 +88,57 @@ class Tongbu extends BaseController
->find();
if($temp)
{
$temp->xingming = $value->xingming;
$temp->sex = $value->getData("sex");
$temp->shengri = $value->getData("shengri");
$temp->password = $value->password;
$temp->teacher_id = $value->id;
$temp->school_id = $value->danwei_id;
$temp->phone = $value->phone;
$temp->worktime = $value->getData("worktime");
$temp->zhiwu_id = $value->zhiwu_id;
$temp->zhicheng_id = $value->zhicheng_id;
$temp->biye = $value->biye;
$temp->zhuanye = $value->zhuanye;
$temp->xueli_id = $value->xueli_id;
$temp->subject_id = $value->subject_id;
$temp->quanpin = $value->quanpin;
$temp->shoupin = $value->shoupin;
$temp->tuixiu = $value->getData("tuixiu");
$temp->denglucishu = $value->denglucishu + $temp->denglucishu;
$arr['id'] = $value->id;
$arr['xingming'] = $value->xingming;
$arr['sex'] = $value->getData("sex");
$arr['shengri'] = strtotime($value->shengri);
$arr['password'] = $value->password;
$arr['teacher_id'] = $value->id;
$arr['school_id'] = $value->danwei_id;
$arr['phone'] = $value->phone;
$arr['worktime'] = strtotime($value->worktime);
$arr['zhiwu_id'] = $value->zhiwu_id;
$arr['zhicheng_id'] = $value->zhicheng_id;
$arr['biye'] = $value->biye;
$arr['zhuanye'] = $value->zhuanye;
$arr['xueli_id'] = $value->xueli_id;
$arr['subject_id'] = $value->subject_id;
$arr['quanpin'] = $value->quanpin;
$arr['shoupin'] = $value->shoupin;
$arr['tuixiu'] = $value->getData("tuixiu");
$arr['denglucishu'] = $value->denglucishu + $temp->denglucishu;
if($temp->this_time < $value->this_time)
{
$temp->lastip = $value->lastip;
$temp->ip = $value->ip;
$temp->lasttime = $value->getData('lasttime');
$temp->thistime = $value->getData('thistime');
$arr['lastip'] = $value->lastip;
$arr['ip'] = $value->ip;
$arr['lasttime'] = strtotime($value->lasttime);
$arr['thistime'] = strtotime($value->thistime);
}
$temp->status = $value->status;
if($temp->create_time > $value->create_time)
{
$temp->create_time = $value->getData('create_time');
$arr['create_time'] = strtotime($value->create_time);
}
if($temp->delete_time < $value->delete_time)
{
$temp->delete_time = $value->getData('delete_time');
$arr['delete_time'] = $value->delete_time;
}
$temp->beizhu = $value->beizhu;
$data = $temp->save();
$arr['beizhu'] = $value->beizhu;
$data = $ad::update($arr);
} else {
$data = $value->toArray();
$data['teacher_id'] = $value->id;
unset($data['id']);
$data['sex'] = $value->getData('sex');
$data['shengri'] = $value->getData('shengri');
$data['shengri'] = strtotime($value->shengri);
$data['username'] = $value->phone;
$data['school_id'] = $value->danwei_id;
unset($data['danwei_id']);
$data['delete_time'] = $value->getData('delete_time');
$data['worktime'] = $value->getData('worktime');
$data['delete_time'] = $value->delete_time;
$data['worktime'] = strtotime($value->worktime);
$data['tuixiu'] = $value->getData('tuixiu');
$data['create_time'] = $value->getData('create_time');
$data['delete_time'] = $value->getData('delete_time');
$data['create_time'] = strtotime($value->create_time);
$data['delete_time'] = $value->delete_time;
unset($data['update_time']);
$data = $ad->create($data);
}
+10 -3
View File
@@ -81,13 +81,20 @@ class Admin extends BaseModel
,'school_id' => ''
];
$src = array_cover($srcfrom, $src);
trim($src['str']);
// 如果有数据则查询教师信息
$list = self::field('id, xingming, school_id, shengri, sex')
->whereOr('xingming', 'like', '%' . $src['str'] . '%')
->whereOr('shoupin', 'like', $src['str'] . '%')
->when(strlen($src['school_id']) > 0, function ($query) use($src) {
$query->where('school_id', $src['danwei_id']);
})
->when(strlen($src['str']) <= 0, function ($query) use($src) {
$query->where('id', '<=', 0);
})
->when(strlen($src['str']) > 0, function ($query) use($src) {
$query
->whereOr('xingming', 'like', '%' . $src['str'] . '%')
->whereOr('shoupin', 'like', $src['str'] . '%');
})
->with(
[
'adSchool' => function($query){
@@ -97,7 +104,7 @@ class Admin extends BaseModel
)
->append(['age'])
->select();
return $list;
}
@@ -43,7 +43,7 @@ class TeacherToAdmin extends Migrator
->addColumn('quanpin','string',['limit'=>30,'default'=>'a','null'=>false,'comment'=>'全拼'])
->addColumn('shoupin','string',['limit'=>5,'default'=>'a','null'=>false,'comment'=>'简拼'])
->addColumn('tuixiu','boolean',['limit'=>1,'default'=>0,'null'=>false,'comment'=>'是否已经退休'])
->addIndex(array('phone'), array('unique' => true))
// ->addIndex(array('phone'), array('unique' => true))
->update();
}
Loaded 3 of 4 files, more files were not shown because too many files have changed in this diff. Show more