正在显示
4 个修改的文件
包含
28 行增加
和
42 行删除
@@ -337,8 +337,9 @@ class Study extends Backend | @@ -337,8 +337,9 @@ class Study extends Backend | ||
337 | $result = $this->model->allowField(true)->save($params); | 337 | $result = $this->model->allowField(true)->save($params); |
338 | $id = $this->model->id; | 338 | $id = $this->model->id; |
339 | $unique = time(); | 339 | $unique = time(); |
340 | - $barpath = Resource::StudyBar($unique); | ||
341 | - $this->model->save(['barcode'=>$barpath,'unique'=>time()],['id'=>$id]); | 340 | + $sno = $this->model->sno; |
341 | + $barpath = Resource::StudyBar($sno); | ||
342 | + $this->model->save(['barcode'=>$barpath,'unique'=>$unique],['id'=>$id]); | ||
342 | Db::commit(); | 343 | Db::commit(); |
343 | } catch (ValidateException|PDOException|Exception $e) { | 344 | } catch (ValidateException|PDOException|Exception $e) { |
344 | Db::rollback(); | 345 | Db::rollback(); |
@@ -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,22 +225,13 @@ class Bind extends Api | @@ -228,22 +225,13 @@ 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') |
@@ -6,9 +6,9 @@ use tinymeng\code\Generate; | @@ -6,9 +6,9 @@ use tinymeng\code\Generate; | ||
6 | 6 | ||
7 | class Resource | 7 | class Resource |
8 | { | 8 | { |
9 | - public static function StudyBar($unique){ | 9 | + public static function StudyBar($sno){ |
10 | $generate = Generate::bar(); | 10 | $generate = Generate::bar(); |
11 | - $file_path = $generate->create($unique,true,true); | 11 | + $file_path = $generate->create($sno,true,true); |
12 | $file_path = substr($file_path,strripos($file_path,"public")+6); | 12 | $file_path = substr($file_path,strripos($file_path,"public")+6); |
13 | return $file_path; | 13 | return $file_path; |
14 | } | 14 | } |
@@ -2582,10 +2582,10 @@ | @@ -2582,10 +2582,10 @@ | ||
2582 | </thead> | 2582 | </thead> |
2583 | <tbody> | 2583 | <tbody> |
2584 | <tr> | 2584 | <tr> |
2585 | - <td>unique</td> | 2585 | + <td>sno</td> |
2586 | <td>string</td> | 2586 | <td>string</td> |
2587 | <td>是</td> | 2587 | <td>是</td> |
2588 | - <td>条形码id</td> | 2588 | + <td>学号</td> |
2589 | </tr> | 2589 | </tr> |
2590 | </tbody> | 2590 | </tbody> |
2591 | </table> | 2591 | </table> |
@@ -2610,8 +2610,8 @@ | @@ -2610,8 +2610,8 @@ | ||
2610 | <div class="panel-body"> | 2610 | <div class="panel-body"> |
2611 | <form enctype="application/x-www-form-urlencoded" role="form" action="/api/bind/scanCode" method="POST" name="form5" id="form5"> | 2611 | <form enctype="application/x-www-form-urlencoded" role="form" action="/api/bind/scanCode" method="POST" name="form5" id="form5"> |
2612 | <div class="form-group"> | 2612 | <div class="form-group"> |
2613 | - <label class="control-label" for="unique">unique</label> | ||
2614 | - <input type="string" class="form-control input-sm" id="unique" required placeholder="条形码id" name="unique"> | 2613 | + <label class="control-label" for="sno">sno</label> |
2614 | + <input type="string" class="form-control input-sm" id="sno" required placeholder="学号" name="sno"> | ||
2615 | </div> | 2615 | </div> |
2616 | <div class="form-group form-group-submit"> | 2616 | <div class="form-group form-group-submit"> |
2617 | <button type="submit" class="btn btn-success send" rel="5">提交</button> | 2617 | <button type="submit" class="btn btn-success send" rel="5">提交</button> |
@@ -3061,20 +3061,17 @@ | @@ -3061,20 +3061,17 @@ | ||
3061 | "avatar": "学生头像", | 3061 | "avatar": "学生头像", |
3062 | "name": "学生名称", | 3062 | "name": "学生名称", |
3063 | "earn_score": "学生获得分数" | 3063 | "earn_score": "学生获得分数" |
3064 | - "study_score": 学生积分构成{ | ||
3065 | - "total": 2, | 3064 | + "item": 雷达图项目{ |
3065 | + "total": 1, | ||
3066 | "per_page": 3, | 3066 | "per_page": 3, |
3067 | "current_page": 1, | 3067 | "current_page": 1, |
3068 | "last_page": 1, | 3068 | "last_page": 1, |
3069 | "data": [ | 3069 | "data": [ |
3070 | { | 3070 | { |
3071 | "item_id": 项目id, | 3071 | "item_id": 项目id, |
3072 | - "sum_score": "项目所获分数", | ||
3073 | - "item_ronda": 项目对应雷达维度名称[ | ||
3074 | - { | ||
3075 | - "radar_id": 雷达维度id, | ||
3076 | - "title": "雷达维度名称" | ||
3077 | - } | 3072 | + "sum_score": "项目分数", |
3073 | + "title": "维度名称" | ||
3074 | + }, | ||
3078 | ] | 3075 | ] |
3079 | },} | 3076 | },} |
3080 | }</pre> | 3077 | }</pre> |
@@ -4973,7 +4970,7 @@ | @@ -4973,7 +4970,7 @@ | ||
4973 | 4970 | ||
4974 | </div> | 4971 | </div> |
4975 | <div class="col-md-6" align="right"> | 4972 | <div class="col-md-6" align="right"> |
4976 | - Generated on 2023-03-15 17:26:25 <a href="./" target="_blank">校园活动</a> | 4973 | + Generated on 2023-03-16 15:52:47 <a href="./" target="_blank">校园活动</a> |
4977 | </div> | 4974 | </div> |
4978 | </div> | 4975 | </div> |
4979 | 4976 |
-
请 注册 或 登录 后发表评论