|
@@ -49,28 +49,19 @@ class User extends Backend |
|
@@ -49,28 +49,19 @@ class User extends Backend |
49
|
if ($this->request->request('keyField')) {
|
49
|
if ($this->request->request('keyField')) {
|
50
|
return $this->selectpage();
|
50
|
return $this->selectpage();
|
51
|
}
|
51
|
}
|
52
|
-// $study = Db::name('study')->field('id,pass_mark')->select();
|
|
|
53
|
-// $user_ids = [];
|
|
|
54
|
-// foreach ($study as &$v) {
|
|
|
55
|
-// $user_ids = array_merge($user_ids,Db::name('third_exam')->where(['study_id'=>$v['id'],'score'=>['>=',$v['pass_mark']]])->column('user_id'));
|
|
|
56
|
-// }
|
52
|
+
|
57
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams('user.id,user.username,user.nickname,user.password,user.card,user.work_address,user.studynum');
|
53
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams('user.id,user.username,user.nickname,user.password,user.card,user.work_address,user.studynum');
|
58
|
$total = $this->model
|
54
|
$total = $this->model
|
59
|
->with('group')
|
55
|
->with('group')
|
60
|
-// ->whereIn('user.id',$user_ids)
|
|
|
61
|
->where($where)
|
56
|
->where($where)
|
62
|
->order($sort, $order)
|
57
|
->order($sort, $order)
|
63
|
->count();
|
58
|
->count();
|
64
|
$list = $this->model
|
59
|
$list = $this->model
|
65
|
->with('group')
|
60
|
->with('group')
|
66
|
-// ->whereIn('user.id',$user_ids)
|
|
|
67
|
->where($where)
|
61
|
->where($where)
|
68
|
->order($sort, $order)
|
62
|
->order($sort, $order)
|
69
|
->limit($offset, $limit)
|
63
|
->limit($offset, $limit)
|
70
|
->select();
|
64
|
->select();
|
71
|
-// foreach ($list as $k => $v) {
|
|
|
72
|
-// $v->hidden(['password', 'salt']);
|
|
|
73
|
-// }
|
|
|
74
|
foreach ($list as $k => &$v) {
|
65
|
foreach ($list as $k => &$v) {
|
75
|
$v['user.mobile_exam_ids'] = Db::name('mobile_exam')->whereIn('id',$v['mobile_exam_ids'])->column('name');
|
66
|
$v['user.mobile_exam_ids'] = Db::name('mobile_exam')->whereIn('id',$v['mobile_exam_ids'])->column('name');
|
76
|
}
|
67
|
}
|
|
@@ -84,87 +75,6 @@ class User extends Backend |
|
@@ -84,87 +75,6 @@ class User extends Backend |
84
|
/**
|
75
|
/**
|
85
|
* 添加
|
76
|
* 添加
|
86
|
*/
|
77
|
*/
|
87
|
-// public function add()
|
|
|
88
|
-// {
|
|
|
89
|
-// if ($this->request->isPost()) {
|
|
|
90
|
-// $params = $this->request->post("row/a");
|
|
|
91
|
-// if ($params) {
|
|
|
92
|
-// $params = $this->preExcludeFields($params);
|
|
|
93
|
-// $params['status'] = 'normal';
|
|
|
94
|
-//
|
|
|
95
|
-// if(empty($params['expirationtime'])){
|
|
|
96
|
-// $this->error('有效期不能为空');
|
|
|
97
|
-// }
|
|
|
98
|
-// $params['expirationtime'] = strtotime($params['expirationtime']);
|
|
|
99
|
-// if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
|
|
100
|
-// $params[$this->dataLimitField] = $this->auth->id;
|
|
|
101
|
-// }
|
|
|
102
|
-// if($this->check_identity($params['card'])) {
|
|
|
103
|
-// $this->error('该身份证号已存在');
|
|
|
104
|
-// }
|
|
|
105
|
-// $study = [];
|
|
|
106
|
-// if($params['study_id'] && $params['periodtime']) {
|
|
|
107
|
-// $study = [
|
|
|
108
|
-// 'study_id' => $params['study_id'],
|
|
|
109
|
-// 'periodtime' => strtotime($params['periodtime'])
|
|
|
110
|
-// ];
|
|
|
111
|
-// unset($params['study_id']);
|
|
|
112
|
-// unset($params['periodtime']);
|
|
|
113
|
-// }
|
|
|
114
|
-//// $result = $this->model->validate('User.add')->save($params);
|
|
|
115
|
-//// if ($result === false) {
|
|
|
116
|
-//// $this->error($this->model->getError());
|
|
|
117
|
-//// }
|
|
|
118
|
-// if (!empty($params['mobile'])) {
|
|
|
119
|
-// if(\app\common\model\User::where('mobile', $params['mobile'])->find()){
|
|
|
120
|
-// $this->error('注册手机号已存在');
|
|
|
121
|
-// }
|
|
|
122
|
-// $params['phone'] = $params['mobile'];
|
|
|
123
|
-// }
|
|
|
124
|
-// $result = false;
|
|
|
125
|
-// Db::startTrans();
|
|
|
126
|
-// try {
|
|
|
127
|
-// //是否采用模型验证
|
|
|
128
|
-// if ($this->modelValidate) {
|
|
|
129
|
-// $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
|
|
130
|
-// $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
|
|
131
|
-// $this->model->validateFailException(true)->validate($validate);
|
|
|
132
|
-// }
|
|
|
133
|
-// $result = $this->model->allowField(true)->save($params);
|
|
|
134
|
-// if($study) {
|
|
|
135
|
-// $study['third_id'] = $this->model->id;
|
|
|
136
|
-// $res['third_id'] = $study['third_id'];
|
|
|
137
|
-// $res['study_id'] = $study['study_id'];
|
|
|
138
|
-// $res['createtime'] = time();
|
|
|
139
|
-// $res['playtime'] = 0;
|
|
|
140
|
-// $classes_ids = Db::name('classes')->where('study_id',$res['study_id'])->where('is_major',1)->column('id');
|
|
|
141
|
-// foreach ($classes_ids as $v){
|
|
|
142
|
-// $res['class_id'] = $v;
|
|
|
143
|
-// Db::name('study_class')->insertGetId($res);
|
|
|
144
|
-// }
|
|
|
145
|
-// Db::name('third_study')->insertGetId($study);
|
|
|
146
|
-// }
|
|
|
147
|
-// Db::commit();
|
|
|
148
|
-// } catch (ValidateException $e) {
|
|
|
149
|
-// Db::rollback();
|
|
|
150
|
-// $this->error($e->getMessage());
|
|
|
151
|
-// } catch (PDOException $e) {
|
|
|
152
|
-// Db::rollback();
|
|
|
153
|
-// $this->error($e->getMessage());
|
|
|
154
|
-// } catch (Exception $e) {
|
|
|
155
|
-// Db::rollback();
|
|
|
156
|
-// $this->error($e->getMessage());
|
|
|
157
|
-// }
|
|
|
158
|
-// if ($result !== false) {
|
|
|
159
|
-// $this->success();
|
|
|
160
|
-// } else {
|
|
|
161
|
-// $this->error(__('No rows were inserted'));
|
|
|
162
|
-// }
|
|
|
163
|
-// }
|
|
|
164
|
-// $this->error(__('Parameter %s can not be empty', ''));
|
|
|
165
|
-// }
|
|
|
166
|
-// return $this->view->fetch();
|
|
|
167
|
-// }
|
|
|
168
|
public function add()
|
78
|
public function add()
|
169
|
{
|
79
|
{
|
170
|
if ($this->request->isPost()) {
|
80
|
if ($this->request->isPost()) {
|
|
@@ -173,10 +83,10 @@ class User extends Backend |
|
@@ -173,10 +83,10 @@ class User extends Backend |
173
|
$params = $this->preExcludeFields($params);
|
83
|
$params = $this->preExcludeFields($params);
|
174
|
$params['status'] = 'normal';
|
84
|
$params['status'] = 'normal';
|
175
|
|
85
|
|
176
|
- if(empty($params['expirationtime'])){
|
|
|
177
|
- $this->error('有效期不能为空');
|
|
|
178
|
- }
|
|
|
179
|
- $params['expirationtime'] = strtotime($params['expirationtime']);
|
86
|
+ // if(empty($params['expirationtime'])){
|
|
|
87
|
+ // $this->error('有效期不能为空');
|
|
|
88
|
+ // }
|
|
|
89
|
+ // $params['expirationtime'] = strtotime($params['expirationtime']);
|
180
|
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
90
|
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
181
|
$params[$this->dataLimitField] = $this->auth->id;
|
91
|
$params[$this->dataLimitField] = $this->auth->id;
|
182
|
}
|
92
|
}
|
|
@@ -191,10 +101,13 @@ class User extends Backend |
|
@@ -191,10 +101,13 @@ class User extends Backend |
191
|
}
|
101
|
}
|
192
|
|
102
|
|
193
|
// 考试数据
|
103
|
// 考试数据
|
194
|
- $study_ids = [];
|
|
|
195
|
- if($params['study_id'] && $params['periodtime']) {
|
|
|
196
|
- $study_ids = explode(',',$params['study_id']);
|
|
|
197
|
- $periodtime = strtotime($params['periodtime']);
|
104
|
+ $studys = [];
|
|
|
105
|
+ if(!empty($params['studys'])){
|
|
|
106
|
+ $studys = json_decode($params['studys'],true);
|
|
|
107
|
+ $study_ids = array_column($studys,'study_id');
|
|
|
108
|
+ if(count($study_ids) != count(array_unique($study_ids))){
|
|
|
109
|
+ $this->error('绑定考试,不能重复');
|
|
|
110
|
+ }
|
198
|
}
|
111
|
}
|
199
|
|
112
|
|
200
|
$result = false;
|
113
|
$result = false;
|
|
@@ -209,24 +122,33 @@ class User extends Backend |
|
@@ -209,24 +122,33 @@ class User extends Backend |
209
|
$result = $this->model->allowField(true)->save($params);
|
122
|
$result = $this->model->allowField(true)->save($params);
|
210
|
|
123
|
|
211
|
// 考试数据-添加
|
124
|
// 考试数据-添加
|
212
|
- foreach ($study_ids as $study_id){
|
|
|
213
|
- $third_id = $this->model->id;
|
|
|
214
|
- Db::name('third_study')->insertGetId([
|
125
|
+ $third_id = $this->model->id;
|
|
|
126
|
+ $third_study_data = [];
|
|
|
127
|
+ $study_class_data = [];
|
|
|
128
|
+ $createtime = time();
|
|
|
129
|
+ foreach ($studys as $study){
|
|
|
130
|
+ $third_study_data[] = [
|
215
|
'third_id' => $third_id,
|
131
|
'third_id' => $third_id,
|
216
|
- 'study_id' => $study_id,
|
|
|
217
|
- 'periodtime' => $periodtime,
|
|
|
218
|
- ]);
|
|
|
219
|
- $classes_ids = Db::name('classes')->where('study_id',$study_id)->where('is_major',1)->column('id');
|
132
|
+ 'study_id' => $study['study_id'],
|
|
|
133
|
+ 'periodtime' => strtotime($study['periodtime']),
|
|
|
134
|
+ ];
|
|
|
135
|
+ $classes_ids = Db::name('classes')->where('study_id',$study['study_id'])->where('is_major',1)->column('id');
|
220
|
foreach ($classes_ids as $class_id){
|
136
|
foreach ($classes_ids as $class_id){
|
221
|
- Db::name('study_class')->insertGetId([
|
137
|
+ $study_class_data[] = [
|
222
|
'third_id' => $third_id,
|
138
|
'third_id' => $third_id,
|
223
|
- 'study_id' => $study_id,
|
139
|
+ 'study_id' => $study['study_id'],
|
224
|
'class_id' => $class_id,
|
140
|
'class_id' => $class_id,
|
225
|
'playtime' => 0,
|
141
|
'playtime' => 0,
|
226
|
- 'createtime' => time(),
|
|
|
227
|
- ]);
|
142
|
+ 'createtime' => $createtime,
|
|
|
143
|
+ ];
|
228
|
}
|
144
|
}
|
229
|
}
|
145
|
}
|
|
|
146
|
+ if(!empty($third_study_data)){
|
|
|
147
|
+ Db::name('third_study')->insertAll($third_study_data);
|
|
|
148
|
+ }
|
|
|
149
|
+ if(!empty($study_class_data)){
|
|
|
150
|
+ Db::name('study_class')->insertAll($study_class_data);
|
|
|
151
|
+ }
|
230
|
|
152
|
|
231
|
Db::commit();
|
153
|
Db::commit();
|
232
|
} catch (ValidateException $e) {
|
154
|
} catch (ValidateException $e) {
|
|
@@ -250,82 +172,9 @@ class User extends Backend |
|
@@ -250,82 +172,9 @@ class User extends Backend |
250
|
return $this->view->fetch();
|
172
|
return $this->view->fetch();
|
251
|
}
|
173
|
}
|
252
|
|
174
|
|
253
|
-
|
|
|
254
|
-// public function edit($ids = NULL)
|
|
|
255
|
-// {
|
|
|
256
|
-// $row = $this->model->get($ids);
|
|
|
257
|
-// if (!$row)
|
|
|
258
|
-// $this->error(__('No Results were found'));
|
|
|
259
|
-// $this->view->assign('groupList', build_select('row[group_id]', \app\admin\model\UserGroup::column('id,name'), $row['group_id'], ['class' => 'form-control selectpicker']));
|
|
|
260
|
-// return parent::edit($ids);
|
|
|
261
|
-// }
|
|
|
262
|
-
|
|
|
263
|
/**
|
175
|
/**
|
264
|
* 编辑
|
176
|
* 编辑
|
265
|
*/
|
177
|
*/
|
266
|
-// public function edit($ids = null)
|
|
|
267
|
-// {
|
|
|
268
|
-// $row = $this->model->get($ids);
|
|
|
269
|
-// if (!$row) {
|
|
|
270
|
-// $this->error(__('No Results were found'));
|
|
|
271
|
-// }
|
|
|
272
|
-// $adminIds = $this->getDataLimitAdminIds();
|
|
|
273
|
-// if (is_array($adminIds)) {
|
|
|
274
|
-// if (!in_array($row[$this->dataLimitField], $adminIds)) {
|
|
|
275
|
-// $this->error(__('You have no permission'));
|
|
|
276
|
-// }
|
|
|
277
|
-// }
|
|
|
278
|
-// if ($this->request->isPost()) {
|
|
|
279
|
-// $params = $this->request->post("row/a");
|
|
|
280
|
-// if ($params) {
|
|
|
281
|
-// if(empty($params['expirationtime'])){
|
|
|
282
|
-// $this->error('有效期不能为空');
|
|
|
283
|
-// }
|
|
|
284
|
-// $params['expirationtime'] = strtotime($params['expirationtime']);
|
|
|
285
|
-// if($this->check_identity($params['card'],$ids)) {
|
|
|
286
|
-// $this->error('该身份证号已存在');
|
|
|
287
|
-// }
|
|
|
288
|
-//// if(strlen($params['username']) < 6 || strlen($params['username']) > 18) {
|
|
|
289
|
-//// $this->error('用户名须为6-18位');
|
|
|
290
|
-//// }
|
|
|
291
|
-// if (!empty($params['mobile'])) {
|
|
|
292
|
-// if(\app\common\model\User::where('mobile', $params['mobile'])->where('id', '<>', $row->id)->find()){
|
|
|
293
|
-// $this->error('注册手机号已存在');
|
|
|
294
|
-// }
|
|
|
295
|
-// $params['phone'] = $params['mobile'];
|
|
|
296
|
-// }
|
|
|
297
|
-// $result = false;
|
|
|
298
|
-// Db::startTrans();
|
|
|
299
|
-// try {
|
|
|
300
|
-// //是否采用模型验证
|
|
|
301
|
-// if ($this->modelValidate) {
|
|
|
302
|
-// $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
|
|
303
|
-// $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
|
|
304
|
-// $row->validateFailException(true)->validate($validate);
|
|
|
305
|
-// }
|
|
|
306
|
-// $result = $row->allowField(true)->save($params);
|
|
|
307
|
-// Db::commit();
|
|
|
308
|
-// } catch (ValidateException $e) {
|
|
|
309
|
-// Db::rollback();
|
|
|
310
|
-// $this->error($e->getMessage());
|
|
|
311
|
-// } catch (PDOException $e) {
|
|
|
312
|
-// Db::rollback();
|
|
|
313
|
-// $this->error($e->getMessage());
|
|
|
314
|
-// } catch (Exception $e) {
|
|
|
315
|
-// Db::rollback();
|
|
|
316
|
-// $this->error($e->getMessage());
|
|
|
317
|
-// }
|
|
|
318
|
-// if ($result !== false) {
|
|
|
319
|
-// $this->success();
|
|
|
320
|
-// } else {
|
|
|
321
|
-// $this->error(__('No rows were updated'));
|
|
|
322
|
-// }
|
|
|
323
|
-// }
|
|
|
324
|
-// $this->error(__('Parameter %s can not be empty', ''));
|
|
|
325
|
-// }
|
|
|
326
|
-// $this->view->assign("row", $row);
|
|
|
327
|
-// return $this->view->fetch();
|
|
|
328
|
-// }
|
|
|
329
|
public function edit($ids = null)
|
178
|
public function edit($ids = null)
|
330
|
{
|
179
|
{
|
331
|
$row = $this->model->get($ids);
|
180
|
$row = $this->model->get($ids);
|
|
@@ -341,10 +190,10 @@ class User extends Backend |
|
@@ -341,10 +190,10 @@ class User extends Backend |
341
|
if ($this->request->isPost()) {
|
190
|
if ($this->request->isPost()) {
|
342
|
$params = $this->request->post("row/a");
|
191
|
$params = $this->request->post("row/a");
|
343
|
if ($params) {
|
192
|
if ($params) {
|
344
|
- if(empty($params['expirationtime'])){
|
|
|
345
|
- $this->error('有效期不能为空');
|
|
|
346
|
- }
|
|
|
347
|
- $params['expirationtime'] = strtotime($params['expirationtime']);
|
193
|
+ // if(empty($params['expirationtime'])){
|
|
|
194
|
+ // $this->error('有效期不能为空');
|
|
|
195
|
+ // }
|
|
|
196
|
+ // $params['expirationtime'] = strtotime($params['expirationtime']);
|
348
|
if($this->check_identity($params['card'],$ids)) {
|
197
|
if($this->check_identity($params['card'],$ids)) {
|
349
|
$this->error('该身份证号已存在');
|
198
|
$this->error('该身份证号已存在');
|
350
|
}
|
199
|
}
|
|
@@ -356,10 +205,13 @@ class User extends Backend |
|
@@ -356,10 +205,13 @@ class User extends Backend |
356
|
}
|
205
|
}
|
357
|
|
206
|
|
358
|
// 考试数据
|
207
|
// 考试数据
|
359
|
- $study_ids = [];
|
|
|
360
|
- if($params['study_id'] && $params['periodtime']) {
|
|
|
361
|
- $study_ids = explode(',',$params['study_id']);
|
|
|
362
|
- $periodtime = strtotime($params['periodtime']);
|
208
|
+ $studys = [];
|
|
|
209
|
+ if(!empty($params['studys'])){
|
|
|
210
|
+ $studys = json_decode($params['studys'],true);
|
|
|
211
|
+ $study_ids = array_column($studys,'study_id');
|
|
|
212
|
+ if(count($study_ids) != count(array_unique($study_ids))){
|
|
|
213
|
+ $this->error('绑定考试,不能重复');
|
|
|
214
|
+ }
|
363
|
}
|
215
|
}
|
364
|
|
216
|
|
365
|
$result = false;
|
217
|
$result = false;
|
|
@@ -373,50 +225,50 @@ class User extends Backend |
|
@@ -373,50 +225,50 @@ class User extends Backend |
373
|
}
|
225
|
}
|
374
|
$result = $row->allowField(true)->save($params);
|
226
|
$result = $row->allowField(true)->save($params);
|
375
|
|
227
|
|
376
|
- $third_id = $row['id'];
|
|
|
377
|
// 考试数据-编辑
|
228
|
// 考试数据-编辑
|
378
|
- foreach ($study_ids as $study_id){
|
|
|
379
|
- $my_study = Db::name('third_study')->where('study_id',$study_id)->where('third_id',$third_id)->find();
|
229
|
+ $third_id = $row['id'];
|
|
|
230
|
+ $third_study_data = [];
|
|
|
231
|
+ $study_class_data = [];
|
|
|
232
|
+ $createtime = time();
|
|
|
233
|
+ foreach ($studys as $study){
|
|
|
234
|
+ $my_study = Db::name('third_study')->where('study_id',$study['study_id'])->where('third_id',$third_id)->find();
|
380
|
if(!$my_study){
|
235
|
if(!$my_study){
|
381
|
- Db::name('third_study')->insertGetId([
|
236
|
+ $third_study_data[] = [
|
382
|
'third_id' => $third_id,
|
237
|
'third_id' => $third_id,
|
383
|
- 'study_id' => $study_id,
|
|
|
384
|
- 'periodtime' => $periodtime,
|
|
|
385
|
- ]);
|
238
|
+ 'study_id' => $study['study_id'],
|
|
|
239
|
+ 'periodtime' => strtotime($study['periodtime']),
|
|
|
240
|
+ ];
|
386
|
}else{
|
241
|
}else{
|
387
|
// 修改到期时间
|
242
|
// 修改到期时间
|
388
|
- Db::name('third_study')->where('id',$my_study['id'])->update(['periodtime'=>$periodtime]);
|
243
|
+ Db::name('third_study')->where('id',$my_study['id'])->update(['periodtime'=>strtotime($study['periodtime'])]);
|
389
|
}
|
244
|
}
|
390
|
- $classes_ids = Db::name('classes')->where('study_id',$study_id)->where('is_major',1)->column('id');
|
245
|
+ $classes_ids = Db::name('classes')->where('study_id',$study['study_id'])->where('is_major',1)->column('id');
|
391
|
foreach ($classes_ids as $class_id){
|
246
|
foreach ($classes_ids as $class_id){
|
392
|
$my_class = Db::name('study_class')->where('class_id',$class_id)->where('third_id',$third_id)->find();
|
247
|
$my_class = Db::name('study_class')->where('class_id',$class_id)->where('third_id',$third_id)->find();
|
393
|
if(!$my_class){
|
248
|
if(!$my_class){
|
394
|
- Db::name('study_class')->insertGetId([
|
249
|
+ $study_class_data[] = [
|
395
|
'third_id' => $third_id,
|
250
|
'third_id' => $third_id,
|
396
|
- 'study_id' => $study_id,
|
251
|
+ 'study_id' => $study['study_id'],
|
397
|
'class_id' => $class_id,
|
252
|
'class_id' => $class_id,
|
398
|
'playtime' => 0,
|
253
|
'playtime' => 0,
|
399
|
- 'createtime' => time(),
|
|
|
400
|
- ]);
|
254
|
+ 'createtime' => $createtime,
|
|
|
255
|
+ ];
|
401
|
}
|
256
|
}
|
402
|
}
|
257
|
}
|
403
|
}
|
258
|
}
|
404
|
-
|
|
|
405
|
- // 删除去掉的科目
|
|
|
406
|
- $my_study_ids = Db::name('third_study')->where('third_id',$third_id)->column('study_id');
|
|
|
407
|
- if($my_study_ids){
|
|
|
408
|
- $delete_study_ids = array_diff($my_study_ids,$study_ids);
|
|
|
409
|
- if($delete_study_ids){
|
|
|
410
|
- Db::name('third_study')
|
|
|
411
|
- ->where('third_id',$third_id)
|
|
|
412
|
- ->where('study_id','in',$delete_study_ids)
|
|
|
413
|
- ->delete();
|
|
|
414
|
- Db::name('study_class')
|
|
|
415
|
- ->where('third_id',$third_id)
|
|
|
416
|
- ->where('study_id','in',$delete_study_ids)
|
|
|
417
|
- ->delete();
|
|
|
418
|
- }
|
259
|
+ if(!empty($third_study_data)){
|
|
|
260
|
+ Db::name('third_study')->insertAll($third_study_data);
|
|
|
261
|
+ }
|
|
|
262
|
+ if(!empty($study_class_data)){
|
|
|
263
|
+ Db::name('study_class')->insertAll($study_class_data);
|
|
|
264
|
+ }
|
|
|
265
|
+ // 删除去掉的考试
|
|
|
266
|
+ $del_where['third_id'] = $third_id;
|
|
|
267
|
+ if($studys){
|
|
|
268
|
+ $del_where['study_id'] = ['not in',$study_ids];
|
419
|
}
|
269
|
}
|
|
|
270
|
+ Db::name('third_study')->where($del_where)->delete();
|
|
|
271
|
+ Db::name('study_class')->where($del_where)->delete();
|
420
|
|
272
|
|
421
|
Db::commit();
|
273
|
Db::commit();
|
422
|
} catch (ValidateException $e) {
|
274
|
} catch (ValidateException $e) {
|
|
@@ -439,10 +291,8 @@ class User extends Backend |
|
@@ -439,10 +291,8 @@ class User extends Backend |
439
|
}
|
291
|
}
|
440
|
|
292
|
|
441
|
// 我的科目
|
293
|
// 我的科目
|
442
|
- $my_study_list = Db::name('third_study')->where('third_id',$row['id'])->select();
|
|
|
443
|
- $my_study_ids = array_column($my_study_list,'study_id');
|
|
|
444
|
- $this->view->assign("study_id", $my_study_ids ? implode(',',$my_study_ids) : '');
|
|
|
445
|
- $this->view->assign("periodtime", count($my_study_list) > 0 ? $my_study_list[0]['periodtime'] : time());
|
294
|
+ $studys = Db::name('third_study')->where('third_id',$row['id'])->field("study_id,FROM_UNIXTIME(periodtime,'%Y-%m-%d %H:%i:%s') periodtime")->select();
|
|
|
295
|
+ $row['studys'] = json_encode($studys);
|
446
|
|
296
|
|
447
|
$this->view->assign("row", $row);
|
297
|
$this->view->assign("row", $row);
|
448
|
return $this->view->fetch();
|
298
|
return $this->view->fetch();
|
|
@@ -568,7 +418,7 @@ class User extends Backend |
|
@@ -568,7 +418,7 @@ class User extends Backend |
568
|
$row['sex'] = 2;
|
418
|
$row['sex'] = 2;
|
569
|
break;
|
419
|
break;
|
570
|
}
|
420
|
}
|
571
|
- $row['expirationtime'] = intval(($row['expirationtime'] - 25569) * 3600 * 24) - 28800; //转换成1970年以来的秒数
|
421
|
+ // $row['expirationtime'] = intval(($row['expirationtime'] - 25569) * 3600 * 24) - 28800; //转换成1970年以来的秒数
|
572
|
$insert[] = $row;
|
422
|
$insert[] = $row;
|
573
|
}
|
423
|
}
|
574
|
}
|
424
|
}
|