1、更新内核

2、代码格式化
This commit is contained in:
2016-07-21 14:29:32 +08:00
parent 3cc2c38dc7
commit a72ba86faa
20 changed files with 1214 additions and 1083 deletions

View File

@@ -24,19 +24,19 @@
* )
*
*/
function int_to_string(&$data,$map=array('status'=>array(1=>'正常',-1=>'删除',0=>'禁用',2=>'未审核',3=>'草稿'))) {
if($data === false || $data === null ){
return $data;
}
$data = (array)$data;
foreach ($data as $key => $row){
foreach ($map as $col=>$pair){
if(isset($row[$col]) && isset($pair[$row[$col]])){
$data[$key][$col.'_text'] = $pair[$row[$col]];
}
}
}
return $data;
function intToString(&$data, $map = array('status' => array(1 => '正常', -1 => '删除', 0 => '禁用', 2 => '未审核', 3 => '草稿'))) {
if ($data === false || $data === null) {
return $data;
}
$data = (array) $data;
foreach ($data as $key => $row) {
foreach ($map as $col => $pair) {
if (isset($row[$col]) && isset($pair[$row[$col]])) {
$data[$key][$col . '_text'] = $pair[$row[$col]];
}
}
}
return $data;
}
/**
@@ -45,27 +45,36 @@ function int_to_string(&$data,$map=array('status'=>array(1=>'正常',-1=>'删除
* @return string 状态文字 false 未获取到
* @author huajie <banhuajie@163.com>
*/
function get_status_title($status = null){
if(!isset($status)){
return false;
}
switch ($status){
case -1 : return '已删除'; break;
case 0 : return '禁用'; break;
case 1 : return '正常'; break;
case 2 : return '待审核'; break;
default : return false; break;
}
function getStatusTitle($status = null) {
if (!isset($status)) {
return false;
}
switch ($status) {
case -1:return '已删除';
break;
case 0:return '禁用';
break;
case 1:return '正常';
break;
case 2:return '待审核';
break;
default:return false;
break;
}
}
// 获取数据的状态操作
function show_status_op($status) {
switch ($status){
case 0 : return '启用'; break;
case 1 : return '禁用'; break;
case 2 : return '审核'; break;
default : return false; break;
}
function showStatusOp($status) {
switch ($status) {
case 0:return '启用';
break;
case 1:return '禁用';
break;
case 2:return '审核';
break;
default:return false;
break;
}
}
/**
@@ -74,15 +83,15 @@ function show_status_op($status) {
* @param bool $all 是否返回全部类型
* @author huajie <banhuajie@163.com>
*/
function get_action_type($type, $all = false){
$list = array(
1=>'系统',
2=>'用户',
);
if($all){
return $list;
}
return $list[$type];
function getActionType($type, $all = false) {
$list = array(
1 => '系统',
2 => '用户',
);
if ($all) {
return $list;
}
return $list[$type];
}
/**
@@ -91,16 +100,16 @@ function get_action_type($type, $all = false){
* @param string $field 需要获取的字段
* @author huajie <banhuajie@163.com>
*/
function get_action($id = null, $field = null){
if(empty($id) && !is_numeric($id)){
return false;
}
$list = cache('action_list');
if(empty($list[$id])){
$map = array('status'=>array('gt', -1), 'id'=>$id);
$list[$id] = db('Action')->where($map)->field(true)->find();
}
return empty($field) ? $list[$id] : $list[$id][$field];
function getAction($id = null, $field = null) {
if (empty($id) && !is_numeric($id)) {
return false;
}
$list = cache('action_list');
if (empty($list[$id])) {
$map = array('status' => array('gt', -1), 'id' => $id);
$list[$id] = db('Action')->where($map)->field(true)->find();
}
return empty($field) ? $list[$id] : $list[$id][$field];
}
/**
@@ -110,18 +119,18 @@ function get_action($id = null, $field = null){
* @param string $field 需要返回的字段,不传则返回整个数据
* @author huajie <banhuajie@163.com>
*/
function get_document_field($value = null, $condition = 'id', $field = null){
if(empty($value)){
return false;
}
function getDocumentField($value = null, $condition = 'id', $field = null) {
if (empty($value)) {
return false;
}
//拼接参数
$map[$condition] = $value;
$info = db('Model')->where($map);
if(empty($field)){
$info = $info->field(true)->find();
}else{
$info = $info->value($field);
}
return $info;
//拼接参数
$map[$condition] = $value;
$info = db('Model')->where($map);
if (empty($field)) {
$info = $info->field(true)->find();
} else {
$info = $info->value($field);
}
return $info;
}

View File

@@ -14,27 +14,27 @@ class Addons extends Admin {
protected $addons;
public function _initialize(){
public function _initialize() {
parent::_initialize();
//加入菜单
$this->getAddonsMenu();
$this->addons = model('Addons');
$this->hooks = db('Hooks');
$this->hooks = db('Hooks');
}
/**
* 插件列表
*/
public function index($refresh = 0){
* 插件列表
*/
public function index($refresh = 0) {
if ($refresh) {
$this->addons->refresh();
}
$list = $this->addons->order('id desc')->paginate(25);
$list = $this->addons->order('id desc')->paginate(25);
// 记录当前列表页的cookie
Cookie('__forward__',$_SERVER['REQUEST_URI']);
Cookie('__forward__', $_SERVER['REQUEST_URI']);
$data = array(
'list' => $list,
'page' => $list->render()
'list' => $list,
'page' => $list->render(),
);
$this->setMeta("插件管理");
$this->assign($data);
@@ -42,27 +42,27 @@ class Addons extends Admin {
}
//创建向导首页
public function add(){
public function add() {
if (IS_POST) {
$data = $this->addons->create();
if ($data) {
if ($result) {
return $this->success("创建成功!",url('admin/addons/index'));
}else{
return $this->success("创建成功!", url('admin/addons/index'));
} else {
return $this->error("创建失败!");
}
}else{
} else {
return $this->error($this->addons->getError());
}
}else{
} else {
$hooks = db('Hooks')->field('name,description')->select();
$this->assign('Hooks',$hooks);
$this->assign('Hooks', $hooks);
$hook = db('Hooks')->field(true)->select();
foreach($hook as $key => $value){
foreach ($hook as $key => $value) {
$addons_opt[$value['name']] = $value['name'];
}
$addons_opt = array(array('type'=>'select','opt'=>$addons_opt));
if(!is_writable(SENT_ADDON_PATH)){
$addons_opt = array(array('type' => 'select', 'opt' => $addons_opt));
if (!is_writable(SENT_ADDON_PATH)) {
return $this->error('您没有创建目录写入权限,无法使用此功能');
}
$this->setMeta("添加插件");
@@ -71,35 +71,35 @@ class Addons extends Admin {
}
//预览
public function preview($output = true){
public function preview($output = true) {
}
/**
* 安装插件
*/
public function install(){
$addon_name = input('addon_name','','trim,ucfirst');
$class = get_addon_class($addon_name);
if(class_exists($class)){
$addons = new $class;
$info = $addons->info;
if(!$info || !$addons->checkInfo()){
public function install() {
$addon_name = input('addon_name', '', 'trim,ucfirst');
$class = get_addon_class($addon_name);
if (class_exists($class)) {
$addons = new $class;
$info = $addons->info;
if (!$info || !$addons->checkInfo()) {
//检测信息的正确性
return $this->error('插件信息缺失');
}
session('addons_install_error',null);
$install_flag = $addons->install();
if(!$install_flag){
return $this->error('执行插件预安装操作失败'.session('addons_install_error'));
session('addons_install_error', null);
$install_flag = $addons->install();
if (!$install_flag) {
return $this->error('执行插件预安装操作失败' . session('addons_install_error'));
}
$result = $this->addons->install($info);
if($result){
if ($result) {
cache('hooks', null);
return $this->success('安装成功');
}else{
} else {
return $this->error($this->addons->getError());
}
}else{
} else {
return $this->error('插件不存在');
}
}
@@ -107,11 +107,11 @@ class Addons extends Admin {
/**
* 卸载插件
*/
public function uninstall($id){
public function uninstall($id) {
$result = $this->addons->uninstall($id);
if($result === false){
return $this->error($this->addons->getError(),'');
}else{
if ($result === false) {
return $this->error($this->addons->getError(), '');
} else {
return $this->success('卸载成功!');
}
}
@@ -119,14 +119,14 @@ class Addons extends Admin {
/**
* 启用插件
*/
public function enable(){
$id = input('id');
public function enable() {
$id = input('id');
cache('hooks', null);
$model = model('Addons');
$result = $model::where(array('id'=>$id))->update(array('status'=>1));
$model = model('Addons');
$result = $model::where(array('id' => $id))->update(array('status' => 1));
if ($result) {
return $this->success('启用成功');
}else{
} else {
return $this->error("启用失败!");
}
}
@@ -134,14 +134,14 @@ class Addons extends Admin {
/**
* 禁用插件
*/
public function disable(){
$id = input('id');
public function disable() {
$id = input('id');
cache('hooks', null);
$model = model('Addons');
$result = $model::where(array('id'=>$id))->update(array('status'=>0));
$model = model('Addons');
$result = $model::where(array('id' => $id))->update(array('status' => 0));
if ($result) {
return $this->success('禁用成功');
}else{
} else {
return $this->error("禁用失败!");
}
}
@@ -149,11 +149,11 @@ class Addons extends Admin {
/**
* 设置插件页面
*/
public function config(){
public function config() {
if (IS_POST) {
# code...
}else{
$id = input('id','','trim,intval');
} else {
$id = input('id', '', 'trim,intval');
if (!$id) {
return $this->error("非法操作!");
}
@@ -162,13 +162,13 @@ class Addons extends Admin {
$class = get_addon_class($info['name']);
$keyList = array();
$data = array(
'keyList' => $keyList
$data = array(
'keyList' => $keyList,
);
$this->assign($data);
$this->setMeta($info['title'] . " - 设置");
return $this->fetch('public/edit');
}else{
} else {
return $this->error("未安装此插件!");
}
}
@@ -180,17 +180,17 @@ class Addons extends Admin {
* @param string $addons 插件名称
* @param string $addons 插件简介
*/
public function existHook($str, $addons, $msg=''){
$hook_mod = db('Hooks');
public function existHook($str, $addons, $msg = '') {
$hook_mod = db('Hooks');
$where['name'] = $str;
$gethook = $hook_mod->where($where)->find();
if(!$gethook || empty($gethook) || !is_array($gethook)){
$data['name'] = $str;
$gethook = $hook_mod->where($where)->find();
if (!$gethook || empty($gethook) || !is_array($gethook)) {
$data['name'] = $str;
$data['description'] = $msg;
$data['type'] = 1;
$data['type'] = 1;
$data['update_time'] = time();
$data['addons'] = $addons;
if( false !== $hook_mod->create($data) ){
$data['addons'] = $addons;
if (false !== $hook_mod->create($data)) {
$hook_mod->add();
}
}
@@ -200,8 +200,8 @@ class Addons extends Admin {
* 删除钩子
* @param string $hook 钩子名称
*/
public function deleteHook($hook){
$model = db('hooks');
public function deleteHook($hook) {
$model = db('hooks');
$condition = array(
'name' => $hook,
);
@@ -212,36 +212,36 @@ class Addons extends Admin {
/**
* 钩子列表
*/
public function hooks(){
public function hooks() {
$map = array();
$map = array();
$order = "id desc";
$list = model('Hooks')->where($map)->order($order)->paginate(10);
$list = model('Hooks')->where($map)->order($order)->paginate(10);
// 记录当前列表页的cookie
Cookie('__forward__',$_SERVER['REQUEST_URI']);
Cookie('__forward__', $_SERVER['REQUEST_URI']);
$data = array(
'list' => $list,
'page' => $list->render()
'list' => $list,
'page' => $list->render(),
);
$this->setMeta("钩子管理");
$this->assign($data);
return $this->fetch();
}
public function addhook(){
public function addhook() {
$hooks = model('Hooks');
if (IS_POST) {
$result = $hooks->change();
if ($result !== false) {
return $this->success("修改成功");
}else{
} else {
return $this->error($hooks->getError());
}
}else{
} else {
$keylist = $hooks->getaddons();
$data = array(
$data = array(
'keyList' => $keylist,
);
$this->assign($data);
@@ -251,20 +251,20 @@ class Addons extends Admin {
}
//钩子出编辑挂载插件页面
public function edithook($id){
public function edithook($id) {
$hooks = model('Hooks');
if (IS_POST) {
$result = $hooks->change();
if ($result !== false) {
return $this->success("修改成功");
}else{
} else {
return $this->error($hooks->getError());
}
}else{
$info = db('Hooks')->find($id);
} else {
$info = db('Hooks')->find($id);
$keylist = $hooks->getaddons($info['addons']);
$data = array(
'info' => $info,
$data = array(
'info' => $info,
'keyList' => $keylist,
);
$this->assign($data);
@@ -274,41 +274,41 @@ class Addons extends Admin {
}
//超级管理员删除钩子
public function delhook(){
$id = input('id','','trim,intval');
$ids = input('post.ids/a',array());
public function delhook() {
$id = input('id', '', 'trim,intval');
$ids = input('post.ids/a', array());
array_push($ids, $id);
$map['id'] = array('IN',$ids);
$result = $this->hooks->where($map)->delete();
if($result !== false){
$map['id'] = array('IN', $ids);
$result = $this->hooks->where($map)->delete();
if ($result !== false) {
return $this->success('删除成功');
}else{
} else {
return $this->error('删除失败');
}
}
public function updateHook(){
$hookModel = D('Hooks');
$data = $hookModel->create();
if($data){
if($data['id']){
public function updateHook() {
$hookModel = D('Hooks');
$data = $hookModel->create();
if ($data) {
if ($data['id']) {
$flag = $hookModel->save($data);
if($flag !== false){
if ($flag !== false) {
S('hooks', null);
$this->success('更新成功', Cookie('__forward__'));
}else{
} else {
$this->error('更新失败');
}
}else{
} else {
$flag = $hookModel->add($data);
if($flag){
if ($flag) {
S('hooks', null);
$this->success('新增成功', Cookie('__forward__'));
}else{
} else {
$this->error('新增失败');
}
}
}else{
} else {
$this->error($hookModel->getError());
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -10,96 +10,96 @@
return array(
// 调试模式
'app_debug' => true,
'app_debug' => true,
'charset' => 'UTF-8',
'lang_switch_on' => true, // 开启语言包功能
'lang_list' => ['zh-cn'], // 支持的语言列表
'charset' => 'UTF-8',
'lang_switch_on' => true, // 开启语言包功能
'lang_list' => ['zh-cn'], // 支持的语言列表
'data_auth_key' => 'sent',
'data_auth_key' => 'sent',
'base_url' => BASE_PATH,
'url_route_on' => true,
'url_common_param' => false,
'base_url' => BASE_PATH,
'url_route_on' => true,
'url_common_param' => false,
'template' => array(
'taglib_build_in' => 'cx,com\Sent'
'template' => array(
'taglib_build_in' => 'cx,com\Sent',
),
// 'dispatch_success_tmpl' => APP_PATH . 'common/view/default/jump.html',
// 'dispatch_error_tmpl' => APP_PATH . 'common/view/default/jump.html',
'attachment_upload' => array(
'attachment_upload' => array(
// 允许上传的文件MiMe类型
'mimes' => [],
'mimes' => [],
// 上传的文件大小限制 (0-不做限制)
'maxSize' => 0,
'maxSize' => 0,
// 允许上传的文件后缀
'exts' => [],
'exts' => [],
// 子目录创建方式,[0]-函数名,[1]-参数,多个参数使用数组
'subName' => ['date', 'Ymd'],
'subName' => ['date', 'Ymd'],
//保存根路径
'rootPath' => './uploads/attachment',
'rootPath' => './uploads/attachment',
// 保存路径
'savePath' => '',
'savePath' => '',
// 上传文件命名规则,[0]-函数名,[1]-参数,多个参数使用数组
'saveName' => ['uniqid', ''],
'saveName' => ['uniqid', ''],
// 文件上传驱动e,
'driver' => 'Local',
'driver' => 'Local',
),
'editor_upload' => array(
'editor_upload' => array(
// 允许上传的文件MiMe类型
'mimes' => [],
'mimes' => [],
// 上传的文件大小限制 (0-不做限制)
'maxSize' => 0,
'maxSize' => 0,
// 允许上传的文件后缀
'exts' => [],
'exts' => [],
// 子目录创建方式,[0]-函数名,[1]-参数,多个参数使用数组
'subName' => ['date', 'Ymd'],
'subName' => ['date', 'Ymd'],
//保存根路径
'rootPath' => './uploads/editor',
'rootPath' => './uploads/editor',
// 保存路径
'savePath' => '',
'savePath' => '',
// 上传文件命名规则,[0]-函数名,[1]-参数,多个参数使用数组
'saveName' => ['uniqid', ''],
'saveName' => ['uniqid', ''],
// 文件上传驱动e,
'driver' => 'Local',
'driver' => 'Local',
),
'picture_upload' => array(
// 允许上传的文件MiMe类型
'mimes' => [],
'mimes' => [],
// 上传的文件大小限制 (0-不做限制)
'maxSize' => 0,
'maxSize' => 0,
// 允许上传的文件后缀
'exts' => [],
'exts' => [],
// 子目录创建方式,[0]-函数名,[1]-参数,多个参数使用数组
'subName' => ['date', 'Ymd'],
'subName' => ['date', 'Ymd'],
//保存根路径
'rootPath' => './uploads/picture',
'rootPath' => './uploads/picture',
// 保存路径
'savePath' => '',
'savePath' => '',
// 上传文件命名规则,[0]-函数名,[1]-参数,多个参数使用数组
'saveName' => ['uniqid', ''],
'saveName' => ['uniqid', ''],
// 文件上传驱动e,
'driver' => 'Local',
'driver' => 'Local',
),
'session' => array(
'prefix' => 'sent',
'type' => '',
'auto_start' => true,
'session' => array(
'prefix' => 'sent',
'type' => '',
'auto_start' => true,
),
'log' => array(
'log' => array(
// 日志记录方式,支持 file sae
'type' => 'file',
// 日志保存目录
'path' => LOG_PATH,
),
// 页面Trace信息
'trace' =>array(
'trace' => array(
//支持Html,Console 设为false则不显示
'type' => 'Html',
'type' => 'Html',
)
);

View File

@@ -8,34 +8,34 @@
// +----------------------------------------------------------------------
return array(
'__pattern__' => array(
'__pattern__' => array(
'name' => '\w+',
),
'/' => 'index/index/index', // 首页访问路由
'search' => 'index/search/index', // 首页访问路由
'/' => 'index/index/index', // 首页访问路由
'search' => 'index/search/index', // 首页访问路由
'cart/index' => 'index/cart/index',
'cart/add' => 'index/cart/add',
'cart/count' => 'index/cart/count',
'cart/index' => 'index/cart/index',
'cart/add' => 'index/cart/add',
'cart/count' => 'index/cart/count',
'login' => 'user/login/index',
'register' => 'user/login/register',
'logout' => 'user/login/logout',
'uc' => 'user/index/index',
'login' => 'user/login/index',
'register' => 'user/login/register',
'logout' => 'user/login/logout',
'uc' => 'user/index/index',
'order/index' => 'user/order/index',
'order/list' => 'user/order/lists',
'order/index' => 'user/order/index',
'order/list' => 'user/order/lists',
'admin/login' => 'admin/index/login',
'admin/logout' => 'admin/index/logout',
'admin/login' => 'admin/index/login',
'admin/logout' => 'admin/index/logout',
// 变量传入index模块的控制器和操作方法
'addons/:mc/:ac' => 'index/addons/execute', // 静态地址和动态地址结合
'usera/:mc/:ac' => 'user/addons/execute', // 静态地址和动态地址结合
'usera/:mc/:ac' => 'user/addons/execute', // 静态地址和动态地址结合
'admina/:mc/:ac' => 'admin/addons/execute', // 静态地址和动态地址结合
'book/list' => 'index/book/index',
'book/search' => 'index/book/search',
'book/detail/:id' => 'index/book/detail',
'book/search' => 'index/book/search',
'book/detail/:id' => 'index/book/detail',
);

View File

@@ -1,4 +1,4 @@
<?php
return array(
'app_init' => array('app\\common\\behavior\\InitHook'),
'app_init' => array('app\\common\\behavior\\InitHook'),
);

View File

@@ -10,51 +10,51 @@
namespace app\user\controller;
use app\common\controller\User;
class Content extends User{
class Content extends User {
public function _initialize(){
public function _initialize() {
parent::_initialize();
$this->getContentMenu();
$model_id = $this->request->param('model_id');
$row = db('Model')->select();
$row = db('Model')->select();
foreach ($row as $key => $value) {
$list[$value['id']] = $value;
$list[$value['id']] = $value;
}
if (empty($list[$model_id])) {
return $this->error("无此模型!");
}else {
} else {
$this->modelInfo = $list[$model_id];
if ($this->modelInfo['extend'] > 1) {
$this->model = model($this->modelInfo['name']);
}else{
} else {
$this->model = model('Document')->extend($this->modelInfo['name']);
}
}
$this->assign('model_id',$model_id);
$this->assign('model_list',$list);
$this->assign('model_info',$this->modelInfo);
$this->assign('model_id', $model_id);
$this->assign('model_list', $list);
$this->assign('model_info', $this->modelInfo);
}
public function index(){
public function index() {
if ($this->modelInfo['list_grid'] == '') {
return $this->error("列表定义不正确!", url('admin/model/edit',array('id'=>$this->modelInfo['id'])));
return $this->error("列表定义不正确!", url('admin/model/edit', array('id' => $this->modelInfo['id'])));
}
$grid_list = get_grid_list($this->modelInfo['list_grid']);
$order = "id desc";
$grid_list = get_grid_list($this->modelInfo['list_grid']);
$order = "id desc";
$map['uid'] = session('user_auth.uid');
if ($this->modelInfo['extend'] == 1) {
$map['model_id'] = $this->modelInfo['id'];
}
$field = array_filter($grid_list['fields']);
$list = $this->model->where($map)->field($field)->order($order)->paginate(15);
$list = $this->model->where($map)->field($field)->order($order)->paginate(15);
$data = array(
'grid' => $grid_list,
'list' => $list,
'page' => $list->render()
'grid' => $grid_list,
'list' => $list,
'page' => $list->render(),
);
$this->assign($data);
return $this->fetch();
@@ -64,21 +64,21 @@ class Content extends User{
* 内容添加
* @author molong <ycgpp@126.com>
*/
public function add(){
public function add() {
if (IS_POST) {
$result = $this->model->change();
if ($result) {
return $this->success("添加成功!",url('admin/content/index',array('model_id'=>$this->modelInfo['id'])));
}else{
return $this->error($this->model->getError(),'');
return $this->success("添加成功!", url('admin/content/index', array('model_id' => $this->modelInfo['id'])));
} else {
return $this->error($this->model->getError(), '');
}
}else{
} else {
$info = array(
'model_id' => $this->modelInfo['id']
'model_id' => $this->modelInfo['id'],
);
$data = array(
'info' => $info,
'fieldGroup' => $this->getField($this->modelInfo)
'info' => $info,
'fieldGroup' => $this->getField($this->modelInfo),
);
$this->assign($data);
return $this->fetch('public/edit');
@@ -89,15 +89,15 @@ class Content extends User{
* 内容修改
* @author molong <ycgpp@126.com>
*/
public function edit($id){
public function edit($id) {
if (IS_POST) {
$result = $this->model->change();
if ($result !== false) {
return $this->success("更新成功!",url('admin/content/index',array('model_id'=>$this->modelInfo['id'])));
}else{
return $this->error($this->model->getError(),'');
return $this->success("更新成功!", url('admin/content/index', array('model_id' => $this->modelInfo['id'])));
} else {
return $this->error($this->model->getError(), '');
}
}else{
} else {
if (!$id) {
return $this->error("非法操作!");
}
@@ -106,9 +106,9 @@ class Content extends User{
return $this->error($this->model->getError());
}
$info['model_id'] = $this->modelInfo['id'];
$data = array(
'info' => $info,
'fieldGroup' => $this->getField($this->modelInfo)
$data = array(
'info' => $info,
'fieldGroup' => $this->getField($this->modelInfo),
);
$this->assign($data);
return $this->fetch('public/edit');
@@ -119,44 +119,44 @@ class Content extends User{
* 内容删除
* @author molong <ycgpp@126.com>
*/
public function del(){
$id = input('get.id','','trim');
$ids = input('post.ids/a',array());
public function del() {
$id = input('get.id', '', 'trim');
$ids = input('post.ids/a', array());
array_push($ids, $id);
if (empty($ids)) {
return $this->error("非法操作!");
}
$map['id'] = array('IN',$ids);
$result = $this->model->del($map);
$map['id'] = array('IN', $ids);
$result = $this->model->del($map);
if ($result) {
return $this->success("删除成功!");
}else{
} else {
return $this->error("删除失败!", '', "");
}
}
protected function getField(){
protected function getField() {
$field_group = parse_config_attr($this->modelInfo['field_group']);
$field_sort = json_decode($this->modelInfo['field_sort'],true);
$field_sort = json_decode($this->modelInfo['field_sort'], true);
if ($this->modelInfo['extend'] > 1) {
$map['model_id'] = $this->modelInfo['id'];
}else{
$model_id[] = $this->modelInfo['id'];
$model_id[] = 1;
$map['model_id'] = array('IN',$model_id);
} else {
$model_id[] = $this->modelInfo['id'];
$model_id[] = 1;
$map['model_id'] = array('IN', $model_id);
}
if (ACTION_NAME == 'add') {
$map['is_show'] = array('in',array('1','2'));
}elseif(ACTION_NAME == 'edit'){
$map['is_show'] = array('in',array('1','3'));
$map['is_show'] = array('in', array('1', '2'));
} elseif (ACTION_NAME == 'edit') {
$map['is_show'] = array('in', array('1', '3'));
}
//获得数组的第一条数组
$first_key = array_keys($field_group);
$fields = model('Attribute')->getFieldlist($map);
$fields = model('Attribute')->getFieldlist($map);
if (!empty($field_sort)) {
foreach ($field_sort as $key => $value) {
foreach ($value as $index) {
@@ -168,8 +168,8 @@ class Content extends User{
}
}
//未进行排序的放入第一组中
$fields[] = array('name'=>'model_id','type'=>'hidden'); //加入模型ID值
$fields[] = array('name'=>'id','type'=>'hidden'); //加入模型ID值
$fields[] = array('name' => 'model_id', 'type' => 'hidden'); //加入模型ID值
$fields[] = array('name' => 'id', 'type' => 'hidden'); //加入模型ID值
foreach ($fields as $key => $value) {
$groupfield[$first_key[0]][] = $value;
}

View File

@@ -10,9 +10,9 @@
namespace app\user\controller;
use app\common\controller\User;
class Index extends User{
class Index extends User {
public function index(){
public function index() {
return $this->fetch();
}
}