浏览代码

Merge branch 'feature/clean_visitor_488' into develop

develop
Fab 2 年前
父节点
当前提交
8f1104a17d
共有 6 个文件被更改,包括 46 次插入0 次删除
  1. +1
    -0
      Builder/Order/OrderShopBuilder.php
  2. +1
    -0
      Builder/User/VisitorBuilder.php
  3. +11
    -0
      Repository/Order/OrderShopRepositoryQuery.php
  4. +11
    -0
      Repository/Order/OrderShopStore.php
  5. +14
    -0
      Repository/User/VisitorRepositoryQuery.php
  6. +8
    -0
      Repository/User/VisitorStore.php

+ 1
- 0
Builder/Order/OrderShopBuilder.php 查看文件

@@ -171,6 +171,7 @@ class OrderShopBuilder
}

if (!$cart) {
dump('niche');
$cart = $this->create($section, $user, $visitor);
}


+ 1
- 0
Builder/User/VisitorBuilder.php 查看文件

@@ -49,6 +49,7 @@ class VisitorBuilder
// setCookieVisitor
public function setCookie($response, $cookie): void
{
dump('NICICIIC');
$response->headers->setCookie(
Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'),

+ 11
- 0
Repository/Order/OrderShopRepositoryQuery.php 查看文件

@@ -107,6 +107,12 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
->setParameter('user', $user);
}

public function filterByUserIsNull(): self
{
return $this
->andWhere('.user IS NULL');
}

public function filterByUserEmail(string $email): self
{
$this->joinUser();
@@ -205,6 +211,11 @@ class OrderShopRepositoryQuery extends AbstractRepositoryQuery
return $this->andWhereEqual('visitor', $visitor);
}

public function filterByVisitorIsNull(): self
{
return $this->andWhere('.visitor IS NULL');
}

public function filterByAddress(AddressInterface $address): self
{
return $this

+ 11
- 0
Repository/Order/OrderShopStore.php 查看文件

@@ -662,4 +662,15 @@ class OrderShopStore extends AbstractStore

return true;
}

public function getCartAlone($query = null){

$query = $this->createQuery($query);

$query->filterByAlias(OrderStatusModel::$statusAliasAsCart);
$query->filterByUserIsNull();
$query->filterByVisitorIsNull();

return $query->limit(50000)->find();
}
}

+ 14
- 0
Repository/User/VisitorRepositoryQuery.php 查看文件

@@ -18,4 +18,18 @@ class VisitorRepositoryQuery extends AbstractRepositoryQuery
->andWhere('.cookie LIKE :cookie')
->setParameter('cookie', $cookie);
}

public function filterByLastAccess(\DateTime $lastAccess)
{
return $this
->andWhere('.lastAccess < :lastAccess')
->setParameter('lastAccess', $lastAccess);
}

public function filterByTotalVisit(int $totalVisit)
{
return $this
->andWhere('.totalVisit = :totalVisit')
->setParameter('totalVisit', $totalVisit);
}
}

+ 8
- 0
Repository/User/VisitorStore.php 查看文件

@@ -36,4 +36,12 @@ class VisitorStore extends AbstractStore
$query->filterByCookie($cookie);
return $query->findOne();
}

public function getOldVisitors(\DateTime $lastAccess, $query = null){

$query = $this->createDefaultQuery($query);
$query->filterByLastAccess($lastAccess);
$query->filterByTotalVisit(1);
return $query->limit(50000)->find();
}
}

正在加载...
取消
保存