更新时间格式bug

This commit is contained in:
2017-01-27 00:05:54 +08:00
parent bcad70a714
commit 0ecf830ff9
7 changed files with 94 additions and 20 deletions

View File

@@ -14,7 +14,49 @@ class Form extends Admin {
//自定义表单
public function index(){
$this->assign('meta_title','自定义表单');
$list = array();
$data = array(
'list' => $list,
//'page' => $list->render()
);
$this->setMeta('自定义表单');
$this->assign($data);
return $this->fetch();
}
/**
* 添加表单
*/
public function add(){
if (IS_POST) {
# code...
}else{
return $this->fetch('public/edit');
}
}
/**
* 编辑表单
*/
public function edit(){
if (IS_POST) {
# code...
}else{
return $this->fetch('public/edit');
}
}
/**
* 删除表单
*/
public function del(){
$id = $this->getArrayParam('id');
$result = false;
if (false !== $result) {
return $this->success('删除成功!');
}else{
return $this->error('删除失败!');
}
}
}

View File

@@ -3,4 +3,33 @@
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
{/block}
{block name="body"}
<div class="main-box clearfix">
<header class="main-box-header clearfix">
<div class="pull-left">
<h2>{$meta_title}</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{:url('add')}">新 增</a>
<button class="btn btn-danger ajax-post confirm" url="{:url('del')}" target-form="ids">删 除</button>
</div>
</header>
<div class="main-box-body clearfix">
<div class="table-responsive clearfix">
<table class="table table-hover">
<thead>
<tr>
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
<th width="60">ID</th>
<th>名称</th>
<th>排序</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
{/block}

View File

@@ -30,33 +30,33 @@
</thead>
<tbody>
{notempty name="list"}
{volist name="list" id="vo"}
{volist name="list" id="item"}
<tr>
<td>
<input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" />
<input class="ids" type="checkbox" name="ids[]" value="{$item['id']}" />
</td>
<td>{$vo.id}</td>
<td>{$vo.name}</td>
<td>{$item['id']}</td>
<td>{$item['name']}</td>
<td>
<a data-id="{$vo.id}" href="{:url('model/edit?id='.$vo['id'])}">{$vo.title}</a>
<a data-id="{$item.id}" href="{:url('model/edit?id='.$item['id'])}">{$item.title}</a>
</td>
<td>
<span>{$vo.create_time|time_format}</span>
<span>{$item.create_time|time_format}</span>
</td>
<td>
{if $vo['status']}
<span class="label label-primary">{$vo['status_text']}</span>
{if $item['status']}
<span class="label label-primary">{$item['status_text']}</span>
{else/}
<span class="label label-danger">{$vo['status_text']}</span>
<span class="label label-danger">{$item['status_text']}</span>
{/if}
</td>
<td>
<a href="{:url('admin/attribute/index?model_id='.$vo['id'])}">字段</a>
<a href="{:url('model/status?ids='.$vo['id'].'&status='.abs(1-$vo['status']))}" class="ajax-get">{$vo.status|show_status_op}</a>
<a href="{:url('model/edit?id='.$vo['id'])}">编辑</a>
<a href="{:url('model/del?id='.$vo['id'])}" class="confirm ajax-get">删除</a>
{if $vo['extend']}
<a href="{:url('admin/content/index?model_id='.$vo['id'])}">数据</a>
<a href="{:url('admin/attribute/index?model_id='.$item['id'])}">字段</a>
<a href="{:url('model/status?ids='.$item['id'].'&status='.abs(1-$item['status']))}" class="ajax-get">{$item['status']|show_status_op}</a>
<a href="{:url('model/edit?id='.$item['id'])}">编辑</a>
<a href="{:url('model/del?id='.$item['id'])}" class="confirm ajax-get">删除</a>
{if $item['extend']}
<a href="{:url('admin/content/index?model_id='.$item['id'])}">数据</a>
{/if}
</td>
</tr>

View File

@@ -17,7 +17,9 @@ class Model extends Base{
protected $auto = [ 'update_time', 'field_sort', 'attribute_list'];
protected $insert = ['name', 'create_time', 'status'=>1];
protected $type = array(
'id' => 'integer'
'id' => 'integer',
'create_time' => 'integer',
'update_time' => 'integer'
);
public function setFieldSortAttr($value){

View File

@@ -20,6 +20,7 @@ class User extends Base{
protected $type = array(
'uid' => 'integer',
'reg_time' => 'integer'
);
protected $insert = array('salt', 'password', 'status', 'reg_time');
protected $update = array();

View File

@@ -97,7 +97,7 @@ return array(
// 日志保存目录
'path' => LOG_PATH,
),
'app_trace' => true,
'app_trace' => false,
// 页面Trace信息
'trace' => array(
//支持Html,Console 设为false则不显示

View File

@@ -24,8 +24,8 @@
<li>
<a href="{:url('index/content/detail?model_id='.$item['model_id'],array('id'=>$item['id']))}">
<div class="time">
<span class="day">{$item['create_time']|date='Y-m-d H:i:s',###}</span>
<span class="moth">{$item['create_time']|date='Y-m-d H:i:s',###}</span>
<span class="day">{$item['create_time']|date='m',###}</span>
<span class="moth">{$item['create_time']|date='d',###}</span>
</div>
<div class="info">
<div class="tit">{$item['title']|msubstr=###,0,80}</div>