first commit

This commit is contained in:
Mr.Qin
2022-08-19 19:48:37 +08:00
commit afdd648b65
3275 changed files with 631084 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<?php
declare (strict_types = 1);
// +----------------------------------------------------------------------
// | swiftAdmin 极速开发框架 [基于WebMan开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2020-2030 http://www.swiftadmin.net
// +----------------------------------------------------------------------
// | swiftAdmin.net High Speed Development Framework
// +----------------------------------------------------------------------
// | Author: meystack <coolsec@foxmail.com> Apache 2.0 License
// +----------------------------------------------------------------------
namespace app\admin\controller\system;
use app\AdminController;
use app\common\model\system\Dictionary as DictionaryModel;
use Webman\Http\Request;
/**
* 字典管理
* Class Dictionary
* @package app\admin\controller\system
*/
class Dictionary extends AdminController
{
public function __construct()
{
parent::__construct();
$this->model = new DictionaryModel();
}
/**
* 字典首页
* @return \support\Response
*/
public function index(): \support\Response
{
$post = input();
$pid = input('pid');
$limit = input('limit/d') ?? 10;
$page = input('page/d') ?? 1;
if ($pid == null) {
$pid = (string)$this->model->minId();
}
if (request()->isAjax()) {
// 生成查询数据
$pid = !strstr($pid,',') ? $pid : explode(',',$pid);
$where[] = ['pid','in',$pid];
if (!empty($post['name'])) {
$where[] = ['name','like','%'.$post['name'].'%'];
}
$count = $this->model->where($where)->count();
$list = $this->model->where($where)->limit($limit)->page($page)->select()
->each(function($item,$key) use ($pid){
if ($key == 0 && $pid == '0') {
$item['LAY_CHECKED'] = true;
}
return $item;
});
return $this->success('查询成功', null, $list, $count);
}
return view('/system/dictionary/index',[ 'pid' => $pid]);
}
}