value = $row->price; }); self::beforeUpdate(function ($row) { //礼物价值=价格 $row->value = $row->price; }); } public function getIsBigList() { return ['0' => __('Is_big 0'), '1' => __('Is_big 1')]; } public function getTypeList() { return ['0' => __('Type 0'), '1' => __('Type 1'), '2' => __('Type 2'), '3' => __('Type 3'), '4' => __('Type 4')]; } public function getComplexList() { return ['1' => __('Complex 1'), '0' => __('Complex 0')]; } public function getBoxtypeList() { return ['0' => __('非宝箱礼物'), '1' => __('青铜宝箱'), '2' => __('黄金宝箱'), '3' => __('荣耀黄金宝箱'), '4' => __('荣耀紫金宝箱')]; } public function getTimelimitList() { return ['1' => __('Timelimit 1'), '0' => __('Timelimit 0')]; } public function getIsShowList() { return ['1' => __('Is_show 1'), '0' => __('Is_show 0')]; } public function getTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getIsBigTextAttr($value, $data) { $value = $value ? $value : (isset($data['is_big']) ? $data['is_big'] : ''); $list = $this->getIsBigList(); return isset($list[$value]) ? $list[$value] : ''; } public function getComplexTextAttr($value, $data) { $value = $value ? $value : (isset($data['complex']) ? $data['complex'] : ''); $list = $this->getComplexList(); return isset($list[$value]) ? $list[$value] : ''; } public function getTimelimitTextAttr($value, $data) { $value = $value ? $value : (isset($data['timelimit']) ? $data['timelimit'] : ''); $list = $this->getTimelimitList(); return isset($list[$value]) ? $list[$value] : ''; } public function gifttype() { return $this->belongsTo('app\admin\model\gift\Type', 'type', 'id', [], 'LEFT')->setEagerlyType(0); } public function getIsShowTextAttr($value, $data) { $value = $value ? $value : (isset($data['is_show']) ? $data['is_show'] : ''); $list = $this->getIsShowList(); return isset($list[$value]) ? $list[$value] : ''; } }