作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -33,7 +33,11 @@ class CustomModuleController extends BaseController
* @time :2023/12/4 15:43
*/
public function lists(){
ProjectServer::useProject($this->param['project_id']);
$result = ProjectServer::useProject($this->param['project_id']);
if($result === false){
$this->response('success');
}
$customModule = new CustomModule();
$this->map['status'] = 0;
$lists = $customModule->lists($this->map,$this->page,$this->row,$this->order = ['topping_time','sort','id']);
... ...
... ... @@ -184,7 +184,7 @@ class OptimizeController extends BaseController
if(isset($this->map['online_updated_at']) && !empty($this->map['online_updated_at'])){
$query = $query->whereBetween('gl_project_deploy_optimize.updated_at', $this->map['online_updated_at']);
}
if(isset($this->map['special']) && !empty($this->map['special'])){
if(isset($this->map['special'])){
$query = $query->where('gl_project_deploy_optimize.special','like','%'.$this->map['special'].'%');
}
if(isset($this->map['manager_mid']) && !empty($this->map['manager_mid'])){
... ... @@ -193,7 +193,7 @@ class OptimizeController extends BaseController
if(isset($this->map['optimize_manager_mid']) && !empty($this->map['optimize_manager_mid'])){
$query = $query->where('gl_project_deploy_optimize.manager_mid','like','%'.$this->map['optimize_manager_mid'].'%');
}
if(isset($this->map['is_upgrade']) && !empty($this->map['is_upgrade'])){
if(isset($this->map['is_upgrade'])){
$query = $query->where('gl_project.is_upgrade',$this->map['is_upgrade']);
}
if(isset($this->map['optimize_tech_mid']) && !empty($this->map['optimize_tech_mid'])){
... ...
... ... @@ -79,4 +79,24 @@ class RatingController extends BaseController
$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');
}
}
... ...
... ... @@ -84,7 +84,7 @@ class LoginLogic extends BaseLogic
* @time :2023/9/7 16:30
*/
public function logout(){
Cache::pull($this->request->header('token'));
Cache::pull(Common::MANAGE_TOKEN.$this->request->header('token'));
return $this->success();
}
... ...
... ... @@ -37,6 +37,7 @@ class RatingLogic extends BaseLogic
'uptime'=>$this->project['uptime'],
'domain'=>$this->user['domain'],
'question'=>$this->model->list(['type'=>$this->param['type']]),
'project_id'=>$this->user['project_id']
];
return $this->success($data);
}
... ...
... ... @@ -37,6 +37,13 @@ class WebSettingReceivingLogic extends BaseLogic
try {
$this->model->del(['project_id'=>$this->user['project_id']]);
foreach ($this->param['data'] as $k => $v){
if($v['type'] == 2){
// 使用正则表达式匹配中国大陆手机号
$pattern = '/^1[3456789]\d{9}$/';
if (!preg_match($pattern, $v['values'])) {
continue;
}
}
$v['project_id'] = $this->user['project_id'];
$v['created_at'] = date('Y-m-d H:i:s');
$v['updated_at'] = date('Y-m-d H:i:s');
... ...
... ... @@ -330,4 +330,5 @@ class UserLoginLogic
}
throw new AsideGlobalException($code, $message);
}
}
... ...
<?php
/**
* @remark :上传文件与图片到亚马逊
* @name :AmazonS3Service.php
* @author :lyh
* @method :post
* @time :2024/1/23 9:17
*/
namespace App\Services;
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
class AmazonS3Service
{
// 替换为你自己的 AWS 访问密钥、区域和存储桶名称
protected $s3;
protected $accessKeyId = '';//key
protected $secretAccessKey = '';//密匙
protected $region = '';//地址
protected $bucket = '';//桶子
public function __construct()
{
// 创建 S3 客户端
$this->s3 = new S3Client([
'version' => 'latest',
'region' => $this->region,
'credentials' => [
'key' => $this->accessKeyId,
'secret' => $this->secretAccessKey,
],
]);
}
/**
* @remark :上传图片与文件
* @name :uploadImage
* @author :lyh
* @method :post
* @time :2024/1/23 9:20
*/
public function uploadFiles($localFilePath, $s3Key)
{
try {
$result = $this->s3->putObject([
'Bucket' => $this->bucket,
'Key' => $s3Key,
'SourceFile' => $localFilePath,
'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改
]);
return $result['ObjectURL'];
} catch (S3Exception $e) {
return false;
}
}
}
... ...
... ... @@ -28,6 +28,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/info', [\App\Http\Controllers\Bside\User\UserController::class, 'info'])->name('user_info');
Route::any('/role_list', [\App\Http\Controllers\Bside\User\UserController::class, 'role_list'])->name('user_role_list');
Route::any('/del', [\App\Http\Controllers\Bside\User\UserController::class, 'del'])->name('user_del');
});
//项目独立头部和底部设置
Route::prefix('pageSetting')->group(function () {
... ... @@ -484,6 +485,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/read', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'getProjectRead'])->name('rating_getProjectRead');
Route::any('/save', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'save'])->name('rating_save');
Route::any('/getHistory', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'getHistory'])->name('rating_getHistory');
Route::any('/code', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'verificationCode'])->name('rating_code');
});
});
//无需登录验证的路由组
... ...