This commit is contained in:
2026-10-21 16:06:37 +08:00
parent e7c178a2ae
commit 8693dc65f4
17 changed files with 1113 additions and 162 deletions
+41
View File
@@ -0,0 +1,41 @@
package validator
import "lone-services/pkg/validate"
type CodeBindValidator struct {
Code string `form:"code" json:"code" validate:"required"`
StoreId int64 `form:"store_id" json:"store_id" validate:"required"`
}
// GetMessage 提示消息
func (p CodeBindValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"Code.required": "验证码不能为空",
"StoreId.required": "门店ID不能为空",
}
}
type CancelBindValidator struct {
StoreId int64 `form:"store_id" json:"store_id" validate:"required"`
}
// GetMessage 提示消息
func (p CancelBindValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"StoreId.required": "门店ID不能为空",
}
}
type ControlBindValidator struct {
StoreId int64 `form:"store_id" json:"store_id" validate:"required"`
Open int32 `form:"open" json:"open" validate:"required,oneof:1 2"`
}
// GetMessage 提示消息
func (p ControlBindValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"StoreId.required": "门店ID不能为空",
"Open.required": "开启展示不能为空",
"Open.oneof": "开启展示只能是1或2",
}
}
@@ -0,0 +1,23 @@
package validator
import "lone-services/pkg/validate"
type UsageRecordsValidator struct {
Id int64 `form:"id" json:"id" validate:"required"`
HostCode string `form:"host_code" json:"host_code" validate:"required"`
ImportMode int32 `form:"import_mode" json:"import_mode"`
PoreFormingStrength int32 `form:"pore_forming_strength" json:"pore_forming_strength"`
ImportStrength int32 `form:"import_strength" json:"import_strength"`
FacialMaskId string `form:"facial_mask_id" json:"facial_mask_id"`
Ts int32 `form:"t_s" json:"t_s"`
Rs int32 `form:"r_s" json:"r_s"`
Ls int32 `form:"l_s" json:"l_s"`
}
// GetMessage 提示消息
func (p UsageRecordsValidator) GetMessage() validate.ValidatorMessages {
return validate.ValidatorMessages{
"Id.required": "ID不能为空",
"HostCode.required": "设备编码不能为空",
}
}