作者 lyh

gx数据

@@ -168,12 +168,15 @@ class BaseController extends Controller @@ -168,12 +168,15 @@ class BaseController extends Controller
168 168
169 169
170 /** 170 /**
171 - * 是否post请求  
172 - * @return bool 171 + * @remark :是否是post请求
  172 + * @name :isPost
  173 + * @author :lyh
  174 + * @method :post
  175 + * @time :2024/12/30 14:17
173 */ 176 */
174 protected final function isPost() 177 protected final function isPost()
175 { 178 {
176 - return \Illuminate\Support\Facades\Request::isMethod('post'); 179 + return Request::isMethod('post');
177 } 180 }
178 181
179 182
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AutoEmailContentController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/12/30 14:09
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Subscribe;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Models\Project\AutoEmail;
  15 +use App\Models\Subscribe\Smtp;
  16 +
  17 +/**
  18 + * @remark :项目设置自动回复邮件内容
  19 + * @name :AutoEmailContentController
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2024/12/30 14:09
  23 + */
  24 +class AutoEmailContentController extends BaseController
  25 +{
  26 + /**
  27 + * @remark :获取
  28 + * @name :getInfo
  29 + * @author :lyh
  30 + * @method :post
  31 + * @time :2024/12/30 14:10
  32 + */
  33 + public function getContent(){
  34 + $autoEmailModel = new AutoEmail();
  35 + $lists = $autoEmailModel->list(['project_id'=>$this->user['project_id']]);
  36 + $this->response('success',Code::SUCCESS,$lists);
  37 + }
  38 +
  39 + /**
  40 + * @remark :保存详情
  41 + * @name :saveContent
  42 + * @author :lyh
  43 + * @method :post
  44 + * @time :2024/12/30 14:11
  45 + */
  46 + public function saveContent(){
  47 + $this->request->validate([
  48 + 'content' => ['required'],
  49 + ], [
  50 + 'content.required' => '内容不能为空',
  51 + ]);
  52 + $smtpModel = new Smtp();
  53 + $smtpInfo = $smtpModel->read(['project_id' => $this->user['project_id']]);
  54 + if($smtpInfo === false){
  55 + $this->fail('请先设置SMTP',Code::USER_ERROR);
  56 + }
  57 + $autoEmailModel = new AutoEmail();
  58 + $info = $autoEmailModel->read(['project_id'=>$this->user['project_id']]);
  59 + if($info === false){
  60 + //执行新增
  61 + $data = ['project_id'=>$this->user['project_id'],'content'=>$this->param['content']];
  62 + $id = $autoEmailModel->addReturnId($data);
  63 + }else{
  64 + $id = $info['id'];
  65 + $autoEmailModel->edit(['content'=>$this->param['content']],['project_id'=>$this->user['project_id']]);
  66 + }
  67 + $this->response('success',Code::SUCCESS,['id'=>$id]);
  68 + }
  69 +
  70 +
  71 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AutoEmail.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/12/30 14:03
  8 + */
  9 +
  10 +namespace App\Models\Project;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class AutoEmail extends Base
  15 +{
  16 + protected $table = 'gl_auto_project_email';
  17 +}
@@ -295,7 +295,6 @@ class SyncSubmitTaskService @@ -295,7 +295,6 @@ class SyncSubmitTaskService
295 if(empty($data['referer']) || empty($data['user_agent']) || empty($data['data'])){ 295 if(empty($data['referer']) || empty($data['user_agent']) || empty($data['data'])){
296 throw new InquiryFilterException( '数据异常:' . $data['country']); 296 throw new InquiryFilterException( '数据异常:' . $data['country']);
297 } 297 }
298 -  
299 $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id); 298 $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id);
300 //没配置 则默认开启且使用全局 299 //没配置 则默认开启且使用全局
301 if(!$config){ 300 if(!$config){
@@ -641,6 +641,13 @@ Route::middleware(['bloginauth'])->group(function () { @@ -641,6 +641,13 @@ Route::middleware(['bloginauth'])->group(function () {
641 Route::any('/info', [\App\Http\Controllers\Bside\Comment\CommentController::class, 'info'])->name('comment_info'); 641 Route::any('/info', [\App\Http\Controllers\Bside\Comment\CommentController::class, 'info'])->name('comment_info');
642 Route::any('/status', [\App\Http\Controllers\Bside\Comment\CommentController::class, 'status'])->name('comment_status'); 642 Route::any('/status', [\App\Http\Controllers\Bside\Comment\CommentController::class, 'status'])->name('comment_status');
643 }); 643 });
  644 +
  645 + //自动邮件设置
  646 + Route::prefix('auto_email_content')->group(function () {
  647 + Route::any('/getContent', [\App\Http\Controllers\Bside\Subscribe\AutoEmailContentController::class, 'getContent'])->name('auto_email_content_getContent');
  648 + Route::any('/saveContent', [\App\Http\Controllers\Bside\Subscribe\AutoEmailContentController::class, 'saveContent'])->name('auto_email_content_saveContent');
  649 +
  650 + });
644 }); 651 });
645 //无需登录验证的路由组 652 //无需登录验证的路由组
646 Route::group([], function () { 653 Route::group([], function () {