作者 lyh

gx

... ... @@ -102,7 +102,7 @@ class LoginController extends BaseController
* @method :post
* @time :2023/8/19 9:13
*/
public function sendLoginSms()
public function sendLoginSms($type = SmsLog::TYPE_LOGIN)
{
$this->request->validate([
'mobile'=>['required', 'regex:/^1[3-9]\d{9}$/'],
... ... @@ -115,7 +115,7 @@ class LoginController extends BaseController
if (empty($user)) {
$this->response('请输入正确的手机号码!', Code::SYSTEM_ERROR);
}
$last_sms = SmsLog::getLastLog($mobile, SmsLog::TYPE_LOGIN);
$last_sms = SmsLog::getLastLog($mobile, $type);
if ($last_sms && $last_sms->use = SmsLog::USE_USABLE && time() - strtotime($last_sms->created_at) < 60) {
$this->response('请不要重复发送短信!', Code::SYSTEM_ERROR);
}
... ... @@ -126,7 +126,7 @@ class LoginController extends BaseController
if (empty($send->Code) && $send->Code != 'OK') {
$this->response('发送失败, 请稍后重试!', Code::SYSTEM_ERROR);
}
SmsLog::createLog($mobile, $code['code']);
SmsLog::createLog($mobile, $code['code'],$type);
$this->response('success');
}
... ...
<?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\Scoring\RatingQuestion;
use App\Models\Sms\SmsLog;
use App\Models\User\User;
use Mrgoon\AliSms\AliSms;
/**
* @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){
$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){
$ratingLogic->ratingSave();
$this->response('success');
}
}
... ...
<?php
/**
* @remark :
* @name :RatingLogic.php
* @author :lyh
* @method :post
* @time :2024/1/20 14:15
*/
namespace App\Http\Logic\Bside\Scoring;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Scoring\RatingQuestion;
use App\Models\Scoring\ScoringSystem;
class RatingLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new RatingQuestion();
$this->scoringModel = new ScoringSystem();
$this->param = $this->requestAll;
}
/**
* @remark :获取详情
* @name :getRatingRead
* @author :lyh
* @method :post
* @time :2024/1/20 14:27
*/
public function getRatingRead(){
$data = [
'company'=>$this->project['company'],
'mobile'=>$this->project['mobile'],
'uptime'=>$this->project['uptime'],
'domain'=>$this->user['domain'],
'question'=>$this->model->list(),
];
return $this->success($data);
}
/**
* @remark :提交统计
* @name :ratingSave
* @author :lyh
* @method :post
* @time :2024/1/20 14:46
*/
public function ratingSave(){
$param = [
'data'=>$this->param['data'],
'mobile'=>$this->param['mobile'],
'project_id'=>$this->user['project_id'],
];
return $this->scoringModel->add($param);
}
}
... ...
<?php
/**
* @remark :
* @name :RatingQuestion.php
* @author :lyh
* @method :post
* @time :2024/1/20 11:14
*/
namespace App\Models\Scoring;
use App\Models\Base;
/**
* @remark :问题
* @name :RatingQuestion
* @author :lyh
* @method :post
* @time :2024/1/20 11:15
*/
class RatingQuestion extends Base
{
protected $table = 'gl_rating_questions';
}
... ...
<?php
/**
* @remark :
* @name :ScoringSystem.php
* @author :lyh
* @method :post
* @time :2024/1/20 11:17
*/
namespace App\Models\Scoring;
use App\Models\Base;
class ScoringSystem extends Base
{
protected $table = 'gl_scoring_system';
}
... ...
... ... @@ -16,6 +16,7 @@ class SmsLog extends Base
const TYPE_REGISTER = 'register';
const TYPE_LOGIN = 'login';
const TYPE_CORING = 'coring';//评分系统
const TYPE_MANAGER_LOGIN = 'manager_login';//管理员登录
const TYPE_NOTICE = 'notice';
... ...