69 lines
3.6 KiB
Go
69 lines
3.6 KiB
Go
// 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"
|
||
)
|
||
|
||
// WithdrawApplicationStatus 提现申请状态
|
||
const (
|
||
WithdrawApplicationStatusPending = 1 // 待审核
|
||
WithdrawApplicationStatusApproved = 2 // 已通过
|
||
WithdrawApplicationStatusRejected = 3 // 已拒绝
|
||
WithdrawApplicationStatusProcessing = 4 // 处理中
|
||
WithdrawApplicationStatusCompleted = 5 // 已完成
|
||
)
|
||
|
||
// WithdrawApplication 提现申请
|
||
type WithdrawApplication struct {
|
||
ID string `bson:"_id"` // 申请ID
|
||
UserID string `bson:"user_id"` // 用户ID
|
||
Amount int64 `bson:"amount"` // 提现金额(单位:分)
|
||
WithdrawAccount string `bson:"withdraw_account"` // 提现账号
|
||
WithdrawAccountType int32 `bson:"withdraw_account_type"` // 提现账号类型:1-支付宝,2-微信,3-银行卡
|
||
Status int32 `bson:"status"` // 申请状态:1-待审核,2-已通过,3-已拒绝,4-处理中,5-已完成
|
||
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"` // 应用版本
|
||
Remark string `bson:"remark"` // 申请备注
|
||
CreateTime time.Time `bson:"create_time"` // 创建时间
|
||
UpdateTime time.Time `bson:"update_time"` // 更新时间
|
||
}
|
||
|
||
func (WithdrawApplication) TableName() string {
|
||
return "withdraw_applications"
|
||
}
|
||
|
||
type WithdrawApplicationInterface interface {
|
||
Create(ctx context.Context, applications ...*WithdrawApplication) error
|
||
Take(ctx context.Context, applicationID string) (*WithdrawApplication, error)
|
||
FindByUserID(ctx context.Context, userID string, pagination pagination.Pagination) (int64, []*WithdrawApplication, error)
|
||
FindByStatus(ctx context.Context, status int32, pagination pagination.Pagination) (int64, []*WithdrawApplication, error)
|
||
UpdateStatus(ctx context.Context, applicationID string, status int32, auditorID string, auditRemark string) error
|
||
Page(ctx context.Context, pagination pagination.Pagination) (int64, []*WithdrawApplication, error)
|
||
Update(ctx context.Context, applicationID string, data map[string]any) error
|
||
}
|