package sysin import ( "context" "net/url" "strings" "hotgo/internal/consts" "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 TradeOrderListInp struct { form.PageReq OrderNo string `json:"orderNo"` Username string `json:"username"` Mobile string `json:"mobile"` AutoDispatch int `json:"autoDispatch"` OrderStatus int `json:"orderStatus"` CreatedAt []*gtime.Time `json:"createdAt"` } func (in *TradeOrderListInp) Filter(ctx context.Context) error { return nil } type TradeOrderListModel struct { Id uint64 `json:"id"` OrderNo string `json:"orderNo"` MemberId uint64 `json:"memberId"` Username string `json:"username"` Mobile string `json:"mobile"` RealNameMask string `json:"realNameMask"` AutoDispatch int `json:"autoDispatch"` AvailableAmount int64 `json:"availableAmount"` FrozenAmount int64 `json:"frozenAmount"` TodayTradeCount int `json:"todayTradeCount"` ProductName string `json:"productName"` OrderType int `json:"orderType"` Quantity uint `json:"quantity"` UnitPriceAmount int64 `json:"unitPriceAmount"` TotalAmount int64 `json:"totalAmount"` CommissionAmount int64 `json:"commissionAmount"` Currency string `json:"currency"` Message string `json:"message"` OrderStatus int `json:"orderStatus"` FreezeStatus int `json:"freezeStatus"` ApprovalRequestId uint64 `json:"approvalRequestId"` MatchedAt *gtime.Time `json:"matchedAt"` CompletedAt *gtime.Time `json:"completedAt"` UnfrozenAt *gtime.Time `json:"unfrozenAt"` CreatedAt *gtime.Time `json:"createdAt"` ApprovalStatus int `json:"approvalStatus"` PaymentStatus string `json:"paymentStatus"` CanMatch bool `json:"canMatch"` CanChangeAmount bool `json:"canChangeAmount"` CanForcePay bool `json:"canForcePay"` CanFreeze bool `json:"canFreeze"` CanReview bool `json:"canReview"` CanApply bool `json:"canApply"` CanExecute bool `json:"canExecute"` } type TradeOrderViewInp struct { Id uint64 `json:"id" v:"required|min:1#订单ID不能为空|订单ID不能为空"` } func (in *TradeOrderViewInp) Filter(ctx context.Context) error { return nil } type TradeOrderViewModel struct { TradeOrderListModel TaskId uint64 `json:"taskId"` ProductId uint64 `json:"productId"` MemberLevelId uint64 `json:"memberLevelId"` RuleSnapshot *gjson.Json `json:"ruleSnapshot"` UpdatedAt *gtime.Time `json:"updatedAt"` Timeline []*TradeOrderTimelineModel `json:"timeline"` Ledgers []*TradeOrderLedgerModel `json:"ledgers"` ApprovalActions []*TradeOrderApprovalActionModel `json:"approvalActions"` } type TradeOrderTimelineModel struct { Title string `json:"title"` Time *gtime.Time `json:"time"` } type TradeOrderLedgerModel struct { LedgerNo string `json:"ledgerNo"` BizType string `json:"bizType"` Direction int `json:"direction"` Amount int64 `json:"amount"` BeforeAmount int64 `json:"beforeAmount"` AfterAmount int64 `json:"afterAmount"` Remark string `json:"remark"` OccurredAt *gtime.Time `json:"occurredAt"` } type TradeOrderApprovalActionModel struct { StepNo uint `json:"stepNo"` ActorId uint64 `json:"actorId"` Action int `json:"action"` Comment string `json:"comment"` CreatedAt *gtime.Time `json:"createdAt"` } type TradeOrderApplyInp struct { Id uint64 `json:"id" v:"required|min:1#订单ID不能为空|订单ID不能为空"` Action string `json:"action" v:"required|in:cancel_match,rematch,unfreeze#处理动作不能为空|处理动作不合法"` ReasonCode string `json:"reasonCode" v:"required|max-length:64#原因编码不能为空|原因编码不能超过64个字符"` ReasonText string `json:"reasonText" v:"required|max-length:500#原因说明不能为空|原因说明不能超过500个字符"` } func (in *TradeOrderApplyInp) Filter(ctx context.Context) error { return nil } type TradeOrderExecuteInp struct { ApprovalId uint64 `json:"approvalId" v:"required|min:1#审批ID不能为空|审批ID不能为空"` } func (in *TradeOrderExecuteInp) Filter(ctx context.Context) error { return nil } type TradeOrderMatchProductListInp struct { form.PageReq Name string `json:"name" dc:"商品名称"` PriceMin string `json:"priceMin" dc:"最低价格"` PriceMax string `json:"priceMax" dc:"最高价格"` } func (in *TradeOrderMatchProductListInp) Filter(ctx context.Context) error { return nil } type TradeOrderMatchProductModel struct { Id uint64 `json:"id"` Name string `json:"name"` CoverUrl string `json:"coverUrl"` PriceAmount int64 `json:"priceAmount"` } type TradeOrderMatchInp struct { Id uint64 `json:"id" v:"required|min:1#订单ID不能为空|订单ID不能为空"` ProductId uint64 `json:"productId" v:"required|min:1#请选择商品|请选择商品"` Quantity uint `json:"quantity" v:"required|min:1|max:999#商品数量不能为空|商品数量最少为1|商品数量不能超过999"` } func (in *TradeOrderMatchInp) Filter(ctx context.Context) error { return nil } type TradeOrderUpdateAmountInp struct { Id uint64 `json:"id" v:"required|min:1#订单ID不能为空|订单ID不能为空"` Amount string `json:"amount" v:"required#更改金额不能为空"` Quantity uint `json:"quantity" v:"required|min:1|max:999#更改数量不能为空|更改数量最少为1|更改数量不能超过999"` } func (in *TradeOrderUpdateAmountInp) Filter(ctx context.Context) error { return nil } type TradeOrderManualActionInp struct { Id uint64 `json:"id" v:"required|min:1#订单ID不能为空|订单ID不能为空"` } func (in *TradeOrderManualActionInp) Filter(ctx context.Context) error { return nil } type FinanceApprovalModel struct { ApprovalId uint64 `json:"approvalId"` ApprovalNo string `json:"approvalNo"` } type RechargeOrderListInp struct { form.PageReq RechargeNo string `json:"rechargeNo"` Username string `json:"username"` Mobile string `json:"mobile"` RechargeStatus int `json:"rechargeStatus"` ChannelId uint64 `json:"channelId"` ChannelName string `json:"channelName"` CreatedAt []*gtime.Time `json:"createdAt"` } func (in *RechargeOrderListInp) Filter(ctx context.Context) error { return nil } type RechargeOrderListModel struct { Id uint64 `json:"id"` RechargeNo string `json:"rechargeNo"` MemberId uint64 `json:"memberId"` Username string `json:"username"` Mobile string `json:"mobile"` RealNameMask string `json:"realNameMask"` AvailableAmount int64 `json:"availableAmount"` ChannelId uint64 `json:"channelId"` ChannelName string `json:"channelName"` RequestAmount int64 `json:"requestAmount"` PaidAmount int64 `json:"paidAmount"` Currency string `json:"currency"` ExternalNo string `json:"externalNo"` VoucherAttachmentIds *gjson.Json `json:"voucherAttachmentIds"` RechargeType int `json:"rechargeType"` RechargeStatus int `json:"rechargeStatus"` Remark string `json:"remark"` ReviewReasonCode string `json:"reviewReasonCode"` ReviewReason string `json:"reviewReason"` ApprovalRequestId uint64 `json:"approvalRequestId"` LedgerId uint64 `json:"ledgerId"` PaidAt *gtime.Time `json:"paidAt"` ReviewedAt *gtime.Time `json:"reviewedAt"` CreditedAt *gtime.Time `json:"creditedAt"` CreatedAt *gtime.Time `json:"createdAt"` } type RechargeSummaryModel struct { TotalCount int64 `json:"totalCount"` TotalAmount int64 `json:"totalAmount"` PaidCount int64 `json:"paidCount"` PaidAmount int64 `json:"paidAmount"` UnpaidCount int64 `json:"unpaidCount"` UnpaidAmount int64 `json:"unpaidAmount"` ReviewCount int64 `json:"reviewCount"` ReviewAmount int64 `json:"reviewAmount"` RejectedCount int64 `json:"rejectedCount"` RejectedAmount int64 `json:"rejectedAmount"` } type RechargeOrderViewInp struct { Id uint64 `json:"id" v:"required|min:1#充值单ID不能为空|充值单ID不能为空"` } func (in *RechargeOrderViewInp) Filter(ctx context.Context) error { return nil } type RechargeReviewInp struct { Id uint64 `json:"id" v:"required|min:1#充值单ID不能为空|充值单ID不能为空"` Decision int `json:"decision" v:"required|in:1,2#审核结论不能为空|审核结论不合法"` PaidAmount int64 `json:"paidAmount" v:"min:0#实付金额不能小于0"` ExternalNo string `json:"externalNo" v:"max-length:128#外部单号不能超过128个字符"` ReasonCode string `json:"reasonCode" v:"required|max-length:64#原因编码不能为空|原因编码不能超过64个字符"` ReasonText string `json:"reasonText" v:"max-length:500#审核说明不能超过500个字符"` } func (in *RechargeReviewInp) Filter(ctx context.Context) error { if in.Decision == consts.FinanceDecisionApprove && in.PaidAmount <= 0 { return gerror.New("审核通过时实付金额必须大于0") } return nil } type FinanceExecuteInp struct { ApprovalId uint64 `json:"approvalId" v:"required|min:1#审批ID不能为空|审批ID不能为空"` } func (in *FinanceExecuteInp) Filter(ctx context.Context) error { return nil } type WithdrawalOrderListInp struct { form.PageReq WithdrawalNo string `json:"withdrawalNo"` Username string `json:"username"` Mobile string `json:"mobile"` WithdrawalStatus int `json:"withdrawalStatus"` CreatedAt []*gtime.Time `json:"createdAt"` } func (in *WithdrawalOrderListInp) Filter(ctx context.Context) error { return nil } type WithdrawalOrderListModel struct { Id uint64 `json:"id"` WithdrawalNo string `json:"withdrawalNo"` MemberId uint64 `json:"memberId"` Username string `json:"username"` Mobile string `json:"mobile"` AvailableAmount int64 `json:"availableAmount"` FrozenAmount int64 `json:"frozenAmount"` RequestAmount int64 `json:"requestAmount"` FeeAmount int64 `json:"feeAmount"` ActualAmount int64 `json:"actualAmount"` Currency string `json:"currency"` AccountMask string `json:"accountMask"` BankName string `json:"bankName"` HolderMask string `json:"holderMask"` PaymentAccountType int `json:"paymentAccountType"` QrCodeUrl string `json:"qrCodeUrl"` RiskResult *gjson.Json `json:"riskResult"` WithdrawalStatus int `json:"withdrawalStatus"` ReviewReasonCode string `json:"reviewReasonCode"` ReviewReason string `json:"reviewReason"` ApprovalRequestId uint64 `json:"approvalRequestId"` ExternalNo string `json:"externalNo"` FreezeLedgerId uint64 `json:"freezeLedgerId"` FinalLedgerId uint64 `json:"finalLedgerId"` ReviewedAt *gtime.Time `json:"reviewedAt"` ProcessedAt *gtime.Time `json:"processedAt"` CompletedAt *gtime.Time `json:"completedAt"` CreatedAt *gtime.Time `json:"createdAt"` } type WithdrawalOrderViewInp struct { Id uint64 `json:"id" v:"required|min:1#提现单ID不能为空|提现单ID不能为空"` } func (in *WithdrawalOrderViewInp) Filter(ctx context.Context) error { return nil } type WithdrawalReviewInp struct { Id uint64 `json:"id" v:"required|min:1#提现单ID不能为空|提现单ID不能为空"` Decision int `json:"decision" v:"required|in:1,2#审核结论不能为空|审核结论不合法"` ReasonCode string `json:"reasonCode" v:"required|max-length:64#原因编码不能为空|原因编码不能超过64个字符"` ReasonText string `json:"reasonText" v:"required|max-length:500#审核说明不能为空|审核说明不能超过500个字符"` } func (in *WithdrawalReviewInp) Filter(ctx context.Context) error { return nil } type WithdrawalCompleteInp struct { Id uint64 `json:"id" v:"required|min:1#提现单ID不能为空|提现单ID不能为空"` Success bool `json:"success"` ExternalNo string `json:"externalNo" v:"max-length:128#外部单号不能超过128个字符"` ReasonText string `json:"reasonText" v:"required|max-length:500#处理说明不能为空|处理说明不能超过500个字符"` } func (in *WithdrawalCompleteInp) Filter(ctx context.Context) error { if in.Success && strings.TrimSpace(in.ExternalNo) == "" { return gerror.New("付款成功时外部付款单号不能为空") } return nil } type CustomerServiceListInp struct { form.PageReq Name string `json:"name"` Status int `json:"status"` } func (in *CustomerServiceListInp) Filter(ctx context.Context) error { return nil } type CustomerServiceEditInp struct { Id uint64 `json:"id"` ServiceCode string `json:"serviceCode" v:"required|max-length:32#客服编码不能为空|客服编码不能超过32个字符"` Name string `json:"name" v:"required|max-length:100#客服名称不能为空|客服名称不能超过100个字符"` AvatarUrl string `json:"avatarUrl" v:"max-length:1000#头像地址不能超过1000个字符"` WorkTime string `json:"workTime" v:"required|max-length:200#工作时间不能为空|工作时间不能超过200个字符"` OnlineStatus int `json:"onlineStatus" v:"required|in:1,2#在线状态不能为空|在线状态不合法"` ServiceUrl string `json:"serviceUrl" v:"max-length:1000#客服链接不能超过1000个字符"` BackupContact string `json:"backupContact" v:"required|max-length:500#备用联系方式不能为空|备用联系方式不能超过500个字符"` SessionMapping *gjson.Json `json:"sessionMapping"` ImTenantCode string `json:"imTenantCode" v:"required|max-length:64#IM租户代码不能为空|IM租户代码不能超过64个字符"` ImUserId string `json:"imUserId" v:"max-length:64#IM用户ID不能超过64个字符"` ImUsername string `json:"imUsername" v:"max-length:64#IM登录名不能超过64个字符"` Status int `json:"status" d:"1" v:"required|in:1,2#状态不能为空|状态不合法"` Sort int `json:"sort"` Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符"` } func (in *CustomerServiceEditInp) Filter(ctx context.Context) error { if strings.TrimSpace(in.ServiceUrl) != "" { u, err := url.Parse(in.ServiceUrl) if err != nil || !strings.EqualFold(u.Scheme, "https") || u.Host == "" { return gerror.New("客服链接必须是有效的 HTTPS 地址") } } in.ImTenantCode = strings.ToLower(strings.TrimSpace(in.ImTenantCode)) in.ImUserId = strings.TrimSpace(in.ImUserId) in.ImUsername = strings.ToLower(strings.TrimSpace(in.ImUsername)) if in.OnlineStatus != consts.CustomerServiceOnline && in.OnlineStatus != consts.CustomerServiceOffline { return gerror.New("客服在线状态不合法") } return nil } type CustomerServiceViewInp struct { Id uint64 `json:"id" v:"required|min:1#客服ID不能为空|客服ID不能为空"` } func (in *CustomerServiceViewInp) Filter(ctx context.Context) error { return nil } type CustomerServiceStatusInp struct { Id uint64 `json:"id" v:"required|min:1#客服ID不能为空|客服ID不能为空"` Status int `json:"status" v:"required|in:1,2#状态不能为空|状态不合法"` } func (in *CustomerServiceStatusInp) Filter(ctx context.Context) error { return nil } type CustomerServiceDeleteInp struct { Id uint64 `json:"id" v:"required|min:1#客服ID不能为空|客服ID不能为空"` Reason string `json:"reason" v:"required|max-length:500#删除原因不能为空|删除原因不能超过500个字符"` } func (in *CustomerServiceDeleteInp) Filter(ctx context.Context) error { return nil } type CustomerServiceListModel struct { *entity.CustomerService }