|
@@ -63,7 +63,7 @@ class Bind extends Api |
|
@@ -63,7 +63,7 @@ class Bind extends Api |
63
|
/**
|
63
|
/**
|
64
|
* @ApiTitle (扫码绑定信息)
|
64
|
* @ApiTitle (扫码绑定信息)
|
65
|
* @ApiMethod (POST)
|
65
|
* @ApiMethod (POST)
|
66
|
- * @ApiParams (name="unique", type="string", required=true, description="条形码id")
|
66
|
+ * @ApiParams (name="sno", type="string", required=true, description="学号")
|
67
|
* @ApiReturn ({
|
67
|
* @ApiReturn ({
|
68
|
"code":"状态码",
|
68
|
"code":"状态码",
|
69
|
"msg": "提示消息",
|
69
|
"msg": "提示消息",
|
|
@@ -72,9 +72,9 @@ class Bind extends Api |
|
@@ -72,9 +72,9 @@ class Bind extends Api |
72
|
*/
|
72
|
*/
|
73
|
public function scanCode()
|
73
|
public function scanCode()
|
74
|
{
|
74
|
{
|
75
|
- $unique = $this->request->param('unique');
|
75
|
+ $sno = $this->request->param('sno');
|
76
|
$user = $this->auth->getUserinfo();
|
76
|
$user = $this->auth->getUserinfo();
|
77
|
- if (empty($unique)) {
|
77
|
+ if (empty($sno)) {
|
78
|
$this->error('参数错误', ['status' => 2]);
|
78
|
$this->error('参数错误', ['status' => 2]);
|
79
|
}
|
79
|
}
|
80
|
$is_bind = db('user')->where('id', $user['id'])->value('bind_study');
|
80
|
$is_bind = db('user')->where('id', $user['id'])->value('bind_study');
|
|
@@ -84,7 +84,7 @@ class Bind extends Api |
|
@@ -84,7 +84,7 @@ class Bind extends Api |
84
|
Db::startTrans();
|
84
|
Db::startTrans();
|
85
|
try {
|
85
|
try {
|
86
|
db('study')
|
86
|
db('study')
|
87
|
- ->where('unique', $unique)
|
87
|
+ ->where('sno', $sno)
|
88
|
->update([
|
88
|
->update([
|
89
|
'user_id' => $user['id'],
|
89
|
'user_id' => $user['id'],
|
90
|
'updatetime' => time()
|
90
|
'updatetime' => time()
|
|
@@ -100,8 +100,8 @@ class Bind extends Api |
|
@@ -100,8 +100,8 @@ class Bind extends Api |
100
|
Db::rollback();
|
100
|
Db::rollback();
|
101
|
$this->error('参数错误', $e->getMessage());
|
101
|
$this->error('参数错误', $e->getMessage());
|
102
|
}
|
102
|
}
|
103
|
- $data = db('study')->where('unique', $unique)->field('id,grade,name,sno')->find();
|
|
|
104
|
- $this->success('绑定成功', [$data, 'status' => 1]);
|
103
|
+ $data = db('study')->where('sno', $sno)->field('id,grade,name,sno')->find();
|
|
|
104
|
+ $this->success('绑定成功', $data);
|
105
|
}
|
105
|
}
|
106
|
|
106
|
|
107
|
/**
|
107
|
/**
|
|
@@ -131,7 +131,7 @@ class Bind extends Api |
|
@@ -131,7 +131,7 @@ class Bind extends Api |
131
|
if (empty($data)) {
|
131
|
if (empty($data)) {
|
132
|
$this->error('当前还未关联项目', ['status' => 2]);
|
132
|
$this->error('当前还未关联项目', ['status' => 2]);
|
133
|
}
|
133
|
}
|
134
|
- $this->success('获取项目成功', [$data, 'status' => 1]);
|
134
|
+ $this->success('获取项目成功', $data);
|
135
|
}
|
135
|
}
|
136
|
|
136
|
|
137
|
/**
|
137
|
/**
|
|
@@ -203,20 +203,17 @@ class Bind extends Api |
|
@@ -203,20 +203,17 @@ class Bind extends Api |
203
|
"avatar": "学生头像",
|
203
|
"avatar": "学生头像",
|
204
|
"name": "学生名称",
|
204
|
"name": "学生名称",
|
205
|
"earn_score": "学生获得分数"
|
205
|
"earn_score": "学生获得分数"
|
206
|
- "study_score": 学生积分构成{
|
|
|
207
|
- "total": 2,
|
206
|
+ "item": 雷达图项目{
|
|
|
207
|
+ "total": 1,
|
208
|
"per_page": 3,
|
208
|
"per_page": 3,
|
209
|
"current_page": 1,
|
209
|
"current_page": 1,
|
210
|
"last_page": 1,
|
210
|
"last_page": 1,
|
211
|
"data": [
|
211
|
"data": [
|
212
|
{
|
212
|
{
|
213
|
"item_id": 项目id,
|
213
|
"item_id": 项目id,
|
214
|
- "sum_score": "项目所获分数",
|
|
|
215
|
- "item_ronda": 项目对应雷达维度名称[
|
|
|
216
|
- {
|
|
|
217
|
- "radar_id": 雷达维度id,
|
|
|
218
|
- "title": "雷达维度名称"
|
|
|
219
|
- }
|
214
|
+ "sum_score": "项目分数",
|
|
|
215
|
+ "title": "维度名称"
|
|
|
216
|
+ },
|
220
|
]
|
217
|
]
|
221
|
},}
|
218
|
},}
|
222
|
})
|
219
|
})
|
|
@@ -228,23 +225,14 @@ class Bind extends Api |
|
@@ -228,23 +225,14 @@ class Bind extends Api |
228
|
$sid = \db('study')->where('user_id', $user['id'])->value('id');
|
225
|
$sid = \db('study')->where('user_id', $user['id'])->value('id');
|
229
|
//获取学生的信息
|
226
|
//获取学生的信息
|
230
|
$data = \db('study')->where('id', $sid)->field('avatar,name,earn_score')->find();
|
227
|
$data = \db('study')->where('id', $sid)->field('avatar,name,earn_score')->find();
|
231
|
- //$data['avatar'] = cdnurl( $data['avatar'], true);
|
228
|
+ $data['avatar'] = cdnurl( $data['avatar'], true);
|
232
|
//获取雷达维度
|
229
|
//获取雷达维度
|
233
|
$data['item'] = \db('study_score_log')
|
230
|
$data['item'] = \db('study_score_log')
|
234
|
->distinct('item_id')
|
231
|
->distinct('item_id')
|
235
|
->field('item_id,SUM(score) as sum_score')
|
232
|
->field('item_id,SUM(score) as sum_score')
|
236
|
->group('item_id')
|
233
|
->group('item_id')
|
237
|
->where(['campus_id' => $campus_id, 'study_id' => $sid])
|
234
|
->where(['campus_id' => $campus_id, 'study_id' => $sid])
|
238
|
-// ->limit(3)
|
|
|
239
|
-// ->select();
|
|
|
240
|
-// foreach ($res as $k) {
|
|
|
241
|
-// $list = $k['sum_score'];
|
|
|
242
|
-// $list['radar'] = \db('item i')
|
|
|
243
|
-// ->join('radar r', 'i.radar_id = r.id')
|
|
|
244
|
-// ->where('i.id', $k['item_id'])
|
|
|
245
|
-// ->value('r.title');
|
|
|
246
|
-// }
|
|
|
247
|
- ->paginate(3)
|
235
|
+ ->paginate(3)
|
248
|
->each(function ($item, $key) {
|
236
|
->each(function ($item, $key) {
|
249
|
$item['title'] = \db('item i')
|
237
|
$item['title'] = \db('item i')
|
250
|
->join('radar r', 'i.radar_id = r.id')
|
238
|
->join('radar r', 'i.radar_id = r.id')
|