...
|
...
|
@@ -192,9 +192,9 @@ class Bind extends Api |
|
|
if (empty($unique) && empty($id)) {
|
|
|
$this->error('参数错误', ['status' => 2]);
|
|
|
}
|
|
|
$study = db('study')->where('unique', $unique)->field('id,grade,name,team_id,earn_score')->find();
|
|
|
$study = db('study')->where('unique', $unique)->field('id,grade,name,team,earn_score')->find();
|
|
|
$item = db('item')->where('id', $id)->field('score,title,campus_id')->find();
|
|
|
$team = \db('team')->where('id', $study['team_id'])->field('title,score')->find();
|
|
|
$team = \db('team')->where('title', $study['team'])->field('title,score')->find();
|
|
|
$sum1 = $team['score'] + $item['score']; //合计战队总分
|
|
|
$sum2 = $study['earn_score'] + $item['score']; //合计个人总分
|
|
|
Db::startTrans();
|
...
|
...
|
@@ -203,7 +203,7 @@ class Bind extends Api |
|
|
'item_id' => $id,
|
|
|
'campus_id' => $item['campus_id'],
|
|
|
'study_id' => $study['id'],
|
|
|
'team_id' => $study['team_id'],
|
|
|
'team' => $study['team'],
|
|
|
'score' => $item['score'],
|
|
|
'memo' => $study['name'] . '参加' . $item['title'] . '加分',
|
|
|
'createtime' => time()
|
...
|
...
|
@@ -214,7 +214,7 @@ class Bind extends Api |
|
|
'earn_score' => $sum2,
|
|
|
]);
|
|
|
\db('team')
|
|
|
->where('id', $study['team_id'])
|
|
|
->where('title', $study['team'])
|
|
|
->update([
|
|
|
'score' => $sum1,
|
|
|
'updatetime' => time()
|
...
|
...
|
|