作者 开飞机的舒克

接口优化

... ... @@ -132,17 +132,9 @@ class Study extends Backend
$row[$fieldArr[$k]] = $v;
}
}
//自动生成条形码
if ($row) {
$insert[] = $row;
}
$id = \db('study')->order('id','desc')->value('id');
$ids = $allRow+$id+1;
dump($ids);
$res = str_pad($ids,8,"0",STR_PAD_LEFT);
$barpath = Resource::StudyBar($res);
$insert['barcode'] = $barpath;
$insert['unique'] = $res;
}
} catch (Exception $exception) {
$this->error($exception->getMessage());
... ... @@ -168,7 +160,9 @@ class Study extends Backend
}
}
}
$this->model->saveAll($insert);
return $this->model->saveAll($insert);
} catch (PDOException $exception) {
$msg = $exception->getMessage();
if (preg_match("/.+Integrity constraint violation: 1062 Duplicate entry '(.+)' for key '(.+)'/is", $msg, $matches)) {
... ...
... ... @@ -35,9 +35,9 @@ class Bind extends Api
$this->error('参数错误', ['status' => 2]);
}
$is_bind = db('user')->where('id', $user['id'])->value('bind_study');
if ($is_bind == 1) {
$this->error('您当前已经绑定过学生了,请勿重复操作', $is_bind);
}
// if ($is_bind == 1) {
// $this->error('您当前已经绑定过学生了,请勿重复操作', $is_bind);
// }
Db::startTrans();
try {
db('study')
... ... @@ -78,9 +78,9 @@ class Bind extends Api
$this->error('参数错误', ['status' => 2]);
}
$is_bind = db('user')->where('id', $user['id'])->value('bind_study');
if ($is_bind == 1) {
$this->error('您当前已经绑定过学生了,请勿重复操作', $is_bind);
}
// if ($is_bind == 1) {
// $this->error('您当前已经绑定过学生了,请勿重复操作', $is_bind);
// }
Db::startTrans();
try {
db('study')
... ...
... ... @@ -5200,7 +5200,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-03-17 15:48:06 <a href="./" target="_blank">校园活动</a>
Generated on 2023-03-17 15:59:03 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...