diff --git a/app/api/model/Order.php b/app/api/model/Order.php index 6024eb5f..6f72f092 100644 --- a/app/api/model/Order.php +++ b/app/api/model/Order.php @@ -13,6 +13,7 @@ declare (strict_types=1); namespace app\api\model; use app\api\model\{Goods as GoodsModel, OrderRefund as OrderRefundModel, Setting as SettingModel, user\UserCoupon}; +use app\api\model\order\Delivery as DeliveryModel; use app\api\service\{order\source\Factory as OrderSourceFactory, User as UserService}; use app\api\service\Store as StoreService; use app\common\enum\{order\DeliveryStatus as DeliveryStatusEnum, @@ -28,7 +29,6 @@ use app\common\model\Order as OrderModel; use app\common\model\TransferRecord; use app\common\service\{Order as OrderService, order\Complete as OrderCompleteService}; use cores\exception\BaseException; -use app\api\model\order\Delivery as DeliveryModel; /** * 订单模型 @@ -114,11 +114,15 @@ class Order extends OrderModel { // 设置订单类型条件 $dataTypeFilter = $this->getFilterDataType($dataType); + //判断当前用户身份 + $where = []; + if (!UserService::isStore()) { + $where['user_id'] = UserService::getCurrentLoginUserId(); + } // 当前用户ID - $userId = UserService::getCurrentLoginUserId(); $query = $this->with(['goods.image']); $query->where($dataTypeFilter) - ->where('user_id', '=', $userId) + ->where($where) ->where('is_delete', '=', 0) ->order(['create_time' => 'desc']); $list = $query->paginate(15)->toArray();