更新学校

This commit is contained in:
yyh931018@qq.com
2022-09-29 14:03:34 +08:00
parent 9bdbfd53d1
commit c155930d70
2 changed files with 8 additions and 0 deletions

View File

@@ -228,6 +228,12 @@ class Group extends Backend
//根据等级直接分配权限 //根据等级直接分配权限
$params['rules'] = $this->rules[$params['level']]; $params['rules'] = $this->rules[$params['level']];
if ($params) { if ($params) {
if($params['level'] == 4){
//学校
db('student')->where('group_id',$ids)->update(array('school'=>$params['name']));
}
Db::startTrans(); Db::startTrans();
try { try {
$row->save($params); $row->save($params);

View File

@@ -136,6 +136,7 @@ class Student extends Backend
$area_encoded = db('area')->where('id', $info['city'])->find(); $area_encoded = db('area')->where('id', $info['city'])->find();
$params['city'] = $area_encoded['name']; $params['city'] = $area_encoded['name'];
$result = $this->model->validateFailException()->validate('Student.add')->allowField(true)->save($params); $result = $this->model->validateFailException()->validate('Student.add')->allowField(true)->save($params);
Db::commit(); Db::commit();
} catch (ValidateException|PDOException|Exception $e) { } catch (ValidateException|PDOException|Exception $e) {
@@ -204,6 +205,7 @@ function getPicUrl($url)
'mobile' => 'regex:1[3-9]\d{9}|unique:student,mobile,' . $row->id, 'mobile' => 'regex:1[3-9]\d{9}|unique:student,mobile,' . $row->id,
]); ]);
$params['avatar'] = $this->getPicUrl($params['avatar']); $params['avatar'] = $this->getPicUrl($params['avatar']);
// dump($params);die;
$result = $row->validateFailException()->validate('Student.edit')->allowField(true)->save($params); $result = $row->validateFailException()->validate('Student.edit')->allowField(true)->save($params);
Db::commit(); Db::commit();
} catch (ValidateException|PDOException|Exception $e) { } catch (ValidateException|PDOException|Exception $e) {