后台列表加入自定义字段显示,
先打开 apps/admin/model/content/ContentModel.php
<?php
/**
* @copyright (C)2016-2099 Hnaoyun Inc.
* @author XingMeng
* @email hnxsh@foxmail.com
* @date 2017年12月15日
* 列表文章模型类
*/
namespace appdminmodelcontent;
use coreasicDb;
use coreasicModel;
class ContentModel extends Model
{
protected $scodes = array();
// 获取文章列表
public function getList($mcode, $where = array())
{
$field = array(
'a.id',
'b.name as sortname',
'a.scode',
'c.name as subsortname',
'a.subscode',
'a.title',
'a.subtitle',
'a.date',
'a.sorting',
'a.status',
'a.istop',
'a.isrecommend',
'a.isheadline',
'a.visits',
'a.ico',
'a.pics',
'a.filename',
'a.outlink',
'd.urlname',
'b.filename as sortfilename',
'content_ext.ext_price'//加入要列表出来得自定义字段,注意上面的逗号
);
$join = array(
array(
'ay_content_sort b',
'a.scode=b.scode',
'LEFT'
),
array(
'ay_content_sort c',
'a.subscode=c.scode',
'LEFT'
),
array(
'ay_model d',
'b.mcode=d.mcode',
'LEFT'
),
array(
'ay_content_ext content_ext',
'a.id=content_ext.contentid',
'LEFT'
)//这里加入表,自定义字段 和条件
);
return parent::table('ay_content a')->field($field)
->where("b.mcode='$mcode'")
->where('d.type=2 OR d.type is null ')
->where("a.acode='" . session('acode') . "'")
->where($where)
->join($join)
->order('a.sorting ASC,a.id DESC')
->page()
->select();
}
// 查找指定分类及子类文章
.........
ppsdminiewdefaultcontent/content.html
然后在模板里面修改,对应表格。加入自定义字段,
<td>[value->ext_price]</td>
如果需要判断模型,来显示。
{if(get('mcode')==3)}
<td>[value->ext_price]</td>
{/if}
大家自由组合。
如果要其他字段,根据这个扩展就行!

