common.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package models
  2. import (
  3. "time"
  4. "passport/client/mysql"
  5. )
  6. // 删除标志
  7. const (
  8. StatusNormal = 0
  9. StatusDelete = 1
  10. )
  11. // 审核状态
  12. const (
  13. VerifyPending = 0
  14. VerifyPassed = 1
  15. VerifyRejected = 2
  16. )
  17. //订单sku
  18. const (
  19. OrderSkuSuccess = 0 // 下单成功
  20. OrderSkuPay = 1 // 已支付,即发货中
  21. OrderSkuPackSuccess = 2 // 发货成功
  22. OrderSkuChange = 3 // 退换货
  23. OrderSkuRefund = 4 // 退货退款
  24. OrderSkuCancel = 5 // 取消下单
  25. )
  26. type CommonField struct {
  27. Id int `gorm:"primary_key;column:id"`
  28. CreatedAt time.Time `json:"created_at" gorm:"column:created_at;type:datetime;NOT NULL;index:idx_created_at;DEFAULT:CURRENT_TIMESTAMP"` // 创建时间
  29. UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;type:datetime;NOT NULL;index:idx_updated_at;DEFAULT:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0)"` // 最后更新时间
  30. Status uint8 `json:"status" gorm:"column:status;NOT NULL;index:idx_status;default:0"` // 删除标记,1:normal, 0: delete
  31. }
  32. func GetShortUUID() string {
  33. db := mysql.Client.Master()
  34. var uuid string
  35. db.Unscoped().Raw("SELECT UUID_SHORT()").Row().Scan(&uuid)
  36. return uuid
  37. }