广告平台(站长下代理使用)
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 line
664 B

  1. package svc
  2. import (
  3. "applet/app/db"
  4. "applet/app/db/implement"
  5. "github.com/gin-gonic/gin"
  6. )
  7. func AdminDelete(c *gin.Context, admIds []int) (err error) {
  8. engine := db.DBs[GetMasterId(c)]
  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. }