...
|
...
|
@@ -33,6 +33,8 @@ class Study extends Backend |
|
|
* @var \app\admin\model\Study
|
|
|
*/
|
|
|
protected $model = null;
|
|
|
protected $modelValidate = true; //开启validate,验证默认是fasle
|
|
|
|
|
|
|
|
|
public function _initialize()
|
|
|
{
|
...
|
...
|
@@ -74,17 +76,13 @@ class Study extends Backend |
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
|
|
|
$list = $this->model
|
|
|
->with(['grade','school','team'])
|
|
|
->with(['team'])
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->paginate($limit);
|
|
|
|
|
|
foreach ($list as $row) {
|
|
|
$row->visible(['id','avatar','name','gender','birthday','grade_id','school_id','sno','team_id','team_rank','earn_score','phone','unique','barcode']);
|
|
|
$row->visible(['grade']);
|
|
|
$row->getRelation('grade')->visible(['id','name']);
|
|
|
$row->visible(['school']);
|
|
|
$row->getRelation('school')->visible(['title']);
|
|
|
$row->visible(['id','avatar','name','gender','birthday','grade','school','sno','team_id','team_rank','earn_score','phone','unique','barcode']);
|
|
|
$row->visible(['team']);
|
|
|
$row->getRelation('team')->visible(['title']);
|
|
|
}
|
...
|
...
|
@@ -215,8 +213,7 @@ class Study extends Backend |
|
|
$id = $this->model->id;
|
|
|
$unique = time();
|
|
|
$barpath = Resource::StudyBar($unique);
|
|
|
$time = date('YmdHi',time());
|
|
|
$this->model->save(['barcode'=>$barpath,'sno'=>$time,'unique'=>time()],['id'=>$id]);
|
|
|
$this->model->save(['barcode'=>$barpath,'unique'=>time()],['id'=>$id]);
|
|
|
Db::commit();
|
|
|
} catch (ValidateException|PDOException|Exception $e) {
|
|
|
Db::rollback();
|
...
|
...
|
|