// Copyright © 2023 OpenIM open source community. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package chat import ( "context" "time" "github.com/openimsdk/tools/db/pagination" ) // WithdrawStatus 提现状态 const ( WithdrawStatusPending = 1 // 待审核 WithdrawStatusApproved = 2 // 已通过 WithdrawStatusRejected = 3 // 已拒绝 ) // Withdraw 提现记录 type Withdraw struct { ID string `bson:"_id"` // 提现ID UserID string `bson:"user_id"` // 用户ID Amount int64 `bson:"amount"` // 提现金额(单位:分) WithdrawAccount string `bson:"withdraw_account"` // 提现账号 Status int32 `bson:"status"` // 审核状态:1-待审核,2-已通过,3-已拒绝 AuditorID string `bson:"auditor_id"` // 审核人ID(管理员ID) AuditTime time.Time `bson:"audit_time"` // 审核时间 AuditRemark string `bson:"audit_remark"` // 审核备注 IP string `bson:"ip"` // 提现IP DeviceID string `bson:"device_id"` // 设备ID Platform string `bson:"platform"` // 平台(iOS、Android、Web等) DeviceModel string `bson:"device_model"` // 设备型号(如:iPhone 14 Pro、Samsung Galaxy S23等) DeviceBrand string `bson:"device_brand"` // 设备品牌(如:Apple、Samsung、Huawei等) OSVersion string `bson:"os_version"` // 操作系统版本(如:iOS 17.0、Android 13等) AppVersion string `bson:"app_version"` // 应用版本 CreateTime time.Time `bson:"create_time"` // 创建时间 UpdateTime time.Time `bson:"update_time"` // 更新时间 } func (Withdraw) TableName() string { return "withdraws" } type WithdrawInterface interface { Create(ctx context.Context, withdraws ...*Withdraw) error Take(ctx context.Context, withdrawID string) (*Withdraw, error) FindByUserID(ctx context.Context, userID string, pagination pagination.Pagination) (int64, []*Withdraw, error) FindByStatus(ctx context.Context, status int32, pagination pagination.Pagination) (int64, []*Withdraw, error) UpdateStatus(ctx context.Context, withdrawID string, status int32, auditorID string, auditRemark string) error Page(ctx context.Context, pagination pagination.Pagination) (int64, []*Withdraw, error) }