wang hou sheng 7 months ago
parent 918c9b2706
commit dab573a3ee
  1. 10
      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();

Loading…
Cancel
Save