status = self::STATUS_PENDING; $this->create_time = time(); if (!empty($this->item_info)) { $this->item_info = kg_json_encode($this->item_info); } else { $this->item_info = ''; // text类型不能填充默认值 } } public function beforeUpdate() { $this->update_time = time(); if (is_array($this->item_info)) { $this->item_info = kg_json_encode($this->item_info); } } public function afterFetch() { if (!empty($this->item_info) && is_string($this->item_info)) { $this->item_info = json_decode($this->item_info, true); } else { $this->item_info = []; } } }