|
|
package domain
|
|
|
|
|
|
import "time"
|
|
|
import (
|
|
|
"fmt"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
const (
|
|
|
StatusEnable int64 = 1
|
|
|
StatusDisable int64 = 2
|
|
|
StatusEnable int64 = 1 //启用
|
|
|
StatusDisable int64 = 2 //禁用
|
|
|
)
|
|
|
// 管理员类型 1.超级管理员 10:企业管理员 100:普通用户
|
|
|
const (
|
|
|
SuperAdministrator = 1
|
|
|
EnterpriseAdministrator = 10
|
|
|
NormalUser = 100
|
|
|
SuperAdministrator = 1 //超级管理员
|
|
|
EnterpriseAdministrator = 10 //企业管理员
|
|
|
NormalUser = 100 //普通用户
|
|
|
)
|
|
|
|
|
|
// UserType
|
|
|
const (
|
|
|
Manager = 1
|
|
|
Partner = 2
|
|
|
Guest = 3
|
|
|
Manager = 1 //高管
|
|
|
Partner = 2 //合伙人
|
|
|
Guest = 3 //游客
|
|
|
)
|
|
|
|
|
|
|
|
|
// 用户实体
|
|
|
type User struct {
|
|
|
// 用户id
|
...
|
...
|
@@ -62,9 +67,6 @@ func (user *User) Identify() interface{} { |
|
|
}
|
|
|
|
|
|
func (user *User) Update(data map[string]interface{}) error {
|
|
|
if userId, ok := data["userId"]; ok {
|
|
|
user.UserId = userId.(int64)
|
|
|
}
|
|
|
if userType, ok := data["userType"]; ok {
|
|
|
user.UserType = userType.(int)
|
|
|
}
|
...
|
...
|
@@ -124,3 +126,46 @@ func (user *User) Update(data map[string]interface{}) error { |
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//添加/编辑高管
|
|
|
|
|
|
func CheckAdminUserType (dm *User)(*User,error) {
|
|
|
if dm.UserInfo.Uid == int64(0){
|
|
|
return nil,fmt.Errorf("高管的uid不能为空")
|
|
|
}
|
|
|
if dm.UserInfo.Email == ""{
|
|
|
return nil,fmt.Errorf("高管的Email不能为空")
|
|
|
}
|
|
|
if dm.UserInfo.EntryTime.IsZero() {
|
|
|
return nil,fmt.Errorf("高管的入职时间不能为空")
|
|
|
}
|
|
|
if dm.UserInfo.Workplace == ""{
|
|
|
return nil,fmt.Errorf("高管的工作地不能为空")
|
|
|
}
|
|
|
if dm.UserInfo.JobNumber == ""{
|
|
|
return nil,fmt.Errorf("高管的工号不能为空")
|
|
|
}
|
|
|
return dm,nil
|
|
|
}
|
|
|
|
|
|
//添加/编辑合伙人
|
|
|
type PartnerUserType struct {}
|
|
|
|
|
|
func CheckPartnerUserType (dm *User)(*User,error) {
|
|
|
if dm.PartnerInfo.Status == 0{
|
|
|
return nil,fmt.Errorf("合伙人的状态不能为空")
|
|
|
}
|
|
|
if dm.PartnerInfo.PartnerAccount == ""{
|
|
|
return nil,fmt.Errorf("合伙人账号不能为空")
|
|
|
}
|
|
|
if dm.PartnerInfo.PartnerName == ""{
|
|
|
return nil,fmt.Errorf("合伙人姓名不能为空")
|
|
|
}
|
|
|
if len(dm.PartnerInfo.PartnerCategorys) == 0 {
|
|
|
return nil,fmt.Errorf("合伙人类别不能为空")
|
|
|
}
|
|
|
if len(dm.PartnerInfo.Salesmans) == 0{
|
|
|
return nil,fmt.Errorf("合伙人查看合伙人账号不能为空")
|
|
|
}
|
|
|
return dm,nil
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|