Files
你的名字 0483b4b364 1
2025-07-14 10:22:40 +08:00

122 lines
3.6 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 项目分类管理
* Class Item
* @package app\akszadmin\controller
*/
class ItemClass extends Controller
{
/**
* 绑定数据表
* @var string
*/
protected $table = 'LcItemClass';
/**
* 项目分类管理
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '项目分类管理';
$query = $this->_query($this->table)->like('name');
$query->order('sort asc,id desc')->page();
}
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
protected function _index_page_filter(&$data)
{
$this->mlist = Db::name('LcUserMember')->select();
foreach ($data as &$vo) {
list($vo['member']) = [[]];
foreach ($this->mlist as $member) if ($member['id'] == $vo['member_id']) $vo['member'] = $member;
}
}
/**
* 添加项目分类
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function add()
{
$this->title = '添加项目分类';
$this->_form($this->table, 'form');
}
/**
* 编辑项目分类
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function edit()
{
$this->title = '编辑项目分类';
$this->_form($this->table, 'form');
}
/**
* 删除项目分类
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->_delete($this->table);
}
/**
* 表单数据处理
* @param array $vo
* @throws \ReflectionException
*/
protected function _form_filter(&$vo){
if ($this->request->isGet()) {
if (empty($vo['member_id']) && $this->request->get('member_id', '0')) $vo['member_id'] = $this->request->get('member_id', '0');
$this->member = Db::name("LcUserMember")->order('id desc')->select();
}
if (empty($vo['add_time'])) $vo['add_time'] = date("Y-m-d H:i:s");
}
}