RatingController.php
2.3 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
<?php
/**
* @remark :
* @name :RatingController.php
* @author :lyh
* @method :post
* @time :2024/1/20 14:02
*/
namespace App\Http\Controllers\Bside\Scoring;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Scoring\RatingLogic;
use App\Models\Sms\SmsLog;
/**
* @remark :评分系统问题管理
* @name :RatingController
* @author :lyh
* @method :post
* @time :2024/1/20 14:02
*/
class RatingController extends BaseController
{
/**
* @remark :问卷调查详情
* @name :getProjectRead
* @author :lyh
* @method :post
* @time :2024/1/20 14:11
*/
public function getProjectRead(RatingLogic $ratingLogic){
$this->request->validate([
'type' => 'required',
],[
'type.required' => '问题类型不能为空',
]);
$info = $ratingLogic->getRatingRead();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :提交评分
* @name :save
* @author :lyh
* @method :post
* @time :2024/1/20 14:43
*/
public function save(RatingLogic $ratingLogic){
$this->request->validate([
'data' => 'required',
'mobile' => 'required',
'type'=> 'required'
],[
'data.required' => '请填写完整',
'mobile.required' => '手机号码不能为空',
'type.required' => '阶段不能为空',
]);
$ratingLogic->ratingSave();
$this->response('success');
}
/**
* @remark :问卷调查验证验证码
* @name :VerificationCode
* @author :lyh
* @method :post
* @time :2024/1/22 11:23
*/
public function verificationCode(){
$smsModel = new SmsLog();
$smsInfo = $smsModel->formatQuery(['mobile'=>$this->param['mobile'],'type'=>$smsModel::TYPE_CORING])->orderBy('id','desc')->first();
if(!empty($smsInfo)){
if(($this->param['code'] != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){
$this->response('验证码已过期或验证码错误',Code::SYSTEM_ERROR);
}
}else{
$this->response('验证码错误',Code::SYSTEM_ERROR);
}
$this->response('success');
}
}