广告平台(媒体使用)
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 rivejä
723 B

  1. package svc
  2. import (
  3. db "code.fnuoos.com/zhimeng/model.git/src"
  4. "code.fnuoos.com/zhimeng/model.git/src/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.NewMediumDb(engine)
  14. _, err = adminDb.MediumDeleteBySession(session, admIds)
  15. if err != nil {
  16. _ = session.Rollback()
  17. return
  18. }
  19. //2、删除 `admin_role`
  20. adminRoleDb := implement.NewMediumWithRoleDb(engine)
  21. _, err = adminRoleDb.MediumDeleteBySessionForAdmId(session, admIds)
  22. if err != nil {
  23. _ = session.Rollback()
  24. return
  25. }
  26. return session.Commit()
  27. }