1 个管道
的构建
失败
耗费
2 秒
后台用户列表功能优化,新增用户同步新增报考数据
正在显示
4 个修改的文件
包含
41 行增加
和
2 行删除
@@ -39,7 +39,7 @@ class User extends Backend | @@ -39,7 +39,7 @@ class User extends Backend | ||
39 | if ($this->request->request('keyField')) { | 39 | if ($this->request->request('keyField')) { |
40 | return $this->selectpage(); | 40 | return $this->selectpage(); |
41 | } | 41 | } |
42 | - list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | 42 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams('user.id,user.username,user.nickname.user.password,user.card,user.work_address,user.studynum'); |
43 | $total = $this->model | 43 | $total = $this->model |
44 | ->with('group') | 44 | ->with('group') |
45 | ->where($where) | 45 | ->where($where) |
@@ -82,6 +82,15 @@ class User extends Backend | @@ -82,6 +82,15 @@ class User extends Backend | ||
82 | if($this->check_identity($params['card'])) { | 82 | if($this->check_identity($params['card'])) { |
83 | $this->error('该身份证号已存在'); | 83 | $this->error('该身份证号已存在'); |
84 | } | 84 | } |
85 | + $study = []; | ||
86 | + if($params['study_id'] && $params['periodtime']) { | ||
87 | + $study = [ | ||
88 | + 'study_id' => $params['study_id'], | ||
89 | + 'periodtime' => strtotime($params['periodtime']) | ||
90 | + ]; | ||
91 | + unset($params['study_id']); | ||
92 | + unset($params['periodtime']); | ||
93 | + } | ||
85 | $result = false; | 94 | $result = false; |
86 | Db::startTrans(); | 95 | Db::startTrans(); |
87 | try { | 96 | try { |
@@ -92,6 +101,22 @@ class User extends Backend | @@ -92,6 +101,22 @@ class User extends Backend | ||
92 | $this->model->validateFailException(true)->validate($validate); | 101 | $this->model->validateFailException(true)->validate($validate); |
93 | } | 102 | } |
94 | $result = $this->model->allowField(true)->save($params); | 103 | $result = $this->model->allowField(true)->save($params); |
104 | + if($study) { | ||
105 | + $res['third_id'] = $params['third_id']; | ||
106 | + $res['study_id'] = $params['study_id']; | ||
107 | + $res['createtime'] = time(); | ||
108 | + $res['playtime'] = 0; | ||
109 | + $classes_ids = Db::name('classes')->where('study_id',$res['study_id'])->where('is_major',1)->column('id'); | ||
110 | + foreach ($classes_ids as $v){ | ||
111 | + $res['class_id'] = $v; | ||
112 | + Db::name('study_class')->insertGetId($res); | ||
113 | + } | ||
114 | + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { | ||
115 | + $params[$this->dataLimitField] = $this->auth->id; | ||
116 | + } | ||
117 | + $study['third_id'] = $this->model->id; | ||
118 | + Db::name('third_study')->insertGetId($study); | ||
119 | + } | ||
95 | Db::commit(); | 120 | Db::commit(); |
96 | } catch (ValidateException $e) { | 121 | } catch (ValidateException $e) { |
97 | Db::rollback(); | 122 | Db::rollback(); |
@@ -29,5 +29,7 @@ return [ | @@ -29,5 +29,7 @@ return [ | ||
29 | 'Updatetime' => '更新时间', | 29 | 'Updatetime' => '更新时间', |
30 | 'Token' => 'Token', | 30 | 'Token' => 'Token', |
31 | 'Status' => '状态', | 31 | 'Status' => '状态', |
32 | + 'Study_id' => '考试科目id', | ||
33 | + 'Periodtime' => '考试有效期', | ||
32 | 'Leave password blank if dont want to change' => '不修改密码请留空', | 34 | 'Leave password blank if dont want to change' => '不修改密码请留空', |
33 | ]; | 35 | ]; |
@@ -90,6 +90,18 @@ | @@ -90,6 +90,18 @@ | ||
90 | <input id="c-expirationtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[expirationtime]" type="text" value="{:date('Y-m-d H:i:s')}"> | 90 | <input id="c-expirationtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[expirationtime]" type="text" value="{:date('Y-m-d H:i:s')}"> |
91 | </div> | 91 | </div> |
92 | </div> | 92 | </div> |
93 | + <div class="form-group"> | ||
94 | + <label class="control-label col-xs-12 col-sm-2">{:__('Study_id')}:</label> | ||
95 | + <div class="col-xs-12 col-sm-8"> | ||
96 | + <input id="c-study_id" data-rule="" data-source="study/index" data-field="examname" class="form-control selectpage" name="row[study_id]" type="text" value=""> | ||
97 | + </div> | ||
98 | + </div> | ||
99 | + <div class="form-group"> | ||
100 | + <label class="control-label col-xs-12 col-sm-2">{:__('Periodtime')}:</label> | ||
101 | + <div class="col-xs-12 col-sm-8"> | ||
102 | + <input id="c-periodtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[periodtime]" type="text" value="{:date('Y-m-d H:i:s')}"> | ||
103 | + </div> | ||
104 | + </div> | ||
93 | <div class="form-group layer-footer"> | 105 | <div class="form-group layer-footer"> |
94 | <label class="control-label col-xs-12 col-sm-2"></label> | 106 | <label class="control-label col-xs-12 col-sm-2"></label> |
95 | <div class="col-xs-12 col-sm-8"> | 107 | <div class="col-xs-12 col-sm-8"> |
@@ -42,7 +42,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -42,7 +42,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
42 | {field: 'card', title: __('身份证'), operate:false}, | 42 | {field: 'card', title: __('身份证'), operate:false}, |
43 | {field: 'phone', title: __('手机号'), operate:false}, | 43 | {field: 'phone', title: __('手机号'), operate:false}, |
44 | {field: 'sex', title: __('性别'), searchList: {"1":"男","0":'女'},formatter: Table.api.formatter.flag}, | 44 | {field: 'sex', title: __('性别'), searchList: {"1":"男","0":'女'},formatter: Table.api.formatter.flag}, |
45 | - {field: 'work_address', title: __('工作地点'), operate:false}, | 45 | + {field: 'work_address', title: __('工作地点'),operate:'LIKE'}, |
46 | {field: 'image', title: __('头像'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image}, | 46 | {field: 'image', title: __('头像'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image}, |
47 | // {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, | 47 | // {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, |
48 | // {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true}, | 48 | // {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true}, |
-
请 注册 或 登录 后发表评论