后台
This commit is contained in:
43
app/czg/sys/controller/OssController.php
Normal file
43
app/czg/sys/controller/OssController.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace app\czg\sys\controller;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use app\common\library\DatabaseRoute;
|
||||
use think\facade\Db;
|
||||
|
||||
class OssController extends Backend
|
||||
{
|
||||
|
||||
public function list()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$data = DatabaseRoute::paginateDb('sys_oss', function ($query) {
|
||||
return $query->order('id', 'desc');
|
||||
}, $params['page'], $params['limit']);
|
||||
$this->n_success(['page' => $data]);
|
||||
}
|
||||
|
||||
public function config()
|
||||
{
|
||||
$data = Db::connect(get_slave_connect_name())->name('sys_config')->where(['param_key' => 'CLOUD_STORAGE_CONFIG_KEY'])->column('param_value')[0];
|
||||
$data = json_decode($data, true);
|
||||
$this->n_success(['config' => $data]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function saveConfig()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
if(is_array($post)) {
|
||||
$post = json_encode($post);
|
||||
}else {
|
||||
$this->error('参数错误');
|
||||
}
|
||||
Db::name('sys_config')->where(['param_key' => 'CLOUD_STORAGE_CONFIG_KEY'])->update(['param_value' => $post]);
|
||||
$this->success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user