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.

63 lines
1.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package model
import (
"base/app/common"
"fmt"
"time"
)
const (
BrokerLevelBase = 1 // 基础用户
BrokerLevelPartner = 2 // 独立合伙人
BrokerLevelBusiness = 3 // 入驻商
BrokerStatusEnabled = 1 // 启用
BrokerStatusDisabled = 2 // 停用
BrokerIsRealFalse = 0 // 未认证
BrokerIsRealTrue = 1 // 已认证
BrokerGenderUnKnow = 0 // 未填写
BrokerGenderMale = 1 // 男
BrokerGenderFemale = 2 // 女
)
type Broker struct {
Id uint `gorm:"primaryKey"`
Nickname string // 昵称
HeadImg string // 头像
Phone string // 手机号
Gender uint // 性别 0未填写 1男 2
Level uint // 用户等级 1=基础用户 2=独立合伙人 3=入驻商
//Status uint // 状态
BusinessId uint // 所属入驻商
StoreId uint
Business BrokerBusiness `gorm:"foreignKey:BusinessId"`
Store BrokerBusinessStore `gorm:"foreignKey:StoreId"`
Staff BrokerBusinessStoreStaff `gorm:"foreignKey:BrokerId"`
IsReal uint // 实名认证 0=未认证 1=已认证
MasterId uint
Master BrokerReal `gorm:"foreignKey:MasterId"`
Wechat BrokerWechat `gorm:"foreignKey:BrokerId"`
CreatedAt time.Time
UpdatedAt time.Time
}
// RandNickname @Title 随机昵称
func (b *Broker) RandNickname() string {
return fmt.Sprintf("云云问车%s", common.RandStr(4, "0123456789"))
}
func (b *Broker) GetLevelName(level uint) string {
switch level {
case BrokerLevelBase:
return "基础用户"
case BrokerLevelPartner:
return "独立合伙人"
case BrokerLevelBusiness:
return "入驻商"
default:
return "未知"
}
}