分销订单查询带上商品信息

pull/1/head
674780036@qq.com 11 months ago
parent 9a3174cba7
commit 8f90a6251e
  1. 9
      app/api/model/dealer/Order.php

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

Loading…
Cancel
Save