广告平台(站长使用)
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

32 rindas
715 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.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. }