mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-05-23 15:21:36 +08:00
增加团队关系数据
This commit is contained in:
parent
267a1d69c6
commit
4032ba0c4f
@ -61,14 +61,40 @@ class Admin extends Controller
|
|||||||
* 数据列表处理
|
* 数据列表处理
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
protected function _page_filter(array &$data)
|
protected function _index_page_filter(array &$data)
|
||||||
{
|
{
|
||||||
$this->upgrades = UserUpgradeService::instance()->levels();
|
$this->upgrades = UserUpgradeService::instance()->levels();
|
||||||
UserAdminService::instance()->buildByUid($data, 'pid1', 'from');
|
UserAdminService::instance()->buildByUid($data, 'pid1', 'from');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户上传
|
* 用户团队关系
|
||||||
|
* @auth true
|
||||||
|
* @menu true
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function teams()
|
||||||
|
{
|
||||||
|
$this->title = '用户团队关系';
|
||||||
|
$map = ['pid1' => input('from', 0)];
|
||||||
|
$this->_query($this->table)->where($map)->page(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据列表处理
|
||||||
|
* @param array $data
|
||||||
|
*/
|
||||||
|
protected function _teams_page_filter(array &$data)
|
||||||
|
{
|
||||||
|
$uids = array_unique(array_column($data, 'id'));
|
||||||
|
$subCount = $this->app->db->name($this->table)->whereIn('pid1', $uids)->group('pid1')->column('count(1) count', 'pid1');
|
||||||
|
foreach ($data as &$vo) $vo['subCount'] = $subCount[$vo['id']] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户推荐人
|
||||||
* @auth true
|
* @auth true
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
@ -139,5 +165,4 @@ class Admin extends Controller
|
|||||||
'status.require' => '状态值不能为空!',
|
'status.require' => '状态值不能为空!',
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
51
app/data/view/user/admin/teams.html
Normal file
51
app/data/view/user/admin/teams.html
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{extend name="../../admin/view/main"}
|
||||||
|
|
||||||
|
{block name="content"}
|
||||||
|
<div class="think-box-shadow">
|
||||||
|
<div id="TeamDataTree"></div>
|
||||||
|
<script>
|
||||||
|
(function (inst1) {
|
||||||
|
// 加载指定用户下级
|
||||||
|
function loaded(uid) {
|
||||||
|
var deferred = jQuery.Deferred();
|
||||||
|
$.form.load('{:url("teams")}', {output: 'json', from: uid}, 'get', function (ret) {
|
||||||
|
var data = [];
|
||||||
|
ret.data.list.forEach(function (item) {
|
||||||
|
data.push({
|
||||||
|
id: item.id, spread: true,
|
||||||
|
title: "<div class='notselect'>"
|
||||||
|
+ '[ <b>' + item.id + '</b> ] ' + (item.nickname || item.username || '-')
|
||||||
|
+ "<span class='color-blue'>【 " + item.subCount + " 】</span>"
|
||||||
|
+ "<span class='color-red'> ( <b>" + item.vip_name + "</b>" + " ) </span>"
|
||||||
|
+ (item.pid1 > 0 ? (item.pid0 > 0 ? '<span class="color-green">永久绑定</span>' : '<span class="color-red">临时绑定</span>') : "<span class='color-desc'>无推荐人</span>")
|
||||||
|
+ "<span class='color-blue'>【 累计充值 <b>" + (parseFloat(item.balance_total)) + "</b> 元,已使用 <b>" + parseFloat(item.balance_used) + "</b> 元,剩余可用 <b>" + (parseFloat((parseFloat(item.balance_total) - parseFloat(item.balance_used)).toFixed(2)) + 0) + "</b> 元 】</span>"
|
||||||
|
+ "<span class='color-green'>【 累计返利 <b>" + (parseFloat(item.rebate_total)) + "</b> 元( 未到账 <b>" + parseFloat(item.rebate_lock) + "</b> 元),已提现 <b>" + parseFloat(item.rebate_used) + "</b> 元,剩余可提 <b>" + (parseFloat((parseFloat(item.rebate_total) - parseFloat(item.rebate_used)).toFixed(2)) + 0) + "</b> 元 】</span>"
|
||||||
|
+ "</div>",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return deferred.resolve(data), false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return deferred;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载一级数据
|
||||||
|
loaded(0).then(function (data) {
|
||||||
|
layui.tree.reload('TeamDataTree', {data: data});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化数据树
|
||||||
|
inst1 = layui.tree.render({
|
||||||
|
elem: '#TeamDataTree', id: 'TeamDataTree',
|
||||||
|
click: function (obj) {
|
||||||
|
loaded(obj.data.id).then(function (data) {
|
||||||
|
obj.data.children = data;
|
||||||
|
inst1.reload();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
data: []
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
{/block}
|
Loading…
x
Reference in New Issue
Block a user