...
|
...
|
@@ -39,7 +39,7 @@ class User extends Backend |
|
|
if ($this->request->request('keyField')) {
|
|
|
return $this->selectpage();
|
|
|
}
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams('user.id,user.username,user.nickname.user.password,user.card,user.work_address,user.studynum');
|
|
|
$total = $this->model
|
|
|
->with('group')
|
|
|
->where($where)
|
...
|
...
|
@@ -82,6 +82,15 @@ class User extends Backend |
|
|
if($this->check_identity($params['card'])) {
|
|
|
$this->error('该身份证号已存在');
|
|
|
}
|
|
|
$study = [];
|
|
|
if($params['study_id'] && $params['periodtime']) {
|
|
|
$study = [
|
|
|
'study_id' => $params['study_id'],
|
|
|
'periodtime' => strtotime($params['periodtime'])
|
|
|
];
|
|
|
unset($params['study_id']);
|
|
|
unset($params['periodtime']);
|
|
|
}
|
|
|
$result = false;
|
|
|
Db::startTrans();
|
|
|
try {
|
...
|
...
|
@@ -92,6 +101,22 @@ class User extends Backend |
|
|
$this->model->validateFailException(true)->validate($validate);
|
|
|
}
|
|
|
$result = $this->model->allowField(true)->save($params);
|
|
|
if($study) {
|
|
|
$res['third_id'] = $params['third_id'];
|
|
|
$res['study_id'] = $params['study_id'];
|
|
|
$res['createtime'] = time();
|
|
|
$res['playtime'] = 0;
|
|
|
$classes_ids = Db::name('classes')->where('study_id',$res['study_id'])->where('is_major',1)->column('id');
|
|
|
foreach ($classes_ids as $v){
|
|
|
$res['class_id'] = $v;
|
|
|
Db::name('study_class')->insertGetId($res);
|
|
|
}
|
|
|
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
|
|
$params[$this->dataLimitField] = $this->auth->id;
|
|
|
}
|
|
|
$study['third_id'] = $this->model->id;
|
|
|
Db::name('third_study')->insertGetId($study);
|
|
|
}
|
|
|
Db::commit();
|
|
|
} catch (ValidateException $e) {
|
|
|
Db::rollback();
|
...
|
...
|
|