面包店
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.

пре 8 месеци
123456789101112131415161718192021222324252627282930
  1. package svc
  2. import (
  3. "applet/app/db"
  4. )
  5. func AdminDelete(admIds []int) (err error) {
  6. session := db.Db.NewSession()
  7. defer session.Close()
  8. session.Begin()
  9. //1、删除 `admin`
  10. adminDb := db.AdminDb{}
  11. adminDb.Set()
  12. _, err = adminDb.AdminDeleteBySession(session, admIds)
  13. if err != nil {
  14. _ = session.Rollback()
  15. return
  16. }
  17. //2、删除 `admin_role`
  18. adminRoleDb := db.AdminRoleDb{}
  19. adminRoleDb.Set()
  20. _, err = adminRoleDb.AdminDeleteBySessionForAdmId(session, admIds)
  21. if err != nil {
  22. _ = session.Rollback()
  23. return
  24. }
  25. return session.Commit()
  26. }