getPk(); $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); }); } public function getCardTypeList() { return ['normal' => __('图片在上'), 'reverse' => __('内容在上')]; } public function getListTypeList() { return ['single' => __('单列布局'), 'double' => __('双列布局')]; } public function getStatusList() { return ['0' => __('禁用'), '1' => __('启用')]; } public function getLangList() { return ['1' => __('简体中文'), '2' => __('English')]; } public function getCardTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['card_type']) ? $data['card_type'] : ''); $list = $this->getCardTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getListTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['list_type']) ? $data['list_type'] : ''); $list = $this->getListTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function getLangTextAttr($value, $data) { $value = $value ? $value : (isset($data['lang']) ? $data['lang'] : ''); $list = $this->getLangList(); return isset($list[$value]) ? $list[$value] : ''; } protected function setContentItemsAttr($value) { return is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : $value; } protected function getContentItemsAttr($value) { return $value ? json_decode($value, true) : []; } }