广告平台(媒体使用)
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 달 전
3 달 전
3 달 전
3 달 전
12345678910111213141516171819202122232425262728293031
  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. }