forked from all_user/stat_center
Initial commit
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package withdrawGameOrdermod
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"stat/common/log"
|
||||
"stat/common/mongos"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
// 初始化model
|
||||
func Init() {
|
||||
// 获取数据库表
|
||||
db = mongos.New(mongos.MgoManager, CollGameWithdrawOrder)
|
||||
|
||||
indexes := []mongo.IndexModel{
|
||||
{
|
||||
Keys: bson.D{{Key: "appId", Value: 1}, {Key: "uid", Value: 1}},
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := db.CreateIndex(context.Background(), indexes); err != nil {
|
||||
panic(fmt.Sprintf("Model %s InitIndex error %+v", CollGameWithdrawOrder, err))
|
||||
}
|
||||
}
|
||||
|
||||
// 获取用户详情(集团)
|
||||
func GetBlocGameWithdrawOrderList(ctx context.Context, appId *int32, start, end *time.Time, skip, limit int64) (count int64, data []GameWithdrawOrder, err error) {
|
||||
filter := bson.M{}
|
||||
|
||||
if appId != nil {
|
||||
filter["appId"] = appId
|
||||
}
|
||||
if start != nil && end != nil {
|
||||
filter["successAt"] = bson.M{"$gte": start, "$lt": end}
|
||||
} else if start != nil {
|
||||
filter["successAt"] = bson.M{"$gte": start}
|
||||
} else if end != nil {
|
||||
filter["successAt"] = bson.M{"$lt": end}
|
||||
}
|
||||
|
||||
sort := bson.D{{Key: "successAt", Value: -1}}
|
||||
|
||||
opts := options.Find().SetSort(sort).SetSkip(skip).SetLimit(limit)
|
||||
|
||||
if err = db.Find(ctx, &data, filter, opts); err != nil {
|
||||
log.Error("register GetBlocGameWithdrawOrderList Find err", log.E(err))
|
||||
return
|
||||
}
|
||||
|
||||
if count, err = db.Count(ctx, filter); err != nil {
|
||||
log.Error("register GetBlocGameWithdrawOrderList Count err", log.E(err))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// AddWithdrawOrder 添加提现请求
|
||||
func AddWithdrawOrder(ctx context.Context, doc *GameWithdrawOrder) (id string, err error) {
|
||||
ret, err := db.InsertOne(ctx, doc)
|
||||
if err != nil {
|
||||
log.Error("withdraw AddWithdraw InsertOne err", log.E(err))
|
||||
return
|
||||
}
|
||||
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// 获取用户详情(集团)
|
||||
func GetGameWithdrawOrder(ctx context.Context, appId int32, start, end time.Time) (data []GameWithdrawOrder, err error) {
|
||||
filter := bson.M{"appId": appId, "successAt": bson.M{"$gte": start, "$lt": end}}
|
||||
|
||||
sort := bson.D{{Key: "successAt", Value: -1}}
|
||||
|
||||
opts := options.Find().SetSort(sort)
|
||||
|
||||
if err = db.Find(ctx, &data, filter, opts); err != nil {
|
||||
log.Error("register GetBlocGameWithdrawOrderList Find err", log.E(err))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//FindManyRechargeInfo 查找一批信息数据
|
||||
func FindManyGameWithdrawOrder(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (data []GameWithdrawOrder, err error) {
|
||||
data = make([]GameWithdrawOrder, 0)
|
||||
if err := db.Find(ctx, &data, filter, opts...); err != nil {
|
||||
log.Warn("FindManyRechargeInfo dbChannel.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package withdrawGameOrdermod
|
||||
|
||||
import (
|
||||
"stat/common/mongos"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
// 表名
|
||||
const CollGameWithdrawOrder = "withdraw_game_order"
|
||||
|
||||
var db *mongos.MongoTool
|
||||
|
||||
// GameWithdrawOrder 游戏提现订单
|
||||
type GameWithdrawOrder struct {
|
||||
ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` //流水id
|
||||
PlatformId string `json:"platformId" bson:"platformId"` //原始平台流水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"` //到账时间 李秋山确认 三方出款时间
|
||||
SyncStatus int64 `json:"syncStatus" bson:"syncStatus"` // 同步大白鲨:0 需要同步 1:不需要同步
|
||||
BlocDeduction bool `json:"blocDeduction" bson:"blocDeduction"` //集团扣量(特定渠道扣量)
|
||||
PayChannel string `json:"payChannel" bson:"payChannel"` //提现渠道
|
||||
IsDirect bool `json:"isDirect" bson:"isDirect"` //true:是直推用户
|
||||
IsFormalUser bool `json:"isFormalUser" bson:"isFormalUser"` // 是否正式用户
|
||||
DistrictCode string `json:"districtCode" bson:"districtCode"` //渠道码
|
||||
PromCode string `json:"promCode,omitempty" bson:"promCode"` //用户推广序列
|
||||
}
|
||||
Reference in New Issue
Block a user