255], [['postage'],'number'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'parent_id' => '上一级id', 'name' => '地区名称', 'level' => '地区等级:1=国家,2=省;3=城市;4=县区', 'is_delete' => 'Is Delete', 'sort' => '排序:升序', 'is_open' => '是否包邮:1不包邮,0包邮', 'postage' => '邮费', ]; } public function saveArea() { if ($this->validate()) { if ($this->save()) { return [ 'code'=>0, 'msg'=>'成功' ]; } else { return [ 'code'=>1, 'msg'=>'失败' ]; } } else { return (new Model())->getErrorResponse($this); } } public function getChildren() { return $this->hasMany(self::className(), ['parent_id'=>'id']); } }