Commit 70026dad authored by wuxiaoli's avatar wuxiaoli

Merge branch 'dev' of http://rungit.jxdsy.cn:10000/sugar/zhupu into dev

parents 2c057adc 2565c0f6
......@@ -4,6 +4,8 @@ namespace app\admin\controller\family;
use app\common\controller\Backend;
use think\Db;
use \app\admin\model\family\FamilyPeople;
/**
* 姓名卡管理
......@@ -59,6 +61,16 @@ class Namecard extends Backend
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $key => $val){
$list[$key]['p_name'] = null;
if($val['pid']){
$list[$key]['p_name'] = FamilyPeople::where(['user_id' =>$val['pid']])->value('name');
}
$list[$key]['name'] = null;
if($val['user_id']){
$list[$key]['name'] = FamilyPeople::where(['user_id' =>$val['user_id']])->value('name');
}
}
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
......
......@@ -3,8 +3,8 @@
return [
'Id' => 'id',
'Card_number' => '卡号',
'User_id' => '所属用户id',
'Pid' => '父级',
'User_id' => '激活用户',
'Pid' => '分配人',
'Updatetime' => '用户认领时间',
'Activation_code' => '姓名卡激活码',
'Url' => '二维码图片链接',
......
......@@ -58,6 +58,12 @@ class Namecard extends Model
}
public function pid(){
return $this->belongsTo('app\admin\model\family\FamilyPeople','pid','user_id','','left')->setEagerlyType(0);
}
public function user(){
return $this->belongsTo('app\admin\model\family\FamilyPeople','user_id','user_id','','left')->setEagerlyType(0);
}
}
......@@ -139,10 +139,12 @@ class Article extends Api{
->select();
}
foreach ($list as $key => $val){
if($val['user_id']){
$fpeople=Db::name('family_people')->where(['user_id' =>$val['user_id']])->find();
$list[$key]['name'] = $fpeople?$fpeople['name']:'';
$list[$key]['name'] = $fpeople ? $fpeople['name']:'';
$list[$key]['photo'] = $fpeople?$fpeople['photo']:'';
$list[$key]['address'] = $fpeople?$fpeople['address']:'';
}
$image_url = explode(',',$val['image_url']);
$list[$key]['image_count'] = count($image_url);
}
......
......@@ -29,8 +29,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'card_number', title: __('Card_number'), operate: 'LIKE'},
{field: 'user_id', title: __('User_id')},
{field: 'pid', title: __('Pid')},
{field: 'name', title: __('User_id')},
{field: 'p_name', title: __('Pid')},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'activation_code', title: __('Activation_code'), operate: 'LIKE'},
{field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment