44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2021年10月7日
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
namespace app\widgets;
|
|
|
|
use yii\base\Widget;
|
|
|
|
|
|
class GoodsSku extends Widget
|
|
{
|
|
public $id;
|
|
|
|
public $attr;
|
|
public $attr_groups;
|
|
public $open_integral;
|
|
|
|
|
|
public function init() {
|
|
parent::init();
|
|
$this->attr = $this->attr && is_array($this->attr) ? json_encode($this->attr) : json_encode([]);
|
|
$this->attr_groups = $this->attr_groups && is_array($this->attr_groups) ? json_encode($this->attr_groups) : ( empty($this->attr_groups) ? json_encode([]) : $this->attr_groups);
|
|
}
|
|
|
|
public function run()
|
|
{
|
|
return $this->render('goods-sku',[
|
|
'id' => $this->id,
|
|
'url' => \Yii::$app->urlManager->createUrl(['file/upload/image', 'imageCompressEnable' => 1, 'imageCompressBorder' => 750]),
|
|
'attr' => $this->attr,
|
|
'attr_groups' => $this->attr_groups,
|
|
'open_integral' => $this->open_integral
|
|
]);
|
|
}
|
|
}
|
|
|