1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Promotion.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Im\V2\Controller;
6
7use Bitrix\Im\V2;
8use Bitrix\Im\V2\Promotion\Internals\DeviceType;
9use Bitrix\Main\DI\ServiceLocator;
10use Bitrix\Main\Engine\AutoWire\Parameter;
11use Bitrix\Main\Engine\Controller;
12use Bitrix\Im\V2\Promotion\Entity;
13use Bitrix\Main\Validation\Engine\AutoWire\ValidationParameter;
14
15class Promotion extends Controller
16{
17 private V2\Promotion\Promotion $promoService;
18
19 public function getAutoWiredParameters(): array
20 {
21 return [
23 Entity\Promotion::class,
24 function (): Entity\Promotion {
25 $request = $this->getRequest();
26 $requestData = $request->getPostList()->toArray();
27
28 return new Entity\Promotion(
29 $requestData['id'] ?? '',
30 $requestData['params'] ?? [],
31 );
32 }
33 ),
34 new Parameter(
35 DeviceType::class,
36 function (): ?DeviceType {
37 $request = $this->getRequest();
38 $requestData = $request->getPostList()->toArray();
39
40 $type = $requestData['type'] ?? DeviceType::ALL->value;
41
42 return DeviceType::tryFrom($type);
43 }
44 ),
45 ];
46 }
47
51 public function readAction(Entity\Promotion $promo): array
52 {
53 return [
54 'result' => $this->promoService->markAsViewed($promo)->isSuccess(),
55 ];
56 }
57
62 {
63 if (null === $type)
64 {
65 return [];
66 }
67
68 return $this->promoService->getActive($type)->toRestFormat();
69 }
70
71 protected function init(): void
72 {
73 parent::init();
74
75 $this->promoService = ServiceLocator::getInstance()->get('Im.Services.Promotion');
76 }
77}
$type
Определения options.php:106
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
readAction(Entity\Promotion $promo)
Определения Promotion.php:51
listActiveAction(?DeviceType $type)
Определения Promotion.php:61
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения ufield.php:9