package svc import ( db "code.fnuoos.com/zhimeng/model.git/src" "code.fnuoos.com/zhimeng/model.git/src/implement" "github.com/gin-gonic/gin" ) func AdminDelete(c *gin.Context, admIds []int) (err error) { engine := db.DBs[GetMasterId(c)] session := engine.NewSession() defer session.Close() session.Begin() //1、删除 `admin` adminDb := implement.NewMediumDb(engine) _, err = adminDb.MediumDeleteBySession(session, admIds) if err != nil { _ = session.Rollback() return } //2、删除 `admin_role` adminRoleDb := implement.NewMediumWithRoleDb(engine) _, err = adminRoleDb.MediumDeleteBySessionForAdmId(session, admIds) if err != nil { _ = session.Rollback() return } return session.Commit() }