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.
73 lines
3.1 KiB
73 lines
3.1 KiB
package model
|
|
|
|
import (
|
|
"github.com/shopspring/decimal"
|
|
"gorm.io/gorm"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
BrokerBusinessStoreStaffGenderUnknown = 0 // 未知
|
|
BrokerBusinessStoreStaffGenderMale = 1 // 男
|
|
BrokerBusinessStoreStaffGenderFemale = 2 // 女
|
|
|
|
BrokerBusinessStoreStaffStatusEnabled = 1 // 启用
|
|
BrokerBusinessStoreStaffStatusDisabled = 2 // 停用
|
|
|
|
BrokerRoleStoreOwner = 1 // 店长
|
|
BrokerRoleStoreWorker = 2 // 车务
|
|
BrokerRoleStoreSale = 3 // 经纪人
|
|
BrokerRoleBusinessOwner = 11 // 入驻商所有者
|
|
BrokerRoleBusinessWorker = 12 // 入驻商车务
|
|
|
|
)
|
|
|
|
// 入驻商下角色能力权限
|
|
var (
|
|
BrokerAbilityBusinessOwner = []uint{BrokerRoleBusinessOwner} // 入驻商所有者
|
|
BrokerAbilityBusiness = []uint{BrokerRoleBusinessOwner, BrokerRoleBusinessWorker} // 入驻商人员
|
|
BrokerAbilityStoreOwner = []uint{BrokerRoleStoreOwner, BrokerRoleBusinessOwner} // 入驻商门店店长及以上
|
|
BrokerAbilityStore = []uint{BrokerRoleStoreOwner, BrokerRoleStoreWorker} // 门店人员
|
|
BrokerAbilityBusinessStaffWorker = []uint{BrokerRoleStoreWorker, BrokerRoleStoreOwner, BrokerRoleBusinessOwner, BrokerRoleBusinessWorker} // 入驻商门店车务及以上
|
|
BrokerAbilityBusinessStaffSale = []uint{BrokerRoleStoreSale, BrokerRoleStoreOwner, BrokerRoleBusinessOwner} // 入驻商门店经纪人及以上
|
|
BrokerAbilityBusinessStaff = []uint{BrokerRoleStoreWorker, BrokerRoleStoreSale} // 入驻商门店常规员工
|
|
)
|
|
|
|
type BrokerBusinessStoreStaff struct {
|
|
Id uint `gorm:"primaryKey"`
|
|
BrokerId uint // 经纪人id
|
|
Name string // 姓名
|
|
Gender uint // 性别 0=未知 1=男 2=女
|
|
Phone string // 手机号
|
|
BusinessId uint // 入驻商id
|
|
Business BrokerBusiness `gorm:"foreignKey:BusinessId"`
|
|
StoreId uint // 所属门店
|
|
Store BrokerBusinessStore `gorm:"foreignKey:StoreId"`
|
|
RoleId uint // 权限
|
|
Role BrokerRole `gorm:"foreignKey:RoleId"`
|
|
Commission decimal.Decimal // 销售提成
|
|
AuditId uint // 审核id
|
|
Audit BrokerBusinessStoreStaffAudit `gorm:"foreignKey:AuditId"`
|
|
Status uint // 状态
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
DeletedAt gorm.DeletedAt
|
|
}
|
|
|
|
func (b *BrokerBusinessStoreStaff) GetRoleName(role uint) string {
|
|
switch role {
|
|
case BrokerRoleStoreOwner:
|
|
return "店长"
|
|
case BrokerRoleStoreWorker:
|
|
return "车务"
|
|
case BrokerRoleStoreSale:
|
|
return "经纪人"
|
|
case BrokerRoleBusinessOwner:
|
|
return "入驻商所有者"
|
|
case BrokerRoleBusinessWorker:
|
|
return "入驻商车务"
|
|
default:
|
|
return "未知"
|
|
}
|
|
}
|