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

39 lines
1.1 KiB
PHP

<?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) {
if (!empty($request->post('domestic'))) {
Redis::set(self::SETTING_DOMESTIC, $request->get('domestic'));
}
if (!empty($request->post('abroad'))) {
Redis::set(self::SETTING_ABROAD, $request->get('abroad'));
}
return $this->success([]);
}
}