diff --git a/.gitignore b/.gitignore index f609c241..e703ab55 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ public/protocol.html runtime/* cert_crmeb copy.key dump.rdb -config/swoole.php \ No newline at end of file +config/swoole.php +.example.env diff --git a/app/common/dao/store/order/StoreOrderDao.php b/app/common/dao/store/order/StoreOrderDao.php index 2af13bd7..924a9d7d 100644 --- a/app/common/dao/store/order/StoreOrderDao.php +++ b/app/common/dao/store/order/StoreOrderDao.php @@ -138,6 +138,9 @@ class StoreOrderDao extends BaseDao ->when(isset($where['order_ids']) && $where['order_ids'] !== '', function ($query) use ($where) { $query->whereIn('order_id', $where['order_ids']); }) + ->when(isset($where['source']) && $where['source'] !== '', function ($query) use ($where) { + $query->whereIn('source', $where['source']); + }) ->when(isset($where['order_id']) && $where['order_id'] !== '', function ($query) use ($where) { if (is_array($where['order_id'])) { $query->whereIn('order_id', $where['order_id']); diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 52b2ba5b..54e00536 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -93,8 +93,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository } if ($cart['product_type'] > 0){ $order_type = $cart['product_type']; - $source = $cart['source']; } + $source = $cart['source']; if ($cart['product_type']<=97 &&$cart['product_type'] > 0 && (($cart['product_type'] != 10 && count($merchantCart['list']) != 1) || count($merchantCartList) != 1)) { throw new ValidateException('活动商品必须单独购买'); } @@ -105,30 +105,24 @@ class StoreOrderCreateRepository extends StoreOrderRepository if ($cart['product']['extend']) { $order_extend = json_decode($cart['product']['extend'], true); } + if ($address) { + if ($cart['source']== 0) { + $userAddressCode = ($address['province_code'] ?? '') . ',' . ($address['city_code'] ?? '') . ',' . ($address['district_code'] ?? '') . ',' . ($address['street_code'] ?? '') . ',' . ($address['village_code'] ?? '') . ',' . ($address['brigade_id'] ?? 0); + $getUrl = env('LOGISTICS_HOST_URL') . '/api/hasCourier?user_address_code=' . $userAddressCode; + $client = new \GuzzleHttp\Client(); + $response = $client->request('GET', $getUrl); + $courierData = json_decode($response->getBody(), true); + if (empty($courierData['code']) || $courierData['code'] != 1) { + throw new ValidateException('该收货区域未设置快递员'); + } + } + } } } // if (($order_type == 98 || $order_type == 99) && count($merchantCartList) > 1) { // throw new ValidateException('采购、委托商品不支持跨店购买'); // } $community = []; - // if ($order_type == 98) { - // $sourceIdArray = []; - // foreach($merchantCart['list'] as $prod){ - // if ($prod['source_id'] > 0) { - // $sourceIdArray[] = $prod['source_id']; - // } - // } - // if (count($sourceIdArray)) { - // if (count(array_unique($sourceIdArray)) > 1) { - // throw new ValidateException('转售商品数据异常'); - // } - // $community = Db::name('Community')->where('community_id', $sourceIdArray[0] ?? 0)->field('community_id, title, image')->fetchSql(false)->find(); - // if ($community) { - // $deliverMethod = Db::name('resale')->where('community_id', $sourceIdArray[0] ?? 0)->value('deliver_method'); - // $deliverMethodArray = explode(',', $deliverMethod); - // } - // } - // } unset($merchantCart, $cart); $order_price = 0; $total_true_price = 0; diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index 1b0e1e3a..c7be71c7 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -1798,7 +1798,6 @@ class StoreOrderRepository extends BaseRepository $arr = $this->getOrderType($status); $query = $this->dao->search($where)->where($arr)->where('StoreOrder.is_del', 0); } - $count = $query->count(); $list = $query->with([ 'orderProduct', diff --git a/app/controller/api/store/order/StoreOrder.php b/app/controller/api/store/order/StoreOrder.php index 1b7feb1d..79f09b98 100644 --- a/app/controller/api/store/order/StoreOrder.php +++ b/app/controller/api/store/order/StoreOrder.php @@ -102,22 +102,6 @@ class StoreOrder extends BaseController if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid))) return app('json')->fail('数据无效'); - if ($addressId) { - $addressRepository = app()->make(UserAddressRepository::class); - $address = $addressRepository->getWhere(['uid' => $uid, 'address_id' => $addressId]); - $cartProductType = Db::name('StoreCart')->where('cart_id', $cartId[0] ?? 0)->value('product_type'); - $deliveryWay = !empty($takes) ? $takes : []; - if ($cartProductType == 0 && count($deliveryWay) == 0) { - $userAddressCode = ($address['province_code'] ?? '') . ',' . ($address['city_code'] ?? '') . ',' . ($address['district_code'] ?? '') . ',' . ($address['street_code'] ?? '') . ',' . ($address['village_code'] ?? '') . ',' . ($address['brigade_id'] ?? 0); - $getUrl = env('LOGISTICS_HOST_URL') . '/api/hasCourier?user_address_code=' . $userAddressCode; - $client = new \GuzzleHttp\Client(); - $response = $client->request('GET', $getUrl); - $courierData = json_decode($response->getBody(), true); - if (empty($courierData['code']) || $courierData['code'] != 1) { - throw new ValidateException('该收货区域未设置快递员'); - } - } - } $groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $takes, $couponIds, $useIntegral, $addressId, $post) { return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post); }); diff --git a/app/controller/api/store/order/StoreOrderBehalf.php b/app/controller/api/store/order/StoreOrderBehalf.php index 2add156b..7cc33d66 100644 --- a/app/controller/api/store/order/StoreOrderBehalf.php +++ b/app/controller/api/store/order/StoreOrderBehalf.php @@ -77,16 +77,19 @@ class StoreOrderBehalf extends BaseController }else{ $where['status']=['=',$status]; } - $column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id'); - if ($column) { - $where['order_id'] = $column; - if($status==0){ - $where['status']=2; - }elseif($status==1){ - $where['status']=3; - } - return app('json')->success($this->repository->getList($where, 1, 100)); + // $column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id'); + // if ($column) { + // $where['order_id'] = $column; + + // } + if ($status == 0) { + $where['status'] = 2; + } elseif ($status == 1) { + $where['status'] = 3; } + $where['source']=103; + return app('json')->success($this->repository->getList($where, $page, $limit)); + } return app('json')->success([]); }