You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.4 KiB
83 lines
2.4 KiB
package upgrade
|
|
|
|
import (
|
|
"recook/internal/model/manage"
|
|
"recook/internal/v2/model/recook/user"
|
|
|
|
"github.com/golangkit/formatime"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type State int
|
|
|
|
const (
|
|
Apply State = 1 + iota
|
|
Suc
|
|
Reject
|
|
)
|
|
|
|
var stataMap = map[State]string{
|
|
Apply: "待审核",
|
|
Suc: "已通过",
|
|
Reject: "已驳回",
|
|
}
|
|
|
|
func (o State) str() string {
|
|
return stataMap[o]
|
|
}
|
|
|
|
type Kind int
|
|
|
|
const (
|
|
Online Kind = 1 + iota
|
|
Offline
|
|
)
|
|
|
|
var kindMap = map[Kind]string{
|
|
Online: "云店铺",
|
|
Offline: "实体店",
|
|
}
|
|
|
|
func (o Kind) str() string {
|
|
return kindMap[o]
|
|
}
|
|
|
|
type ApplyEntry struct {
|
|
ID uint `json:"id"`
|
|
Mobile string `json:"mobile"`
|
|
ApplyUserID uint `json:"-"`
|
|
Kind Kind `json:"kind"`
|
|
KindStr string `json:"kind_str" gorm:"-"`
|
|
CreatedAt formatime.Second `json:"created_at"`
|
|
State State `json:"state"`
|
|
StateStr string `json:"state_str" gorm:"-"`
|
|
ProcessUserID uint `json:"-"`
|
|
ProcessTime formatime.Second `json:"process_time"`
|
|
Reason string `json:"reason"`
|
|
ApplyUser user.RecookUserInfoModel `json:"-" gorm:"foreignKey:apply_user_id"`
|
|
ProcessUser manage.UserInfo `json:"-" gorm:"foreignKey:process_user_id"`
|
|
ProcessUserName string `json:"process_user_name" gorm:"-"`
|
|
ApplyUserName string `json:"apply_user_name" gorm:"-"`
|
|
ApplyUserMobile string `json:"apply_user_mobile" gorm:"-"`
|
|
ParentID uint `json:"-"`
|
|
BusinessPhoto string `json:"business_photo"`
|
|
BusinessAddress string `json:"business_address"`
|
|
MainPhoto string `json:"main_photo"`
|
|
UserInfo user.RecookUserInfoModel `gorm:"foreignKey:mobile;references:mobile" json:"-"`
|
|
Nickname string `json:"nickname" gorm:"-"`
|
|
}
|
|
|
|
func (o *ApplyEntry) TableName() string {
|
|
return "jyy_update_apply"
|
|
}
|
|
|
|
func (o *ApplyEntry) AfterFind(tx *gorm.DB) error {
|
|
o.StateStr = o.State.str()
|
|
o.KindStr = o.Kind.str()
|
|
o.ProcessUserName = o.ProcessUser.Name
|
|
o.ApplyUserName = o.ApplyUser.Nickname
|
|
o.ApplyUserMobile = o.ApplyUser.Mobile
|
|
o.Nickname = o.UserInfo.Nickname
|
|
return nil
|
|
}
|