后台
This commit is contained in:
44
app/czg/controller/CommonController.php
Normal file
44
app/czg/controller/CommonController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\czg\controller;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use app\common\library\DatabaseRoute;
|
||||
use think\facade\Db;
|
||||
|
||||
class CommonController extends Backend
|
||||
{
|
||||
protected array $noNeedLogin = ['*'];
|
||||
public function info()
|
||||
{
|
||||
$condition = $this->request->param();
|
||||
$this->successWithData(Db::name('common_info')->where([
|
||||
'condition_from' => $condition['condition']
|
||||
])->select()->toArray());
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
$params['create_at'] = getNormalDate();
|
||||
Db::name('common_info')->where([
|
||||
'id' => $params['id']
|
||||
])->update(convertKeysCamelToSnakeRecursive($params));
|
||||
|
||||
$info = Db::name('common_info')->where([
|
||||
'id' => $params['id']
|
||||
])->find();
|
||||
cache('common_info:'.$info['type'], null);
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function type()
|
||||
{
|
||||
$get = $this->request->param();
|
||||
if(empty($get['num'])) {
|
||||
$this->error('type 不能为空');
|
||||
}
|
||||
$data = convertToCamelCase(Db::connect(config('database.search_library'))->name('common_info')->where('type', $get['num'])->find());
|
||||
$this->success('ok', $data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user