浏览代码

Merge branch 'develop'

master
Guillaume Bourgeois 2 年前
父节点
当前提交
e1a5230a6a
共有 4 个文件被更改,包括 31 次插入28 次删除
  1. +29
    -24
      Builder/User/VisitorBuilder.php
  2. +0
    -2
      Controller/Ticket/TicketAdminController.php
  3. +1
    -1
      Model/Ticket/TicketModel.php
  4. +1
    -1
      Repository/Product/ProductFamilyRepositoryQuery.php

+ 29
- 24
Builder/User/VisitorBuilder.php 查看文件

@@ -16,20 +16,21 @@ class VisitorBuilder
protected EntityManagerInterface $entityManager;

public function __construct(
EntityManagerInterface $entityManager,
CookieComponent $cookieComponent,
ParameterBagInterface $parameterBag
) {
EntityManagerInterface $entityManager,
CookieComponent $cookieComponent,
ParameterBagInterface $parameterBag
)
{
$this->entityManager = $entityManager;
$this->cookieComponent = $cookieComponent;
$this->parameterBag = $parameterBag;
}

// addVisitor
public function create(string $cookie, string $ip)
public function create(string $cookieValue, string $ip)
{
$visitorFactory = new VisitorFactory();
$visitor = $visitorFactory->create($cookie, $ip);
$visitor = $visitorFactory->create($cookieValue, $ip);

$this->entityManager->create($visitor);
$this->entityManager->flush();
@@ -37,9 +38,11 @@ class VisitorBuilder

public function update(VisitorInterface $visitor)
{
$totalVisit = $visitor->getTotalVisit() + 1;
if($visitor->getLastAccess() < new \DateTime('-1 hour')) {
$totalVisit = $visitor->getTotalVisit() + 1;
$visitor->setTotalVisit($totalVisit);
}

$visitor->setTotalVisit($totalVisit);
$visitor->setLastAccess(new \DateTime());

$this->entityManager->update($visitor);
@@ -47,30 +50,32 @@ class VisitorBuilder
}

// setCookieVisitor
public function setCookie($response, $cookie): void
public function setCookie($response, $cookieValue): Cookie
{
$response->headers->setCookie(
Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'),
$this->cookieComponent->cryptCookie($cookie),
new \DateTime('+2 months'),
'/',
$this->cookieComponent->getCookieDomain()
)
$cookie = Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'),
$this->cookieComponent->cryptCookie($cookieValue),
new \DateTime('+2 months'),
'/',
$this->cookieComponent->getCookieDomain()
);

$response->headers->setCookie($cookie);

return $cookie;
}

// updateVisitorCookie
public function updateCookie($response): void
{
$response->headers->setCookie(
Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'),
$this->cookieComponent->cryptCookie($this->getVisitorCurrent()->getCookie()),
new \DateTime('+2 months'),
'/',
$this->cookieComponent->getCookieDomain()
)
Cookie::create(
$this->parameterBag->get('app.cookie_name_visitor'),
$this->cookieComponent->cryptCookie($this->getVisitorCurrent()->getCookie()),
new \DateTime('+2 months'),
'/',
$this->cookieComponent->getCookieDomain()
)
);
}


+ 0
- 2
Controller/Ticket/TicketAdminController.php 查看文件

@@ -16,7 +16,6 @@ abstract class TicketAdminController extends SovTicketAdminController
{
return $this->getTicketContainer()
->getFactory()
->setSection($this->getSectionCurrent())
->setMerchant($this->getMerchantCurrent())
->create();
}
@@ -25,7 +24,6 @@ abstract class TicketAdminController extends SovTicketAdminController
{
return $this->getTicketContainer()->getFieldDefinition()
->setMerchant($this->getMerchantCurrent())
->setSection($this->getSectionCurrent())
->getFields($pageName);
}


+ 1
- 1
Model/Ticket/TicketModel.php 查看文件

@@ -13,7 +13,7 @@ use Lc\SovBundle\Model\Ticket\TicketModel as SovTicketModel;
/**
* @ORM\MappedSuperclass()
*/
abstract class TicketModel extends SovTicketModel implements FilterSectionInterface, FilterMerchantInterface
abstract class TicketModel extends SovTicketModel implements FilterMerchantInterface
{
const TYPE_PRODUCT_UNAVAILABLE = 'product-unavailable';
const TYPE_PRODUCT_ERROR = 'product-error';

+ 1
- 1
Repository/Product/ProductFamilyRepositoryQuery.php 查看文件

@@ -55,7 +55,7 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery

$this->leftJoin('.qualityLabels', 'qualityLabels');
if ($addSelect) {
$this->addSelect('qualityLabels');
//$this->addSelect('qualityLabels');
}
}
return $this;

正在加载...
取消
保存