|
- 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()
- }
|