ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1\Entity;
|
||||
|
||||
class Item extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
return $this->setData('id', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_data['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData('name', $name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1;
|
||||
|
||||
use Magento\TestModule2\Service\V1\Entity\Item;
|
||||
use Magento\TestModule2\Service\V1\Entity\ItemFactory;
|
||||
|
||||
class NoWebApiXml implements \Magento\TestModule2\Service\V1\NoWebApiXmlInterface
|
||||
{
|
||||
/**
|
||||
* @var ItemFactory
|
||||
*/
|
||||
protected $itemFactory;
|
||||
|
||||
/**
|
||||
* @param ItemFactory $itemFactory
|
||||
*/
|
||||
public function __construct(ItemFactory $itemFactory)
|
||||
{
|
||||
$this->itemFactory = $itemFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function item($id)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($id)->setName('testProduct1');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function items()
|
||||
{
|
||||
$result1 = $this->itemFactory->create()->setId(1)->setName('testProduct1');
|
||||
|
||||
$result2 = $this->itemFactory->create()->setId(2)->setName('testProduct2');
|
||||
|
||||
return [$result1, $result2];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create($name)
|
||||
{
|
||||
return $this->itemFactory->create()->setId(rand())->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function update(Item $item)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($item->getId())->setName('Updated' . $item->getName());
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1;
|
||||
|
||||
use Magento\TestModule2\Service\V1\Entity\Item;
|
||||
|
||||
interface NoWebApiXmlInterface
|
||||
{
|
||||
/**
|
||||
* Get an item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function item($id);
|
||||
|
||||
/**
|
||||
* Create an item.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function create($name);
|
||||
|
||||
/**
|
||||
* Update an item.
|
||||
*
|
||||
* @param \Magento\TestModule2\Service\V1\Entity\Item $item
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function update(Item $item);
|
||||
|
||||
/**
|
||||
* Retrieve a list of items.
|
||||
*
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item[]
|
||||
*/
|
||||
public function items();
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1;
|
||||
|
||||
use Magento\TestModule2\Service\V1\Entity\Item;
|
||||
use Magento\TestModule2\Service\V1\Entity\ItemFactory;
|
||||
|
||||
class SubsetRest implements \Magento\TestModule2\Service\V1\SubsetRestInterface
|
||||
{
|
||||
/**
|
||||
* @var ItemFactory
|
||||
*/
|
||||
protected $itemFactory;
|
||||
|
||||
/**
|
||||
* @param ItemFactory $itemFactory
|
||||
*/
|
||||
public function __construct(ItemFactory $itemFactory)
|
||||
{
|
||||
$this->itemFactory = $itemFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function item($id)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($id)->setName('testItem' . $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function items()
|
||||
{
|
||||
$result1 = $this->itemFactory->create()->setId(1)->setName('testItem1');
|
||||
|
||||
$result2 = $this->itemFactory->create()->setId(2)->setName('testItem2');
|
||||
|
||||
return [$result1, $result2];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create($name)
|
||||
{
|
||||
return $this->itemFactory->create()->setId(rand())->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function update(Item $item)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($item->getId())->setName('Updated' . $item->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove($id)
|
||||
{
|
||||
return $this->itemFactory->create()->setId(1);
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1;
|
||||
|
||||
use Magento\TestModule2\Service\V1\Entity\Item;
|
||||
|
||||
interface SubsetRestInterface
|
||||
{
|
||||
/**
|
||||
* Return a single item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function item($id);
|
||||
|
||||
/**
|
||||
* Return multiple items.
|
||||
*
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item[]
|
||||
*/
|
||||
public function items();
|
||||
|
||||
/**
|
||||
* Create an item.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function create($name);
|
||||
|
||||
/**
|
||||
* Update an item.
|
||||
*
|
||||
* @param \Magento\TestModule2\Service\V1\Entity\Item $item
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function update(Item $item);
|
||||
|
||||
/**
|
||||
* Delete an item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function remove($id);
|
||||
}
|
||||
Reference in New Issue
Block a user