作者 zhl

u

... ... @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingFromLogic;
use Illuminate\Http\Request;
/**
* @name:表单设置
... ... @@ -32,4 +33,28 @@ class WebSettingFromController extends BaseController
$webSettingFromLogic->setting_from_save();
$this->response('success');
}
/**
* 保存询盘请求返回信息
* @param Request $request
* @param WebSettingFromLogic $webSettingFromLogic
*/
public function saveBack(Request $request, WebSettingFromLogic $webSettingFromLogic)
{
$message = $request->input('message', 'success');
$url = $request->input('url');
$webSettingFromLogic->fromBackMsgSet($message, $url);
$this->response('success');
}
/**
* 获取询盘请求返回信息
* @param Request $request
* @param WebSettingFromLogic $webSettingFromLogic
*/
public function getBack(Request $request, WebSettingFromLogic $webSettingFromLogic)
{
$result = $webSettingFromLogic->fromBackMsgGet();
$this->response('success', Code::SUCCESS, $result);
}
}
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\Setting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\WebSetting\WebSettingForm;
use App\Models\WebSetting\WebSettingFormBack;
class WebSettingFromLogic extends BaseLogic
{
... ... @@ -54,4 +55,32 @@ class WebSettingFromLogic extends BaseLogic
return $this->success();
}
/**
* 保存询盘请求返回信息
* @param $message
* @param $url
* @return WebSettingFormBack|mixed
*/
public function fromBackMsgSet($message, $url)
{
$project_id = $this->user['project_id'];
$info = WebSettingFormBack::saveBack($project_id, $message, $url);
return $info;
}
/**
* 获取询盘请求返回信息
* @return mixed
*/
public function fromBackMsgGet()
{
$project_id = $this->user['project_id'];
$info = WebSettingFormBack::getBack($project_id);
$result = [
'message' => $info->message ?? '',
'url' => $info->url ?? '',
'other' => $info->other ?? ''
];
return $result;
}
}
... ...
... ... @@ -14,4 +14,7 @@ class NewsCategory extends Base
//连接数据库
protected $connection = 'custom_mysql';
const STATUS_SHOW = 0;
const STATUS_HIDE = 1;
}
... ...
<?php
/**
* Created by PhpStorm.
* User: zhl
* Date: 2023/10/10
* Time: 17:01
*/
namespace App\Models\WebSetting;
use App\Models\Base;
/**
* Class WebSettingFormBack
* @package App\Models\WebSetting
*/
class WebSettingFormBack extends Base
{
/**
* @var string
*/
protected $table = 'gl_web_setting_form_back';
/**
* 保存返回信息
* @param int $project_id
* @param string $message
* @param string $url
* @param string $other
* @return WebSettingFormBack|mixed
*/
public static function saveBack($project_id = 0, $message = '', $url = '', $other = '')
{
$info = self::getBack($project_id);
if (empty($info))
$info = new self();
$info->project_id = $project_id;
$info->message = $message;
$info->url = $url;
$info->other = $other;
$info->save();
return $info;
}
/**
* 根据企业获取返回信息设置
* @param int $project_id
* @return mixed
*/
public static function getBack($project_id = 0)
{
return self::where(['project_id' => $project_id])->first();
}
}
\ No newline at end of file
... ...
... ... @@ -134,6 +134,8 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('from')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'info'])->name('web_setting_from_info');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'save'])->name('web_setting_from_info');
Route::any('/get_back', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'getBack'])->name('web_get_from_back');
Route::any('/set_back', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'saveBack'])->name('web_setting_from_back');
});
//多语言设置
Route::prefix('country')->group(function () {
... ...