|
123456789101112131415161718192021222324252627282930 |
- package svc
-
- import (
- "applet/app/db"
- )
-
- func AdminDelete(admIds []int) (err error) {
- session := db.Db.NewSession()
- defer session.Close()
- session.Begin()
- //1、删除 `admin`
- adminDb := db.AdminDb{}
- adminDb.Set()
- _, err = adminDb.AdminDeleteBySession(session, admIds)
- if err != nil {
- _ = session.Rollback()
- return
- }
-
- //2、删除 `admin_role`
- adminRoleDb := db.AdminRoleDb{}
- adminRoleDb.Set()
- _, err = adminRoleDb.AdminDeleteBySessionForAdmId(session, admIds)
- if err != nil {
- _ = session.Rollback()
- return
- }
-
- return session.Commit()
- }
|