作者 zhl

u

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Setting; @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Setting;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 6 use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\Setting\WebSettingFromLogic; 7 use App\Http\Logic\Bside\Setting\WebSettingFromLogic;
  8 +use Illuminate\Http\Request;
8 9
9 /** 10 /**
10 * @name:表单设置 11 * @name:表单设置
@@ -32,4 +33,28 @@ class WebSettingFromController extends BaseController @@ -32,4 +33,28 @@ class WebSettingFromController extends BaseController
32 $webSettingFromLogic->setting_from_save(); 33 $webSettingFromLogic->setting_from_save();
33 $this->response('success'); 34 $this->response('success');
34 } 35 }
  36 +
  37 + /**
  38 + * 保存询盘请求返回信息
  39 + * @param Request $request
  40 + * @param WebSettingFromLogic $webSettingFromLogic
  41 + */
  42 + public function saveBack(Request $request, WebSettingFromLogic $webSettingFromLogic)
  43 + {
  44 + $message = $request->input('message', 'success');
  45 + $url = $request->input('url');
  46 + $webSettingFromLogic->fromBackMsgSet($message, $url);
  47 + $this->response('success');
  48 + }
  49 +
  50 + /**
  51 + * 获取询盘请求返回信息
  52 + * @param Request $request
  53 + * @param WebSettingFromLogic $webSettingFromLogic
  54 + */
  55 + public function getBack(Request $request, WebSettingFromLogic $webSettingFromLogic)
  56 + {
  57 + $result = $webSettingFromLogic->fromBackMsgGet();
  58 + $this->response('success', Code::SUCCESS, $result);
  59 + }
35 } 60 }
@@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\Setting; @@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\Setting;
4 4
5 use App\Http\Logic\Bside\BaseLogic; 5 use App\Http\Logic\Bside\BaseLogic;
6 use App\Models\WebSetting\WebSettingForm; 6 use App\Models\WebSetting\WebSettingForm;
  7 +use App\Models\WebSetting\WebSettingFormBack;
7 8
8 class WebSettingFromLogic extends BaseLogic 9 class WebSettingFromLogic extends BaseLogic
9 { 10 {
@@ -54,4 +55,32 @@ class WebSettingFromLogic extends BaseLogic @@ -54,4 +55,32 @@ class WebSettingFromLogic extends BaseLogic
54 return $this->success(); 55 return $this->success();
55 } 56 }
56 57
  58 + /**
  59 + * 保存询盘请求返回信息
  60 + * @param $message
  61 + * @param $url
  62 + * @return WebSettingFormBack|mixed
  63 + */
  64 + public function fromBackMsgSet($message, $url)
  65 + {
  66 + $project_id = $this->user['project_id'];
  67 + $info = WebSettingFormBack::saveBack($project_id, $message, $url);
  68 + return $info;
  69 + }
  70 +
  71 + /**
  72 + * 获取询盘请求返回信息
  73 + * @return mixed
  74 + */
  75 + public function fromBackMsgGet()
  76 + {
  77 + $project_id = $this->user['project_id'];
  78 + $info = WebSettingFormBack::getBack($project_id);
  79 + $result = [
  80 + 'message' => $info->message ?? '',
  81 + 'url' => $info->url ?? '',
  82 + 'other' => $info->other ?? ''
  83 + ];
  84 + return $result;
  85 + }
57 } 86 }
@@ -14,4 +14,7 @@ class NewsCategory extends Base @@ -14,4 +14,7 @@ class NewsCategory extends Base
14 //连接数据库 14 //连接数据库
15 protected $connection = 'custom_mysql'; 15 protected $connection = 'custom_mysql';
16 16
  17 + const STATUS_SHOW = 0;
  18 + const STATUS_HIDE = 1;
  19 +
17 } 20 }
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: zhl
  5 + * Date: 2023/10/10
  6 + * Time: 17:01
  7 + */
  8 +
  9 +namespace App\Models\WebSetting;
  10 +
  11 +use App\Models\Base;
  12 +
  13 +/**
  14 + * Class WebSettingFormBack
  15 + * @package App\Models\WebSetting
  16 + */
  17 +class WebSettingFormBack extends Base
  18 +{
  19 + /**
  20 + * @var string
  21 + */
  22 + protected $table = 'gl_web_setting_form_back';
  23 +
  24 + /**
  25 + * 保存返回信息
  26 + * @param int $project_id
  27 + * @param string $message
  28 + * @param string $url
  29 + * @param string $other
  30 + * @return WebSettingFormBack|mixed
  31 + */
  32 + public static function saveBack($project_id = 0, $message = '', $url = '', $other = '')
  33 + {
  34 + $info = self::getBack($project_id);
  35 + if (empty($info))
  36 + $info = new self();
  37 + $info->project_id = $project_id;
  38 + $info->message = $message;
  39 + $info->url = $url;
  40 + $info->other = $other;
  41 + $info->save();
  42 + return $info;
  43 + }
  44 +
  45 + /**
  46 + * 根据企业获取返回信息设置
  47 + * @param int $project_id
  48 + * @return mixed
  49 + */
  50 + public static function getBack($project_id = 0)
  51 + {
  52 + return self::where(['project_id' => $project_id])->first();
  53 + }
  54 +}
@@ -134,6 +134,8 @@ Route::middleware(['bloginauth'])->group(function () { @@ -134,6 +134,8 @@ Route::middleware(['bloginauth'])->group(function () {
134 Route::prefix('from')->group(function () { 134 Route::prefix('from')->group(function () {
135 Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'info'])->name('web_setting_from_info'); 135 Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'info'])->name('web_setting_from_info');
136 Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'save'])->name('web_setting_from_info'); 136 Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'save'])->name('web_setting_from_info');
  137 + Route::any('/get_back', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'getBack'])->name('web_get_from_back');
  138 + Route::any('/set_back', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'saveBack'])->name('web_setting_from_back');
137 }); 139 });
138 //多语言设置 140 //多语言设置
139 Route::prefix('country')->group(function () { 141 Route::prefix('country')->group(function () {