作者 魏强

online

... ... @@ -38,7 +38,7 @@ class Group extends Backend
public function index()
{
//当前是否为关联查询
$this->relationSearch = true;
$this->relationSearch = false;
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax())
... ... @@ -50,20 +50,20 @@ class Group extends Backend
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->with(['area'])
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->with(['area'])
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
foreach ($list as $row) {
$row->visible(['group_image','name','intro','qrcodeimage']);
}
$list = collection($list)->toArray();
... ...
<?php
return [
'Id' => 'ID',
'Group_image' => '图片地址',
'Name' => '群名称',
'Intro' => '群简介',
'Area_id' => '区域id',
'Media_id' => '微信永久素材id',
'Qrcodeimage' => '二维码图片',
'Area.id' => 'ID',
'Area.pid' => '父id',
'Area.shortname' => '简称',
'Area.name' => '名称',
'Area.mergename' => '全称',
'Area.level' => '层级 0 1 2 省市区县',
'Area.pinyin' => '拼音',
'Area.code' => '长途区号',
'Area.zip' => '邮编',
'Area.first' => '首字母',
'Area.lng' => '经度',
'Area.lat' => '纬度'
'Id' => 'ID',
'Group_image' => '图片地址',
'Name' => '群名称',
'Intro' => '群简介',
'Area_id' => '区域id',
'Media_id' => '微信永久素材id',
'Qrcodeimage' => '二维码图片'
];
... ...
... ... @@ -37,8 +37,4 @@ class Group extends Model
public function area()
{
return $this->belongsTo('Area', 'area_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}
... ...
... ... @@ -29,7 +29,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Area_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-area_id" data-source="area/index" class="form-control selectpage" name="row[area_id]" type="text" value="">
<input id="c-area_id" data-rule="required" data-source="area/index" class="form-control selectpage" name="row[area_id]" type="text" value="">
</div>
</div>
<div class="form-group">
... ...
... ... @@ -24,25 +24,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'group_image', title: __('Group_image'), events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'name', title: __('Name')},
{field: 'intro', title: __('Intro')},
{field: 'area_id', title: __('Area_id')},
{field: 'media_id', title: __('Media_id')},
{field: 'qrcodeimage', title: __('Qrcodeimage'), events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'area.id', title: __('Area.id')},
{field: 'area.pid', title: __('Area.pid')},
{field: 'area.shortname', title: __('Area.shortname')},
{field: 'area.name', title: __('Area.name')},
{field: 'area.mergename', title: __('Area.mergename')},
{field: 'area.level', title: __('Area.level')},
{field: 'area.pinyin', title: __('Area.pinyin')},
{field: 'area.code', title: __('Area.code')},
{field: 'area.zip', title: __('Area.zip')},
{field: 'area.first', title: __('Area.first')},
{field: 'area.lng', title: __('Area.lng')},
{field: 'area.lat', title: __('Area.lat')},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
... ...