...
|
...
|
@@ -63,7 +63,7 @@ class Bind extends Api |
|
|
/**
|
|
|
* @ApiTitle (扫码绑定信息)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiParams (name="unique", type="string", required=true, description="条形码id")
|
|
|
* @ApiParams (name="sno", type="string", required=true, description="学号")
|
|
|
* @ApiReturn ({
|
|
|
"code":"状态码",
|
|
|
"msg": "提示消息",
|
...
|
...
|
@@ -72,9 +72,9 @@ class Bind extends Api |
|
|
*/
|
|
|
public function scanCode()
|
|
|
{
|
|
|
$unique = $this->request->param('unique');
|
|
|
$sno = $this->request->param('sno');
|
|
|
$user = $this->auth->getUserinfo();
|
|
|
if (empty($unique)) {
|
|
|
if (empty($sno)) {
|
|
|
$this->error('参数错误', ['status' => 2]);
|
|
|
}
|
|
|
$is_bind = db('user')->where('id', $user['id'])->value('bind_study');
|
...
|
...
|
@@ -84,7 +84,7 @@ class Bind extends Api |
|
|
Db::startTrans();
|
|
|
try {
|
|
|
db('study')
|
|
|
->where('unique', $unique)
|
|
|
->where('sno', $sno)
|
|
|
->update([
|
|
|
'user_id' => $user['id'],
|
|
|
'updatetime' => time()
|
...
|
...
|
@@ -100,8 +100,8 @@ class Bind extends Api |
|
|
Db::rollback();
|
|
|
$this->error('参数错误', $e->getMessage());
|
|
|
}
|
|
|
$data = db('study')->where('unique', $unique)->field('id,grade,name,sno')->find();
|
|
|
$this->success('绑定成功', [$data, 'status' => 1]);
|
|
|
$data = db('study')->where('sno', $sno)->field('id,grade,name,sno')->find();
|
|
|
$this->success('绑定成功', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -131,7 +131,7 @@ class Bind extends Api |
|
|
if (empty($data)) {
|
|
|
$this->error('当前还未关联项目', ['status' => 2]);
|
|
|
}
|
|
|
$this->success('获取项目成功', [$data, 'status' => 1]);
|
|
|
$this->success('获取项目成功', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -203,20 +203,17 @@ class Bind extends Api |
|
|
"avatar": "学生头像",
|
|
|
"name": "学生名称",
|
|
|
"earn_score": "学生获得分数"
|
|
|
"study_score": 学生积分构成{
|
|
|
"total": 2,
|
|
|
"item": 雷达图项目{
|
|
|
"total": 1,
|
|
|
"per_page": 3,
|
|
|
"current_page": 1,
|
|
|
"last_page": 1,
|
|
|
"data": [
|
|
|
{
|
|
|
"item_id": 项目id,
|
|
|
"sum_score": "项目所获分数",
|
|
|
"item_ronda": 项目对应雷达维度名称[
|
|
|
{
|
|
|
"radar_id": 雷达维度id,
|
|
|
"title": "雷达维度名称"
|
|
|
}
|
|
|
"sum_score": "项目分数",
|
|
|
"title": "维度名称"
|
|
|
},
|
|
|
]
|
|
|
},}
|
|
|
})
|
...
|
...
|
@@ -228,23 +225,14 @@ class Bind extends Api |
|
|
$sid = \db('study')->where('user_id', $user['id'])->value('id');
|
|
|
//获取学生的信息
|
|
|
$data = \db('study')->where('id', $sid)->field('avatar,name,earn_score')->find();
|
|
|
//$data['avatar'] = cdnurl( $data['avatar'], true);
|
|
|
$data['avatar'] = cdnurl( $data['avatar'], true);
|
|
|
//获取雷达维度
|
|
|
$data['item'] = \db('study_score_log')
|
|
|
->distinct('item_id')
|
|
|
->field('item_id,SUM(score) as sum_score')
|
|
|
->group('item_id')
|
|
|
->where(['campus_id' => $campus_id, 'study_id' => $sid])
|
|
|
// ->limit(3)
|
|
|
// ->select();
|
|
|
// foreach ($res as $k) {
|
|
|
// $list = $k['sum_score'];
|
|
|
// $list['radar'] = \db('item i')
|
|
|
// ->join('radar r', 'i.radar_id = r.id')
|
|
|
// ->where('i.id', $k['item_id'])
|
|
|
// ->value('r.title');
|
|
|
// }
|
|
|
->paginate(3)
|
|
|
->paginate(3)
|
|
|
->each(function ($item, $key) {
|
|
|
$item['title'] = \db('item i')
|
|
|
->join('radar r', 'i.radar_id = r.id')
|
...
|
...
|
|