diff --git a/app/api/model/dealer/Order.php b/app/api/model/dealer/Order.php index 775b7870..0b41c3b9 100644 --- a/app/api/model/dealer/Order.php +++ b/app/api/model/dealer/Order.php @@ -15,6 +15,7 @@ namespace app\api\model\dealer; use app\api\service\User as UserService; use app\common\model\Order as OrderModel; use app\common\model\dealer\Order as DealerOrderModel; +use app\api\model\Order as OrderApiModel; /** * 分销商订单模型 @@ -55,12 +56,17 @@ class Order extends DealerOrderModel ->paginate(15); // 数据整理 foreach ($list as &$item) { + $with = ['goods' => ['image'], 'extract_shop', 'delivery.express']; + $where = ['order_id' => $item['order_id']]; + // 查询订单记录 + $order_goods = OrderApiModel::detail($where, $with); // 我的佣金 $money = [ $item['first_user_id'] => $item['first_money'], $item['second_user_id'] => $item['second_money'], $item['third_user_id'] => $item['third_money'], ]; + $item['goods'] = $order_goods['goods']; $item['my_money'] = $money[$userId]; } return $list; @@ -97,11 +103,12 @@ class Order extends DealerOrderModel // 分销订单模型 $model = new static; // 分销商基本设置 - $setting = Setting::getItem('basic'); + $setting = Setting::getItem('basic'); // 是否开启分销功能 if (!$setting['is_open']) { return false; } + // 获取当前买家的所有上级分销商用户id $dealerUser = $model->getDealerUserId((int)$order['user_id'], (int)$setting['level'], (bool)$setting['self_buy']); // 非分销订单