Files
2026-05-20 16:13:58 +08:00

72 lines
3.8 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import (
"context"
"fmt"
"stat/common/log"
"stat/common/mongos"
"stat/common/utils"
"time"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo/options"
)
type DspWithdraw struct {
ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` //流水id
AppId int32 `json:"appId" bson:"appId"` // appID
UID uint64 `json:"uid" bson:"uid"` //用户id
Name string `json:"name" bson:"name"` //用户名
Amount int64 `json:"amount" bson:"amount"` //蝴蝶币数量
OID string `json:"oid" bson:"oid"` //第三方支付平台id
Money int64 `json:"money" bson:"money" binding:"required"` //提现金额
PayMoney int64 `json:"payMoney" bson:"payMoney"` //实际到账
PayType string `json:"payType" bson:"payType" binding:"required"` //提现方式,alipay,bankcard
ActName string `json:"actName" bson:"actName"` //交易账户持有人
Act string `json:"act" bson:"act"` //交易账户
UserIP string `json:"userIp" bson:"userIp"` //用户ip
DeviceType string `json:"deviceType" bson:"deviceType"` //设备类型
DevID string `json:"devID" bson:"devID"` //设备id
Status int `json:"status" bson:"status"` //1未审核 2审核通过,转账中 3已拒绝 4未知错误 5提现成功 6提现失败
StatusDesc string `json:"statusDesc" bson:"statusDesc"` //状态说明
CheckedAt time.Time `json:"checkedAt" bson:"checkedAt"` //审核时间
ProgressAt time.Time `json:"progressAt" bson:"progressAt"` //第三方下单成功时间
SuccessAt time.Time `json:"successAt" bson:"successAt"` //回调成功时间
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` //刷新时间
CreatedAt time.Time `json:"createdAt" bson:"createdAt"` //提现申请时间
ReceivedAt time.Time `json:"receivedAt" bson:"receivedAt"` //到账时间 李秋山确认 三方出款时间
BlocDeduction bool `json:"blocDeduction" bson:"blocDeduction"` //集团扣量(特定渠道扣量)
IsDirect bool `json:"isDirect" bson:"isDirect"` //true:是直推用户
DistrictCode string `json:"districtCode" bson:"districtCode"` //渠道码
PromCode string `json:"promCode,omitempty" bson:"promCode"` //用户推广序列
}
const CollWithdraw = "withdraw_order"
var dbWithdraw *mongos.MongoTool
func WithdrawInit() {
dbWithdraw = mongos.New(ManagerDsp, CollWithdraw)
}
// FindDspWithdraw 查询用户
func FindDspWithdraw(ctx context.Context, skip int64, limit int64) ([]DspWithdraw, error) {
list := make([]DspWithdraw, 0)
beginTimeStr := "2020-07-01T00:00:00-08:00"
beginTime := utils.StrTimeToTime(beginTimeStr)
query := bson.M{"successAt": bson.M{"$gt": beginTime}, "withdrawType": 1}
sort := bson.D{{Key: "successAt", Value: 1}}
opts := options.Find().SetSkip(skip).SetLimit(limit).SetSort(sort)
if err := dbWithdraw.Find(ctx, &list, query, opts); err != nil {
log.Error(fmt.Sprintf("model %s FindDspWithdraw Find error", CollDistrict), log.E(err))
return list, err
}
return list, nil
}