app/admin/controller/Channeltype.php
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/**
* 人人站CMS
* ============================================================================
* 版权所有 2015-2030 山东康程信息科技有限公司,并保留所有权利。
* 网站地址: http://www.rrzcms.com
* ----------------------------------------------------------------------------
* 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
* ============================================================================
*/
namespace app\admin\controller;
class Channeltype extends Base
{
function index() {
$type = I('type', 'articles');
$this->pagedata['tabs'] = $type == 'articles' ? [
['name' => '文章列表', 'url' => U('Article/index'),],
['name' => '文章栏目', 'url' => U('Article/nodes'),],
['name' => '文章模型', 'class' => 'current',],
] : [
['name' => '产品列表', 'url' => U('Goods/index'),],
['name' => '产品分类', 'url' => U('Goods/cat'),],
['name' => '产品品牌', 'url' => U('Goods/brand'),],
['name' => '产品模型', 'class' => 'current',],
];
$this->pagedata['actions'] = [
['label' => '新增模型', 'target' => 'dialog', 'options' => '{title:"新增模型",area:["450px"]}', 'href' => U('Channeltype/addType', ['type' => $type,]),],
];
$this->pagedata['columns'] = [
['field' => 'id', 'title' => 'ID', 'width' => '100',],
['field' => 'title', 'title' => '模型名称', 'width' => '250', 'align' => 'left',],
['field' => 'cz', 'title' => '操作', 'width' => '200', 'callback' => function ($item) use ($type) {
$html = '';
$html .= '<a target="dialog" options="{title:\'编辑模型\',area:[\'450px\']}" href="' . U('Channeltype/addType', ['id' => $item['id'],]) . '" class="layui-btn layui-btn-xs">编辑</a>';
$html .= '<a href="' . U('Channeltype/delType', ['id' => $item['id'],]) . '" msg="<font color="#ff0000">此操作将会删除与该模型所有相关的数据且不可恢复,请谨慎操作!</font>是否确认删除?" target="confirm" class="layui-btn layui-btn-danger layui-btn-xs">删除</a>';
$html .= '<a class="layui-btn layui-btn-xs layui-btn-normal" href="' . U('Channeltype/fields', ['type_id' => $item['id'],]) . '" target="dialog" options="{title:false,area:[\'1020px\',\'550px\']}" >内容字段</a>';
return $html;
}],
];
$this->pagedata['model'] = M('channeltype')->where('type', '=', $type)->order('id asc');
$this->pagedata['fixedColumn'] = true;
return $this->grid_fetch();
}
//删除模型
function delType() {
$id = I('get.id');
is_numeric($id) or $this->error('参数错误!');
$channel = M('channeltype')->where('id', $id)->find();
//删除模型
M('channeltype')->where('id', $id)->delete() or $this->error('删除失败!');
//删除模型字段
$ids = M('channelfield')->where('channel_id', $id)->column('id');
$lib = new \app\admin\lib\Field;
foreach ($ids as $field_id) {
$lib->delField($field_id);
}
后面还有 142 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
