200], [['opening_bank_account'], 'string', 'max' => 100], [['address', 'remark'], 'string', 'max' => 255], [['phone'], 'string', 'max' => 50], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'merchant_id' => '商户id', 'store_id' => '店铺ID', 'member_id' => '用户id', 'title' => '抬头', // 公司抬头 'duty_paragraph' => '公司税号', // 公司税号 'opening_bank' => '公司开户行', 'opening_bank_account' => '公司开户行账号', 'address' => '公司地址', 'phone' => '公司电话', 'remark' => '备注', 'is_default' => '默认', 'type' => '类型', // 1:企业; 2:个人 'status' => '状态', 'created_at' => '创建时间', 'updated_at' => '修改时间', ]; } /** * @param bool $insert * @return bool */ public function beforeSave($insert) { if (($this->isNewRecord || $this->oldAttributes['is_default'] == StatusEnum::DISABLED) && $this->is_default == StatusEnum::ENABLED) { self::updateAll(['is_default' => StatusEnum::DISABLED], ['member_id' => $this->member_id, 'is_default' => StatusEnum::ENABLED]); } return parent::beforeSave($insert); } }