40 lines
1.2 KiB
PHP
40 lines
1.2 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->get('domestic'))) {
|
||
|
return $this->error('请上传境内合同');
|
||
|
}
|
||
|
if (empty($request->get('abroad'))) {
|
||
|
return $this->error('请上传境外合同');
|
||
|
}
|
||
|
Redis::set(self::SETTING_DOMESTIC, $request->get('domestic'));
|
||
|
Redis::set(self::SETTING_ABROAD, $request->get('abroad'));
|
||
|
return $this->success([]);
|
||
|
}
|
||
|
}
|