ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,74 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Ui\DataProvider\ActionsLog;
use Amasty\AdminActionsLog\Model\LogEntry\Frontend\LogDetailsFormatter;
use Amasty\AdminActionsLog\Model\LogEntry\LogEntry;
use Amasty\AdminActionsLog\Model\LogEntry\ResourceModel\Grid\CollectionFactory;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
use Magento\Ui\DataProvider\AbstractDataProvider;
class Form extends AbstractDataProvider
{
/**
* @var LogDetailsFormatter
*/
private $logDetailsFormatter;
/**
* @var TimezoneInterface
*/
private $localeDate;
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
CollectionFactory $collectionFactory,
LogDetailsFormatter $logDetailsFormatter,
TimezoneInterface $localeDate,
array $meta = [],
array $data = []
) {
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
$this->collection = $collectionFactory->create();
$this->logDetailsFormatter = $logDetailsFormatter;
$this->localeDate = $localeDate;
}
public function getData()
{
$data = parent::getData();
if ($data['totalRecords'] > 0) {
$data['items'][0]['date'] = $this->localeDate->formatDateTime(
$data['items'][0]['date'],
\IntlDateFormatter::MEDIUM,
\IntlDateFormatter::MEDIUM
);
$logId = (int)$data['items'][0]['id'];
$data[$logId]['log_entry'] = $data['items'][0];
try {
$data[$logId]['log_entry'][LogEntry::LOG_DETAILS] = array_values(
$this->logDetailsFormatter->format($logId)
);
} catch (\RuntimeException $e) {
$data[$logId]['log_entry']['messages'] = [
'isError' => true,
'message' => $e->getMessage()
];
$data[$logId]['log_entry'][LogEntry::LOG_DETAILS] = [];
}
}
return $data;
}
}
@@ -0,0 +1,122 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Ui\DataProvider\ActionsLog;
use Amasty\AdminActionsLog\Model\LogEntry\LogEntry;
use Amasty\AdminActionsLog\Model\LogEntry\ResourceModel\Grid\Collection;
use Magento\Framework\Api\Filter;
use Magento\Framework\Api\FilterBuilder;
use Magento\Framework\Api\Search\ReportingInterface;
use Magento\Framework\Api\Search\SearchCriteriaBuilder;
use Magento\Framework\Api\Search\SearchResultInterface;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Data\CollectionModifierInterface;
use Magento\Framework\DataObject;
use Magento\Framework\Stdlib\DateTime\DateTime;
use Magento\Framework\Stdlib\DateTime\Timezone;
use Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider;
class Listing extends DataProvider
{
/**
* @var CollectionModifierInterface[]
*/
private $collectionModifiers;
/**
* @var DateTime
*/
private $dateTime;
/**
* @var Timezone
*/
private $timezone;
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
ReportingInterface $reporting,
SearchCriteriaBuilder $searchCriteriaBuilder,
RequestInterface $request,
FilterBuilder $filterBuilder,
DateTime $dateTime,
Timezone $timezone,
array $collectionModifiers = [],
array $meta = [],
array $data = []
) {
parent::__construct(
$name,
$primaryFieldName,
$requestFieldName,
$reporting,
$searchCriteriaBuilder,
$request,
$filterBuilder,
$meta,
$data
);
$this->collectionModifiers = $collectionModifiers;
$this->dateTime = $dateTime;
$this->timezone = $timezone;
}
public function addFilter(Filter $filter)
{
if (isset($this->data['config']['filter_url_params'][$filter->getField()])) {
return;
}
switch ($filter->getField()) {
case LogEntry::DATE:
$value = $filter->getValue();
$date = new \DateTime(
$value,
new \DateTimeZone($this->timezone->getConfigTimezone())
);
$date = $this->dateTime->gmtDate('Y-m-d H:i:s', $date);
$filter->setValue($date);
break;
}
parent::addFilter($filter);
}
public function getSearchResult()
{
/** @var Collection $collection */
$collection = parent::getSearchResult();
$namespace = $this->request->getParam('namespace');
if (isset($this->collectionModifiers[$namespace])) {
$this->collectionModifiers[$namespace]->apply($collection);
}
return $collection;
}
protected function searchResultToOutput(SearchResultInterface $searchResult)
{
$logEntryItems = array_reduce($searchResult->getItems(), function (array $carry, DataObject $item): array {
$carry[] = $item->getData();
return $carry;
}, []);
return [
'items' => $logEntryItems,
'totalRecords' => $searchResult->getTotalCount()
];
}
}
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Ui\DataProvider\ActiveSession;
use Amasty\AdminActionsLog\Model\ActiveSession\ResourceModel\CollectionFactory;
use Magento\Ui\DataProvider\AbstractDataProvider;
class Listing extends AbstractDataProvider
{
public function __construct(
CollectionFactory $collectionFactory,
$name,
$primaryFieldName,
$requestFieldName,
array $meta = [],
array $data = []
) {
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
$this->collection = $collectionFactory->create();
}
}
@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Ui\DataProvider\LoginAttempt;
use Amasty\AdminActionsLog\Model\LoginAttempt\ResourceModel\Grid\CollectionFactory;
use Magento\Framework\Api\Search\SearchCriteria;
use Magento\Framework\Api\Search\SearchCriteriaBuilder;
use Magento\Ui\DataProvider\AbstractDataProvider;
class Listing extends AbstractDataProvider
{
/**
* @var SearchCriteria
*/
private $searchCriteria;
public function __construct(
CollectionFactory $collectionFactory,
SearchCriteriaBuilder $searchCriteriaBuilder,
$name,
$primaryFieldName,
$requestFieldName,
array $meta = [],
array $data = []
) {
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
$this->collection = $collectionFactory->create();
$this->searchCriteria = $searchCriteriaBuilder->create()->setRequestName($name);
$this->collection->setSearchCriteria($this->searchCriteria);
}
/**
* @return SearchCriteria
*/
public function getSearchCriteria()
{
return $this->searchCriteria;
}
}
@@ -0,0 +1,110 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Ui\DataProvider\Product\Form\Modifier;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Framework\UrlInterface;
use Magento\Ui\Component\Form;
class History extends AbstractModifier
{
public const GROUP_HISTORY = 'history';
public const GROUP_CONTENT = 'content';
public const SORT_ORDER = 100;
public const LISTING_NS = 'amaudit_product_history_listing';
/**
* @var LocatorInterface
*/
protected $locator;
/**
* @var UrlInterface
*/
protected $urlBuilder;
/**
* @param LocatorInterface $locator
* @param UrlInterface $urlBuilder
*/
public function __construct(
LocatorInterface $locator,
UrlInterface $urlBuilder
) {
$this->locator = $locator;
$this->urlBuilder = $urlBuilder;
}
public function modifyData(array $data)
{
$productId = $this->locator->getProduct()->getId();
$data[$productId][self::DATA_SOURCE_DEFAULT]['current_product_id'] = $productId;
return $data;
}
public function modifyMeta(array $meta)
{
if (!$this->locator->getProduct()->getId()) {
return $meta;
}
$meta[static::GROUP_HISTORY] = [
'children' => [
self::LISTING_NS => [
'arguments' => [
'data' => [
'config' => [
'autoRender' => true,
'componentType' => 'insertListing',
'dataScope' => 'amaudit_product_history_listing',
'externalProvider' => self::LISTING_NS . '.amaudit_actionslog_listing_data_source',
'selectionsProvider' => self::LISTING_NS . '.' . self::LISTING_NS
. '.product_columns.ids',
'ns' => 'amaudit_product_history_listing',
'render_url' => $this->urlBuilder->getUrl('mui/index/render'),
'realTimeLink' => false,
'externalFilterMode' => true,
'imports' => [
'productId' => '${ $.provider }:data.product.current_product_id',
'__disableTmpl' => ['productId' => false]
],
'exports' => [
'productId' => '${ $.externalProvider }:params.current_product_id',
'__disableTmpl' => ['productId' => false]
],
],
],
],
],
],
'arguments' => [
'data' => [
'config' => [
'label' => __('History of Changes'),
'collapsible' => true,
'opened' => false,
'componentType' => Form\Fieldset::NAME,
'sortOrder' =>
$this->getNextGroupSortOrder(
$meta,
static::GROUP_CONTENT,
static::SORT_ORDER
),
],
],
],
];
return $meta;
}
}
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Ui\DataProvider\VisitHistory;
use Amasty\AdminActionsLog\Model\VisitHistoryEntry\ResourceModel\CollectionFactory;
use Magento\Ui\DataProvider\AbstractDataProvider;
class Listing extends AbstractDataProvider
{
public function __construct(
CollectionFactory $collectionFactory,
$name,
$primaryFieldName,
$requestFieldName,
array $meta = [],
array $data = []
) {
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
$this->collection = $collectionFactory->create();
}
}