This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,155 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Api\Data;
interface WebinarInterface
{
const CUSTOMER_ID = 'customer_id';
const EMAIL = 'email';
const NAME = 'name';
const MOBILE = 'mobile';
const COMPANY = 'company';
const TITLE = 'title';
const STATE = 'state';
const CITY = 'city';
const STREET = 'street';
const ZIP = 'zip';
const FROM = 'from';
const REMARK = 'remark';
/**
* Get email
* @return string|null
*/
public function getEmail();
/**
* Set email
* @param string $email
* @return self
*/
public function setEmail(string $email);
/**
* @param int $customerId
* @return self
*/
public function setCustomerId(int $customerId);
/**
* @return int | null
*/
public function getCustomerId(): ?int;
/**
* @param string $name
* @return self
*/
public function setName(string $name);
/**
* @return string | null
*/
public function getName(): ?string;
/**
* @param string $mobile
* @return self
*/
public function setMobile(string $mobile);
/**
* @return string | null
*/
public function getMobile();
/**
* @param string $company
* @return self
*/
public function setCompany(string $company);
/**
* @return string | null
*/
public function getCompany();
/**
* @param string $title
* @return self
*/
public function setTitle(string $title);
/**
* @return string | null
*/
public function getTitle();
/**
* @param string $state
* @return self
*/
public function setState(string $state);
/**
* @return string | null
*/
public function getState();
/**
* @param string $city
* @return self
*/
public function setCity(string $city);
/**
* @return string | null
*/
public function getCity();
/**
* @param string $street
* @return self
*/
public function setStreet(string $street);
/**
* @return string | null
*/
public function getStreet();
/**
* @param string $zip
* @return self
*/
public function setZip(string $zip);
/**
* @return string | null
*/
public function getZip();
/**
* @param string $from
* @return self
*/
public function setFrom(string $from);
/**
* @return string | null
*/
public function getFrom();
/**
* @param string $remark
* @return self
*/
public function setRemark(string $remark);
/**
* @return string | null
*/
public function getRemark();
}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Api\Data;
interface WebinarSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface
{
/**
* Get Webinar list.
* @return \Stemcell\Webinar\Api\Data\WebinarInterface[]
*/
public function getItems();
/**
* Set entity_id list.
* @param \Stemcell\Webinar\Api\Data\WebinarInterface[] $items
* @return $this
*/
public function setItems(array $items);
}
@@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Api;
use Magento\Framework\Api\SearchCriteriaInterface;
interface WebinarRepositoryInterface
{
/**
* Save Webinar
* @param \Stemcell\Webinar\Api\Data\WebinarInterface $webinar
* @return \Stemcell\Webinar\Api\Data\WebinarInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function save(
\Stemcell\Webinar\Api\Data\WebinarInterface $webinar
);
/**
* @param $value
* @param $field
*
* @return \Stemcell\Webinar\Api\Data\WebinarInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function get($value, $field);
/**
* Retrieve Webinar matching the specified criteria.
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
* @return \Stemcell\Webinar\Api\Data\WebinarSearchResultsInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getList(
\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
);
/**
* Delete Webinar
* @param \Stemcell\Webinar\Api\Data\WebinarInterface $webinar
* @return bool true on success
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function delete(
\Stemcell\Webinar\Api\Data\WebinarInterface $webinar
);
/**
* Delete Webinar by ID
* @param string $webinarId
* @return bool true on success
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function deleteById($webinarId);
}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Block\Adminhtml\Index;
class Index extends \Magento\Backend\Block\Template
{
/**
* Constructor
*
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
array $data = []
) {
parent::__construct($context, $data);
}
}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Block\Index;
class Save extends \Magento\Framework\View\Element\Template
{
/**
* Constructor
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
array $data = []
) {
parent::__construct($context, $data);
}
}
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Controller\Adminhtml\Index;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\View\Result\PageFactory;
class Index implements HttpGetActionInterface
{
/**
* @var PageFactory
*/
protected $resultPageFactory;
/**
* Constructor
*
* @param PageFactory $resultPageFactory
*/
public function __construct(PageFactory $resultPageFactory)
{
$this->resultPageFactory = $resultPageFactory;
}
/**
* Execute view action
*
* @return ResultInterface
*/
public function execute()
{
return $this->resultPageFactory->create();
}
}
@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Controller\Adminhtml;
use Magento\Framework\App\ActionFactory;
use Magento\Framework\App\Action\Forward;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\RouterInterface;
class Router implements RouterInterface
{
protected $transportBuilder;
protected $actionFactory;
/**
* Router constructor
*
* @param ActionFactory $actionFactory
*/
public function __construct(ActionFactory $actionFactory)
{
$this->actionFactory = $actionFactory;
}
/**
* {@inheritdoc}
*/
public function match(RequestInterface $request)
{
$result = null;
if ($request->getModuleName() != 'example' && $this->validateRoute($request)) {
$request->setModuleName('example')
->setControllerName('index')
->setActionName('index')
->setParam('param', 3);
$result = $this->actionFactory->create(Forward::class);
}
return $result;
}
/**
* @param RequestInterface $request
* @return bool
*/
public function validateRoute(RequestInterface $request)
{
$identifier = trim($request->getPathInfo(), '/');
return strpos($identifier, 'webinar') !== false;
}
}
@@ -0,0 +1,117 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Controller\Index;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\App\CsrfAwareActionInterface;
use Magento\Framework\App\Request\InvalidRequestException;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Phrase;
use Magento\Framework\Validator\Regex;
use Stemcell\Customer\Api\Data\Http\JsonResponse;
use Stemcell\Webinar\Model\WebinarFactory;
use Stemcell\Webinar\Model\WebinarRepository;
use Magento\Framework\Validator\ValidatorChain;
use Magento\Framework\Validator\NotEmpty;
class Save implements HttpPostActionInterface, CsrfAwareActionInterface
{
protected JsonFactory $jsonResponse;
protected WebinarFactory $webinarFactory;
protected JsonResponse $jsonResponseData;
protected WebinarRepository $repository;
protected RequestInterface $request;
/**
* @param JsonFactory $jsonResponse
* @param WebinarFactory $webinarFactory
* @param JsonResponse $jsonResponse
* @param WebinarRepository $repository
*/
public function __construct(
JsonFactory $jsonResponse,
WebinarFactory $webinarFactory,
JsonResponse $jsonResponseData,
WebinarRepository $repository,
RequestInterface $request
)
{
$this->jsonResponse = $jsonResponse;
$this->jsonResponseData = $jsonResponseData;
$this->webinarFactory = $webinarFactory;
$this->repository = $repository;
$this->request = $request;
}
protected function validate(){
$validateData = ['name', 'email', 'mobile', 'company'];
$errors = [];
foreach ($validateData as $item) {
$this->request->setParam($item, trim($this->request->getParam($item)));
if (!ValidatorChain::is($this->request->getParam($item), NotEmpty::class)) {
$errors[] = $item.' 是必填项';
}
}
// if (!preg_match('/^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/', $this->request->getParam('email'))) {
// $errors[] = '请输入有效的邮箱';
// }
return $errors;
}
/**
* Execute view action
*
* @return ResultInterface
*/
public function execute()
{
$jsonResponse = $this->jsonResponse->create();
$errors = $this->validate();
if (!empty($errors)) {
return $jsonResponse->setData($this->jsonResponseData->setErrors(true)->setData($errors));
}
$message = null;
try {
try {
$webinar = $this->repository->get($this->request->getParam('email'), 'email');
$id = $webinar->getId();
$webinar = $webinar->setData($this->request->getParams())->setId($id);
} catch (NoSuchEntityException $exception) {
$webinar = $this->webinarFactory->create()->setData($this->request->getParams());
}
$this->repository->save($webinar);
$error = false;
} catch (LocalizedException $exception) {
$error = true;
$message = $exception->getMessage();
}
return $jsonResponse->setData($this->jsonResponseData
->setErrors($error)
->setMessages([$message])
);
}
public function createCsrfValidationException(RequestInterface $request): ?InvalidRequestException
{
$phrase = new Phrase('Invalid Form Key. Please refresh the page.');
$responseData = $this->jsonResponseData->setErrors(true)->setMessages([
$phrase->getText()
]);
return new InvalidRequestException(
$this->jsonResponse->create()->setData($responseData)
);
}
public function validateForCsrf(RequestInterface $request): ?bool
{
return true;
}
}
@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Controller;
use Magento\Framework\App\ActionFactory;
use Magento\Framework\App\Action\Forward;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\RouterInterface;
class Router implements RouterInterface
{
protected $transportBuilder;
protected $actionFactory;
/**
* Router constructor
*
* @param ActionFactory $actionFactory
*/
public function __construct(ActionFactory $actionFactory)
{
$this->actionFactory = $actionFactory;
}
/**
* {@inheritdoc}
*/
public function match(RequestInterface $request)
{
$result = null;
if ($request->getModuleName() != 'example' && $this->validateRoute($request)) {
$request->setModuleName('example')
->setControllerName('index')
->setActionName('index')
->setParam('param', 3);
$result = $this->actionFactory->create(Forward::class);
}
return $result;
}
/**
* @param RequestInterface $request
* @return bool
*/
public function validateRoute(RequestInterface $request)
{
$identifier = trim($request->getPathInfo(), '/');
return strpos($identifier, 'webinar') !== false;
}
}
@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Model\ResourceModel;
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
class Webinar extends AbstractDb
{
/**
* @inheritDoc
*/
protected function _construct()
{
$this->_init('webinar_request', 'entity_id');
}
}
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Model\ResourceModel\Webinar;
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
class Collection extends AbstractCollection
{
/**
* @inheritDoc
*/
protected $_idFieldName = 'entity_id';
/**
* @inheritDoc
*/
protected function _construct()
{
$this->_init(
\Stemcell\Webinar\Model\Webinar::class,
\Stemcell\Webinar\Model\ResourceModel\Webinar::class
);
}
}
+224
View File
@@ -0,0 +1,224 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Model;
use Magento\Customer\Model\Session;
use Magento\Framework\Data\Collection\AbstractDb;
use Magento\Framework\Model\AbstractModel;
use Magento\Framework\Model\Context;
use Magento\Framework\Model\ResourceModel\AbstractResource;
use Magento\Framework\Registry;
use Stemcell\Webinar\Api\Data\WebinarInterface;
class Webinar extends AbstractModel implements WebinarInterface
{
protected Session $customerSession;
public function __construct(
Context $context,
Registry $registry,
Session $customerSession,
AbstractResource $resource = null,
AbstractDb $resourceCollection = null,
array $data = []
) {
$this->customerSession = $customerSession;
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}
/**
* @inheritDoc
*/
public function _construct(): void
{
$this->_init(\Stemcell\Webinar\Model\ResourceModel\Webinar::class);
}
/**
* @inheritDoc
*/
public function getEmail()
{
return $this->getData(self::EMAIL);
}
/**
* @inheritDoc
*/
public function setEmail($email)
{
return $this->setData(self::EMAIL, $email);
}
/**
* @inheritDoc
*/
public function setCustomerId(int $customerId)
{
return $this->setData(self::CUSTOMER_ID, $this->customerSession->getCustomerId());
}
/**
* @inheritDoc
*/
public function getCustomerId(): ?int
{
return $this->getData(self::CUSTOMER_ID);
}
/**
* @inheritDoc
*/
public function setName(string $name)
{
return $this->setData(self::NAME, $name);
}
/**
* @inheritDoc
*/
public function getName(): ?string
{
return $this->getData(self::NAME);
}
/**
* @inheritDoc
*/
public function setMobile(string $mobile)
{
return $this->setData(self::MOBILE, $mobile);
}
/**
* @inheritDoc
*/
public function getMobile()
{
return $this->getData(self::MOBILE);
}
/**
* @inheritDoc
*/
public function setCompany(string $company)
{
return $this->setData(self::COMPANY, $company);
}
/**
* @inheritDoc
*/
public function getCompany()
{
return $this->getData(self::COMPANY);
}
/**
* @inheritDoc
*/
public function setTitle(string $title)
{
return $this->setData(self::TITLE, $title);
}
/**
* @inheritDoc
*/
public function getTitle()
{
return $this->getData(self::TITLE);
}
/**
* @inheritDoc
*/
public function setState(string $state)
{
return $this->setData(self::STATE, $state);
}
/**
* @inheritDoc
*/
public function getState()
{
return $this->getData(self::STATE);
}
/**
* @inheritDoc
*/
public function setCity(string $city)
{
return $this->setData(self::CITY, $city);
}
/**
* @inheritDoc
*/
public function getCity()
{
return $this->getData(self::CITY);
}
/**
* @inheritDoc
*/
public function setStreet(string $street)
{
return $this->setData(self::STREET, $street);
}
/**
* @inheritDoc
*/
public function getStreet()
{
return $this->getData(self::STREET);
}
/**
* @inheritDoc
*/
public function setZip(string $zip)
{
return $this->setData(self::ZIP, $zip);
}
/**
* @inheritDoc
*/
public function getZip()
{
return $this->getData(self::ZIP);
}
/**
* @inheritDoc
*/
public function setFrom(string $from)
{
return $this->setData(self::FROM, $from);
}
/**
* @inheritDoc
*/
public function getFrom()
{
return $this->getData(self::FROM);
}
/**
* @inheritDoc
*/
public function setRemark(string $remark)
{
return $this->setData(self::REMARK, $remark);
}
/**
* @inheritDoc
*/
public function getRemark()
{
return $this->getData(self::REMARK);
}
}
@@ -0,0 +1,148 @@
<?php
declare(strict_types=1);
namespace Stemcell\Webinar\Model;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Exception\CouldNotDeleteException;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\NoSuchEntityException;
use Stemcell\Webinar\Api\Data\WebinarInterface;
use Stemcell\Webinar\Api\Data\WebinarInterfaceFactory;
use Stemcell\Webinar\Api\Data\WebinarSearchResultsInterfaceFactory;
use Stemcell\Webinar\Api\WebinarRepositoryInterface;
use Stemcell\Webinar\Model\ResourceModel\Webinar as ResourceWebinar;
use Stemcell\Webinar\Model\ResourceModel\Webinar\CollectionFactory as WebinarCollectionFactory;
class WebinarRepository implements WebinarRepositoryInterface
{
/**
* @var WebinarCollectionFactory
*/
protected $webinarCollectionFactory;
/**
* @var WebinarInterfaceFactory
*/
protected $webinarFactory;
/**
* @var CollectionProcessorInterface
*/
protected $collectionProcessor;
/**
* @var ResourceWebinar
*/
protected $resource;
/**
* @var Webinar
*/
protected $searchResultsFactory;
/**
* @param ResourceWebinar $resource
* @param WebinarInterfaceFactory $webinarFactory
* @param WebinarCollectionFactory $webinarCollectionFactory
* @param WebinarSearchResultsInterfaceFactory $searchResultsFactory
* @param CollectionProcessorInterface $collectionProcessor
*/
public function __construct(
ResourceWebinar $resource,
WebinarInterfaceFactory $webinarFactory,
WebinarCollectionFactory $webinarCollectionFactory,
WebinarSearchResultsInterfaceFactory $searchResultsFactory,
CollectionProcessorInterface $collectionProcessor
) {
$this->resource = $resource;
$this->webinarFactory = $webinarFactory;
$this->webinarCollectionFactory = $webinarCollectionFactory;
$this->searchResultsFactory = $searchResultsFactory;
$this->collectionProcessor = $collectionProcessor;
}
/**
* @inheritDoc
*/
public function save(WebinarInterface $webinar)
{
try {
$this->resource->save($webinar);
} catch (\Exception $exception) {
throw new CouldNotSaveException(__(
'Could not save the webinar: %1',
$exception->getMessage()
));
}
return $webinar;
}
/**
* @param $value
* @param $field
* @return WebinarInterface
* @throws NoSuchEntityException
*/
public function get($value, $field)
{
$webinar = $this->webinarFactory->create();
$this->resource->load($webinar, $value, $field);
if (!$webinar->getId()) {
throw new NoSuchEntityException(__('Webinar with %1 "%2" does not exist.', $field, $value));
}
return $webinar;
}
/**
* @inheritDoc
*/
public function getList(
\Magento\Framework\Api\SearchCriteriaInterface $criteria
) {
$collection = $this->webinarCollectionFactory->create();
$this->collectionProcessor->process($criteria, $collection);
$searchResults = $this->searchResultsFactory->create();
$searchResults->setSearchCriteria($criteria);
$items = [];
foreach ($collection as $model) {
$items[] = $model;
}
$searchResults->setItems($items);
$searchResults->setTotalCount($collection->getSize());
return $searchResults;
}
/**
* @inheritDoc
*/
public function delete(WebinarInterface $webinar)
{
try {
$webinarModel = $this->webinarFactory->create();
$this->resource->load($webinarModel, $webinar->getWebinarId());
$this->resource->delete($webinarModel);
} catch (\Exception $exception) {
throw new CouldNotDeleteException(__(
'Could not delete the Webinar: %1',
$exception->getMessage()
));
}
return true;
}
/**
* @inheritDoc
*/
public function deleteById($webinarId)
{
return $this->delete($this->get($webinarId));
}
}
+55
View File
@@ -0,0 +1,55 @@
# Mage2 Module Stemcell Webinar
``stemcell/module-webinar``
- [Main Functionalities](#markdown-header-main-functionalities)
- [Installation](#markdown-header-installation)
- [Configuration](#markdown-header-configuration)
- [Specifications](#markdown-header-specifications)
- [Attributes](#markdown-header-attributes)
## Main Functionalities
Webinar
## Installation
\* = in production please use the `--keep-generated` option
### Type 1: Zip file
- Unzip the zip file in `app/code/Stemcell`
- Enable the module by running `php bin/magento module:enable Stemcell_Webinar`
- Apply database updates by running `php bin/magento setup:upgrade`\*
- Flush the cache by running `php bin/magento cache:flush`
### Type 2: Composer
- Make the module available in a composer repository for example:
- private repository `repo.magento.com`
- public repository `packagist.org`
- public github repository as vcs
- Add the composer repository to the configuration by running `composer config repositories.repo.magento.com composer https://repo.magento.com/`
- Install the module composer by running `composer require stemcell/module-webinar`
- enable the module by running `php bin/magento module:enable Stemcell_Webinar`
- apply database updates by running `php bin/magento setup:upgrade`\*
- Flush the cache by running `php bin/magento cache:flush`
## Configuration
## Specifications
- Controller
- frontend > webinar/index/save
- Controller
- adminhtml > webinar/index/index
## Attributes
+22
View File
@@ -0,0 +1,22 @@
{
"name": "stemcell/module-webinar",
"description": "Webinar",
"type": "magento2-module",
"license": "proprietary",
"authors": [
{
"name": "Liang Feng",
"email": "344531331@qq.com"
}
],
"minimum-stability": "dev",
"require": {},
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Stemcell\\Webinar\\": ""
}
}
}
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Stemcell_Webinar::webinar" title="webinar" sortOrder="10">
<resource id="Stemcell_Webinar::index_index" title="index index" sortOrder="10"/>
</resource>
</resource>
</resources>
</acl>
</config>
@@ -0,0 +1,14 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\App\RouterList">
<arguments>
<argument name="routerList" xsi:type="array">
<item name="webinar" xsi:type="array">
<item name="class" xsi:type="string">Stemcell\Webinar\Controller\Adminhtml\Router</item>
<item name="disable" xsi:type="boolean">false</item>
<item name="sortOrder" xsi:type="string">999</item>
</item>
</argument>
</arguments>
</type>
</config>
@@ -0,0 +1,6 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Stemcell_Webinar::index_index" title="Webinar" module="Stemcell_Webinar" sortOrder="9999" resource="Stemcell_Webinar::index_index" parent="Magento_Customer::customer" action="webinar/index/index"/>
</menu>
</config>
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="webinar" frontName="webinar">
<module name="Stemcell_Webinar" before="Magento_Backend"/>
</route>
</router>
</config>
@@ -0,0 +1,26 @@
<?xml version="1.0" ?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="webinar_request">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true"
comment="Entity ID"/>
<column xsi:type="int" name="customer_id" unsigned="true" nullable="true" comment="Entity ID"/>
<column xsi:type="varchar" name="email" nullable="false" length="255" comment="Email"/>
<column xsi:type="varchar" name="name" nullable="false" length="255" comment="Name"/>
<column xsi:type="varchar" name="title" nullable="false" length="255" comment="职称"/>
<column xsi:type="varchar" name="mobile" nullable="false" comment="Mobile" />
<column xsi:type="varchar" name="company" nullable="true" length="255" comment="Company"/>
<column xsi:type="varchar" name="state" nullable="true" length="255" comment="省、州、地区"/>
<column xsi:type="varchar" name="city" nullable="true" length="255" comment="城市"/>
<column xsi:type="varchar" name="street" nullable="true" length="255" comment="街道"/>
<column xsi:type="varchar" name="zip" nullable="true" length="255" comment="邮编"/>
<column xsi:type="varchar" name="from" nullable="true" length="255" comment="来源"/>
<column xsi:type="varchar" name="remark" nullable="true" length="255" comment="补充说明"/>
<column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
comment="Created At"/>
<column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP"
comment="Updated At"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="entity_id"/>
</constraint>
</table>
</schema>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Stemcell\Webinar\Api\WebinarRepositoryInterface" type="Stemcell\Webinar\Model\WebinarRepository"/>
<preference for="Stemcell\Webinar\Api\Data\WebinarInterface" type="Stemcell\Webinar\Model\Webinar"/>
<preference for="Stemcell\Webinar\Api\Data\WebinarSearchResultsInterface" type="Magento\Framework\Api\SearchResults"/>
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="webinar_grid_data_source" xsi:type="string">Stemcell\Webinar\Model\ResourceModel\Grid\Collection</item>
</argument>
</arguments>
</type>
<virtualType name="Stemcell\Webinar\Model\ResourceModel\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">webinar_request</argument>
<argument name="identifierName" xsi:type="string">entity_id</argument>
<argument name="resourceModel" xsi:type="string">Stemcell\Webinar\Model\ResourceModel\Webinar</argument>
</arguments>
</virtualType>
</config>
@@ -0,0 +1,14 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\App\RouterList">
<arguments>
<argument name="routerList" xsi:type="array">
<item name="webinar" xsi:type="array">
<item name="class" xsi:type="string">Stemcell\Webinar\Controller\Router</item>
<item name="disable" xsi:type="boolean">false</item>
<item name="sortOrder" xsi:type="string">999</item>
</item>
</argument>
</arguments>
</type>
</config>
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="webinar" frontName="webinar">
<module name="Stemcell_Webinar"/>
</route>
</router>
</config>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Stemcell_Webinar"/>
</config>
@@ -0,0 +1,5 @@
<?php
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Stemcell_Webinar', __DIR__);
@@ -0,0 +1,13 @@
<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>
Webinar List
</title>
</head>
<body>
<referenceContainer name="content">
<uiComponent name="webinar_grid"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1 @@
Hello index/index.phtml
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">webinar_grid.webinar_grid_data_source</item>
</item>
</argument>
<settings>
<spinner>webinar_columns</spinner>
<deps>
<dep>webinar_grid.webinar_grid_data_source</dep>
</deps>
</settings>
<dataSource name="webinar_grid_data_source" component="Magento_Ui/js/grid/provider">
<settings>
<updateUrl path="mui/index/render"/>
</settings>
<aclResource>Stemcell_Webinar::index_index</aclResource>
<dataProvider class="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider" name="webinar_grid_data_source">
<settings>
<requestFieldName>id</requestFieldName>
<primaryFieldName>main_table.entity_id</primaryFieldName>
</settings>
</dataProvider>
</dataSource>
<listingToolbar name="listing_top">
<settings>
<sticky>true</sticky>
</settings>
<bookmark name="bookmarks"/>
<columnsControls name="columns_controls"/>
<filters name="listing_filters"/>
<filterSearch name="fulltext"/>
<paging name="listing_paging"/>
</listingToolbar>
<columns name="webinar_columns">
<selectionsColumn name="ids" component="Magento_Sales/js/grid/columns/multiselect">
<settings>
<indexField>entity_id</indexField>
</settings>
</selectionsColumn>
<column name="customer_id">
<settings>
<filter>text</filter>
<label translate="true">Customer id</label>
</settings>
</column>
<column name="email">
<settings>
<filter>text</filter>
<label translate="true">Email</label>
</settings>
</column>
<column name="name">
<settings>
<filter>text</filter>
<label translate="true">Name</label>
</settings>
</column>
<column name="mobile">
<settings>
<filter>text</filter>
<label translate="true">Mobile</label>
</settings>
</column>
<column name="company">
<settings>
<filter>text</filter>
<label translate="true">Company</label>
</settings>
</column>
<column name="title">
<settings>
<filter>text</filter>
<label translate="true">职称</label>
</settings>
</column>
<column name="state">
<settings>
<filter>text</filter>
<label translate="true">省、州、地区</label>
</settings>
</column>
<column name="city">
<settings>
<filter>text</filter>
<label translate="true">城市</label>
</settings>
</column>
<column name="street">
<settings>
<filter>text</filter>
<label translate="true">街道</label>
</settings>
</column>
<column name="zip">
<settings>
<filter>text</filter>
<label translate="true">邮编</label>
</settings>
</column>
<column name="remark">
<settings>
<filter>text</filter>
<label translate="true">备注</label>
</settings>
</column>
<column name="from">
<settings>
<filter>text</filter>
<label translate="true">来源</label>
</settings>
</column>
<column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
<settings>
<filter>dateRange</filter>
<dataType>date</dataType>
<label translate="true">Created At</label>
<sorting>desc</sorting>
</settings>
</column>
<column name="updated_at" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
<settings>
<filter>dateRange</filter>
<dataType>date</dataType>
<label translate="true">Updated At</label>
</settings>
</column>
</columns>
</listing>
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block name="index.save" class="Stemcell\Webinar\Block\Index\Save" template="Stemcell_Webinar::index/save.phtml"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1 @@
Hello index/save.phtml