add gva error message

This commit is contained in:
SliverHorn
2020-10-26 15:55:55 +08:00
parent a7bb4a7ac4
commit f7804b627e
13 changed files with 79 additions and 13 deletions

View File

@@ -2,6 +2,7 @@ package datas
import (
gormadapter "github.com/casbin/gorm-adapter/v3"
"github.com/gookit/color"
"gorm.io/gorm"
)
@@ -157,6 +158,10 @@ func InitCasbinModel(db *gorm.DB) (err error) {
return err
}
}
if tx.Where("p_type = ? AND v0 IN ?", "p", []string{"888", "8881", "9528"}).Find(&[]gormadapter.CasbinRule{}).RowsAffected == 142 {
color.Danger.Println("casbin_rule表的初始数据已存在!")
return nil
}
if tx.Create(&Carbines).Error != nil { // 遇到错误时回滚事务
return err
}