...
|
...
|
@@ -18,7 +18,7 @@ class Bind extends Api |
|
|
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (输入学号绑定信息)
|
|
|
* @ApiTitle (输入手环ID绑定信息)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiParams (name="unique", type="string", required=true, description="手环id")
|
|
|
* @ApiReturn ({
|
...
|
...
|
@@ -27,7 +27,7 @@ class Bind extends Api |
|
|
"data": {}
|
|
|
})
|
|
|
*/
|
|
|
public function inputUnique()
|
|
|
public function inUnique()
|
|
|
{
|
|
|
$unique = $this->request->param('unique');
|
|
|
$user = $this->auth->getUserinfo();
|
...
|
...
|
@@ -150,20 +150,20 @@ class Bind extends Api |
|
|
*/
|
|
|
public function Ewm()
|
|
|
{
|
|
|
$items_id = $this->request->param('items_id');
|
|
|
$id = $this->request->param('id');
|
|
|
$unique = $this->request->param('unique');
|
|
|
if (empty($unique) && empty($items_id)) {
|
|
|
if (empty($unique) && empty($id)) {
|
|
|
$this->error('参数错误', ['status' => 2]);
|
|
|
}
|
|
|
$study = db('study')->where('unique', $unique)->field('id,grade_id,name,team_id,earn_score')->find();
|
|
|
$item = db('item')->where('id', $items_id)->field('score,title,campus_id')->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();
|
|
|
$sum1 = $team['score'] + $item['score']; //合计战队总分
|
|
|
$sum2 = $study['earn_score'] + $item['score']; //合计个人总分
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
db('study_score_log')->insert([
|
|
|
'item_id' => $items_id,
|
|
|
'item_id' => $id,
|
|
|
'campus_id' => $item['campus_id'],
|
|
|
'study_id' => $study['id'],
|
|
|
'team_id' => $study['team_id'],
|
...
|
...
|
@@ -194,7 +194,7 @@ class Bind extends Api |
|
|
/**
|
|
|
* @ApiTitle (获取学生信息)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiParams (name="campus_id", type="string", required=true, description="校区id")
|
|
|
* @ApiParams (name="cid", type="string", required=true, description="校区id")
|
|
|
* @ApiReturn ({
|
|
|
"code":"状态码",
|
|
|
"msg": "提示消息",
|
...
|
...
|
@@ -220,7 +220,7 @@ class Bind extends Api |
|
|
public function getScore()
|
|
|
{
|
|
|
$user = $this->auth->getUserinfo();
|
|
|
$campus_id = $this->request->param('campus_id');
|
|
|
$cid = $this->request->param('cid');
|
|
|
$sid = \db('study')->where('user_id', $user['id'])->value('id');
|
|
|
//获取学生的信息
|
|
|
$data = \db('study')->where('id', $sid)->field('avatar,name,earn_score')->find();
|
...
|
...
|
@@ -230,7 +230,7 @@ class Bind extends Api |
|
|
->distinct('item_id')
|
|
|
->field('item_id,SUM(score) as sum_score')
|
|
|
->group('item_id')
|
|
|
->where(['campus_id' => $campus_id, 'study_id' => $sid])
|
|
|
->where(['campus_id' => $cid, 'study_id' => $sid])
|
|
|
->paginate(3)
|
|
|
->each(function ($item, $key) {
|
|
|
$item['title'] = \db('item i')
|
...
|
...
|
|