update admin
CI / changes (push) Successful in 14s
CI / docker-bff (push) Successful in 3s
CI / docker-product (push) Has been skipped
CI / docker-admin (push) Successful in 31s
CI / docker-user (push) Has been skipped
CI / docker-ad (push) Has been skipped
CI / docker-chore (push) Has been skipped
CI / docker-express (push) Has been skipped
CI / docker-sale (push) Successful in 24s
CI / changes (push) Successful in 14s
CI / docker-bff (push) Successful in 3s
CI / docker-product (push) Has been skipped
CI / docker-admin (push) Successful in 31s
CI / docker-user (push) Has been skipped
CI / docker-ad (push) Has been skipped
CI / docker-chore (push) Has been skipped
CI / docker-express (push) Has been skipped
CI / docker-sale (push) Successful in 24s
This commit is contained in:
@@ -14,6 +14,8 @@ type Admin struct {
|
||||
Salt string `gorm:"column:salt;type:char(5);comment:与密码混合搭配加密;NOT NULL" json:"salt"`
|
||||
Roles string `gorm:"column:roles;type:varchar(255);comment:角色" json:"roles"`
|
||||
Status uint8 `gorm:"column:status;type:tinyint(1);default:1;comment:状态,1为正常,2为禁用;NOT NULL" json:"status"`
|
||||
Type uint8 `json:"type" gorm:"type"` // 1:销售,2:管理员
|
||||
SaleId int64 `json:"sale_id" gorm:"sale_id"` // 销售ID
|
||||
LastTime utils.CustomTime `gorm:"column:last_time;type:datetime;default:NULL;comment:最后一次登录时间" json:"last_time"`
|
||||
FailNumber int `gorm:"column:fail_number;type:tinyint(2);default:0;comment:连续登录失败次数" json:"fail_number"`
|
||||
Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"`
|
||||
@@ -48,6 +50,8 @@ type AdminInfo struct {
|
||||
Email string `gorm:"column:email;type:varchar(255);comment:邮箱" json:"email"`
|
||||
Roles string `gorm:"column:roles;type:varchar(255);comment:角色" json:"roles"`
|
||||
LastTime utils.CustomTime `gorm:"column:last_time;type:datetime;comment:最后一次登录时间" json:"last_time"`
|
||||
Type uint8 `json:"type" gorm:"type"` // 1:销售,2:管理员
|
||||
SaleId int64 `json:"sale_id" gorm:"sale_id"` // 销售ID
|
||||
FailNumber int `gorm:"column:fail_number;type:tinyint(2);default:0;comment:连续登录失败次数" json:"fail_number"`
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,8 @@ func (l *AdminEditLogic) AdminEdit(in *admin.AdminEditRequest) (*admin.Response,
|
||||
info.Roles = strings.Join(roles, utils.DecollatorComma)
|
||||
info.Email = in.Email
|
||||
info.Avatar = in.Avatar
|
||||
info.Type = uint8(in.Type)
|
||||
info.SaleId = in.SaleId
|
||||
var err error
|
||||
var row int64
|
||||
if info.Id > utils.NumberZero {
|
||||
|
||||
@@ -11,16 +11,21 @@ type AdminEditValidator struct {
|
||||
Phone string `validate:"required"`
|
||||
Email string `validate:"required,email"`
|
||||
Roles []int
|
||||
Type int32 `validate:"required,oneof=1 2"`
|
||||
SaleId int64 `validate:"required_if=Type 2"`
|
||||
}
|
||||
|
||||
// GetMessage 创建/编辑 - 提示消息
|
||||
func (p AdminEditValidator) GetMessage() validate.ValidatorMessages {
|
||||
return validate.ValidatorMessages{
|
||||
"Phone.required": "手机号不能为空",
|
||||
"Email.email": "邮箱格式不对",
|
||||
"Email.required": "邮箱不能为空",
|
||||
"Username.required": "账号不能为空",
|
||||
"Name.required": "姓名不能为空",
|
||||
"Phone.required": "手机号不能为空",
|
||||
"Email.email": "邮箱格式不对",
|
||||
"Email.required": "邮箱不能为空",
|
||||
"Username.required": "账号不能为空",
|
||||
"Name.required": "姓名不能为空",
|
||||
"Type.required": "姓名不能为空",
|
||||
"Type.oneof": "类型不对",
|
||||
"SaleId.required_if": "销售ID不能为空",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
services/sale/logs/
|
||||
services/sale/run.toml
|
||||
tmp
|
||||
@@ -2,7 +2,7 @@
|
||||
login_out_time=43200 #api接口超时时间分
|
||||
login_refresh_out_time=83200
|
||||
name = "sale-service"
|
||||
listenOn = "0.0.0.0:10300"
|
||||
listenOn = "0.0.0.0:10900"
|
||||
mode = "dev"
|
||||
[log]
|
||||
path = "logs"
|
||||
|
||||
Reference in New Issue
Block a user