后台
This commit is contained in:
48
app/czg/controller/AppinfoController.php
Normal file
48
app/czg/controller/AppinfoController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\czg\controller;
|
||||
|
||||
use app\api\model\CommonInfo;
|
||||
use app\common\controller\Backend;
|
||||
use app\common\library\DatabaseRoute;
|
||||
use think\facade\Db;
|
||||
|
||||
class AppinfoController extends Backend
|
||||
{
|
||||
protected array $noNeedLogin = ['*'];
|
||||
public function list()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
$list = Db::name('app')->paginate([
|
||||
'page' => $params['page'],
|
||||
'list_rows' => $params['limit']
|
||||
]);
|
||||
$this->successWithData([
|
||||
'records' => convertToCamelCase($list->items()), // 当前页数据
|
||||
'totalCount' => $list->total(), // 总记录数
|
||||
'currPage' => $list->currentPage(),
|
||||
'last_page' => $list->lastPage(),
|
||||
'pageSize' => $params['limit']
|
||||
]);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
$params = convertKeysCamelToSnakeRecursive($params);
|
||||
if (empty($params['id'])) {
|
||||
$params['create_at'] = getNormalDate();
|
||||
Db::name('app')->insert($params);
|
||||
}else {
|
||||
Db::name('app')->where([
|
||||
'id' => $params['id']
|
||||
])->update($params);
|
||||
}
|
||||
|
||||
$this->success();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user