212 lines
8.7 KiB
Go
212 lines
8.7 KiB
Go
package sysin
|
|
|
|
import (
|
|
"context"
|
|
|
|
"hotgo/internal/consts"
|
|
"hotgo/internal/library/dict"
|
|
"hotgo/internal/model"
|
|
"hotgo/internal/model/entity"
|
|
"hotgo/internal/model/input/form"
|
|
|
|
"github.com/gogf/gf/v2/encoding/gjson"
|
|
"github.com/gogf/gf/v2/errors/gerror"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
)
|
|
|
|
type MemberLevelListInp struct {
|
|
form.PageReq
|
|
Name string `json:"name"`
|
|
Status int `json:"status"`
|
|
PublishStatus int `json:"publishStatus"`
|
|
}
|
|
|
|
func (in *MemberLevelListInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type MemberLevelListModel struct {
|
|
Id uint64 `json:"id"`
|
|
LevelCode string `json:"levelCode"`
|
|
Name string `json:"name"`
|
|
IconUrl string `json:"iconUrl"`
|
|
CurrentVersionId uint64 `json:"currentVersionId"`
|
|
MemberCount uint64 `json:"memberCount"`
|
|
Status int `json:"status"`
|
|
Sort int `json:"sort"`
|
|
Remark string `json:"remark"`
|
|
CreatedAt *gtime.Time `json:"createdAt"`
|
|
VersionNo uint `json:"versionNo"`
|
|
UpgradeAmount int64 `json:"upgradeAmount"`
|
|
GiftAmount int64 `json:"giftAmount"`
|
|
DailyOrderLimit uint `json:"dailyOrderLimit"`
|
|
CommissionRate uint `json:"commissionRate"`
|
|
DailyWithdrawLimit uint `json:"dailyWithdrawLimit"`
|
|
PublishStatus int `json:"publishStatus"`
|
|
EffectiveAt *gtime.Time `json:"effectiveAt"`
|
|
}
|
|
type MemberLevelViewInp struct {
|
|
Id uint64 `json:"id" v:"required|min:1#等级ID不能为空|等级ID不能为空"`
|
|
}
|
|
|
|
func (in *MemberLevelViewInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type MemberLevelViewModel struct {
|
|
Level *entity.AppMemberLevel `json:"level"`
|
|
Draft *entity.AppMemberLevelVersion `json:"draft"`
|
|
Published *entity.AppMemberLevelVersion `json:"published"`
|
|
}
|
|
type MemberLevelSaveInp struct {
|
|
Id uint64 `json:"id"`
|
|
VersionId uint64 `json:"versionId"`
|
|
Version uint `json:"version"`
|
|
LevelCode string `json:"levelCode" v:"required|max-length:32#等级编码不能为空|等级编码不能超过32个字符"`
|
|
Name string `json:"name" v:"required|max-length:64#等级名称不能为空|等级名称不能超过64个字符"`
|
|
IconAttachmentId uint64 `json:"iconAttachmentId"`
|
|
IconUrl string `json:"iconUrl" v:"max-length:1000#图标地址不能超过1000个字符"`
|
|
UpgradeAmount int64 `json:"upgradeAmount" v:"min:0#升级金额不能小于0"`
|
|
GiftAmount int64 `json:"giftAmount" v:"min:0#赠送金额不能小于0"`
|
|
DailyOrderLimit uint `json:"dailyOrderLimit"`
|
|
CommissionRate uint `json:"commissionRate" v:"max:10000#佣金比例不能超过100%"`
|
|
DailyWithdrawLimit uint `json:"dailyWithdrawLimit"`
|
|
RuleJson *gjson.Json `json:"ruleJson"`
|
|
EffectiveAt *gtime.Time `json:"effectiveAt"`
|
|
Sort int `json:"sort"`
|
|
Status int `json:"status" d:"1"`
|
|
Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符"`
|
|
}
|
|
|
|
func (in *MemberLevelSaveInp) Filter(ctx context.Context) error {
|
|
if in.Status != consts.StatusEnabled && in.Status != consts.StatusDisable {
|
|
return gerror.New("等级状态不合法")
|
|
}
|
|
if in.UpgradeAmount > 0 && in.GiftAmount > in.UpgradeAmount {
|
|
return gerror.New("赠送金额不能超过升级金额")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type MemberLevelSubmitInp struct {
|
|
VersionId uint64 `json:"versionId" v:"required|min:1#版本ID不能为空|版本ID不能为空"`
|
|
Version uint `json:"version"`
|
|
Reason string `json:"reason" v:"required|max-length:500#提交原因不能为空|提交原因不能超过500个字符"`
|
|
}
|
|
|
|
func (in *MemberLevelSubmitInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type MemberLevelPublishInp struct {
|
|
VersionId uint64 `json:"versionId" v:"required|min:1#版本ID不能为空|版本ID不能为空"`
|
|
Version uint `json:"version"`
|
|
}
|
|
|
|
func (in *MemberLevelPublishInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type MemberLevelRollbackInp struct {
|
|
VersionId uint64 `json:"versionId" v:"required|min:1#版本ID不能为空|版本ID不能为空"`
|
|
Reason string `json:"reason" v:"required|max-length:500#回滚原因不能为空|回滚原因不能超过500个字符"`
|
|
}
|
|
|
|
func (in *MemberLevelRollbackInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type MemberLevelHistoryInp struct {
|
|
form.PageReq
|
|
LevelId uint64 `json:"levelId" v:"required|min:1#等级ID不能为空|等级ID不能为空"`
|
|
}
|
|
|
|
func (in *MemberLevelHistoryInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type MemberLevelStatusInp struct {
|
|
Id uint64 `json:"id" v:"required|min:1#等级ID不能为空|等级ID不能为空"`
|
|
Status int `json:"status" v:"required|in:1,2#状态不能为空|状态不合法"`
|
|
}
|
|
|
|
func (in *MemberLevelStatusInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type MemberLevelDeleteInp struct {
|
|
Id uint64 `json:"id" v:"required|min:1#等级ID不能为空|等级ID不能为空"`
|
|
Reason string `json:"reason" v:"required|max-length:500#删除原因不能为空|删除原因不能超过500个字符"`
|
|
}
|
|
|
|
func (in *MemberLevelDeleteInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type MemberLevelApprovalModel struct {
|
|
ApprovalId uint64 `json:"approvalId"`
|
|
ApprovalNo string `json:"approvalNo"`
|
|
}
|
|
|
|
type TaskHallListInp struct {
|
|
form.PageReq
|
|
Name string `json:"name"`
|
|
PublishStatus int `json:"publishStatus"`
|
|
}
|
|
|
|
func (in *TaskHallListInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type TaskHallListModel struct {
|
|
Id uint64 `json:"id"`
|
|
HallCode string `json:"hallCode"`
|
|
Name string `json:"name"`
|
|
IconAttachmentId uint64 `json:"iconAttachmentId"`
|
|
IconUrl string `json:"iconUrl"`
|
|
Summary string `json:"summary"`
|
|
CommissionRate uint `json:"commissionRate"`
|
|
RateUnit string `json:"rateUnit"`
|
|
ClientRoute string `json:"clientRoute"`
|
|
PublishStatus int `json:"publishStatus"`
|
|
Sort int `json:"sort"`
|
|
Version uint `json:"version"`
|
|
Remark string `json:"remark"`
|
|
CreatedAt *gtime.Time `json:"createdAt"`
|
|
LevelIds []uint64 `json:"levelIds"`
|
|
LevelNames []string `json:"levelNames"`
|
|
}
|
|
type TaskHallViewInp struct {
|
|
Id uint64 `json:"id" v:"required|min:1#大厅ID不能为空|大厅ID不能为空"`
|
|
}
|
|
|
|
func (in *TaskHallViewInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type TaskHallEditInp struct {
|
|
Id uint64 `json:"id"`
|
|
Version uint `json:"version"`
|
|
HallCode string `json:"hallCode" v:"required|max-length:32#大厅编码不能为空|大厅编码不能超过32个字符"`
|
|
Name string `json:"name" v:"required|max-length:100#大厅名称不能为空|大厅名称不能超过100个字符"`
|
|
IconAttachmentId uint64 `json:"iconAttachmentId"`
|
|
IconUrl string `json:"iconUrl" v:"required|max-length:1000#图标不能为空|图标地址不能超过1000个字符"`
|
|
Summary string `json:"summary" v:"required|max-length:500#简介不能为空|简介不能超过500个字符"`
|
|
CommissionRate uint `json:"commissionRate" v:"max:10000#佣金比例不能超过100%"`
|
|
ClientRoute string `json:"clientRoute" v:"required|max-length:500#C端跳转不能为空|C端跳转不能超过500个字符"`
|
|
LevelIds []uint64 `json:"levelIds" v:"required#至少绑定一个会员等级"`
|
|
Sort int `json:"sort"`
|
|
Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符"`
|
|
}
|
|
|
|
func (in *TaskHallEditInp) Filter(ctx context.Context) error {
|
|
if len(in.LevelIds) != 1 {
|
|
return gerror.New("请选择一个会员等级")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type TaskHallStatusInp struct {
|
|
Id uint64 `json:"id" v:"required|min:1#大厅ID不能为空|大厅ID不能为空"`
|
|
Version uint `json:"version"`
|
|
PublishStatus int `json:"publishStatus" v:"required|in:3,4#状态不能为空|仅支持发布或下线"`
|
|
}
|
|
|
|
func (in *TaskHallStatusInp) Filter(ctx context.Context) error {
|
|
if !dict.HasOptionKey(consts.BizPublishStatusOptions, in.PublishStatus) {
|
|
return gerror.New("发布状态不合法")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type TaskHallDeleteInp struct {
|
|
Id uint64 `json:"id" v:"required|min:1#大厅ID不能为空|大厅ID不能为空"`
|
|
Reason string `json:"reason" v:"required|max-length:500#删除原因不能为空|删除原因不能超过500个字符"`
|
|
}
|
|
|
|
func (in *TaskHallDeleteInp) Filter(ctx context.Context) error { return nil }
|
|
|
|
type MemberLevelOptionModel struct {
|
|
Options []*model.Option `json:"options"`
|
|
}
|