add gva error message
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user