50], [['value'], 'string', 'max' => 256], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'cx_mch_id' => '平台商户ID', 'type' => '类型:0=分类', 'post_id' => '文章ID', 'key' => 'KEY', 'value' => 'VALUE', 'created_at' => '添加时间', 'updated_at' => '更新时间', 'is_delete' => '是否删除:0=否,1=是', 'deleted_at' => '删除时间', ]; } public function beforeSave($insert) { if(parent::beforeSave($insert)){ if($this->isNewRecord){ $this->created_at = time(); } $this->updated_at = time(); if($this->is_delete == 1) $this->deleted_at = time(); return true; } else { return false; } } }