admin.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package view
  2. import (
  3. "time"
  4. "gorm.io/gorm"
  5. )
  6. type MemberList struct {
  7. ID uint64 `json:"id"`
  8. Email string `json:"email"`
  9. Address string `json:"address"`
  10. Status string `json:"status"`
  11. Name string `json:"name"`
  12. EncVersion int `json:"enc_version"`
  13. CheckSum string `json:"check_sum"`
  14. Phone string `json:"phone"`
  15. Team string `json:"team,omitempty"`
  16. CreatedAt time.Time `json:"created_at"`
  17. }
  18. type AdministratorList struct {
  19. ID uint64 `json:"id"`
  20. Email string `json:"email"`
  21. Name string `json:"name"`
  22. Status string `json:"status"`
  23. User int `json:"user"`
  24. Collection int `json:"collection"`
  25. System int `json:"system"`
  26. Admin int `json:"admin"`
  27. Log int `json:"log"`
  28. Phone string `json:"phone"`
  29. Position string `json:"position"`
  30. Chargeof string `json:"chargeof"`
  31. Team string `json:"team"`
  32. CreatedAt time.Time `json:"created_at"`
  33. UpdateAt time.Time `json:"update_at"`
  34. }
  35. func GetMemberList(db *gorm.DB) *gorm.DB {
  36. querySet := db.Select(`user.id, user.status, user.created_at, user_profile.name, user_profile.phone,
  37. user_authentication.email, user_wallet.address, user_wallet.check_sum, user_wallet.enc_version, artist_profile.team`).Table("user").
  38. Joins("INNER JOIN user_profile ON user_profile.user_id = user.id").
  39. Joins("INNER JOIN user_authentication ON user_authentication.user_id = user.id").
  40. Joins("INNER JOIN user_wallet ON user_wallet.user_id = user.id").
  41. Joins("LEFT JOIN artist_profile ON artist_profile.user_id = user.id").Order("user.id desc")
  42. return querySet
  43. }
  44. func GetAdministorList(db *gorm.DB) *gorm.DB {
  45. querySet := db.Select(`admin.id, admin.email, admin.name, admin.status, admin_permission.user,
  46. admin_permission.collection, admin_permission.system, admin_permission.admin, admin_permission.log,
  47. admin.phone, admin.position, admin.chargeof, admin.team, admin.created_at, admin_permission.updated_at`).Table("admin").
  48. Joins("INNER JOIN admin_permission ON admin_permission.admin_id = admin.id").Order("admin.id desc")
  49. return querySet
  50. }