Browse Source

店铺新用户

master
weigang 5 years ago
parent
commit
7f0a0a52c2
  1. 13
      app/Service/v3/Implementations/UserService.php

13
app/Service/v3/Implementations/UserService.php

@ -35,12 +35,13 @@ class UserService implements UserServiceInterface
public function isStoreFirstOrderToday($user_id, $store_id, $current_order_id, $limit_amount = 3)
{
return !Order::query()
->where(['user_id' => $user_id, 'store_id' => $store_id, 'type' => OrderType::OFFLINE])
->whereIn('state', OrderState::FINISH)
->where('time_add', '>=', date('Y-m-d 00:00:00'))
->where('time_add', '<=', date('Y-m-d 23:59:59'))
->where('money', '>=', $limit_amount)
->where('id', '!=', $current_order_id)
->join('lanzu_order_main as main', 'main.id', '=', 'lanzu_order.order_main_id')
->where(['main.user_id' => $user_id, 'order.store_id' => $store_id, 'main.type' => OrderType::OFFLINE])
->whereIn('main.state', OrderState::FINISH)
->where('order.created_at', '>=', strtotime(date('Y-m-d 00:00:00')))
->where('order.created_at', '<=', strtotime(date('Y-m-d 23:59:59')))
->where('main.money', '>=', $limit_amount)
->where('order.id', '!=', $current_order_id)
->exists();
}
Loading…
Cancel
Save