|
12345678910111213141516171819202122232425262728293031 |
- 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.NewAdminDb(engine)
- _, err = adminDb.AdminDeleteBySession(session, admIds)
- if err != nil {
- _ = session.Rollback()
- return
- }
-
- //2、删除 `admin_role`
- adminRoleDb := implement.NewAdminRoleDb(engine)
- _, err = adminRoleDb.AdminDeleteBySessionForAdmId(session, admIds)
- if err != nil {
- _ = session.Rollback()
- return
- }
-
- return session.Commit()
- }
|