Browse Source

限制商户购买自己店铺的商品

master
weigang 5 years ago
parent
commit
cd31a621ba
  1. 9
      app/Service/v3/Implementations/OrderOnlineService.php

9
app/Service/v3/Implementations/OrderOnlineService.php

@ -207,7 +207,14 @@ class OrderOnlineService implements OrderOnlineServiceInterface
$subAmount = 0;
// 店铺分类
$storeType = Store::query()->where(['id' => $storeId])->value('category_id');
$store = Store::query()->where(['id' => $storeId])->first();
// 禁止店铺自己下自己的单
if (in_array($userId, [$store->user_id, $store->admin_id])) {
throw new ErrorCodeException(ErrorCode::ORDER_ONLINE_FAIL, '无法购买自己店铺商品', ['store' => json_encode($store), 'user_id' => $userId, 'store_item' => $storeItem]);
}
$storeType = $store->category_id;
$storeTypeIds[] = (string)$storeType;
// 店铺今天的订单数
$count = Order::query()

Loading…
Cancel
Save