修复后台模块

This commit is contained in:
2020-03-30 22:40:52 +08:00
parent f31f3b99fa
commit de73484cca
10 changed files with 73 additions and 65 deletions

View File

@@ -1,20 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\model;
/**
* 设置模型
*/
class Content extends Model {
protected $auto = ['update_time'];
protected $insert = ['create_time', 'status' => 1];
}

View File

@@ -81,11 +81,24 @@ class Model extends \think\Model{
return strtolower($value);
}
public function getGridListAttr($value, $data){
$list = [];
if ($data['list_grid'] !== '') {
$row = explode(PHP_EOL, $data['list_grid']);
foreach ($row as $r) {
list($field, $title) = explode(":", $r);
$list[$field] = ['field' => $field, 'title' => $title];
if (strrpos($title, "|")) {
$title = explode("|", $title);
$list[$field] = ['field' => $field, 'title' => $title[0], 'format' => $title[1]];
}
}
}
return $list;
}
public function getStatusTextAttr($value, $data) {
$status = array(
0 => '禁用',
1 => '启用',
);
$status = [0 => '禁用', 1 => '启用'];
return $status[$data['status']];
}