YuyueController.php
24.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Powerless < wzxaini9@gmail.com>
// +----------------------------------------------------------------------
namespace app\user\controller;
use app\user\model\CommentModel;
use cmf\controller\UserBaseController;
use app\user\model\UserModel;
use think\Db;
use think\Request;
use app\portal\controller\ToolController as tool;
class YuyueController extends UserBaseController
{
/*按时间预约*/
//step1:时间选择
public function index()
{
return $this->fetch('yu_studycar');
}
//step2:预约时间提交
public function yueyue_do(Request $re)
{
$day = $re->param('day');
$begin = $re->param('begin');
$end = $re->param('end');
$week = $re->param('week');
session('yuyue_pre.day', $day);
session('yuyue_pre.week', $week);
session('yuyue_pre.begin', $begin);
session('yuyue_pre.end', $end);
return json(['code' => '1', 'msg' => 'ok']);
}
//step3:选择响应时间教练
public function coach_list()
{
if (!session('yuyue_pre.day')) {
echo '非法请求';
}
//获取选择的时间时段
$bbegin = session('yuyue_pre.begin');
$eend = session('yuyue_pre.end');
//获取当前已被预约的教练
$rr = Db::name('yuyue')
->where(['yuyue_day' => session('yuyue_pre.day')])
->select()->toArray();
//获取当前时段已被预约的教练
$ex = '';
foreach ($rr as $v) {
$day_find = [];
for ($i = $v['yuyue_begin']; $i <= $v['yuyue_end']; $i++) {
$day_find[] = $i;
}
$f1 = array_search($bbegin, $day_find);
$f2 = array_search($eend, $day_find);
$ac = count($day_find) - 1;
if (($f2 && $f2 > '0') || ($f1 && $f1 < $ac) || ($f1 && $f2)) {
$ex .= $v['teach_id'] . ',';
}
}
//获取当前时段有时间的教练
$where['user_type'] = 3;
$where['id'] = array('not in', $ex);
$rree = Db::name('user')->where($where)->select();
//赋值已经选择的时间段
$data['day1'] = session('yuyue_pre.day');
$data['hour1'] = session('yuyue_pre.begin') . ':00 - ' . session('yuyue_pre.end') . ':00';
$data['week'] = session('yuyue_pre.week');
$this->assign("data", $data);
$this->assign("data1", $rree);
return $this->fetch();
}
//step4:教练信息查看
public function coach_introduce(Request $re)
{
$tech_id = $re->param('id');
$ddata = session('yuyue_pre.day');
$id = $re->param('id');
$rr = Db::name('user')->where(['id' => $id])->find();
$rre = Db::name('commente')->where(['teach_id' => $id])->find();
$rree = Db::name('commente_tag')->where(['id' => ['in', $rre['comment_tag']]])->field('name')->select()->toArray();
//获取标签
$rre = Db::name('commente')
->alias('c')
->join('qnb_user u', 'u.id = c.uid')
->where(['teach_id' => $id])
->field('c.*,u.user_nickname')
->select()
->toarray();
$cm_tg = '';
foreach ($rre as $v) {
$cm_tg .= $v['comment_tag'];
}
$cm_td_ar = explode(',', $cm_tg);
$aaa = array_unique($cm_td_ar);
$bbb = implode(',', $aaa);
$rree = Db::name('commente_tag')->where(['id' => ['in', $bbb]])->field('name')->select()->toArray();
$this->assign("ddata", $ddata);
$this->assign("data", $rr);
$this->assign("cdata", $rre);
$this->assign("ctdata", $rree);
$this->assign("tech_id", $tech_id);
$this->assign("shijian_data", session('yuyue_pre.hour1'));
return $this->fetch();
}
//step5:提交预约信息
public function yuyue_time_do(Request $re, tool $tool)
{
$tech_id = $re->param('id');
if (!$tech_id) {
return json(['code' => '0', 'msg' => '抱歉,数据错误']);
} else {
$data['teach_id'] = intval($tech_id);
$data['uid'] = session('user.id');
$data['status'] = array('neq','3');
//预约订单完成后才可以再次预约
$rr = Db::name('yuyue')->where($data)->order('create_time', 'desc')->find();
unset($data['status']);
$ytime = strtotime($rr['yuyue_day'].''.$rr['yuyue_end'].':00');
$tt = time();
if ( $ytime >$tt) {
return json(['code' => '0', 'msg' => '您好,您有待学车预约']);
}
$data['yuyue_day'] = session('yuyue_pre.day');
$data['yuyue_week'] = session('yuyue_pre.week');
$data['yuyue_end'] = session('yuyue_pre.end');
$data['yuyue_begin'] = session('yuyue_pre.begin');
$ress = Db::name('yuyue')->where($data)->find();
if($ress){
return json(['code'=>'0','msg'=>'抱歉,您已经预约过']);
}
$data['status'] = '1';
$data['create_time'] = time();
$res = Db::name('yuyue')->insert($data);
if ($res) {
$stu_info = Db::name('user')->where(['id' => $data['uid']])->find();
$tea_info = Db::name('user')->where(['id' => $data['teach_id']])->find();
$msg = "您好!您已成功预约:{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 时间段{$tea_info['user_nickname']}的课程,请按时上课,教练电话:{$tea_info['mobile']},如有问题可直接与教练或您的学车顾问进行联系。【悠乐驾】";
$tool->get_sms_code_p($stu_info['mobile'], $msg);
$msg1 = "您好!您的:{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 时间段课程已被{$stu_info['user_nickname']}学员预约,请按时上课,学员电话:{$stu_info['mobile']}【悠乐驾】";
$tool->get_sms_code_p($tea_info['mobile'], $msg1);
$param1 = [
'touser' => $stu_info['openid'],
'topcolor' => '#7B68EE',
'url' => 'http://wx.youlj.cn/user/yuyue/my_yuyue',
'template_id' => 'Ei5jEwFCIe-tS2hatyRRLDkklA2e3prk85rpTx2JBfE',
'data' => array(
'first' => array('value' => '您的预约成功啦'),
'keyword1' => array('value' => $stu_info['user_nickname'], 'color' => '#0099FF'),
'keyword2' => array('value' => $stu_info['mobile']),
'keyword3' => array('value' => "{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 ", 'color' => '#333366'),
'keyword4' => array('value' => $tea_info['user_nickname']),
'remark' => array('value' => "点击查看预约")
)
];
$param2 = [
'touser' => $tea_info['openid'],
'topcolor' => '#7B68EE',
'url' => 'http://wx.youlj.cn/user/yuyue/my_yuyue',
'template_id' => 'Ei5jEwFCIe-tS2hatyRRLDkklA2e3prk85rpTx2JBfE',
'data' => array(
'first' => array('value' => '有新的学员预约啦'),
'keyword1' => array('value' => $stu_info['user_nickname'], 'color' => '#0099FF'),
'keyword2' => array('value' => $stu_info['mobile']),
'keyword3' => array('value' => "{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 ", 'color' => '#333366'),
'keyword4' => array('value' => $tea_info['user_nickname']),
'remark' => array('value' => "点击查看预约并确认预约")
)
];
$res = $tool->wxtemsg_send($param1);
$res = $tool->wxtemsg_send($param2);
return json(['code' => '1', 'msg' => '预约成功']);
} else {
return json(['code' => '0', 'msg' => '抱歉,预约失败']);
}
}
}
/*按教练预约*/
//step1:教练选择
public function yu_coach()
{
$rr = Db::name('user')->where(['user_type' => 3])->select();
$this->assign("data", $rr);
return $this->fetch('yu_coach');
}
//step2:教练信息查看
public function coach_introduce_2(Request $re)
{
$ddata = date('Y-m-d', strtotime(session('yuyue_pre.day')));
$id = $re->param('id');
$rr = Db::name('user')->where(['id' => $id])->find();
//获取标签
$rre = Db::name('commente')
->alias('c')
->join('qnb_user u', 'u.id = c.uid')
->where(['teach_id' => $id])
->field('c.*,u.user_nickname')
->select()
->toarray();
$cm_tg = '';
foreach ($rre as $v) {
$cm_tg .= $v['comment_tag'];
}
$cm_td_ar = explode(',', $cm_tg);
$aaa = array_unique($cm_td_ar);
$bbb = implode(',', $aaa);
$rree = Db::name('commente_tag')->where(['id' => ['in', $bbb]])->field('name')->select()->toArray();
$this->assign("ddata", $ddata);
$this->assign("data", $rr);
$this->assign("cdata", $rre);
$this->assign("ctdata", $rree);
$this->assign("id", $id);
return $this->fetch();
}
//step3:教练时间列表
public function yu_studycar_2(Request $re)
{
$id = $re->param('id');
$ddata = date('Y-m-d', strtotime(session('yuyue_pre.day')));
$id = $re->param('id');
$rr = Db::name('user')->where(['id' => $id])->find();
$rre = Db::name('commente')->where(['teach_id' => $id])->find();
$rree = Db::name('commente_tag')->where(['id' => ['in', $rre['comment_tag']]])->field('name')->select()->toArray();
$this->assign("ddata", $ddata);
$this->assign("data", $rr);
$this->assign("cdata", $rre);
$this->assign("ctdata", $rree);
$this->assign("id", $id);
return $this->fetch();
}
//step4:提交预约信息
public function yuyue_coach_do(Request $re, tool $tool)
{
$day = $re->param('day');
$begin = $re->param('begin');
$end = $re->param('end');
$week = $re->param('week');
$tech_id = $re->param('id');
if (!$tech_id) {
return json(['code' => '0', 'msg' => '抱歉,数据错误']);
} else {
$data['teach_id'] = intval($tech_id);
$data['uid'] = session('user.id');
$data['yuyue_day'] = $day;
$data['yuyue_begin'] = $begin;
$data['yuyue_end'] = $end;
$data['yuyue_week'] = $week;
$data['status'] = array('neq','3');
$ress = Db::name('yuyue')->where($data)->find();
unset($data['status']);
if($ress){
return json(['code'=>'0','msg'=>'抱歉,您已经预约过']);
}
$data['status'] = 1;
$data['create_time'] = time();
$res = Db::name('yuyue')->insert($data);
if ($res) {
$stu_info = Db::name('user')->where(['id' => $data['uid']])->find();
$tea_info = Db::name('user')->where(['id' => $data['teach_id']])->find();
$msg = "您好!您已成功预约:{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 时间段{$tea_info['user_nickname']}的课程,请按时上课,教练电话:{$tea_info['mobile']},如有问题可直接与教练或您的学车顾问进行联系。【悠乐驾】";
$tool->get_sms_code_p($stu_info['mobile'], $msg);
$msg1 = "您好!您的:{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 时间段课程已被{$stu_info['user_nickname']}学员预约,请按时上课,学员电话:{$stu_info['mobile']}【悠乐驾】";
$tool->get_sms_code_p($tea_info['mobile'], $msg1);
$param1 = [
'touser' => $stu_info['openid'],
'topcolor' => '#7B68EE',
'url' => 'http://wx.youlj.cn/user/yuyue/my_yuyue',
'template_id' => 'Ei5jEwFCIe-tS2hatyRRLDkklA2e3prk85rpTx2JBfE',
'data' => array(
'first' => array('value' => '您的预约成功啦'),
'keyword1' => array('value' => $stu_info['user_nickname'], 'color' => '#0099FF'),
'keyword2' => array('value' => $stu_info['mobile']),
'keyword3' => array('value' => "{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 ", 'color' => '#333366'),
'keyword4' => array('value' => $tea_info['user_nickname']),
'remark' => array('value' => "点击查看预约")
)
];
$param2 = [
'touser' => $tea_info['openid'],
'topcolor' => '#7B68EE',
'url' => 'http://wx.youlj.cn/user/yuyue/my_yuyue',
'template_id' => 'Ei5jEwFCIe-tS2hatyRRLDkklA2e3prk85rpTx2JBfE',
'data' => array(
'first' => array('value' => '有新的学员预约啦'),
'keyword1' => array('value' => $stu_info['user_nickname'], 'color' => '#0099FF'),
'keyword2' => array('value' => $stu_info['mobile']),
'keyword3' => array('value' => "{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 ", 'color' => '#333366'),
'keyword4' => array('value' => $tea_info['user_nickname']),
'remark' => array('value' => "点击查看预约并确认预约")
)
];
$res = $tool->wxtemsg_send($param1);
$res = $tool->wxtemsg_send($param2);
return json(['code' => '1', 'msg' => '预约成功']);
} else {
return json(['code' => '0', 'msg' => '抱歉,预约失败']);
}
}
}
/*我的预约*/
//我的预约 学员
public function my_yuyue()
{
$id = session("user.id");
$p_info = Db::name('user')->where(['id' => $id])->find();
if($p_info['user_type']=='3'){
return $this->redirect('my_yuyue_coach');
}
$gname = Db::name('order')
->alias('o')
->join('__GOODS__ g', 'o.gid = g.id')
->join('__USER__ u', 'u.id = o.uid')
->where(['uid' => session('user.id'), 'o.status' => '1'])
->field('o.*,g.name,g.price')
->value('name');
$data = Db::name('yuyue')
->alias('yy')
->join('qnb_user u', 'u.id=yy.teach_id')
->where(['uid' => $id])
->field('yy.*,u.user_nickname,u.headimgurl,u.id as tech_id')
->order('create_time desc')
->select()
->toArray();
foreach ($data as $k => $v) {
if ($v['status'] == '3' && $v['pingjia_jiaolian'] != '1') {
$data[$k]['status'] = '2';
}
}
$dxdata = Db::name('yuyue')
->alias('yy')
->join('qnb_user u', 'u.id=yy.teach_id')
->where(['uid' => $id, 'status' => 1])
->field('yy.*,u.user_nickname,u.headimgurl,u.id as tech_id')
->order('create_time desc')
->select()
->toArray();
$dpdata = Db::name('yuyue')
->alias('yy')
->join('qnb_user u', 'u.id=yy.teach_id')
->where(['uid' => $id, 'status' => ['in','2,3']])
->field('yy.*,u.user_nickname,u.headimgurl,u.id as tech_id')
->order('create_time desc')
->select()
->toArray();
foreach ($dpdata as $k => $v) {
if ($v['status'] == '3' && $v['pingjia_jiaolian'] == '1') {
unset ($dpdata[$k]);
}
}
$ypdata = Db::name('yuyue')
->alias('yy')
->join('qnb_user u', 'u.id=yy.teach_id')
->where(['uid' => $id, 'status' => 3])
->field('yy.*,u.user_nickname,u.headimgurl,u.id as tech_id')
->order('create_time desc')
->select()
->toArray();
$yyxs = Db::name('yuyue')
->where(['uid' => $id, 'status' => 3])
->count();
$yyxs = $yyxs ? $yyxs : 0;
$this->assign("data", $data);
$this->assign("yyxs", $yyxs);
$this->assign("p_info", $p_info);
$this->assign("dxdata", $dxdata);
$this->assign("dpdata", $dpdata);
$this->assign("ypdata", $ypdata);
$this->assign("gname", $gname);
return $this->fetch();
}
//我的预约 教练
public function my_yuyue_coach()
{
$id = session("user.id");
$p_info = Db::name('user')->where(['id' => $id])->find();
$data = Db::name('yuyue')
->alias('yy')
->join('qnb_user u', 'u.id=yy.uid')
->join('order o', 'o.uid=yy.uid')
->join('goods g', 'g.id=o.gid')
->where(['teach_id' => $id])
->field('yy.*,u.user_nickname,u.headimgurl,u.id as tech_id,g.name as gname')
->order('create_time desc')
->select()
->toArray();
$data1 = Db::name('yuyue')
->alias('yy')
->join('qnb_user u', 'u.id=yy.uid')
->join('order o', 'o.uid=yy.uid')
->join('goods g', 'g.id=o.gid')
->where(['teach_id' => $id])
->where(['yy.status' => '1'])
->field('yy.*,u.user_nickname,u.headimgurl,u.id as tech_id,g.name as gname')
->order('create_time desc')
->select()
->toArray();
$data2 = Db::name('yuyue')
->alias('yy')
->join('qnb_user u', 'u.id=yy.uid')
->join('order o', 'o.uid=yy.uid')
->join('goods g', 'g.id=o.gid')
->where(['teach_id' => $id])
->where(['yy.status' => '4'])
->field('yy.*,u.user_nickname,u.headimgurl,u.id as tech_id,g.name as gname')
->order('create_time desc')
->select()
->toArray();
$data3 = Db::name('yuyue')
->alias('yy')
->join('qnb_user u', 'u.id=yy.uid')
->join('order o', 'o.uid=yy.uid')
->join('goods g', 'g.id=o.gid')
->where(['teach_id' => $id])
->where(['yy.status' => '2'])
->field('yy.*,u.user_nickname,u.headimgurl,u.id as tech_id,g.name as gname')
->order('create_time desc')
->select()
->toArray();
$data4 = Db::name('yuyue')
->alias('yy')
->join('qnb_user u', 'u.id=yy.uid')
->join('order o', 'o.uid=yy.uid')
->join('goods g', 'g.id=o.gid')
->where(['teach_id' => $id])
->where(['yy.status' => '3'])
->field('yy.*,u.user_nickname,u.headimgurl,u.id as tech_id,g.name as gname')
->order('create_time desc')
->select()
->toArray();
$yjxs = Db::name('yuyue')
->where(['teach_id' => $id, 'status' => 3])
->count();
$yjxs = $yjxs ? $yjxs : 0;
$this->assign("data", $data);
$this->assign("data1", $data1);
$this->assign("data2", $data2);
$this->assign("data3", $data3);
$this->assign("data4", $data4);
$this->assign("yjxs", $yjxs);
$this->assign("p_info", $p_info);
return $this->fetch();
}
//取消预约
public function redo(Request $re, tool $tool)
{
$id = $re->param('id');
if (!$id) {
return json(['code' => '0', 'msg' => '数据错误']);
}
$data = Db::name('yuyue')->where(['id' => $id])->find();
if ($data) {
$rdata = json_encode($data);
$rree = Db::name('recycle_bin')->insert(['name' => $rdata, 'create_time' => time()]);
if ($rree) {
$rres = Db::name('yuyue')->where(['id' => $id])->delete();
if ($rres) {
$stu_info = Db::name('user')->where(['id' => $data['uid']])->find();
$tea_info = Db::name('user')->where(['id' => $data['teach_id']])->find();
$msg = "您好!您已成功取消:{$data['yuyue_day']}--{$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 时间段{$tea_info['user_nickname']}的课程,欢迎您再次预约。【悠乐驾】";
$tool->get_sms_code_p($stu_info['mobile'], $msg);
$msg1 = "您好!您的:{$data['yuyue_day']}--{$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 时间段课程已被{$stu_info['user_nickname']}学员取消,该时间段将进入待预约状态。
【悠乐驾】";
$tool->get_sms_code_p($tea_info['mobile'], $msg1);
$param1 = [
'touser' => $stu_info['openid'],
'topcolor' => '#7B68EE',
'url' => 'http://wx.youlj.cn/user/yuyue/my_yuyue',
'template_id' => 'u4uRiWRnlZb8xQ4mbInvtv5AiVxPJZ13mpYQxZh7P0o',
'data' => array(
'first' => array('value' => '您的预约已取消'),
'keyword1' => array('value' => $tea_info['user_nickname'], 'color' => '#0099FF'),
'keyword2' => array('value' => "{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 ", 'color' => '#333366'),
'remark' => array('value' => "谢谢使用")
)
];
$param2 = [
'touser' => $tea_info['openid'],
'topcolor' => '#7B68EE',
'url' => 'http://wx.youlj.cn/user/yuyue/my_yuyue',
'template_id' => 'u4uRiWRnlZb8xQ4mbInvtv5AiVxPJZ13mpYQxZh7P0o',
'data' => array(
'first' => array('value' => '您的预约已取消'),
'keyword1' => array('value' => $stu_info['user_nickname'], 'color' => '#0099FF'),
'keyword2' => array('value' => "{$data['yuyue_day']} {$data['yuyue_begin']}:00 - {$data['yuyue_end']}:00 ", 'color' => '#333366'),
'remark' => array('value' => "谢谢使用")
)
];
$res = $tool->wxtemsg_send($param1);
$res = $tool->wxtemsg_send($param2);
return json(['code' => '1', 'msg' => '删除成功']);
} else {
return json(['code' => '0', 'msg' => '抱歉,删除失败']);
}
}
}
}
//开始学车
public function kaishi_xue(Request $re)
{
$id = $re->param('id');
if (!$id) {
return json(['code' => '0', 'msg' => '抱歉,数据错误']);
} else {
$res = Db::name('yuyue')->where(['id' => $id])->update(['status' => '4']);
if ($res) {
return json(['code' => '1', 'msg' => '学车开始']);
} else {
return json(['code' => '0', 'msg' => '抱歉,数据错误']);
}
}
}
//学车完毕
public function wanbi_xue(Request $re)
{
$id = $re->param('id');
if (!$id) {
return json(['code' => '0', 'msg' => '抱歉,数据错误']);
} else {
$res = Db::name('yuyue')->where(['id' => $id])->update(['status' => '2']);
if ($res) {
return json(['code' => '1', 'msg' => '学车完毕']);
} else {
return json(['code' => '0', 'msg' => '抱歉,数据错误']);
}
}
}
}