travel/service/app/admin/controller/SettingController.php

39 lines
1.1 KiB
PHP
Raw Normal View History

2024-10-21 17:14:32 +08:00
<?php
namespace app\admin\controller;
use app\model\Settings;
use support\Redis;
use support\Request;
class SettingController extends base {
const SETTING_DOMESTIC = 'setting:domestic';
const SETTING_ABROAD = 'setting:abroad';
/**
* 配置合同获取
* @param Request $request
* @return \support\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getContractSetting(Request $request) {
$domestic = Redis::get(self::SETTING_DOMESTIC) ?? '';
$abroad = Redis::get(self::SETTING_ABROAD) ?? '';
return $this->success(compact('domestic', 'abroad'));
}
/**
* 合同配置保存
*/
public function saveContractSetting(Request $request) {
2024-10-22 09:09:13 +08:00
if (!empty($request->post('domestic'))) {
Redis::set(self::SETTING_DOMESTIC, $request->get('domestic'));
2024-10-21 17:14:32 +08:00
}
2024-10-22 09:09:13 +08:00
if (!empty($request->post('abroad'))) {
Redis::set(self::SETTING_ABROAD, $request->get('abroad'));
2024-10-21 17:14:32 +08:00
}
2024-10-22 09:09:13 +08:00
2024-10-21 17:14:32 +08:00
return $this->success([]);
}
}