广告平台(总站长使用)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
704 B

  1. package svc
  2. import (
  3. db "code.fnuoos.com/zhimeng/model.git/src"
  4. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  5. "github.com/gin-gonic/gin"
  6. )
  7. func AdminDelete(c *gin.Context, admIds []int) (err error) {
  8. engine := db.Db
  9. session := engine.NewSession()
  10. defer session.Close()
  11. session.Begin()
  12. //1、删除 `admin`
  13. adminDb := implement.NewAdminDb(engine)
  14. _, err = adminDb.AdminDeleteBySession(session, admIds)
  15. if err != nil {
  16. _ = session.Rollback()
  17. return
  18. }
  19. //2、删除 `admin_role`
  20. adminRoleDb := implement.NewAdminRoleDb(engine)
  21. _, err = adminRoleDb.AdminDeleteBySessionForAdmId(session, admIds)
  22. if err != nil {
  23. _ = session.Rollback()
  24. return
  25. }
  26. return session.Commit()
  27. }