找到 \app\common\repositories\user\UserRepository.php
文件,复制下面的内容替换原来的 subOrder
方法(832-869行)
public function subOrder($uid, $page, $limit, array $where = [])
{
if (isset($where['level'])) {
if (!$where['level']) {
$ids = $this->dao->getSubIds($uid);
$subIds = $ids ? $this->dao->getSubAllIds($ids) : [];
$ids[] = $uid;
} else if ($where['level'] == 2) {
$ids = $this->dao->getSubIds($uid);
$subIds = $ids ? $this->dao->getSubAllIds($ids) : [];
$ids = [];
} else {
$ids = $this->dao->getSubIds($uid);
$subIds = [];
$ids[] = $uid;
}
} else {
$ids = $this->dao->getSubIds($uid);
$subIds = $ids ? $this->dao->getSubAllIds($ids) : [];
$ids[] = $uid;
}
$all = array_unique(array_merge($ids, $subIds));
if (!count($all)) return ['count' => 0, 'list' => []];
$query = app()->make(StoreOrderRepository::class)->usersOrderQuery($where, $all);
$count = $query->count();
$list = $query->page($page, $limit)->field('uid,order_sn,pay_time,extension_one,extension_two,is_selfbuy')->with(['user' => function ($query) {
$query->field('avatar,nickname,uid');
}])->select()->toArray();
foreach ($list as $k => $item) {
if ($item['is_selfbuy']) {
$list[$k]['brokerage'] = $item['uid'] == $uid ? $item['extension_one'] : $item['extension_two'];
} else {
$list[$k]['brokerage'] = in_array($item['uid'], $ids) ? $item['extension_one'] : $item['extension_two'];
}
unset($list[$k]['extension_one'], $list[$k]['extension_two']);
}
return compact('count', 'list');
}
修改完毕后重启 swoole
即可
{{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}}