system_mobile.go 879 B

123456789101112131415161718192021222324252627282930313233
  1. package model
  2. import (
  3. operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
  4. "time"
  5. )
  6. type SystemMobile struct {
  7. Id int64 `json:"id,omitempty"`
  8. Name string `json:"name"`
  9. IsShow operationPb.IsShow_Kind `json:"is_show"`
  10. CreatedAt int64 `json:"created_at"`
  11. UpdatedAt int64 `json:"updated_at"`
  12. }
  13. func (s *SystemMobile) TableName() string {
  14. return "system_mobile"
  15. }
  16. type SystemMobileSlice []*SystemMobile
  17. func (s SystemMobileSlice) ToPB() []*operationPb.MobileData {
  18. res := make([]*operationPb.MobileData, len(s))
  19. for i, v := range s {
  20. res[i] = &operationPb.MobileData{
  21. Id: uint32(v.Id),
  22. Name: v.Name,
  23. CreatedAt: uint32(v.CreatedAt),
  24. CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
  25. }
  26. }
  27. return res
  28. }