This commit is contained in:
mkm 2024-01-05 11:24:04 +08:00
parent 6bfed4f836
commit 6e672fa89b
6 changed files with 30 additions and 46 deletions

3
.gitignore vendored

@ -17,4 +17,5 @@ public/protocol.html
runtime/*
cert_crmeb copy.key
dump.rdb
config/swoole.php
config/swoole.php
.example.env

@ -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']);

@ -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;

@ -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',

@ -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);
});

@ -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([]);
}