crmeb 多商户1.4自购佣金显示错误问题修复方法

2021-05-19 11:21:33 浏览数 (1)

找到 appcommonrepositoriesuserUserRepository.php 文件,复制下面的内容替换原来的 subOrder 方法(832-869行)

代码语言:javascript复制
    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 即可

来自 “开源世界 ” ,链接:http://ym.baisou.ltd/post/545.html,如需转载,请注明出处,否则将追究法律责任。

0 人点赞