一、文件地址:
app/services/agent/AgentManageServices.php
方法名:agentSystemPage()
替换此方法如下代码
public function agentSystemPage(array $where, $is_page = true)
{
/** @var UserServices $userServices */
$userServices = app()->make(UserServices::class);
$data = $userServices->getAgentUserList($where, '*', $is_page);
/** @var UserBrokerageServices $userBrokerageServices */
$userBrokerageServices = app()->make(UserBrokerageServices::class);
$uids = array_column($data['list'], 'uid');
$spreadCount = $userServices->search(['spread_uid'=>$uids])
->group('spread_uid')
->field('uid,count(*) as spread_count,spread_uid')
->select()->toArray();
$spreadCount = array_column($spreadCount, 'spread_count', 'spread_uid');
foreach ($data['list'] as &$item) {
$item['headimgurl'] = $item['avatar'];
$item['extract_count_price'] = $item['extract'][0]['extract_count_price'] ?? 0;
$item['extract_count_num'] = $item['extract'][0]['extract_count_num'] ?? 0;
$item['spread_name'] = $item['spreadUser']['nickname'] ?? '';
if ($item['spread_name']) {
$item['spread_name'] .= '/' . $item['spread_uid'];
}
$item['spread_count'] = $spreadCount[$item['uid']] ?? 0 ;
$item['order_price'] = $item['order'][0]['order_price'] ?? 0;
$item['order_count'] = $item['order'][0]['order_count'] ?? 0;
$item['broken_commission'] = $userBrokerageServices->getUserFrozenPrice((int)$item['uid']);
if ($item['broken_commission'] < 0)
$item['broken_commission'] = 0;
$item['brokerage_money'] = $item['brokerage'][0]['brokerage_money'] ?? 0;
if ($item['brokerage_price'] > $item['broken_commission'])
$item['brokerage_money'] = bcsub($item['brokerage_price'], $item['broken_commission'], 2);
else
$item['brokerage_money'] = 0;
$item['new_money'] = $item['brokerage_price'];
unset($item['extract'], $item['order'], $item['bill'], $item['spreadUser'], $item['spreadCount']);
}
return $data;
}
如图:
二、文件地址:
app/services/user/UserServices.php
方法名:getUserSpredadUids()
替换此方法,代码如下:
public function getUserSpredadUids(int $uid, int $type = 0)
{
$uids = $this->dao->getColumn(['spread_uid' => $uid], 'uid');
if ($type === 1) {
return $uids;
}
if ($uids) {
$uidsTwo = $this->dao->getColumn([['spread_uid', 'in', $uids]], 'uid');
if ($type === 2) {
return $uidsTwo;
}
$brokerage_level = sys_config('brokerage_level');
if ($uidsTwo && $brokerage_level == 2) {
$uids = array_merge($uids, $uidsTwo);
}
}
return $uids;
}
如下图
三、文件地址:
app/model/user/User.php
方法名:searchSpreadUidAttr
修改此方法.代码如下:
public function searchSpreadUidAttr($query, $value)
{
if ($value !== '') {
if (is_array($value)) {
$query->whereIn('spread_uid', $value);
} else {
$query->where('spread_uid', $value);
}
}
}
如下图
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}